From 14c32751713acad00c3ad01017e3464244ef709d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 15 Jan 2012 03:24:24 +0100 Subject: initial import Signed-off-by: Pablo Neira Ayuso --- .../libnetfilter_cthelper/libnetfilter_cthelper.h | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/libnetfilter_cthelper/libnetfilter_cthelper.h (limited to 'include/libnetfilter_cthelper/libnetfilter_cthelper.h') diff --git a/include/libnetfilter_cthelper/libnetfilter_cthelper.h b/include/libnetfilter_cthelper/libnetfilter_cthelper.h new file mode 100644 index 0000000..13bfca8 --- /dev/null +++ b/include/libnetfilter_cthelper/libnetfilter_cthelper.h @@ -0,0 +1,43 @@ +#ifndef _LIBNETFILTER_ACCT_H_ +#define _LIBNETFILTER_ACCT_H_ + +#include +#include + +struct nfct_helper; + +enum nfct_helper_attr_type { + NFCTH_ATTR_NAME = 0, + NFCTH_ATTR_QUEUE_NUM, + NFCTH_ATTR_PROTO_L3NUM, + NFCTH_ATTR_PROTO_L4NUM, + NFCTH_ATTR_EXP_POLICY_NAME, + NFCTH_ATTR_EXP_POLICY_TIMEOUT, + NFCTH_ATTR_EXP_POLICY_MAX, +}; + +struct nfct_helper *nfct_helper_alloc(void); +void nfct_helper_free(struct nfct_helper *nfct_helper); + +void nfct_helper_attr_set(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const void *data); +void nfct_helper_attr_set_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const char *name); +void nfct_helper_attr_set_u8(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint8_t value); +void nfct_helper_attr_set_u16(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint16_t value); +void nfct_helper_attr_set_u32(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint32_t value); +void nfct_helper_attr_unset(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); + +const void *nfct_helper_attr_get(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); +const char *nfct_helper_attr_get_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); +uint8_t nfct_helper_attr_get_u8(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); +uint16_t nfct_helper_attr_get_u16(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); +uint32_t nfct_helper_attr_get_u32(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type); + +struct nlmsghdr; + +struct nlmsghdr *nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq); +void nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *nfct_helper); +int nfct_helper_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_helper *nfct_helper); + +int nfct_helper_snprintf(char *buf, size_t size, struct nfct_helper *nfct_helper, unsigned int flags); + +#endif -- cgit v1.2.3