1IPQ_MESSAGE_TYPE(3)        Linux Programmer's Manual       IPQ_MESSAGE_TYPE(3)
2
3
4

NAME

6       ipq_message_type, ipq_get_packet, ipq_getmsgerr - query queue messages
7

SYNOPSIS

9       #include <linux/netfilter.h>
10       #include <libipq.h>
11
12       int ipq_message_type(const unsigned char *buf);
13       ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf);
14       int ipq_get_msgerr(const unsigned char *buf);
15

DESCRIPTION

17       The  ipq_message_type  function  returns  the  type  of  queue  message
18       returned to userspace via ipq_read.
19
20       ipq_message_type should always be called following a successful call to
21       ipq_read  to  determine  whether  the message is a packet message or an
22       error message. The buf parameter should be the same data obtained  from
23       the previous call to ipq_read.
24
25       ipq_message_type will return one of the following values:
26
27       NLMSG_ERROR
28              An error message generated by the Netlink transport.
29
30       IPQM_PACKET
31              A  packet message containing packet metadata and optional packet
32              payload data.
33
34       The  ipq_get_packet  function  should  be  called  if  ipq_message_type
35       returns  IPQM_PACKET.   The buf parameter should point to the same data
36       used for  the  call  to  ipq_message_type.   The  pointer  returned  by
37       ipq_get_packet  points  to  a packet message, which is declared as fol‐
38       lows:
39
40              typedef struct ipq_packet_msg {
41                   unsigned long packet_id;        /* ID of queued packet */
42                   unsigned long mark;             /* Netfilter mark value */
43                   long timestamp_sec;             /* Packet arrival time (seconds) */
44                   long timestamp_usec;            /* Packet arrvial time (+useconds) */
45                   unsigned int hook;              /* Netfilter hook we rode in on */
46                   char indev_name[IFNAMSIZ];      /* Name of incoming interface */
47                   char outdev_name[IFNAMSIZ];     /* Name of outgoing interface */
48                   unsigned short hw_protocol;     /* Hardware protocol (network order) */
49                   unsigned short hw_type;         /* Hardware type */
50                   unsigned char hw_addrlen;       /* Hardware address length */
51                   unsigned char hw_addr[8];       /* Hardware address */
52                   size_t data_len;                /* Length of packet data */
53                   unsigned char payload[0];       /* Optional packet data */
54              } ipq_packet_msg_t;
55
56       Each of these fields may be read by the application.  If the queue mode
57       is  IPQ_COPY_PACKET  and  the  data_len value is greater than zero, the
58       packet payload contents may be accessed in  the  memory  following  the
59       ipq_packet_msg_t structure to a range of data_len.
60
61       The  packet_id field contains a packet identifier to be used when call‐
62       ing ipq_set_verdict.
63
64       The  ipq_get_msgerr  function  should  be  called  if  ipq_message_type
65       returns  NLMSG_ERROR.   The buf parameter should point to the same data
66       used  for  the  call  to  ipq_message_type.   The  value  returned   by
67       ipq_get_msgerr  is  set  by higher level kernel code and corresponds to
68       standard errno values.
69

BUGS

71       None known.
72

AUTHOR

74       James Morris <jmorris@intercode.com.au>
75
77       Copyright (c) 2000-2001 Netfilter Core Team.
78
79       Distributed under the GNU General Public License.
80

SEE ALSO

82       iptables(8), libipq(3).
83
84
85
86Linux iptables 1.2              16 October 2001            IPQ_MESSAGE_TYPE(3)
Impressum