netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
libnetfilter_queue.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_queue/libnetfilter_queue.h>
#include "src/internal.h"
Include dependency graph for libnetfilter_queue.c:

Data Structures

struct  nfq_handle
 
struct  nfq_q_handle
 
struct  nfq_data
 

Macros

#define SNPRINTF_FAILURE(ret, rem, offset, len)
 

Functions

 EXPORT_SYMBOL (nfq_errno)
 
struct nfnl_handlenfq_nfnlh (struct nfq_handle *h)
 
 EXPORT_SYMBOL (nfq_nfnlh)
 
int nfq_fd (struct nfq_handle *h)
 nfq_fd - get the file descriptor associated with the nfqueue handler More...
 
 EXPORT_SYMBOL (nfq_fd)
 
struct nfq_handlenfq_open (void)
 nfq_open - open a nfqueue handler More...
 
 EXPORT_SYMBOL (nfq_open)
 
struct nfq_handlenfq_open_nfnl (struct nfnl_handle *nfnlh)
 nfq_open_nfnl - open a nfqueue handler from a existing nfnetlink handler More...
 
 EXPORT_SYMBOL (nfq_open_nfnl)
 
int nfq_close (struct nfq_handle *h)
 nfq_close - close a nfqueue handler More...
 
 EXPORT_SYMBOL (nfq_close)
 
int nfq_bind_pf (struct nfq_handle *h, u_int16_t pf)
 nfq_bind_pf - bind a nfqueue handler to a given protocol family More...
 
 EXPORT_SYMBOL (nfq_bind_pf)
 
int nfq_unbind_pf (struct nfq_handle *h, u_int16_t pf)
 nfq_unbind_pf - unbind nfqueue handler from a protocol family More...
 
 EXPORT_SYMBOL (nfq_unbind_pf)
 
struct nfq_q_handlenfq_create_queue (struct nfq_handle *h, u_int16_t num, nfq_callback *cb, void *data)
 nfq_create_queue - create a new queue handle and return it. More...
 
 EXPORT_SYMBOL (nfq_create_queue)
 
int nfq_destroy_queue (struct nfq_q_handle *qh)
 nfq_destroy_queue - destroy a queue handle More...
 
 EXPORT_SYMBOL (nfq_destroy_queue)
 
int nfq_handle_packet (struct nfq_handle *h, char *buf, int len)
 nfq_handle_packet - handle a packet received from the nfqueue subsystem More...
 
 EXPORT_SYMBOL (nfq_handle_packet)
 
int nfq_set_mode (struct nfq_q_handle *qh, u_int8_t mode, u_int32_t range)
 nfq_set_mode - set the amount of packet data that nfqueue copies to userspace More...
 
 EXPORT_SYMBOL (nfq_set_mode)
 
int nfq_set_queue_flags (struct nfq_q_handle *qh, uint32_t mask, uint32_t flags)
 nfq_set_queue_flags - set flags (options) for the kernel queue More...
 
 EXPORT_SYMBOL (nfq_set_queue_flags)
 
int nfq_set_queue_maxlen (struct nfq_q_handle *qh, u_int32_t queuelen)
 nfq_set_queue_maxlen - Set kernel queue maximum length parameter More...
 
 EXPORT_SYMBOL (nfq_set_queue_maxlen)
 
int nfq_set_verdict (struct nfq_q_handle *qh, u_int32_t id, u_int32_t verdict, u_int32_t data_len, const unsigned char *buf)
 nfq_set_verdict - issue a verdict on a packet More...
 
 EXPORT_SYMBOL (nfq_set_verdict)
 
int nfq_set_verdict2 (struct nfq_q_handle *qh, u_int32_t id, u_int32_t verdict, u_int32_t mark, u_int32_t data_len, const unsigned char *buf)
 nfq_set_verdict2 - like nfq_set_verdict, but you can set the mark. More...
 
 EXPORT_SYMBOL (nfq_set_verdict2)
 
int nfq_set_verdict_batch (struct nfq_q_handle *qh, u_int32_t id, u_int32_t verdict)
 nfq_set_verdict_batch - issue verdicts on several packets at once More...
 
 EXPORT_SYMBOL (nfq_set_verdict_batch)
 
int nfq_set_verdict_batch2 (struct nfq_q_handle *qh, u_int32_t id, u_int32_t verdict, u_int32_t mark)
 nfq_set_verdict_batch2 - like nfq_set_verdict_batch, but you can set a mark. More...
 
 EXPORT_SYMBOL (nfq_set_verdict_batch2)
 
int nfq_set_verdict_mark (struct nfq_q_handle *qh, u_int32_t id, u_int32_t verdict, u_int32_t mark, u_int32_t data_len, const unsigned char *buf)
 nfq_set_verdict_mark - like nfq_set_verdict, but you can set the mark. More...
 
 EXPORT_SYMBOL (nfq_set_verdict_mark)
 
struct nfqnl_msg_packet_hdrnfq_get_msg_packet_hdr (struct nfq_data *nfad)
 nfqnl_msg_packet_hdr - return the metaheader that wraps the packet More...
 
 EXPORT_SYMBOL (nfq_get_msg_packet_hdr)
 
