summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-07-30 20:55:43 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-07-30 20:55:43 +0000
commit689346d6528085eb4216007d658bd7f34ee6cb60 (patch)
tree25d22ab90b22ab159d92fb8383d57878a86ae5b7 /include
parenta019e98d464e442b323969d2fcd6c5385ec4aa91 (diff)
directory restructuring
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am3
-rw-r--r--include/libnfnetlink_queue/Makefile.am3
-rw-r--r--include/libnfnetlink_queue/libipq.h88
-rw-r--r--include/libnfnetlink_queue/libnfnetlink_queue.h61
4 files changed, 155 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..4040f9f
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,3 @@
+
+SUBDIRS = libnfnetlink_queue
+
diff --git a/include/libnfnetlink_queue/Makefile.am b/include/libnfnetlink_queue/Makefile.am
new file mode 100644
index 0000000..ebdfd5c
--- /dev/null
+++ b/include/libnfnetlink_queue/Makefile.am
@@ -0,0 +1,3 @@
+
+pkginclude_HEADERS = libnfnetlink_queue.h libipq.h
+
diff --git a/include/libnfnetlink_queue/libipq.h b/include/libnfnetlink_queue/libipq.h
new file mode 100644
index 0000000..483a514
--- /dev/null
+++ b/include/libnfnetlink_queue/libipq.h
@@ -0,0 +1,88 @@
+/*
+ * libipq.h
+ *
+ * IPQ library for userspace.
+ *
+ * Author: James Morris <jmorris@intercode.com.au>
+ *
+ * Copyright (c) 2000-2001 Netfilter Core Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef _LIBIPQ_H
+#define _LIBIPQ_H
+
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <asm/types.h>
+#include <linux/netlink.h>
+
+#ifdef KERNEL_64_USERSPACE_32
+#include "ip_queue_64.h"
+typedef u_int64_t ipq_id_t;
+#else
+#include <linux/netfilter_ipv4/ip_queue.h>
+typedef unsigned long ipq_id_t;
+#endif
+
+#ifdef DEBUG_LIBIPQ
+#include <stdio.h>
+#define LDEBUG(x...) fprintf(stderr, ## x)
+#else
+#define LDEBUG(x...)
+#endif /* DEBUG_LIBIPQ */
+
+/* FIXME: glibc sucks */
+#ifndef MSG_TRUNC
+#define MSG_TRUNC 0x20
+#endif
+
+struct ipq_handle
+{
+ struct nfqnl_handle nfqnlh;
+ struct nfqnl_q_handle qh;
+ u_int8_t family;
+ u_int8_t blocking;
+};
+
+struct ipq_handle *ipq_create_handle(u_int32_t flags, u_int32_t protocol);
+
+int ipq_destroy_handle(struct ipq_handle *h);
+
+ssize_t ipq_read(const struct ipq_handle *h,
+ unsigned char *buf, size_t len, int timeout);
+
+int ipq_set_mode(const struct ipq_handle *h, u_int8_t mode, size_t len);
+
+ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf);
+
+int ipq_message_type(const unsigned char *buf);
+
+int ipq_get_msgerr(const unsigned char *buf);
+
+int ipq_set_verdict(const struct ipq_handle *h,
+ ipq_id_t id,
+ unsigned int verdict,
+ size_t data_len,
+ unsigned char *buf);
+
+int ipq_ctl(const struct ipq_handle *h, int request, ...);
+
+char *ipq_errstr(void);
+void ipq_perror(const char *s);
+
+#endif /* _LIBIPQ_H */
+
diff --git a/include/libnfnetlink_queue/libnfnetlink_queue.h b/include/libnfnetlink_queue/libnfnetlink_queue.h
new file mode 100644
index 0000000..1b807a7
--- /dev/null
+++ b/include/libnfnetlink_queue/libnfnetlink_queue.h
@@ -0,0 +1,61 @@
+/* libnfqnetlink.h: Header file for the Netfilter Queue library.
+ *
+ * (C) 2005 by Harald Welte <laforge@gnumonks.org>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#ifndef __LIBCTNETLINK_H
+#define __LIBCTNETLINK_H
+
+#include <linux/netfilter/nfnetlink.h>
+#include <linux/netfilter/nfnetlink_queue.h>
+#include <libnfnetlink.h>
+
+
+#define NFQN
+struct nfqnl_handle
+{
+ struct nfnl_handle nfnlh;
+};
+
+struct nfqnl_q_handle
+{
+ struct nfqnl_handle *h;
+ u_int16_t id;
+};
+
+struct ctnl_msg_handler {
+ int type;
+ int (*handler)(struct sockaddr_nl *, struct nlmsghdr *, void *arg);
+};
+
+struct ctnl_handle {
+ struct nfnl_handle nfnlh;
+ struct ctnl_msg_handler *handler[NFQNL_MSG_MAX];
+};
+
+extern int nfqnl_open(struct nfqnl_handle *h);
+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 int nfqnl_create_queue(struct nfqnl_handle *h,
+ struct nfqnl_q_handle *qh, u_int16_t num);
+extern int nfqnl_destroy_queue(struct nfqnl_q_handle *qh);
+
+extern int nfqnl_set_mode(struct nfqnl_q_handle *qh,
+ u_int8_t mode, unsigned int len);
+
+extern int nfqnl_set_verdict(struct nfqnl_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);
+#endif /* __LIBNFQNETLINK_H */