From b4c3a23c884c24f4e5d941fb928cf49561a9cdf9 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org" Date: Tue, 19 Dec 2006 17:41:53 +0000 Subject: Introduce the new libnetfilter_conntrack API, features: - object oriented infrastructure - extensible and configurable output (XML) - low level functions to interact with netlink details - fairly documented Still backward compatible. --- src/libnetfilter_conntrack.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/libnetfilter_conntrack.c') diff --git a/src/libnetfilter_conntrack.c b/src/libnetfilter_conntrack.c index 3b6f2cf..dc8d619 100644 --- a/src/libnetfilter_conntrack.c +++ b/src/libnetfilter_conntrack.c @@ -22,20 +22,9 @@ #include #include -#define NFCT_BUFSIZE 4096 +#include "internal.h" -typedef int (*nfct_handler)(struct nfct_handle *cth, struct nlmsghdr *nlh, - void *arg); - -/* Harald says: "better for encapsulation" ;) */ -struct nfct_handle { - struct nfnl_handle *nfnlh; - struct nfnl_subsys_handle *nfnlssh_ct; - struct nfnl_subsys_handle *nfnlssh_exp; - nfct_callback callback; /* user callback */ - void *callback_data; /* user data for callback */ - nfct_handler handler; /* netlink handler */ -}; +#define NFCT_BUFSIZE 4096 static char *lib_dir = LIBNETFILTER_CONNTRACK_DIR; static LIST_HEAD(proto_list); @@ -151,6 +140,14 @@ int nfct_close(struct nfct_handle *cth) cth->nfnlssh_ct = NULL; } + /* required by the new API */ + cth->cb = NULL; + free(cth->nfnl_cb.data); + + cth->nfnl_cb.call = NULL; + cth->nfnl_cb.data = NULL; + cth->nfnl_cb.attr_count = 0; + err = nfnl_close(cth->nfnlh); free(cth); -- cgit v1.2.3