From 0a0a6669a49b5253344a33f2fc9116ed67424887 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Tue, 26 Jul 2005 06:56:22 +0000 Subject: add new queue userspace library --- nfqnl_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nfqnl_test.c (limited to 'nfqnl_test.c') diff --git a/nfqnl_test.c b/nfqnl_test.c new file mode 100644 index 0000000..28971da --- /dev/null +++ b/nfqnl_test.c @@ -0,0 +1,33 @@ + +#include +#include +#include +#include + +#include "libnfqnetlink.h" + +int main(int argc, char **argv) +{ + struct nfqnl_handle h; + int rv; + char buf[4096]; + + rv = nfqnl_open(&h, 0); + if (rv < 0) + exit(rv); + + nfqnl_bind_pf(&h, AF_INET); + nfqnl_bind(&h, 0); + nfqnl_set_mode(&h, 0, NFQNL_COPY_PACKET, 0xffff); + + while (recv(h.nfnlh.fd, buf, sizeof(buf), 0) > 0) { + printf("pkt received\n"); + } + + nfqnl_unbind(&h, 0); + nfqnl_unbind_pf(&h, AF_INET); + + nfqnl_close(&h); + + exit(0); +} -- cgit v1.2.3