Copyright (c) 2000-2001 Netfilter Core Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <libipq.h> "ssize_t ipq_read(const struct ipq_handle *" h ", unsigned char *" buf ", size_t " len ", int " timeout ");"
The h parameter is a context handle which must previously have been returned successfully from a call to ipq_create_handle .
The caller is responsible for ensuring that the memory pointed to by buf is large enough to contain len bytes.
The timeout parameter may be used to set a timeout for the operation, specified in microseconds. This is implemented internally by the library via the select system call. A value of zero provides normal, backwards-compatible blocking behaviour with no timeout. A negative value causes the function to return immediately.
Data returned via buf should not be accessed directly. Use the ipq_message_type , ipq_get_packet ", and" ipq_get_msgerr functions to access the queue message in the buffer.
On success, a non-zero positive value is returned when no timeout value is specified.
On success with a timeout value specified, zero is returned if no data was available to read, or if a non-blocked signal was caught. In the latter case, the global errno value will be set to EINTR .
Distributed under the GNU General Public License.