Blame libipq/ipq_create_handle.3

Packit 7b22a4
.TH IPQ_CREATE_HANDLE 3 "16 October 2001" "Linux iptables 1.2" "Linux Programmer's Manual" 
Packit 7b22a4
.\"
Packit 7b22a4
.\"     Copyright (c) 2000-2001 Netfilter Core Team
Packit 7b22a4
.\"
Packit 7b22a4
.\"     This program is free software; you can redistribute it and/or modify
Packit 7b22a4
.\"     it under the terms of the GNU General Public License as published by
Packit 7b22a4
.\"     the Free Software Foundation; either version 2 of the License, or
Packit 7b22a4
.\"     (at your option) any later version.
Packit 7b22a4
.\"
Packit 7b22a4
.\"     This program is distributed in the hope that it will be useful,
Packit 7b22a4
.\"     but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7b22a4
.\"     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7b22a4
.\"     GNU General Public License for more details.
Packit 7b22a4
.\"
Packit 7b22a4
.\"     You should have received a copy of the GNU General Public License
Packit 7b22a4
.\"     along with this program; if not, write to the Free Software
Packit 7b22a4
.\"     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit 7b22a4
.\"
Packit 7b22a4
.\"
Packit 7b22a4
.SH NAME
Packit 7b22a4
ipq_create_handle, ipq_destroy_handle \(em create and destroy libipq handles.
Packit 7b22a4
.SH SYNOPSIS
Packit 7b22a4
.B #include <linux/netfilter.h>
Packit 7b22a4
.br
Packit 7b22a4
.B #include <libipq.h>
Packit 7b22a4
.sp
Packit 7b22a4
.BI "struct ipq_handle *ipq_create_handle(u_int32_t " flags ", u_int32_t " protocol ");"
Packit 7b22a4
.br
Packit 7b22a4
.BI "int ipq_destroy_handle(struct ipq_handle *" h );
Packit 7b22a4
.SH DESCRIPTION
Packit 7b22a4
The
Packit 7b22a4
.B ipq_create_handle
Packit 7b22a4
function initialises libipq for an application, attempts to bind to the
Packit 7b22a4
Netlink socket used by ip_queue, and returns an opaque context handle.  It
Packit 7b22a4
should be the first libipq function to be called by an application.  The
Packit 7b22a4
handle returned should be used in all subsequent library calls which 
Packit 7b22a4
require a handle parameter.
Packit 7b22a4
.PP
Packit 7b22a4
The
Packit 7b22a4
.I flags
Packit 7b22a4
parameter is not currently used and should be set to zero by the application
Packit 7b22a4
for forward compatibility.
Packit 7b22a4
.PP
Packit 7b22a4
The
Packit 7b22a4
.I protocol
Packit 7b22a4
parameter is used to specify the protocol of the packets to be queued.
Packit 7b22a4
Valid values are NFPROTO_IPV4 for IPv4 and NFPROTO_IPV6 for IPv6. Currently,
Packit 7b22a4
only one protocol may be queued at a time for a handle.
Packit 7b22a4
.PP
Packit 7b22a4
The
Packit 7b22a4
.B ipq_destroy_handle
Packit 7b22a4
function frees up resources allocated by
Packit 7b22a4
.BR ipq_create_handle ,
Packit 7b22a4
and should be used when the handle is no longer required by the application.
Packit 7b22a4
.SH RETURN VALUES
Packit 7b22a4
On success,
Packit 7b22a4
.B ipq_create_handle
Packit 7b22a4
returns a pointer to a context handle.
Packit 7b22a4
.br
Packit 7b22a4
On failure, NULL is returned.
Packit 7b22a4
.PP
Packit 7b22a4
On success,
Packit 7b22a4
.B ipq_destroy_handle
Packit 7b22a4
returns zero.
Packit 7b22a4
.br
Packit 7b22a4
On failure, \-1 is returned.
Packit 7b22a4
.SH ERRORS
Packit 7b22a4
On failure, a descriptive error message will be available
Packit 7b22a4
via the
Packit 7b22a4
.B ipq_errstr
Packit 7b22a4
function.
Packit 7b22a4
.SH BUGS
Packit 7b22a4
None known.
Packit 7b22a4
.SH AUTHOR
Packit 7b22a4
James Morris <jmorris@intercode.com.au>
Packit 7b22a4
.SH COPYRIGHT
Packit 7b22a4
Copyright (c) 2000-2001 Netfilter Core Team.
Packit 7b22a4
.PP
Packit 7b22a4
Distributed under the GNU General Public License.
Packit 7b22a4
.SH SEE ALSO
Packit 7b22a4
.BR iptables (8),
Packit 7b22a4
.BR libipq (3).