IPQ\_CREATE\_HANDLE(3) Linux Programmer's Manual IPQ\_CREATE\_HANDLE(3)

# [NAME](#NAME)

ipq\_create\_handle, ipq\_destroy\_handle — create and destroy libipq handles.

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;linux/netfilter.h&gt;**  
**#include &lt;libipq.h&gt;**

**struct ipq\_handle \*ipq\_create\_handle(uint32\_t flags, uint32\_t protocol);**  
**int ipq\_destroy\_handle(struct ipq\_handle \*h);**

# [DESCRIPTION](#DESCRIPTION)

The **ipq\_create\_handle** function initialises libipq for an application, attempts to bind to the Netlink socket used by ip\_queue, and returns an opaque context handle. It should be the first libipq function to be called by an application. The handle returned should be used in all subsequent library calls which require a handle parameter.

The *flags* parameter is not currently used and should be set to zero by the application for forward compatibility.

The *protocol* parameter is used to specify the protocol of the packets to be queued. Valid values are NFPROTO\_IPV4 for IPv4 and NFPROTO\_IPV6 for IPv6. Currently, only one protocol may be queued at a time for a handle.

The **ipq\_destroy\_handle** function frees up resources allocated by **ipq\_create\_handle**, and should be used when the handle is no longer required by the application.

# [RETURN VALUES](#RETURN_VALUES)

On success, **ipq\_create\_handle** returns a pointer to a context handle.  
On failure, NULL is returned.

On success, **ipq\_destroy\_handle** returns zero.  
On failure, -1 is returned.

# [ERRORS](#ERRORS)

On failure, a descriptive error message will be available via the **ipq\_errstr** function.

# [BUGS](#BUGS)

None known.

# [AUTHOR](#AUTHOR)

James Morris &lt;jmorris@intercode.com.au&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright (c) 2000-2001 Netfilter Core Team.

Distributed under the GNU General Public License.

# [SEE ALSO](#SEE_ALSO)

[**iptables**(8)](/man/os/iptables/iptables.8), [**libipq**(3)](/man/os/iptables/libipq.3).

16 October 2001 Linux iptables 1.2

---

Document: ipq_destroy_handle(3) from iptables 1.8.13-r4 (Chainguard OS)
Source: https://git.netfilter.org/iptables/
