non-modified payload arguments are pointer-to-const
[platform/upstream/libnetfilter_queue.git] / include / libnetfilter_queue / libnetfilter_queue.h
index 9c2b40d..2e2ca8b 100644 (file)
 #define __LIBCTNETLINK_H
 
 #include <libnfnetlink/libnfnetlink.h>
+// #include <libnfnetlink/liunx_nfnetlink.h>
 
-#include <linux/netfilter/nfnetlink.h>
-#include <linux/netfilter/nfnetlink_queue.h>
+#include <libnetfilter_queue/linux_nfnetlink_queue.h>
 
-struct nfqnl_handle;
-struct nfqnl_q_handle;
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-extern int nfqnl_errno;
+struct nfq_handle;
+struct nfq_q_handle;
+struct nfq_data;
 
-extern struct nfnl_handle *nfqnl_nfnlh(struct nfqnl_handle *h);
-extern int nfqnl_fd(struct nfqnl_handle *h);
+extern int nfq_errno;
 
-typedef int  nfqnl_callback(struct nfqnl_q_handle *gh, struct nfgenmsg *nfmsg,
-                      struct nfattr *nfa[], void *data);
+extern struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h);
+extern int nfq_fd(struct nfq_handle *h);
 
+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 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 struct nfq_handle *nfq_open(void);
+extern struct nfq_handle *nfq_open_nfnl(struct nfnl_handle *nfnlh);
+extern int nfq_close(struct nfq_handle *h);
 
-extern struct nfqnl_q_handle *nfqnl_create_queue(struct nfqnl_handle *h,
+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 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,
+int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
+                       u_int32_t queuelen);
+
+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, 
-                                 u_int32_t id,
-                                 u_int32_t verdict, 
-                                 u_int32_t mark,
-                                 u_int32_t datalen,
-                                 unsigned char *buf);
+                            const unsigned char *buf);
+
+extern int nfq_set_verdict2(struct nfq_q_handle *qh,
+                           u_int32_t id,
+                           u_int32_t verdict, 
+                           u_int32_t mark,
+                           u_int32_t datalen,
+                           const unsigned char *buf);
+
+extern __attribute__((deprecated))
+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,
+                        const unsigned char *buf);
 
 /* message parsing function */
 
 extern struct nfqnl_msg_packet_hdr *
-                               nfqnl_get_msg_packet_hdr(struct nfattr *nfa[]);
+                               nfq_get_msg_packet_hdr(struct nfq_data *nfad);
 
-extern u_int32_t nfqnl_get_nfmark(struct nfattr *nfa[]);
+extern u_int32_t nfq_get_nfmark(struct nfq_data *nfad);
 
-extern struct nfqnl_msg_packet_timestamp *
-                               nfqnl_get_timestamp(struct nfattr *nfa[]);
+extern int nfq_get_timestamp(struct nfq_data *nfad, struct timeval *tv);
 
 /* return 0 if not set */
-extern u_int32_t nfqnl_get_indev(struct nfattr *nfa[]);
-extern u_int32_t nfqnl_get_physindev(struct nfattr *nfa[]);
-extern u_int32_t nfqnl_get_outdev(struct nfattr *nfa[]);
-extern u_int32_t nfqnl_get_physoutdev(struct nfattr *nfa[]);
-
-extern struct nfqnl_msg_packet_hw *nfqnl_get_packet_hw(struct nfattr *nfa[]);
-
-/* return 0 if problem */
-extern int nfqnl_get_payload(struct nfattr *nfa[],
-                            char ** data, unsigned int* datalen);
-
-
+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 int nfq_get_indev_name(struct nlif_handle *nlif_handle,
+                             struct nfq_data *nfad, char *name);
+extern int nfq_get_physindev_name(struct nlif_handle *nlif_handle,
+                                 struct nfq_data *nfad, char *name);
+extern int nfq_get_outdev_name(struct nlif_handle *nlif_handle,
+                              struct nfq_data *nfad, char *name);
+extern int nfq_get_physoutdev_name(struct nlif_handle *nlif_handle,
+                                  struct nfq_data *nfad, char *name);
+
+extern struct nfqnl_msg_packet_hw *nfq_get_packet_hw(struct nfq_data *nfad);
+
+/* return -1 if problem, length otherwise */
+extern int nfq_get_payload(struct nfq_data *nfad, char **data);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* __LIBNFQNETLINK_H */