1 /* libnfqnetlink.h: Header file for the Netfilter Queue library.
3 * (C) 2005 by Harald Welte <laforge@gnumonks.org>
7 * (2005/08/11) added parsing function (Eric Leblond <regit@inl.fr>)
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
13 #ifndef __LIBCTNETLINK_H
14 #define __LIBCTNETLINK_H
16 #include <libnfnetlink/libnfnetlink.h>
18 #include <linux/netfilter/nfnetlink.h>
19 #include <linux/netfilter/nfnetlink_queue.h>
22 struct nfqnl_q_handle;
24 extern int nfqnl_errno;
26 extern struct nfnl_handle *nfqnl_nfnlh(struct nfqnl_handle *h);
27 extern int nfqnl_fd(struct nfqnl_handle *h);
29 typedef int nfqnl_callback(struct nfqnl_q_handle *gh, struct nfgenmsg *nfmsg,
30 struct nfattr *nfa[], void *data);
33 extern struct nfqnl_handle *nfqnl_open(void);
34 extern int nfqnl_close(struct nfqnl_handle *h);
36 extern int nfqnl_bind_pf(struct nfqnl_handle *h, u_int16_t pf);
37 extern int nfqnl_unbind_pf(struct nfqnl_handle *h, u_int16_t pf);
39 extern struct nfqnl_q_handle *nfqnl_create_queue(struct nfqnl_handle *h,
43 extern int nfqnl_destroy_queue(struct nfqnl_q_handle *qh);
45 extern int nfqnl_handle_packet(struct nfqnl_handle *h, char *buf, int len);
47 extern int nfqnl_set_mode(struct nfqnl_q_handle *qh,
48 u_int8_t mode, unsigned int len);
50 extern int nfqnl_set_verdict(struct nfqnl_q_handle *qh,
56 extern int nfqnl_set_verdict_mark(struct nfqnl_q_handle *qh,
63 /* message parsing function */
65 extern struct nfqnl_msg_packet_hdr *
66 nfqnl_get_msg_packet_hdr(struct nfattr *nfa[]);
68 extern u_int32_t nfqnl_get_nfmark(struct nfattr *nfa[]);
70 extern struct nfqnl_msg_packet_timestamp *
71 nfqnl_get_timestamp(struct nfattr *nfa[]);
73 /* return 0 if not set */
74 extern u_int32_t nfqnl_get_indev(struct nfattr *nfa[]);
75 extern u_int32_t nfqnl_get_physindev(struct nfattr *nfa[]);
76 extern u_int32_t nfqnl_get_outdev(struct nfattr *nfa[]);
77 extern u_int32_t nfqnl_get_physoutdev(struct nfattr *nfa[]);
79 extern struct nfqnl_msg_packet_hw *nfqnl_get_packet_hw(struct nfattr *nfa[]);
81 /* return 0 if problem */
82 extern int nfqnl_get_payload(struct nfattr *nfa[],
83 char ** data, unsigned int* datalen);
87 #endif /* __LIBNFQNETLINK_H */