diff options
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-10-09 15:46:20 +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-10-09 15:46:20 +0000 |
commit | 646df1a88eceeab23750c700847198f2f02b4e69 (patch) | |
tree | 7e1d0618307e6e7d26b3d862fb4236eae8ac50c5 /include/libnetfilter_queue/libipq.h | |
parent | 6ce0d594eeb3aca7928e73930fa0c4c20c9256cb (diff) |
rename libnfnetlink_queue to libnetfilter_queue
Diffstat (limited to 'include/libnetfilter_queue/libipq.h')
-rw-r--r-- | include/libnetfilter_queue/libipq.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/include/libnetfilter_queue/libipq.h b/include/libnetfilter_queue/libipq.h new file mode 100644 index 0000000..06c10c1 --- /dev/null +++ b/include/libnetfilter_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 */ + |