libnetfilter_cthelper  1.0.0
libnetfilter_cthelper.h
1 #ifndef _LIBNETFILTER_ACCT_H_
2 #define _LIBNETFILTER_ACCT_H_
3 
4 #include <sys/types.h>
5 #include <linux/netfilter/nfnetlink_cthelper.h>
6 
7 struct nfct_helper_policy;
8 
9 enum nfct_helper_policy_attr_type {
10  NFCTH_ATTR_POLICY_NAME = 0,
11  NFCTH_ATTR_POLICY_TIMEOUT,
12  NFCTH_ATTR_POLICY_MAX,
13 };
14 
17 
18 void nfct_helper_policy_attr_set(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const void *data);
19 void nfct_helper_policy_attr_set_str(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const char *name);
20 void nfct_helper_policy_attr_set_u32(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, uint32_t value);
21 void nfct_helper_policy_attr_unset(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type);
22 
23 enum nfct_helper_attr_type {
24  NFCTH_ATTR_NAME = 0,
25  NFCTH_ATTR_QUEUE_NUM,
26  NFCTH_ATTR_PROTO_L3NUM,
27  NFCTH_ATTR_PROTO_L4NUM,
28  NFCTH_ATTR_PRIV_DATA_LEN,
29  NFCTH_ATTR_POLICY,
30  NFCTH_ATTR_POLICY1 = NFCTH_ATTR_POLICY,
31  NFCTH_ATTR_POLICY2,
32  NFCTH_ATTR_POLICY3,
33  NFCTH_ATTR_POLICY4,
34  NFCTH_ATTR_STATUS,
35 };
36 
37 struct nfct_helper;
38 
39 struct nfct_helper *nfct_helper_alloc(void);
40 void nfct_helper_free(struct nfct_helper *h);
41 
42 void nfct_helper_attr_set(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const void *data);
43 void nfct_helper_attr_set_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const char *name);
44 void nfct_helper_attr_set_u8(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint8_t value);
45 void nfct_helper_attr_set_u16(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint16_t value);
46 void nfct_helper_attr_set_u32(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, uint32_t value);
47 void nfct_helper_attr_unset(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
48 
49 const void *nfct_helper_attr_get(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
50 const char *nfct_helper_attr_get_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
51 uint8_t nfct_helper_attr_get_u8(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
52 uint16_t nfct_helper_attr_get_u16(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
53 uint32_t nfct_helper_attr_get_u32(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type);
54 
55 struct nlmsghdr;
56 
57 struct nlmsghdr *nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq);
58 void nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *nfct_helper);
59 int nfct_helper_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_helper *nfct_helper);
60 
61 int nfct_helper_snprintf(char *buf, size_t size, struct nfct_helper *nfct_helper, unsigned int type, unsigned int flags);
62 
63 #endif
int nfct_helper_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_helper *nfct_helper)
void nfct_helper_attr_set_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const char *name)
void nfct_helper_policy_attr_set(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const void *data)
struct nfct_helper * nfct_helper_alloc(void)
void nfct_helper_policy_free(struct nfct_helper_policy *p)
struct nfct_helper_policy * nfct_helper_policy_alloc(void)
const void * nfct_helper_attr_get(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)
void nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *nfct_helper)
int nfct_helper_snprintf(char *buf, size_t size, struct nfct_helper *nfct_helper, unsigned int type, unsigned int flags)
void nfct_helper_policy_attr_set_str(struct nfct_helper_policy *p, enum nfct_helper_policy_attr_type type, const char *name)
uint8_t nfct_helper_attr_get_u8(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type)
struct nlmsghdr * nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
uint32_t nfct_helper_attr_get_u32(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type)
void nfct_helper_attr_set(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const void *data)
const char * nfct_helper_attr_get_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type)
void nfct_helper_free(struct nfct_helper *h)
void nfct_helper_attr_unset(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type)