6 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
8 static int event_cb(
enum nf_conntrack_msg_type type,
9 struct nf_conntrack *ct,
15 nfct_snprintf(buf,
sizeof(buf), ct, type, NFCT_O_XML, NFCT_OF_TIME | NFCT_OF_TIMESTAMP);
21 return NFCT_CB_CONTINUE;
27 struct nfct_handle *h;
29 h =
nfct_open(CONNTRACK, NFCT_ALL_CT_GROUPS);
37 printf(
"TEST: waiting for 10 events...\n");
41 printf(
"TEST: conntrack events ");
43 printf(
"(%d)(%s)\n", ret, strerror(errno));
49 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 nfct_catch(struct nfct_handle *h)
struct nfct_handle * nfct_open(uint8_t, unsigned)