Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / netfilter_ipv4 / ip_queue.h
blobaa08d68c4841ebdf265a99494bc9a88933f5d815
1 /*
2 * This is a module which is used for queueing IPv4 packets and
3 * communicating with userspace via netlink.
5 * (C) 2000 James Morris, this code is GPL.
6 */
7 #ifndef _IP_QUEUE_H
8 #define _IP_QUEUE_H
10 #ifdef __KERNEL__
11 #ifdef DEBUG_IPQ
12 #define QDEBUG(x...) printk(KERN_DEBUG ## x)
13 #else
14 #define QDEBUG(x...)
15 #endif /* DEBUG_IPQ */
16 #else
17 #include <net/if.h>
18 #endif /* ! __KERNEL__ */
20 /* Messages sent from kernel */
21 typedef struct ipq_packet_msg {
22 unsigned long packet_id; /* ID of queued packet */
23 unsigned long mark; /* Netfilter mark value */
24 long timestamp_sec; /* Packet arrival time (seconds) */
25 long timestamp_usec; /* Packet arrvial time (+useconds) */
26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 unsigned short hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */
33 size_t data_len; /* Length of packet data */
34 unsigned char payload[0]; /* Optional packet data */
35 } ipq_packet_msg_t;
37 /* Messages sent from userspace */
38 typedef struct ipq_mode_msg {
39 unsigned char value; /* Requested mode */
40 size_t range; /* Optional range of packet requested */
41 } ipq_mode_msg_t;
43 typedef struct ipq_verdict_msg {
44 unsigned int value; /* Verdict to hand to netfilter */
45 unsigned long id; /* Packet ID for this verdict */
46 size_t data_len; /* Length of replacement data */
47 unsigned char payload[0]; /* Optional replacement packet */
48 } ipq_verdict_msg_t;
50 typedef struct ipq_peer_msg {
51 union {
52 ipq_verdict_msg_t verdict;
53 ipq_mode_msg_t mode;
54 } msg;
55 } ipq_peer_msg_t;
57 /* Packet delivery modes */
58 enum {
59 IPQ_COPY_NONE, /* Initial mode, packets are dropped */
60 IPQ_COPY_META, /* Copy metadata */
61 IPQ_COPY_PACKET /* Copy metadata + packet (range) */
63 #define IPQ_COPY_MAX IPQ_COPY_PACKET
65 /* Types of messages */
66 #define IPQM_BASE 0x10 /* standard netlink messages below this */
67 #define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */
68 #define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */
69 #define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */
70 #define IPQM_MAX (IPQM_BASE + 4)
72 #endif /*_IP_QUEUE_H*/