summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-19 23:04:49 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-19 23:04:49 +0000
commit13f4c15f214dd807899c10ebdff74ab5148d650f (patch)
tree50bbeb5ef948e29b40fd2a2833f0b68189fd2a1f /include
parent426f53894b8ced42130425c196aea38d115e9e18 (diff)
downloadconntrack-tools-13f4c15f214dd807899c10ebdff74ab5148d650f.tar.gz
conntrack-tools-13f4c15f214dd807899c10ebdff74ab5148d650f.zip
compose the file descriptor set at initialization stage to save some cycles
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am2
-rw-r--r--include/conntrackd.h4
-rw-r--r--include/fds.h16
3 files changed, 20 insertions, 2 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index d7f27a9..92ebbcc 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,5 +3,5 @@ noinst_HEADERS = alarm.h jhash.h slist.h cache.h linux_list.h linux_rbtree.h \
sync.h conntrackd.h local.h us-conntrack.h \
debug.h log.h hash.h mcast.h conntrack.h \
state_helper.h network.h ignore.h queue.h \
- traffic_stats.h netlink.h
+ traffic_stats.h netlink.h fds.h
diff --git a/include/conntrackd.h b/include/conntrackd.h
index 47898e2..69c1303 100644
--- a/include/conntrackd.h
+++ b/include/conntrackd.h
@@ -105,6 +105,8 @@ struct ct_general_state {
struct nfct_handle *event; /* event handler */
struct nfct_handle *dump; /* dump handler */
+ struct fds *fds;
+
/* statistics */
uint64_t malformed;
uint64_t bytes[NFCT_DIR_MAX];
@@ -151,7 +153,7 @@ extern struct ct_general_state st;
struct ct_mode {
int (*init)(void);
- int (*add_fds_to_set)(fd_set *readfds);
+ int (*register_fds)(struct fds *fds);
void (*run)(fd_set *readfds);
int (*local)(int fd, int type, void *data);
void (*kill)(void);
diff --git a/include/fds.h b/include/fds.h
new file mode 100644
index 0000000..cc213fe
--- /dev/null
+++ b/include/fds.h
@@ -0,0 +1,16 @@
+#ifndef _FDS_H_
+#define _FDS_H_
+
+struct fds {
+ int maxfd;
+ int fd_array_len;
+ int fd_array_cur;
+ int *fd_array;
+ fd_set readfds;
+};
+
+struct fds *create_fds(void);
+void destroy_fds(struct fds *);
+int register_fd(int fd, struct fds *fds);
+
+#endif