.TH "LibrarySetup" 3 "Thu Jan 28 2021" "Version 1.0.5" "libnetfilter_queue" \" -*- nroff -*- .ad l .nh .SH NAME LibrarySetup \- Library setup [DEPRECATED] .SH SYNOPSIS .br .PP .SS "Functions" .in +1c .ti -1c .RI "struct nfq_handle * \fBnfq_open\fP (void)" .br .ti -1c .RI "int \fBnfq_close\fP (struct nfq_handle *h)" .br .ti -1c .RI "int \fBnfq_bind_pf\fP (struct nfq_handle *h, uint16_t pf)" .br .ti -1c .RI "int \fBnfq_unbind_pf\fP (struct nfq_handle *h, uint16_t pf)" .br .in -1c .SH "Detailed Description" .PP Library initialisation is made in two steps\&. .PP First step is to call \fBnfq_open()\fP to open a NFQUEUE handler\&. .PP Second step is to tell the kernel that userspace queueing is handle by NFQUEUE for the selected protocol\&. This is made by calling \fBnfq_unbind_pf()\fP and \fBnfq_bind_pf()\fP with protocol information\&. The idea behind this is to enable simultaneously loaded modules to be used for queuing\&. .PP Here's a little code snippet that bind with AF_INET: .PP .nf h = nfq_open(); if (!h) { fprintf(stderr, "error during nfq_open()\n"); exit(1); } printf("unbinding existing nf_queue handler for AF_INET (if any)\n"); if (nfq_unbind_pf(h, AF_INET) < 0) { fprintf(stderr, "error during nfq_unbind_pf()\n"); exit(1); } printf("binding nfnetlink_queue as nf_queue handler for AF_INET\n"); if (nfq_bind_pf(h, AF_INET) < 0) { fprintf(stderr, "error during nfq_bind_pf()\n"); exit(1); } .fi .PP Once this is done, you can setup and use a \fBQueue\fP\&. .PP When the program has finished with libnetfilter_queue, it has to call the \fBnfq_close()\fP function to free all associated resources\&. .SH "Function Documentation" .PP .SS "int nfq_bind_pf (struct nfq_handle * h, uint16_t pf)" nfq_bind_pf - bind a nfqueue handler to a given protocol family .PP \fBParameters\fP .RS 4 \fIh\fP Netfilter queue connection handle obtained via call to \fBnfq_open()\fP .br \fIpf\fP protocol family to bind to nfqueue handler obtained from \fBnfq_open()\fP .RE .PP Binds the given queue connection handle to process packets belonging to the given protocol family (ie\&. PF_INET, PF_INET6, etc)\&. This call is obsolete, Linux kernels from 3\&.8 onwards ignore it\&. .PP \fBReturns\fP .RS 4 integer inferior to 0 in case of failure .RE .PP .PP Definition at line 474 of file libnetfilter_queue\&.c\&. .SS "int nfq_close (struct nfq_handle * h)" nfq_close - close a nfqueue handler .PP \fBParameters\fP .RS 4 \fIh\fP Netfilter queue connection handle obtained via call to \fBnfq_open()\fP .RE .PP This function closes the nfqueue handler and free associated resources\&. .PP \fBReturns\fP .RS 4 0 on success, non-zero on failure\&. .RE .PP .PP Definition at line 452 of file libnetfilter_queue\&.c\&. .SS "struct nfq_handle* nfq_open (void)" nfq_open - open a nfqueue handler .PP This function obtains a netfilter queue connection handle\&. When you are finished with the handle returned by this function, you should destroy it by calling \fBnfq_close()\fP\&. A new netlink connection is obtained internally and associated with the queue connection handle returned\&. .PP \fBReturns\fP .RS 4 a pointer to a new queue handle or NULL on failure\&. .RE .PP .PP Definition at line 363 of file libnetfilter_queue\&.c\&. .SS "int nfq_unbind_pf (struct nfq_handle * h, uint16_t pf)" nfq_unbind_pf - unbind nfqueue handler from a protocol family .PP \fBParameters\fP .RS 4 \fIh\fP Netfilter queue connection handle obtained via call to \fBnfq_open()\fP .br \fIpf\fP protocol family to unbind family from .RE .PP Unbinds the given queue connection handle from processing packets belonging to the given protocol family\&. .PP This call is obsolete, Linux kernels from 3\&.8 onwards ignore it\&. .PP Definition at line 490 of file libnetfilter_queue\&.c\&. .SH "Author" .PP Generated automatically by Doxygen for libnetfilter_queue from the source code\&.