Add patch to set max. queue length (Eric Leblond)
[platform/upstream/libnetfilter_queue.git] / include / libnetfilter_queue / libnetfilter_queue.h
1 /* libnfqnetlink.h: Header file for the Netfilter Queue library.
2  *
3  * (C) 2005 by Harald Welte <laforge@gnumonks.org>
4  *
5  *
6  * Changelog : 
7  *      (2005/08/11)  added  parsing function (Eric Leblond <regit@inl.fr>)
8  * 
9  * This software may be used and distributed according to the terms
10  * of the GNU General Public License, incorporated herein by reference.
11  */
12
13 #ifndef __LIBCTNETLINK_H
14 #define __LIBCTNETLINK_H
15
16 #include <libnfnetlink/libnfnetlink.h>
17 // #include <libnfnetlink/liunx_nfnetlink.h>
18
19 #include <libnetfilter_queue/linux_nfnetlink_queue.h>
20
21 struct nfq_handle;
22 struct nfq_q_handle;
23 struct nfq_data;
24
25 extern int nfq_errno;
26
27 extern struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h);
28 extern int nfq_fd(struct nfq_handle *h);
29
30 typedef int  nfq_callback(struct nfq_q_handle *gh, struct nfgenmsg *nfmsg,
31                        struct nfq_data *nfad, void *data);
32
33
34 extern struct nfq_handle *nfq_open(void);
35 extern struct nfq_handle *nfq_open_nfnl(struct nfnl_handle *nfnlh);
36 extern int nfq_close(struct nfq_handle *h);
37
38 extern int nfq_bind_pf(struct nfq_handle *h, u_int16_t pf);
39 extern int nfq_unbind_pf(struct nfq_handle *h, u_int16_t pf);
40
41 extern struct nfq_q_handle *nfq_create_queue(struct nfq_handle *h,
42                                                  u_int16_t num,
43                                                  nfq_callback *cb,
44                                                  void *data);
45 extern int nfq_destroy_queue(struct nfq_q_handle *qh);
46
47 extern int nfq_handle_packet(struct nfq_handle *h, char *buf, int len);
48
49 extern int nfq_set_mode(struct nfq_q_handle *qh,
50                           u_int8_t mode, unsigned int len);
51
52 int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
53                         u_int32_t queuelen);
54
55 extern int nfq_set_verdict(struct nfq_q_handle *qh,
56                              u_int32_t id,
57                              u_int32_t verdict,
58                              u_int32_t data_len,
59                              unsigned char *buf);
60
61 extern int nfq_set_verdict_mark(struct nfq_q_handle *qh, 
62                                   u_int32_t id,
63                                   u_int32_t verdict, 
64                                   u_int32_t mark,
65                                   u_int32_t datalen,
66                                   unsigned char *buf);
67
68 /* message parsing function */
69
70 extern struct nfqnl_msg_packet_hdr *
71                                 nfq_get_msg_packet_hdr(struct nfq_data *nfad);
72
73 extern u_int32_t nfq_get_nfmark(struct nfq_data *nfad);
74
75 extern int nfq_get_timestamp(struct nfq_data *nfad, struct timeval *tv);
76
77 /* return 0 if not set */
78 extern u_int32_t nfq_get_indev(struct nfq_data *nfad);
79 extern u_int32_t nfq_get_physindev(struct nfq_data *nfad);
80 extern u_int32_t nfq_get_outdev(struct nfq_data *nfad);
81 extern u_int32_t nfq_get_physoutdev(struct nfq_data *nfad);
82
83 extern struct nfqnl_msg_packet_hw *nfq_get_packet_hw(struct nfq_data *nfad);
84
85 /* return -1 if problem, length otherwise */
86 extern int nfq_get_payload(struct nfq_data *nfad, char **data);
87
88
89
90 #endif  /* __LIBNFQNETLINK_H */