[netfilter-cvslog] r4454 - in trunk/libnetfilter_queue: include/libnetfilter_queue src utils

laforge at netfilter.org laforge at netfilter.org
Sat Nov 5 10:53:28 CET 2005


Author: laforge at netfilter.org
Date: 2005-11-05 10:53:27 +0100 (Sat, 05 Nov 2005)
New Revision: 4454

Modified:
   trunk/libnetfilter_queue/include/libnetfilter_queue/libipq.h
   trunk/libnetfilter_queue/include/libnetfilter_queue/libnetfilter_queue.h
   trunk/libnetfilter_queue/src/libipq_compat.c
   trunk/libnetfilter_queue/src/libnetfilter_queue.c
   trunk/libnetfilter_queue/utils/nfqnl_test.c
Log:
rename all data types and functions to get rid of 'nl' (== netlink) part in prefix


Modified: trunk/libnetfilter_queue/include/libnetfilter_queue/libipq.h
===================================================================
--- trunk/libnetfilter_queue/include/libnetfilter_queue/libipq.h	2005-11-05 09:41:38 UTC (rev 4453)
+++ trunk/libnetfilter_queue/include/libnetfilter_queue/libipq.h	2005-11-05 09:53:27 UTC (rev 4454)
@@ -52,8 +52,8 @@
 
 struct ipq_handle
 {
-	struct nfqnl_handle *nfqnlh;
-	struct nfqnl_q_handle *qh;
+	struct nfq_handle *nfqnlh;
+	struct nfq_q_handle *qh;
 	u_int8_t family;
 	u_int8_t blocking;
 };

Modified: trunk/libnetfilter_queue/include/libnetfilter_queue/libnetfilter_queue.h
===================================================================
--- trunk/libnetfilter_queue/include/libnetfilter_queue/libnetfilter_queue.h	2005-11-05 09:41:38 UTC (rev 4453)
+++ trunk/libnetfilter_queue/include/libnetfilter_queue/libnetfilter_queue.h	2005-11-05 09:53:27 UTC (rev 4454)
@@ -18,43 +18,43 @@
 #include <linux/netfilter/nfnetlink.h>
 #include <linux/netfilter/nfnetlink_queue.h>
 
-struct nfqnl_handle;
-struct nfqnl_q_handle;
-struct nfnl_q_data;
+struct nfq_handle;
+struct nfq_q_handle;
+struct nfq_data;
 
-extern int nfqnl_errno;
+extern int nfq_errno;
 
-extern struct nfnl_handle *nfqnl_nfnlh(struct nfqnl_handle *h);
-extern int nfqnl_fd(struct nfqnl_handle *h);
+extern struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h);
+extern int nfq_fd(struct nfq_handle *h);
 
-typedef int  nfqnl_callback(struct nfqnl_q_handle *gh, struct nfgenmsg *nfmsg,
-		       struct nfnl_q_data *nfad, void *data);
+typedef int  nfq_callback(struct nfq_q_handle *gh, struct nfgenmsg *nfmsg,
+		       struct nfq_data *nfad, void *data);
 
 
-extern struct nfqnl_handle *nfqnl_open(void);
-extern int nfqnl_close(struct nfqnl_handle *h);
+extern struct nfq_handle *nfq_open(void);
+extern int nfq_close(struct nfq_handle *h);
 
-extern int nfqnl_bind_pf(struct nfqnl_handle *h, u_int16_t pf);
-extern int nfqnl_unbind_pf(struct nfqnl_handle *h, u_int16_t pf);
+extern int nfq_bind_pf(struct nfq_handle *h, u_int16_t pf);
+extern int nfq_unbind_pf(struct nfq_handle *h, u_int16_t pf);
 
