From b64b71ab1468ee02fad9a904e666e1e1fd521a75 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Sat, 14 Jan 2006 19:04:51 +0000 Subject: Introduce various API changes throughout the library stack 1) make libnfnetlink dynamically allocate it's handles 2) apply that change throughout libnetfilter_* 3) add {nfq,nflog,nfct}_open_nfnl() functions that open the specific subsystem on top of an existing nfnl_handle, which is required for upcoming libnetfilter_conntrack_helper The changes break ABI and API compatibility of libnfnetlink, but don't break ABI or API compatibility of the libnetfilter_* libraries. --- include/libnfnetlink/libnfnetlink.h | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'include/libnfnetlink') diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h index 982c1b6..839a3ee 100644 --- a/include/libnfnetlink/libnfnetlink.h +++ b/include/libnfnetlink/libnfnetlink.h @@ -43,25 +43,20 @@ struct nfnl_callback { u_int16_t attr_count; }; -struct nfnl_handle { - int fd; - struct sockaddr_nl local; - struct sockaddr_nl peer; - u_int8_t subsys_id; - u_int32_t seq; - u_int32_t dump; - struct nlmsghdr *last_nlhdr; - - u_int8_t cb_count; - struct nfnl_callback *cb; /* array of callbacks */ -}; +struct nfnl_handle; +struct nfnl_subsys_handle; extern int nfnl_fd(struct nfnl_handle *h); /* get a new library handle */ -extern int nfnl_open(struct nfnl_handle *, u_int8_t, u_int8_t, unsigned int); +extern struct nfnl_handle *nfnl_open(void); extern int nfnl_close(struct nfnl_handle *); +extern struct nfnl_subsys_handle *nfnl_subsys_open(struct nfnl_handle *, + u_int8_t, u_int8_t, + unsigned int); +extern void nfnl_subsys_close(struct nfnl_subsys_handle *); + /* sending of data */ extern int nfnl_send(struct nfnl_handle *, struct nlmsghdr *); extern int nfnl_sendmsg(const struct nfnl_handle *, const struct msghdr *msg, @@ -69,7 +64,7 @@ extern int nfnl_sendmsg(const struct nfnl_handle *, const struct msghdr *msg, extern int nfnl_sendiov(const struct nfnl_handle *nfnlh, const struct iovec *iov, unsigned int num, unsigned int flags); -extern void nfnl_fill_hdr(struct nfnl_handle *, struct nlmsghdr *, +extern void nfnl_fill_hdr(struct nfnl_subsys_handle *, struct nlmsghdr *, unsigned int, u_int8_t, u_int16_t, u_int16_t, u_int16_t); extern int nfnl_talk(struct nfnl_handle *, struct nlmsghdr *, pid_t, @@ -84,9 +79,9 @@ extern int nfnl_listen(struct nfnl_handle *, /* receiving */ extern ssize_t nfnl_recv(const struct nfnl_handle *h, unsigned char *buf, size_t len); -extern int nfnl_callback_register(struct nfnl_handle *, +extern int nfnl_callback_register(struct nfnl_subsys_handle *, u_int8_t type, struct nfnl_callback *cb); -extern int nfnl_callback_unregister(struct nfnl_handle *, u_int8_t type); +extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, u_int8_t type); extern int nfnl_handle_packet(struct nfnl_handle *, char *buf, int len); /* parsing */ -- cgit v1.2.3