6 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
11 ct_event_cb(
enum nf_conntrack_msg_type type,
struct nf_conntrack *ct,
void *data)
15 nfct_snprintf(buf,
sizeof(buf), ct, type, NFCT_O_PLAIN, NFCT_OF_TIME);
16 printf(
"[CT] %s\n", buf);
21 return NFCT_CB_CONTINUE;
25 exp_event_cb(
enum nf_conntrack_msg_type type,
struct nf_expect *exp,
void *data)
30 printf(
"[EXP] %s\n", buf);
35 return NFCT_CB_CONTINUE;
41 struct nfct_handle *h;
43 h =
nfct_open(NFNL_SUBSYS_NONE, NF_NETLINK_CONNTRACK_EXP_NEW |
44 NF_NETLINK_CONNTRACK_EXP_UPDATE |
45 NF_NETLINK_CONNTRACK_EXP_DESTROY |
46 NF_NETLINK_CONNTRACK_NEW |
47 NF_NETLINK_CONNTRACK_UPDATE |
48 NF_NETLINK_CONNTRACK_DESTROY);
57 printf(
"TEST: waiting for 20 expectation events...\n");
62 printf(
"TEST: expectation events ");
64 printf(
"(%d)(%s)\n", ret, strerror(errno));
70 ret == -1 ? exit(EXIT_FAILURE) : exit(EXIT_SUCCESS);
int nfct_close(struct nfct_handle *cth)
int nfct_snprintf(char *buf, unsigned int size, const struct nf_conntrack *ct, const unsigned int msg_type, const unsigned int out_type, const unsigned int out_flags)
int nfct_callback_register(struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data), void *data)
int nfexp_snprintf(char *buf, unsigned int size, const struct nf_expect *exp, const unsigned int msg_type, const unsigned int out_type, const unsigned int out_flags)
int nfct_catch(struct nfct_handle *h)
int nfexp_callback_register(struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(enum nf_conntrack_msg_type type, struct nf_expect *exp, void *data), void *data)
struct nfct_handle * nfct_open(uint8_t, unsigned)