From de73c2fe742c29acada99aace6c381a3c26aaf8b 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: Sat, 5 Nov 2005 09:53:27 +0000 Subject: rename all data types and functions to get rid of 'nl' (== netlink) part in prefix --- utils/nfqnl_test.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'utils') diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c index ccb5eff..a687215 100644 --- a/utils/nfqnl_test.c +++ b/utils/nfqnl_test.c @@ -8,7 +8,7 @@ #include /* 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 @@ static u_int32_t print_pkt (struct nfnl_q_data *tb) 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 u_int32_t print_pkt (struct nfnl_q_data *tb) } -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); } -- cgit v1.2.3