1IPQ_READ(3) Linux Programmer's Manual IPQ_READ(3)
2
3
4
6 ipq_read — read queue messages from ip_queue and read into supplied
7 buffer
8
10 #include <linux/netfilter.h>
11 #include <libipq.h>
12
13 ssize_t ipq_read(const struct ipq_handle *h, unsigned char *buf, size_t
14 len, int timeout);
15
17 The ipq_read function reads a queue message from the kernel and copies
18 it to the memory pointed to by buf to a maximum length of len.
19
20 The h parameter is a context handle which must previously have been
21 returned successfully from a call to ipq_create_handle.
22
23 The caller is responsible for ensuring that the memory pointed to by
24 buf is large enough to contain len bytes.
25
26 The timeout parameter may be used to set a timeout for the operation,
27 specified in microseconds. This is implemented internally by the
28 library via the select system call. A value of zero provides normal,
29 backwards-compatible blocking behaviour with no timeout. A negative
30 value causes the function to return immediately.
31
32 Data returned via buf should not be accessed directly. Use the
33 ipq_message_type, ipq_get_packet, and ipq_get_msgerr functions to
34 access the queue message in the buffer.
35
37 On failure, -1 is returned.
38 On success, a non-zero positive value is returned when no timeout value
39 is specified.
40 On success with a timeout value specified, zero is returned if no data
41 was available to read, or if a non-blocked signal was caught. In the
42 latter case, the global errno value will be set to EINTR.
43
45 On error, a descriptive error message will be available via the
46 ipq_errstr function.
47
49 While the ipq_read function may return successfully, the queue message
50 copied to the buffer may itself be an error message from a higher level
51 kernel component. Use ipq_message_type to determine if it is an error
52 message, and ipq_get_msgerr to access the value of the message.
53
55 None known.
56
58 James Morris <jmorris@intercode.com.au>
59
61 Copyright (c) 2000-2001 Netfilter Core Team.
62
63 Distributed under the GNU General Public License.
64
66 Joost Remijn implemented the timeout feature, which appeared in the
67 1.2.4 release of iptables.
68
70 iptables(8), libipq(3), select(2).
71
72
73
74
75Linux iptables 1.2 16 October 2001 IPQ_READ(3)