summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-05-10 20:53:43 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-05-13 16:36:10 +0200
commit850be7cc038f39d0293d0478927e4185c327768a (patch)
tree02f776327d7f81a55a12e45624c7f2db1325d639 /include
parent0b4e5aeb306a10014c09372e1823f3d802264649 (diff)
src: add NFCTH_STATUS and other enhancements
This patch includes the modification of the snprintf interface and the completition of the expectation policy handling. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/libnetfilter_cthelper/libnetfilter_cthelper.h31
-rw-r--r--include/linux/netfilter/nfnetlink_cthelper.h4
2 files changed, 29 insertions, 6 deletions
diff --git a/include/libnetfilter_cthelper/libnetfilter_cthelper.h b/include/libnetfilter_cthelper/libnetfilter_cthelper.h
index d0fcfa7..1b34e44 100644
--- a/include/libnetfilter_cthelper/libnetfilter_cthelper.h
+++ b/include/libnetfilter_cthelper/libnetfilter_cthelper.h
@@ -4,21 +4,40 @@
#include <sys/types.h>
#include <linux/netfilter/nfnetlink_cthelper.h>
-struct nfct_helper;
+struct nfct_helper_policy;
+
+enum nfct_helper_policy_attr_type {
+ NFCTH_ATTR_POLICY_NAME = 0,
+ NFCTH_ATTR_POLICY_TIMEOUT,
+ NFCTH_ATTR_POLICY_MAX,
+};
+
+struct nfct_helper_policy *nfct_helper_policy_alloc(void);
+void nfct_helper_policy_free(struct nfct_helper_policy *p);
+
+void nfct_helper_policy_attr_set(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const void *data);
+void nfct_helper_policy_attr_set_str(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const char *name);
+void nfct_helper_policy_attr_set_u32(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, uint32_t value);
+void nfct_helper_policy_attr_unset(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type);
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,
NFCTH_ATTR_PRIV_DATA_LEN,
+ NFCTH_ATTR_POLICY,
+ NFCTH_ATTR_POLICY1 = NFCTH_ATTR_POLICY,
+ NFCTH_ATTR_POLICY2,
+ NFCTH_ATTR_POLICY3,
+ NFCTH_ATTR_POLICY4,
+ NFCTH_ATTR_STATUS,
};
+struct nfct_helper;
+
struct nfct_helper *nfct_helper_alloc(void);
-void nfct_helper_free(struct nfct_helper *nfct_helper);
+void nfct_helper_free(struct nfct_helper *h);
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);
@@ -39,6 +58,6 @@ struct nlmsghdr *nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t fl
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);
+int nfct_helper_snprintf(char *buf, size_t size, struct nfct_helper *nfct_helper, unsigned int type, unsigned int flags);
#endif
diff --git a/include/linux/netfilter/nfnetlink_cthelper.h b/include/linux/netfilter/nfnetlink_cthelper.h
index 4676922..33659f6 100644
--- a/include/linux/netfilter/nfnetlink_cthelper.h
+++ b/include/linux/netfilter/nfnetlink_cthelper.h
@@ -1,6 +1,9 @@
#ifndef _NFNL_CTHELPER_H_
#define _NFNL_CTHELPER_H_
+#define NFCT_HELPER_STATUS_DISABLED 0
+#define NFCT_HELPER_STATUS_ENABLED 1
+
enum nfnl_acct_msg_types {
NFNL_MSG_CTHELPER_NEW,
NFNL_MSG_CTHELPER_GET,
@@ -15,6 +18,7 @@ enum nfnl_cthelper_type {
NFCTH_QUEUE_NUM,
NFCTH_POLICY,
NFCTH_PRIV_DATA_LEN,
+ NFCTH_STATUS,
__NFCTH_MAX
};
#define NFCTH_MAX (__NFCTH_MAX - 1)