1/* Redefine everything for a 64-bit kernel on 32-bit userspace */
2
3/* Based on ip_queue.h by (C) 2000 James Morris, this code is GPL. */
4#ifndef _IP_QUEUE_H
5#define _IP_QUEUE_H
6
7#include <net/if.h>
8#include <sys/types.h>
9
10/* Messages sent from kernel */
11typedef struct ipq_packet_msg {
12	u_int64_t packet_id;	/* ID of queued packet */
13	u_int64_t mark;		/* Netfilter mark value */
14	int64_t timestamp_sec;	/* Packet arrival time (seconds) */
15	int64_t timestamp_usec;	/* Packet arrvial time (+useconds) */
16	unsigned int hook;		/* Netfilter hook we rode in on */
17	char indev_name[IFNAMSIZ];	/* Name of incoming interface */
18	char outdev_name[IFNAMSIZ];	/* Name of outgoing interface */
19	unsigned short hw_protocol;	/* Hardware protocol (network order) */
20	unsigned short hw_type;		/* Hardware type */
21	unsigned char hw_addrlen;	/* Hardware address length */
22	unsigned char hw_addr[8];	/* Hardware address */
23	u_int64_t data_len;		/* Length of packet data */
24	unsigned char payload[0];	/* Optional packet data */
25} ipq_packet_msg_t;
26
27/* Messages sent from userspace */
28typedef struct ipq_mode_msg {
29	unsigned char value;		/* Requested mode */
30	u_int64_t range;		/* Optional range of packet requested */
31} ipq_mode_msg_t;
32
33typedef struct ipq_verdict_msg {
34	unsigned int value;		/* Verdict to hand to netfilter */
35	u_int64_t id;		/* Packet ID for this verdict */
36	u_int64_t data_len;		/* Length of replacement data */
37	unsigned char payload[0];	/* Optional replacement packet */
38} ipq_verdict_msg_t;
39
40typedef struct ipq_peer_msg {
41	union {
42		ipq_verdict_msg_t verdict;
43		ipq_mode_msg_t mode;
44	} msg;
45} ipq_peer_msg_t;
46
47/* Packet delivery modes */
48enum {
49	IPQ_COPY_NONE,		/* Initial mode, packets are dropped */
50	IPQ_COPY_META,		/* Copy metadata */
51	IPQ_COPY_PACKET		/* Copy metadata + packet (range) */
52};
53#define IPQ_COPY_MAX IPQ_COPY_PACKET
54
55/* Types of messages */
56#define IPQM_BASE	0x10	/* standard netlink messages below this */
57#define IPQM_MODE	(IPQM_BASE + 1)		/* Mode request from peer */
58#define IPQM_VERDICT	(IPQM_BASE + 2)		/* Verdict from peer */
59#define IPQM_PACKET	(IPQM_BASE + 3)		/* Packet from kernel */
60#define IPQM_MAX	(IPQM_BASE + 4)
61
62#endif /*_IP_QUEUE_H*/
63