diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-04-24 10:55:33 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-08-01 19:17:35 +0200 |
commit | c712ccebc993cad3f73000bbe9e4788ebeb95ca2 (patch) | |
tree | ea989f68f8b5ae703948be15c76457d17d5a963d /src/stats-mode.c | |
parent | ec4c0ff33746fb2c663194f27dd41deee83f870f (diff) | |
download | conntrack-tools-c712ccebc993cad3f73000bbe9e4788ebeb95ca2.tar.gz conntrack-tools-c712ccebc993cad3f73000bbe9e4788ebeb95ca2.zip |
conntrackd: generalize file descriptor infrastructure
This patch generalizes the select-based file descriptor infrastructure
by allowing you to register file descriptors and its callbacks. Instead
of hardcoding the descriptors that needs to be checked.
Now, struct fds_item contains a callback and pointer to data that is
passed to it:
struct fds_item {
struct list_head head;
int fd;
+ void (*cb)(void *data);
+ void *data;
};
Then, we check which ones are active in the select_main_step() function:
list_for_each_entry(cur, &STATE(fds)->list, head) {
if (FD_ISSET(cur->fd, &readfds))
cur->cb(cur->data);
}
And it invoked the corresponding callback.
I had to slightly modify the channel infrastructure to fit it into
the changes.
This modularity is required for the upcoming cthelper support.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/stats-mode.c')
-rw-r--r-- | src/stats-mode.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/stats-mode.c b/src/stats-mode.c index b768033..6b7f08d 100644 --- a/src/stats-mode.c +++ b/src/stats-mode.c @@ -201,7 +201,6 @@ static struct internal_handler internal_cache_stats = { struct ct_mode stats_mode = { .init = init_stats, - .run = NULL, .local = local_handler_stats, .kill = kill_stats, .internal = &internal_cache_stats, |