6 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
8 static int cb(
enum nf_conntrack_msg_type type,
9 struct nf_conntrack *ct,
14 nfct_snprintf(buf,
sizeof(buf), ct, NFCT_T_UNKNOWN, NFCT_O_DEFAULT, NFCT_OF_SHOW_LAYER3 | NFCT_OF_TIMESTAMP);
17 return NFCT_CB_CONTINUE;
23 struct nfct_handle *h;
31 if (filter_dump == NULL) {
32 perror(
"nfct_filter_dump_alloc");
45 ret =
nfct_query(h, NFCT_Q_DUMP_FILTER, filter_dump);
49 printf(
"TEST: get conntrack ");
51 printf(
"(%d)(%s)\n", ret, strerror(errno));
57 ret == -1 ? exit(EXIT_FAILURE) : exit(EXIT_SUCCESS);
int nfct_query(struct nfct_handle *h, const enum nf_conntrack_query query, const void *data)
int nfct_close(struct nfct_handle *cth)
void nfct_filter_dump_set_attr(struct nfct_filter_dump *filter_dump, const enum nfct_filter_dump_attr type, const void *data)
void nfct_filter_dump_set_attr_u8(struct nfct_filter_dump *filter_dump, const enum nfct_filter_dump_attr type, uint8_t data)
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)
void nfct_filter_dump_destroy(struct nfct_filter_dump *filter)
struct nfct_handle * nfct_open(uint8_t, unsigned)
struct nfct_filter_dump * nfct_filter_dump_create(void)