From c7c7bbb573e310ca6fa6040e11f86440c9380ad7 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: Fri, 28 Oct 2005 00:28:35 +0000 Subject: o Renamed nfct_[set|unset]_callback to nfct_[register|unregister]_callback o Added some very brief comments to libnetfilter_conntrack.h o Implemented the conntrack printers API nfct_sprintf_* o Now nfct_default_conntrack_display display the classical /proc output, and nfct_default_conntrack_display the classical + conntrack ids o Use nfnl_talk if there's no data expected from kernel space to be processed, that is the case of nfct_[get|delete]_conntrack o Added some missing memset's zeroing o Code simplification: killed some char *buf where struct nfnlhdr is enough o Killed protocol handler destructors (fini) and nfct_unregister_proto: The library is unloaded if something goes wrong (different library versions), the modules never gets inserted in the proto_list. Fixes a segfault. o Bumped version to 0.2.0 --- .../libnetfilter_conntrack.h | 55 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'include/libnetfilter_conntrack') diff --git a/include/libnetfilter_conntrack/libnetfilter_conntrack.h b/include/libnetfilter_conntrack/libnetfilter_conntrack.h index f642163..55391bb 100644 --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h @@ -17,7 +17,7 @@ #include #include "linux_list.h" -#define LIBNETFILTER_CONNTRACK_VERSION "0.1.3" +#define LIBNETFILTER_CONNTRACK_VERSION "0.2.0" enum { CONNTRACK = NFNL_SUBSYS_CTNETLINK, @@ -169,6 +169,11 @@ struct nfct_handle { nfct_handler handler; /* netlink handler */ }; +extern void nfct_register_proto(struct nfct_proto *h); + +/* + * [Allocate|free] a conntrack + */ extern struct nfct_conntrack * nfct_conntrack_alloc(struct nfct_tuple *orig, struct nfct_tuple *reply, unsigned long timeout, union nfct_protoinfo *proto, @@ -176,26 +181,38 @@ nfct_conntrack_alloc(struct nfct_tuple *orig, struct nfct_tuple *reply, unsigned int id, struct nfct_nat *range); extern void nfct_conntrack_free(struct nfct_conntrack *ct); +/* + * [Allocate|free] an expectation + */ extern struct nfct_expect * nfct_expect_alloc(struct nfct_tuple *master, struct nfct_tuple *tuple, struct nfct_tuple *mask, unsigned long timeout, unsigned int id); extern void nfct_expect_free(struct nfct_expect *exp); -extern void nfct_register_proto(struct nfct_proto *h); -extern void nfct_unregister_proto(struct nfct_proto *h); - +/* + * [Open|close] a conntrack handler + */ extern struct nfct_handle *nfct_open(u_int8_t, unsigned); extern int nfct_close(struct nfct_handle *cth); -extern void nfct_set_callback(struct nfct_handle *cth, nfct_callback callback); -extern void nfct_unset_callback(struct nfct_handle *cth); + +/* + * [Register|unregister] callbacks + */ +extern void nfct_register_callback(struct nfct_handle *cth, + nfct_callback callback); +extern void nfct_unregister_callback(struct nfct_handle *cth); /* * callback displayers */ extern int nfct_default_conntrack_display(void *arg, unsigned int, int); +extern int nfct_default_conntrack_display_id(void *arg, unsigned int, int); extern int nfct_default_expect_display(void *arg, unsigned int, int); +/* + * [Create|update|get|destroy] conntracks + */ extern int nfct_create_conntrack(struct nfct_handle *cth, struct nfct_conntrack *ct); extern int nfct_update_conntrack(struct nfct_handle *cth, @@ -206,10 +223,36 @@ extern int nfct_delete_conntrack(struct nfct_handle *cth, extern int nfct_get_conntrack(struct nfct_handle *cth, struct nfct_tuple *tuple, int dir, unsigned int id); +/* + * Conntrack table dumping & zeroing + */ extern int nfct_dump_conntrack_table(struct nfct_handle *cth); extern int nfct_dump_conntrack_table_reset_counters(struct nfct_handle *cth); + +/* + * Conntrack event notification + */ extern int nfct_event_conntrack(struct nfct_handle *cth); +/* + * Conntrack printing functions + */ +extern int nfct_sprintf_conntrack(char *buf, struct nfct_conntrack *ct, + unsigned int flags); +extern int nfct_sprintf_conntrack_id(char *buf, struct nfct_conntrack *ct, + unsigned int flags); +extern int nfct_sprintf_address(char *buf, struct nfct_conntrack *ct, int dir); +extern int nfct_sprintf_proto(char *buf, struct nfct_conntrack *ct, int dir); +extern int nfct_sprintf_protoinfo(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_timeout(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_protocol(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_status_assured(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_status_seen_reply(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_counters(char *buf, struct nfct_conntrack *ct, int dir); +extern int nfct_sprintf_mark(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_use(char *buf, struct nfct_conntrack *ct); +extern int nfct_sprintf_id(char *buf, struct nfct_conntrack *ct); + /* * Expectations */ -- cgit v1.2.3