structnflog_g_handle*nflog_bind_group(structnflog_handle*h,uint16_tnum)
nflog_bind_group - bind a new handle to a specific group number.
Parametersh Netfilter log handle obtained via call to nflog_open()num the number of the group to bind to
Returns
an nflog_g_handle for the newly created group or NULL on failure.
ErrorsEBUSY This process has already binded to the group
EOPNOTSUPP Request rejected by kernel. Another process has already binded to the group, or this
process is not running as root
Definition at line 464 of file libnetfilter_log.c.
intnflog_callback_register(structnflog_g_handle*gh,nflog_callback*cb,void*data)
nflog_callback_register - register function to process packets
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group()cb callback function to call for each logged packet
data custom data to pass to the callback function
Returns
0
Definition at line 343 of file libnetfilter_log.c.
intnflog_fd(structnflog_handle*h)
nflog_fd - get the file descriptor associated with the nflog handler
Parametersh handler obtained via call to nflog_open()Returns
a file descriptor for the netlink connection associated with the given log connection handle. The
file descriptor can then be used for receiving the logged packets for processing.
Definition at line 245 of file libnetfilter_log.c.
intnflog_handle_packet(structnflog_handle*h,char*buf,intlen)
nflog_handle_packet - handle a packet received from the nflog subsystem
Parametersh Netfilter log handle obtained via call to nflog_open()buf nflog data received from the kernel
len length of packet data in buffer
Triggers an associated callback for each packet contained in buf. Data can be read from the queue using
nflog_fd() and recv(). See example code in the Detailed Description.
Returns
0 on success, -1 if either the callback returned -ve or buf contains corrupt data. errno is not
reliably set: caller should zeroise first if interested.
Definition at line 366 of file libnetfilter_log.c.
intnflog_set_flags(structnflog_g_handle*gh,uint16_tflags)
nflog_set_flags - set the nflog flags for this group
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group().
flags Flags that you want to set
There are two existing flags:
- NFULNL_CFG_F_SEQ: This enables local nflog sequence numbering.
- NFULNL_CFG_F_SEQ_GLOBAL: This enables global nflog sequence numbering.
- NFULNL_CFG_F_CONNTRACK: This enables to acquire related conntrack.
Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 664 of file libnetfilter_log.c.
intnflog_set_mode(structnflog_g_handle*gh,uint8_tmode,uint32_trange)
nflog_set_mode - set the amount of packet data that nflog copies to userspace
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group().
mode the part of the packet that we are interested in
range size of the packet that we want to get
Sets the amount of data to be copied to userspace for each packet logged to the given group.
• NFULNL_COPY_NONE - do not copy any data
• NFULNL_COPY_META - copy only packet metadata
• NFULNL_COPY_PACKET - copy entire packet
Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 534 of file libnetfilter_log.c.
intnflog_set_nlbufsiz(structnflog_g_handle*gh,uint32_tnlbufsiz)
nflog_set_nlbufsiz - set the size of the nflog buffer for this group
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group().
nlbufsiz Size of the nflog buffer
This function sets the size (in bytes) of the buffer that is used to stack log messages in nflog.
Warning
The use of this function is strongly discouraged. The default buffer size (which is one memory page)
provides the optimum results in terms of performance. Do not use this function in your applications.
Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 627 of file libnetfilter_log.c.
intnflog_set_qthresh(structnflog_g_handle*gh,uint32_tqthresh)
nflog_set_qthresh - set the maximum amount of logs in buffer for this group
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group().
qthresh Maximum number of log entries
This function determines the maximum number of log entries in the buffer until it is pushed to userspace.
Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 596 of file libnetfilter_log.c.
intnflog_set_timeout(structnflog_g_handle*gh,uint32_ttimeout)
nflog_set_timeout - set the maximum time to push log buffer for this group
Parametersgh Netfilter log group handle obtained by call to nflog_bind_group().
timeout Time to wait until the log buffer is pushed to userspace
This function allows one to set the maximum time that nflog waits until it pushes the log buffer to
userspace if no new logged packets have occured. Basically, nflog implements a buffer to reduce the
computational cost of delivering the log message to userspace.
Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 569 of file libnetfilter_log.c.
intnflog_unbind_group(structnflog_g_handle*gh)
nflog_unbind_group - unbind a group handle.
Parametersgh Netfilter log group handle obtained via nflog_bind_group()Returns
0 on success, -1 on failure with errno set.
Errors
from underlying calls, in exceptional circumstances
Definition at line 506 of file libnetfilter_log.c.