James Morris | 949810c | 2000-11-20 14:13:31 +0000 | [diff] [blame^] | 1 | .TH IPQ_READ 3 "18 November 2000" "Linux iptables 1.1.3+" "Linux Programmer's Manual" |
| 2 | .\" |
| 3 | .\" $Id: $ |
| 4 | .\" |
| 5 | .\" Copyright (c) 2000 Netfilter Core Team |
| 6 | .\" |
| 7 | .\" This program is free software; you can redistribute it and/or modify |
| 8 | .\" it under the terms of the GNU General Public License as published by |
| 9 | .\" the Free Software Foundation; either version 2 of the License, or |
| 10 | .\" (at your option) any later version. |
| 11 | .\" |
| 12 | .\" This program is distributed in the hope that it will be useful, |
| 13 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | .\" GNU General Public License for more details. |
| 16 | .\" |
| 17 | .\" You should have received a copy of the GNU General Public License |
| 18 | .\" along with this program; if not, write to the Free Software |
| 19 | .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | .\" |
| 21 | .\" |
| 22 | .SH NAME |
| 23 | ipq_read - wait for queue messages from ip_queue and read into supplied buffer |
| 24 | .SH SYNOPSIS |
| 25 | .B #include <linux/netfilter.h> |
| 26 | .br |
| 27 | .B #include <libipq.h> |
| 28 | .sp |
| 29 | .BI "ssize_t ipq_read(const struct ipq_handle *" h ", unsigned char *" buf ", size_t " len ", int " timeout ");" |
| 30 | .SH DESCRIPTION |
| 31 | The |
| 32 | .B ipq_read |
| 33 | function waits for a queue message to arrive from the kernel and copies it to |
| 34 | the memory pointed to by |
| 35 | .I buf |
| 36 | to a maximum length of |
| 37 | . I len . |
| 38 | .PP |
| 39 | The |
| 40 | .I h |
| 41 | parameter is a context handle which must previously have been returned |
| 42 | successfully from a call to |
| 43 | .B ipq_create_handle . |
| 44 | .PP |
| 45 | The caller is responsible for ensuring that the memory pointed to by |
| 46 | .I buf |
| 47 | is large enough to contain |
| 48 | .I len |
| 49 | bytes. |
| 50 | .PP |
| 51 | The |
| 52 | .I timeout |
| 53 | parameter is not currently implemented. |
| 54 | .PP |
| 55 | Data returned via |
| 56 | .I buf |
| 57 | should not be accessed directly. Use the |
| 58 | .BR ipq_message_type , |
| 59 | .BR ipq_get_packet ", and" |
| 60 | .BR ipq_get_msgerr |
| 61 | functions to access the queue message in the buffer. |
| 62 | .SH RETURN VALUE |
| 63 | On failure, -1 is returned. |
| 64 | .br |
| 65 | On success, a non-zero positive value is returned. |
| 66 | .SH ERRORS |
| 67 | On error, a descriptive error message will be available |
| 68 | via the |
| 69 | .B ipq_errstr |
| 70 | function. |
| 71 | .SH DIAGNOSTICS |
| 72 | While the |
| 73 | .B ipq_read |
| 74 | function may return successfully, the queue message copied to the buffer |
| 75 | may itself be an error message from a higher level kernel component. Use |
| 76 | .B ipq_message_type |
| 77 | to determine if it is an error message, and |
| 78 | .B ipq_get_msgerr |
| 79 | to access the value of the message. |
| 80 | .SH TODO |
| 81 | Implement |
| 82 | .I timeout |
| 83 | as part of a non-blocking interface. |
| 84 | .SH BUGS |
| 85 | None known. |
| 86 | .SH AUTHOR |
| 87 | James Morris <jmorris@intercode.com.au> |
| 88 | .SH COPYRIGHT |
| 89 | Copyright (c) 2000 Netfilter Core Team. |
| 90 | .PP |
| 91 | Distributed under the GNU General Public License. |
| 92 | .SH SEE ALSO |
| 93 | .BR iptables (8), |
| 94 | .BR libipq (3). |
| 95 | |