summaryrefslogtreecommitdiffstats
path: root/include/libnfnetlink/libnfnetlink.h
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2006-12-19 17:12:21 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2006-12-19 17:12:21 +0000
commitba17d7f03f467f45fe5784be8283253facc4766d (patch)
treeb49c065919d4c44a0b8891c781851e78036c6439 /include/libnfnetlink/libnfnetlink.h
parent6961073a2d0a062b120c44503d2b165a1476f6db (diff)
Introduce several improvements in the library, still backward compatible.
- add iterator API - add replacements for nfnl_listen and nfnl_talk - fix error handling - add assertions - add documentation - minor cleanups
Diffstat (limited to 'include/libnfnetlink/libnfnetlink.h')
-rw-r--r--include/libnfnetlink/libnfnetlink.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
index bc24757..7fe4189 100644
--- a/include/libnfnetlink/libnfnetlink.h
+++ b/include/libnfnetlink/libnfnetlink.h
@@ -98,6 +98,42 @@ extern struct nlmsghdr *nfnl_get_msg_next(struct nfnl_handle *h,
const unsigned char *buf,
size_t len);
+/* callback verdict */
+enum {
+ NFNL_CB_FAILURE = -1, /* failure */
+ NFNL_CB_STOP = 0, /* stop the query */
+ NFNL_CB_CONTINUE = 1, /* keep iterating */
+};
+
+/* join a certain netlink multicast group */
+extern int nfnl_join(const struct nfnl_handle *nfnlh, unsigned int group);
+
+/* process a netlink message */
+extern int nfnl_process(struct nfnl_handle *h,
+ const unsigned char *buf,
+ size_t len);
+
+/* iterator API */
+
+extern struct nfnl_iterator *
+nfnl_iterator_create(const struct nfnl_handle *h,
+ const char *buf,
+ size_t len);
+
+extern void nfnl_iterator_destroy(struct nfnl_iterator *it);
+
+extern int nfnl_iterator_process(struct nfnl_handle *h,
+ struct nfnl_iterator *it);
+
+extern int nfnl_iterator_next(const struct nfnl_handle *h,
+ struct nfnl_iterator *it);
+
+/* replacement for nfnl_listen */
+extern int nfnl_catch(struct nfnl_handle *h);
+
+/* replacement for nfnl_talk */
+extern int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh);
+
#define nfnl_attr_present(tb, attr) \
(tb[attr-1])
@@ -116,10 +152,10 @@ extern struct nlmsghdr *nfnl_get_msg_next(struct nfnl_handle *h,
})
/* nfnl attribute handling functions */
-extern int nfnl_addattr_l(struct nlmsghdr *, int, int, void *, int);
+extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int);
extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t);
extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
-extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, void *, int);
+extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, const void *, int);
extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t);
extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);