-extern struct nfqnl_q_handle *nfqnl_create_queue(struct nfqnl_handle *h,
+extern struct nfq_q_handle *nfq_create_queue(struct nfq_handle *h,
 			      			 u_int16_t num,
-						 nfqnl_callback *cb,
+						 nfq_callback *cb,
 						 void *data);
-extern int nfqnl_destroy_queue(struct nfqnl_q_handle *qh);
+extern int nfq_destroy_queue(struct nfq_q_handle *qh);
 
-extern int nfqnl_handle_packet(struct nfqnl_handle *h, char *buf, int len);
+extern int nfq_handle_packet(struct nfq_handle *h, char *buf, int len);
 
-extern int nfqnl_set_mode(struct nfqnl_q_handle *qh,
+extern int nfq_set_mode(struct nfq_q_handle *qh,
 			  u_int8_t mode, unsigned int len);
 
-extern int nfqnl_set_verdict(struct nfqnl_q_handle *qh,
+extern int nfq_set_verdict(struct nfq_q_handle *qh,
 			     u_int32_t id,
 			     u_int32_t verdict,
 			     u_int32_t data_len,
 			     unsigned char *buf);
 
-extern int nfqnl_set_verdict_mark(struct nfqnl_q_handle *qh, 
+extern int nfq_set_verdict_mark(struct nfq_q_handle *qh, 
 				  u_int32_t id,
 			   	  u_int32_t verdict, 
 				  u_int32_t mark,
@@ -64,23 +64,23 @@
 /* message parsing function */
 
 extern struct nfqnl_msg_packet_hdr *
-				nfqnl_get_msg_packet_hdr(struct nfnl_q_data *nfad);
+				nfq_get_msg_packet_hdr(struct nfq_data *nfad);
 
-extern u_int32_t nfqnl_get_nfmark(struct nfnl_q_data *nfad);
+extern u_int32_t nfq_get_nfmark(struct nfq_data *nfad);
 
-extern struct nfqnl_msg_packet_timestamp *
-				nfqnl_get_timestamp(struct nfnl_q_data *nfad);
+extern struct nfq_msg_packet_timestamp *
+				nfq_get_timestamp(struct nfq_data *nfad);
 
 /* return 0 if not set */
-extern u_int32_t nfqnl_get_indev(struct nfnl_q_data *nfad);
-extern u_int32_t nfqnl_get_physindev(struct nfnl_q_data *nfad);
-extern u_int32_t nfqnl_get_outdev(struct nfnl_q_data *nfad);
-extern u_int32_t nfqnl_get_physoutdev(struct nfnl_q_data *nfad);
+extern u_int32_t nfq_get_indev(struct nfq_data *nfad);
+extern u_int32_t nfq_get_physindev(struct nfq_data *nfad);
+extern u_int32_t nfq_get_outdev(struct nfq_data *nfad);
+extern u_int32_t nfq_get_physoutdev(struct nfq_data *nfad);
 
-extern struct nfqnl_msg_packet_hw *nfqnl_get_packet_hw(struct nfnl_q_data *nfad);
+extern struct nfqnl_msg_packet_hw *nfq_get_packet_hw(struct nfq_data *nfad);
 
 /* return 0 if problem */
-extern int nfqnl_get_payload(struct nfnl_q_data *nfad,
+extern int nfq_get_payload(struct nfq_data *nfad,
 			     char ** data, unsigned int* datalen);
 
 

Modified: trunk/libnetfilter_queue/src/libipq_compat.c
===================================================================
--- trunk/libnetfilter_queue/src/libipq_compat.c	2005-11-05 09:41:38 UTC (rev 4453)
+++ trunk/libnetfilter_queue/src/libipq_compat.c	2005-11-05 09:53:27 UTC (rev 4454)
@@ -111,16 +111,16 @@
 	
 	memset(h, 0, sizeof(struct ipq_handle));
 
-	h->nfqnlh = nfqnl_open();
+	h->nfqnlh = nfq_open();
 	if (!h->nfqnlh) {
 		ipq_errno = IPQ_ERR_SOCKET;
 		goto err_free;
 	}
 	
         if (protocol == PF_INET)
-		status = nfqnl_bind_pf(h->nfqnlh, PF_INET);
+		status = nfq_bind_pf(h->nfqnlh, PF_INET);
         else if (protocol == PF_INET6)
-		status = nfqnl_bind_pf(h->nfqnlh, PF_INET6);
+		status = nfq_bind_pf(h->nfqnlh, PF_INET6);
         else {
 		ipq_errno = IPQ_ERR_PROTOCOL;
 		goto err_close;
@@ -131,7 +131,7 @@
 		goto err_close;
 	}
 
-	h->qh = nfqnl_create_queue(h->nfqnlh, 0, NULL, NULL);
+	h->qh = nfq_create_queue(h->nfqnlh, 0, NULL, NULL);
 	if (!h->qh) {
 		ipq_errno = IPQ_ERR_BIND;
 		goto err_close;
@@ -140,7 +140,7 @@
 	return h;
 
 err_close:
-	nfqnl_close(h->nfqnlh);
+	nfq_close(h->nfqnlh);
 err_free:
 	free(h);
 	return NULL;
@@ -153,7 +153,7 @@
 int ipq_destroy_handle(struct ipq_handle *h)
 {
 	if (h) {
-		nfqnl_close(h->nfqnlh);
+		nfq_close(h->nfqnlh);
 		free(h);
 	}
 	return 0;
@@ -162,7 +162,7 @@
 int ipq_set_mode(const struct ipq_handle *h,
                  u_int8_t mode, size_t range)
 {
-	return nfqnl_set_mode(h->qh, mode, range);
+	return nfq_set_mode(h->qh, mode, range);
 }
 
 /*
@@ -183,7 +183,7 @@
 	 * in order to build a data structure that is compatible to
 	 * the old ipq interface... */
 
-	nfa = nfnl_parse_hdr(nfqnl_nfnlh(h->nfqnlh), nlh, &msg);
+	nfa = nfnl_parse_hdr(nfq_nfnlh(h->nfqnlh), nlh, &msg);
 	if (!msg || !nfa)
 		return 0;
 
@@ -219,7 +219,7 @@
                     size_t data_len,
                     unsigned char *buf)
 {
-	return nfqnl_set_verdict(h->qh, id, verdict, data_len, buf);
+	return nfq_set_verdict(h->qh, id, verdict, data_len, buf);
 }
 
 /* Not implemented yet */

Modified: trunk/libnetfilter_queue/src/libnetfilter_queue.c
===================================================================
--- trunk/libnetfilter_queue/src/libnetfilter_queue.c	2005-11-05 09:41:38 UTC (rev 4453)
+++ trunk/libnetfilter_queue/src/libnetfilter_queue.c	2005-11-05 09:53:27 UTC (rev 4454)
@@ -29,35 +29,35 @@
 #include <libnfnetlink/libnfnetlink.h>
 #include <libnetfilter_queue/libnetfilter_queue.h>
 
-struct nfqnl_handle
+struct nfq_handle
 {
 	struct nfnl_handle nfnlh;
-	struct nfqnl_q_handle *qh_list;
+	struct nfq_q_handle *qh_list;
 };
 
-struct nfqnl_q_handle
+struct nfq_q_handle
 {
-	struct nfqnl_q_handle *next;
-	struct nfqnl_handle *h;
+	struct nfq_q_handle *next;
+	struct nfq_handle *h;
 	u_int16_t id;
 
-	nfqnl_callback *cb;
+	nfq_callback *cb;
 	void *data;
 };
 
-struct nfnl_q_data {
+struct nfq_data {
 	struct nfattr **data;
 };
 
-int nfqnl_errno;
+int nfq_errno;
 
 /***********************************************************************
  * low level stuff 
  ***********************************************************************/
 
-static void del_qh(struct nfqnl_q_handle *qh)
+static void del_qh(struct nfq_q_handle *qh)
 {
-	struct nfqnl_q_handle *cur_qh, *prev_qh = NULL;
+	struct nfq_q_handle *cur_qh, *prev_qh = NULL;
 
 	for (cur_qh = qh->h->qh_list; cur_qh; cur_qh = cur_qh->next) {
 		if (cur_qh == qh) {
@@ -71,15 +71,15 @@
 	}
 }
 
-static void add_qh(struct nfqnl_q_handle *qh)
+static void add_qh(struct nfq_q_handle *qh)
 {
 	qh->next = qh->h->qh_list;
 	qh->h->qh_list = qh;
 }
 
-static struct nfqnl_q_handle *find_qh(struct nfqnl_handle *h, u_int16_t id)
+static struct nfq_q_handle *find_qh(struct nfq_handle *h, u_int16_t id)
 {
-	struct nfqnl_q_handle *qh;
+	struct nfq_q_handle *qh;
 
 	for (qh = h->qh_list; qh; qh = qh->next) {
 		if (qh->id == id)
@@ -90,7 +90,7 @@
 
 /* build a NFQNL_MSG_CONFIG message */
 	static int
-__build_send_cfg_msg(struct nfqnl_handle *h, u_int8_t command,
+__build_send_cfg_msg(struct nfq_handle *h, u_int8_t command,
 		u_int16_t queuenum, u_int16_t pf)
 {
 	char buf[NFNL_HEADER_LEN
@@ -108,14 +108,14 @@
 	return nfnl_talk(&h->nfnlh, nmh, 0, 0, NULL, NULL, NULL);
 }
 
-static int __nfqnl_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
+static int __nfq_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
 		void *data)
 {
 	struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
-	struct nfqnl_handle *h = data;
+	struct nfq_handle *h = data;
 	u_int16_t queue_num = ntohs(nfmsg->res_id);
-	struct nfqnl_q_handle *qh = find_qh(h, queue_num);
-	struct nfnl_q_data nfqa;
+	struct nfq_q_handle *qh = find_qh(h, queue_num);
+	struct nfq_data nfqa;
 
 	if (!qh)
 		return -ENODEV;
@@ -129,25 +129,25 @@
 }
 
 static struct nfnl_callback pkt_cb = {
-	.call		= &__nfqnl_rcv_pkt,
+	.call		= &__nfq_rcv_pkt,
 	.attr_count	= NFQA_MAX,
 };
 
 /* public interface */
 
-struct nfnl_handle *nfqnl_nfnlh(struct nfqnl_handle *h)
+struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h)
 {
 	return &h->nfnlh;
 }
 
-int nfqnl_fd(struct nfqnl_handle *h)
+int nfq_fd(struct nfq_handle *h)
 {
-	return nfnl_fd(nfqnl_nfnlh(h));
+	return nfnl_fd(nfq_nfnlh(h));
 }
 
-struct nfqnl_handle *nfqnl_open(void)
+struct nfq_handle *nfq_open(void)
 {
-	struct nfqnl_handle *h;
+	struct nfq_handle *h;
 	int err;
 
 	h = malloc(sizeof(*h));
@@ -158,14 +158,14 @@
 
 	err = nfnl_open(&h->nfnlh, NFNL_SUBSYS_QUEUE, NFQNL_MSG_MAX, 0);
 	if (err < 0) {
-		nfqnl_errno = err;
+		nfq_errno = err;
 		goto out_free;
 	}
 
 	pkt_cb.data = h;
 	err = nfnl_callback_register(&h->nfnlh, NFQNL_MSG_PACKET, &pkt_cb);
 	if (err < 0) {
-		nfqnl_errno = err;
+		nfq_errno = err;
 		goto out_close;
 	}
 
@@ -177,7 +177,7 @@
 	return NULL;
 }
 
-int nfqnl_close(struct nfqnl_handle *h)
+int nfq_close(struct nfq_handle *h)
 {
 	int ret = nfnl_close(&h->nfnlh);
 	if (ret == 0)
@@ -186,25 +186,25 @@
 }
 
 /* bind nf_queue from a specific protocol family */
-int nfqnl_bind_pf(struct nfqnl_handle *h, u_int16_t pf)
+int nfq_bind_pf(struct nfq_handle *h, u_int16_t pf)
 {
 	return __build_send_cfg_msg(h, NFQNL_CFG_CMD_PF_BIND, 0, pf);
 }
 
 /* unbind nf_queue from a specific protocol family */
-int nfqnl_unbind_pf(struct nfqnl_handle *h, u_int16_t pf)
+int nfq_unbind_pf(struct nfq_handle *h, u_int16_t pf)
 {
 	return __build_send_cfg_msg(h, NFQNL_CFG_CMD_PF_UNBIND, 0, pf);
 }
 
 /* bind this socket to a specific queue number */
-struct nfqnl_q_handle *nfqnl_create_queue(struct nfqnl_handle *h, 
+struct nfq_q_handle *nfq_create_queue(struct nfq_handle *h, 
 		u_int16_t num,
-		nfqnl_callback *cb,
+		nfq_callback *cb,
 		void *data)
 {
 	int ret;
-	struct nfqnl_q_handle *qh;
+	struct nfq_q_handle *qh;
 
 	if (find_qh(h, num))
 		return NULL;
@@ -219,7 +219,7 @@
 
 	ret = __build_send_cfg_msg(h, NFQNL_CFG_CMD_BIND, num, 0);
 	if (ret < 0) {
-		nfqnl_errno = ret;
+		nfq_errno = ret;
 		free(qh);
 		return NULL;
 	}
@@ -229,7 +229,7 @@
 }
 
 /* unbind this socket from a specific queue number */
-int nfqnl_destroy_queue(struct nfqnl_q_handle *qh)
+int nfq_destroy_queue(struct nfq_q_handle *qh)
 {
 	int ret = __build_send_cfg_msg(qh->h, NFQNL_CFG_CMD_UNBIND, qh->id, 0);
 	if (ret == 0) {
@@ -240,12 +240,12 @@
 	return ret;
 }
 
-int nfqnl_handle_packet(struct nfqnl_handle *h, char *buf, int len)
+int nfq_handle_packet(struct nfq_handle *h, char *buf, int len)
 {
 	return nfnl_handle_packet(&h->nfnlh, buf, len);
 }
 
-int nfqnl_set_mode(struct nfqnl_q_handle *qh,
+int nfq_set_mode(struct nfq_q_handle *qh,
 		u_int8_t mode, u_int32_t range)
 {
 	char buf[NFNL_HEADER_LEN
@@ -264,7 +264,7 @@
 	return nfnl_talk(&qh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL);
 }
 
-static int __set_verdict(struct nfqnl_q_handle *qh, u_int32_t id,
+static int __set_verdict(struct nfq_q_handle *qh, u_int32_t id,
 		u_int32_t verdict, u_int32_t mark, int set_mark,
 		u_int32_t data_len, unsigned char *data)
 {
@@ -306,14 +306,14 @@
 	return nfnl_sendiov(&qh->h->nfnlh, iov, nvecs, 0);
 }
 
-int nfqnl_set_verdict(struct nfqnl_q_handle *qh, u_int32_t id,
+int nfq_set_verdict(struct nfq_q_handle *qh, u_int32_t id,
 		u_int32_t verdict, u_int32_t data_len, 
 		unsigned char *buf)
 {
 	return __set_verdict(qh, id, verdict, 0, 0, data_len, buf);
 }	
 
-int nfqnl_set_verdict_mark(struct nfqnl_q_handle *qh, u_int32_t id,
+int nfq_set_verdict_mark(struct nfq_q_handle *qh, u_int32_t id,
 		u_int32_t verdict, u_int32_t mark,
 		u_int32_t datalen, unsigned char *buf)
 {
@@ -324,52 +324,52 @@
  * Message parsing functions 
  *************************************************************/
 
-struct nfqnl_msg_packet_hdr *nfqnl_get_msg_packet_hdr(struct nfnl_q_data *nfad)
+struct nfqnl_msg_packet_hdr *nfq_get_msg_packet_hdr(struct nfq_data *nfad)
 {
 	return nfnl_get_pointer_to_data(nfad->data, NFQA_PACKET_HDR,
 					struct nfqnl_msg_packet_hdr);
 }
 
-uint32_t nfqnl_get_nfmark(struct nfnl_q_data *nfad)
+uint32_t nfq_get_nfmark(struct nfq_data *nfad)
 {
 	return ntohl(nfnl_get_data(nfad->data, NFQA_MARK, u_int32_t));
 }
 
-struct nfqnl_msg_packet_timestamp *nfqnl_get_timestamp(struct nfnl_q_data *nfad)
+struct nfq_msg_packet_timestamp *nfq_get_timestamp(struct nfq_data *nfad)
 {
 	return nfnl_get_pointer_to_data(nfad->data, NFQA_TIMESTAMP,
-					struct nfqnl_msg_packet_timestamp);
+					struct nfq_msg_packet_timestamp);
 }
 
-/* all nfqnl_get_*dev() functions return 0 if not set, since linux only allows
+/* all nfq_get_*dev() functions return 0 if not set, since linux only allows
  * ifindex >= 1, see net/core/dev.c:2600  (in 2.6.13.1) */
-u_int32_t nfqnl_get_indev(struct nfnl_q_data *nfad)
+u_int32_t nfq_get_indev(struct nfq_data *nfad)
 {
 	return ntohl(nfnl_get_data(nfad->data, NFQA_IFINDEX_INDEV, u_int32_t));
 }
 
-u_int32_t nfqnl_get_physindev(struct nfnl_q_data *nfad)
+u_int32_t nfq_get_physindev(struct nfq_data *nfad)
 {
 	return ntohl(nfnl_get_data(nfad->data, NFQA_IFINDEX_PHYSINDEV, u_int32_t));
 }
 
-u_int32_t nfqnl_get_outdev(struct nfnl_q_data *nfad)
+u_int32_t nfq_get_outdev(struct nfq_data *nfad)
 {
 	return ntohl(nfnl_get_data(nfad->data, NFQA_IFINDEX_OUTDEV, u_int32_t));
 }
 
-u_int32_t nfqnl_get_physoutdev(struct nfnl_q_data *nfad)
+u_int32_t nfq_get_physoutdev(struct nfq_data *nfad)
 {
 	return ntohl(nfnl_get_data(nfad->data, NFQA_IFINDEX_PHYSOUTDEV, u_int32_t));
 }
 
-struct nfqnl_msg_packet_hw *nfqnl_get_packet_hw(struct nfnl_q_data *nfad)
+struct nfqnl_msg_packet_hw *nfq_get_packet_hw(struct nfq_data *nfad)
 {
 	return nfnl_get_pointer_to_data(nfad->data, NFQA_HWADDR,
 					struct nfqnl_msg_packet_hw);
 }
 
-int nfqnl_get_payload(struct nfnl_q_data *nfad, char **data,
+int nfq_get_payload(struct nfq_data *nfad, char **data,
 		      unsigned int *datalen)
 {
 	*data = nfnl_get_pointer_to_data(nfad->data, NFQA_PAYLOAD, char);

Modified: trunk/libnetfilter_queue/utils/nfqnl_test.c
===================================================================
--- trunk/libnetfilter_queue/utils/nfqnl_test.c	2005-11-05 09:41:38 UTC (rev 4453)
+++ trunk/libnetfilter_queue/utils/nfqnl_test.c	2005-11-05 09:53:27 UTC (rev 4454)
@@ -8,7 +8,7 @@
 #include <libnetfilter_queue/libnetfilter_queue.h>
 
 /* returns packet id */
-static u_int32_t print_pkt (struct nfnl_q_data *tb)
+static u_int32_t print_pkt (struct nfq_data *tb)
 {
 	int id = 0;
 	struct nfqnl_msg_packet_hdr *ph;
@@ -17,26 +17,26 @@
 	unsigned int datalength;
 	char * data;
 	
-	ph = nfqnl_get_msg_packet_hdr(tb);
+	ph = nfq_get_msg_packet_hdr(tb);
 	if (ph){
 		id = ntohl(ph->packet_id);
 		printf("hw_protocol=0x%04x hook=%u id=%u ",
 			ntohs(ph->hw_protocol), ph->hook, id);
 	}
 	
-	mark = nfqnl_get_nfmark(tb);
+	mark = nfq_get_nfmark(tb);
 	if (mark)
 		printf("mark=%u ", mark);
 
-	ifi = nfqnl_get_indev(tb);
+	ifi = nfq_get_indev(tb);
 	if (ifi)
 		printf("indev=%u ", ifi);
 
-	ifi = nfqnl_get_outdev(tb);
+	ifi = nfq_get_outdev(tb);
 	if (ifi)
 		printf("outdev=%u ", ifi);
 
-	ret = nfqnl_get_payload(tb, &data, &datalength);
+	ret = nfq_get_payload(tb, &data, &datalength);
 	if (ret)
 		printf("payload_len=%d ", datalength);
 
@@ -46,75 +46,75 @@
 }
 	
 
-static int cb(struct nfqnl_q_handle *qh, struct nfgenmsg *nfmsg,
-	      struct nfnl_q_data *nfa, void *data)
+static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
+	      struct nfq_data *nfa, void *data)
 {
 	u_int32_t id = print_pkt(nfa);
 	printf("entering callback\n");
-	return nfqnl_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
+	return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
 }
 
 int main(int argc, char **argv)
 {
-	struct nfqnl_handle *h;
-	struct nfqnl_q_handle *qh;
+	struct nfq_handle *h;
+	struct nfq_q_handle *qh;
 	struct nfnl_handle *nh;
 	int fd;
 	int rv;
 	char buf[4096];
 
 	printf("opening library handle\n");
-	h = nfqnl_open();
+	h = nfq_open();
 	if (!h) {
-		fprintf(stderr, "error during nfqnl_open()\n");
+		fprintf(stderr, "error during nfq_open()\n");
 		exit(1);
 	}
 
 	printf("unbinding existing nf_queue handler for AF_INET (if any)\n");
-	if (nfqnl_unbind_pf(h, AF_INET) < 0) {
-		fprintf(stderr, "error during nfqnl_unbind_pf()\n");
+	if (nfq_unbind_pf(h, AF_INET) < 0) {
+		fprintf(stderr, "error during nfq_unbind_pf()\n");
 		exit(1);
 	}
 
 	printf("binding nfnetlink_queue as nf_queue handler for AF_INET\n");
-	if (nfqnl_bind_pf(h, AF_INET) < 0) {
-		fprintf(stderr, "error during nfqnl_bind_pf()\n");
+	if (nfq_bind_pf(h, AF_INET) < 0) {
+		fprintf(stderr, "error during nfq_bind_pf()\n");
 		exit(1);
 	}
 
 	printf("binding this socket to queue '0'\n");
-	qh = nfqnl_create_queue(h,  0, &cb, NULL);
+	qh = nfq_create_queue(h,  0, &cb, NULL);
 	if (!qh) {
-		fprintf(stderr, "error during nfqnl_create_queue()\n");
+		fprintf(stderr, "error during nfq_create_queue()\n");
 		exit(1);
 	}
 
 	printf("setting copy_packet mode\n");
-	if (nfqnl_set_mode(qh, NFQNL_COPY_PACKET, 0xffff) < 0) {
+	if (nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xffff) < 0) {
 		fprintf(stderr, "can't set packet_copy mode\n");
 		exit(1);
 	}
 
-	nh = nfqnl_nfnlh(h);
+	nh = nfq_nfnlh(h);
 	fd = nfnl_fd(nh);
 
 	while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
 		printf("pkt received\n");
-		nfqnl_handle_packet(h, buf, rv);
+		nfq_handle_packet(h, buf, rv);
 	}
 
 	printf("unbinding from queue 0\n");
-	nfqnl_destroy_queue(qh);
+	nfq_destroy_queue(qh);
 
 #ifdef INSANE
 	/* normally, applications SHOULD NOT issue this command, since
 	 * it detaches other programs/sockets from AF_INET, too ! */
 	printf("unbinding from AF_INET\n");
-	nfqnl_unbind_pf(h, AF_INET);
+	nfq_unbind_pf(h, AF_INET);
 #endif
 
 	printf("closing library handle\n");
-	nfqnl_close(h);
+	nfq_close(h);
 
 	exit(0);
 }




More information about the netfilter-cvslog mailing list