uint32_t nfq_get_nfmark (struct nfq_data *nfad)
 nfq_get_nfmark - get the packet mark More...
 
 EXPORT_SYMBOL (nfq_get_nfmark)
 
int nfq_get_timestamp (struct nfq_data *nfad, struct timeval *tv)
 nfq_get_timestamp - get the packet timestamp More...
 
 EXPORT_SYMBOL (nfq_get_timestamp)
 
u_int32_t nfq_get_indev (struct nfq_data *nfad)
 nfq_get_indev - get the interface that the packet was received through More...
 
 EXPORT_SYMBOL (nfq_get_indev)
 
u_int32_t nfq_get_physindev (struct nfq_data *nfad)
 nfq_get_physindev - get the physical interface that the packet was received More...
 
 EXPORT_SYMBOL (nfq_get_physindev)
 
u_int32_t nfq_get_outdev (struct nfq_data *nfad)
 nfq_get_outdev - gets the interface that the packet will be routed out More...
 
 EXPORT_SYMBOL (nfq_get_outdev)
 
u_int32_t nfq_get_physoutdev (struct nfq_data *nfad)
 nfq_get_physoutdev - get the physical interface that the packet output More...
 
 EXPORT_SYMBOL (nfq_get_physoutdev)
 
int nfq_get_indev_name (struct nlif_handle *nlif_handle, struct nfq_data *nfad, char *name)
 nfq_get_indev_name - get the name of the interface the packet was received through More...
 
 EXPORT_SYMBOL (nfq_get_indev_name)
 
int nfq_get_physindev_name (struct nlif_handle *nlif_handle, struct nfq_data *nfad, char *name)
 nfq_get_physindev_name - get the name of the physical interface the packet was received through More...
 
 EXPORT_SYMBOL (nfq_get_physindev_name)
 
int nfq_get_outdev_name (struct nlif_handle *nlif_handle, struct nfq_data *nfad, char *name)
 nfq_get_outdev_name - get the name of the physical interface the packet will be sent to More...
 
 EXPORT_SYMBOL (nfq_get_outdev_name)
 
int nfq_get_physoutdev_name (struct nlif_handle *nlif_handle, struct nfq_data *nfad, char *name)
 nfq_get_physoutdev_name - get the name of the interface the packet will be sent to More...
 
 EXPORT_SYMBOL (nfq_get_physoutdev_name)
 
struct nfqnl_msg_packet_hwnfq_get_packet_hw (struct nfq_data *nfad)
 nfq_get_packet_hw More...
 
 EXPORT_SYMBOL (nfq_get_packet_hw)
 
int nfq_get_uid (struct nfq_data *nfad, u_int32_t *uid)
 nfq_get_uid - get the UID of the user the packet belongs to More...
 
 EXPORT_SYMBOL (nfq_get_uid)
 
int nfq_get_gid (struct nfq_data *nfad, u_int32_t *gid)
 nfq_get_gid - get the GID of the user the packet belongs to More...
 
 EXPORT_SYMBOL (nfq_get_gid)
 
int nfq_get_payload (struct nfq_data *nfad, unsigned char **data)
 nfq_get_payload - get payload More...
 
 EXPORT_SYMBOL (nfq_get_payload)
 
int nfq_snprintf_xml (char *buf, size_t rem, struct nfq_data *tb, int flags)
 nfq_snprintf_xml - print the enqueued packet in XML format into a buffer More...
 
 EXPORT_SYMBOL (nfq_snprintf_xml)
 

Variables

int nfq_errno
 

Macro Definition Documentation

#define SNPRINTF_FAILURE (   ret,
  rem,
  offset,
  len 
)
Value:
do { \
if (ret < 0) \
return ret; \
len += ret; \
if (ret > rem) \
ret = rem; \
offset += ret; \
rem -= ret; \
} while (0)
int len
Definition: utils.c:56

Referenced by nfq_snprintf_xml().

Function Documentation

EXPORT_SYMBOL ( nfq_errno  )
EXPORT_SYMBOL ( nfq_nfnlh  )
EXPORT_SYMBOL ( nfq_open_nfnl  )
struct nfnl_handle* nfq_nfnlh ( struct nfq_handle h)

References nfq_handle::nfnlh.

Referenced by nfq_fd().

Here is the caller graph for this function:

struct nfq_handle* nfq_open_nfnl ( struct nfnl_handle nfnlh)

nfq_open_nfnl - open a nfqueue handler from a existing nfnetlink handler

Parameters
nfnlhNetfilter netlink connection handle obtained by calling nfnl_open()

This function obtains a netfilter queue connection handle using an existing netlink connection. This function is used internally to implement nfq_open(), and should typically not be called directly.

Returns
a pointer to a new queue handle or NULL on failure.

References nfnl_callback::data, nfnl_callback_register(), nfnl_subsys_close(), nfnl_subsys_open(), NFNL_SUBSYS_QUEUE, nfq_handle::nfnlh, nfq_handle::nfnlssh, nfq_errno, NFQNL_MSG_MAX, NFQNL_MSG_PACKET, and NULL.

Referenced by nfq_open().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int nfq_errno

Referenced by nfq_create_queue(), and nfq_open_nfnl().