int main(void) { int ret; u_int8_t family = AF_INET; struct nfct_handle *h; h = nfct_open(EXPECT, 0); if (!h) { perror("nfct_open"); return -1; } nfexp_callback_register(h, NFCT_T_ALL, cb, NULL); ret = nfexp_query(h, NFCT_Q_DUMP, &family); printf("TEST: dumo expectation "); if (ret == -1) printf("(%d)(%s)\n", ret, strerror(errno)); else printf("(OK)\n"); nfct_close(h); ret == -1 ? exit(EXIT_FAILURE) : exit(EXIT_SUCCESS); }
int main() { int ret; struct nfct_handle *h; h = nfct_open(EXPECT, NF_NETLINK_CONNTRACK_EXP_NEW); if (!h) { perror("nfct_open"); return -1; } nfexp_callback_register(h, NFCT_T_ALL, event_cb, NULL); printf("TEST: waiting for 10 expectation events...\n"); ret = nfexp_catch(h); printf("TEST: OK (%d)(%s)\n", ret, strerror(errno)); nfct_close(h); if (ret == -1) exit(EXIT_FAILURE); exit(EXIT_SUCCESS); }