blob: 784027768fbe2c5323d4afce01b9b8c4121c3532 [file] [log] [blame]
James Morris460c7472001-10-16 14:41:02 +00001.TH IPQ_CREATE_HANDLE 3 "16 October 2001" "Linux iptables 1.2" "Linux Programmer's Manual"
James Morris949810c2000-11-20 14:13:31 +00002.\"
James Morrisffe96c52001-11-24 15:09:19 +00003\" $Id: ipq_create_handle.3,v 1.2 2001/10/16 14:41:02 jamesm Exp $
James Morris949810c2000-11-20 14:13:31 +00004.\"
James Morris460c7472001-10-16 14:41:02 +00005.\" Copyright (c) 2000-2001 Netfilter Core Team
James Morris949810c2000-11-20 14:13:31 +00006.\"
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
23ipq_create_handle, ipq_destroy_handle - create and destroy libipq handles.
24.SH SYNOPSIS
25.B #include <linux/netfilter.h>
26.br
27.B #include <libipq.h>
28.sp
James Morrisffe96c52001-11-24 15:09:19 +000029.BI "struct ipq_handle *ipq_create_handle(u_int32_t " flags ", u_int32_t " protocol ");"
James Morris949810c2000-11-20 14:13:31 +000030.br
31.BI "int ipq_destroy_handle(struct ipq_handle *" h );
32.SH DESCRIPTION
33The
34.B ipq_create_handle
35function initialises libipq for an application, attempts to bind to the
36Netlink socket used by ip_queue, and returns an opaque context handle. It
37should be the first libipq function to be called by an application. The
38handle returned should be used in all subsequent library calls which
39require a handle parameter.
40.PP
41The
42.I flags
43parameter is not currently used and should be set to zero by the application
44for forward compatibility.
45.PP
46The
James Morrisffe96c52001-11-24 15:09:19 +000047.I protocol
48parameter is used to specify the protocol of the packets to be queued.
Jan Engelhardt03d99482008-11-18 12:27:54 +010049Valid values are NFPROTO_IPV4 for IPv4 and NFPROTO_IPV6 for IPv6. Currently,
James Morrisffe96c52001-11-24 15:09:19 +000050only one protocol may be queued at a time for a handle.
51.PP
52The
James Morris949810c2000-11-20 14:13:31 +000053.B ipq_destroy_handle
54function frees up resources allocated by
55.BR ipq_create_handle ,
56and should be used when the handle is no longer required by the application.
57.SH RETURN VALUES
58On success,
59.B ipq_create_handle
60returns a pointer to a context handle.
61.br
62On failure, NULL is returned.
63.PP
64On success,
65.B ipq_destroy_handle
66returns zero.
67.br
68On failure, -1 is returned.
69.SH ERRORS
70On failure, a descriptive error message will be available
71via the
72.B ipq_errstr
73function.
74.SH BUGS
75None known.
76.SH AUTHOR
77James Morris <jmorris@intercode.com.au>
78.SH COPYRIGHT
James Morris460c7472001-10-16 14:41:02 +000079Copyright (c) 2000-2001 Netfilter Core Team.
James Morris949810c2000-11-20 14:13:31 +000080.PP
81Distributed under the GNU General Public License.
82.SH SEE ALSO
83.BR iptables (8),
84.BR libipq (3).