This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference.
Documentation by Gregor Maier <gregor@majordomus.org>, with a lot of stuff taken from Brad Fisher's <brad@info-link.net> libnetfilter_queue documentation.
Typedefs | |
typedef int | nflog_callback (struct nflog_g_handle *gh, struct nfgenmsg *nfmsg, struct nflog_data *nfad, void *data) |
Callback prototype. | |
Functions | |
nfnl_handle * | nflog_nfnlh (struct nflog_handle *h) |
Returns the netfilter netlink handle used by h. | |
nflog_handle * | nflog_open (void) |
Obtains netfilter log connection handle. | |
nflog_handle * | nflog_open_nfnl (struct nfnl_handle *nfnlh) |
Obtains netfilter log connection handle. | |
int | nflog_close (struct nflog_handle *h) |
Close netfilter log connection. | |
int | nflog_bind_pf (struct nflog_handle *h, u_int16_t pf) |
Binds the netfilter_log kernel logging backend to PF. | |
int | nflog_unbind_pf (struct nflog_handle *h, u_int16_t pf) |
Unbinds the netfilter_log kernel logging backend from PF. (Dangerous). | |
nflog_g_handle * | nflog_bind_group (struct nflog_handle *h, u_int16_t num) |
Bind the connection handle to a loggroup. | |
int | nflog_unbind_group (struct nflog_g_handle *gh) |
Unbind and free a group handle. | |
int | nflog_set_mode (struct nflog_g_handle *gh, u_int8_t mode, unsigned int len) |
Sets the amount of data copied to userspace for each packet. | |
int | nflog_set_timeout (struct nflog_g_handle *gh, u_int32_t timeout) |
Set flush timeout. | |
int | nflog_set_flags (struct nflog_g_handle *gh, u_int16_t flags) |
UNUSED. | |
int | nflog_set_qthresh (struct nflog_g_handle *gh, u_int32_t qthresh) |
Set transmit threshold. | |
int | nflog_set_nlbufsiz (struct nflog_g_handle *gh, u_int32_t nlbufsiz) |
Set the kernel buffer size. | |
int | nflog_callback_register (struct nflog_g_handle *gh, nflog_callback *cb, void *data) |
Register callback function that receives packets. | |
int | nflog_fd (struct nflog_handle *h) |
Return fd associated with netfilter log handle. | |
int | nflog_handle_packet (struct nflog_handle *h, char *buf, int len) |
Handle packet(s) received from kernel. | |
nfulnl_msg_packet_hdr * | nflog_get_msg_packet_hdr (struct nflog_data *nfad) |
Returns netfilter log packet header. | |
u_int32_t | nflog_get_nfmark (struct nflog_data *nfad) |
Returns netfilter mark currently assigned to the packet. | |
int | nflog_get_timestamp (struct nflog_data *nfad, struct timeval *tv) |
Returns the timestamp of the packet. | |
u_int32_t | nflog_get_indev (struct nflog_data *nfad) |
Return ingresss interface index. | |
u_int32_t | nflog_get_physindev (struct nflog_data *nfad) |
Return physical ingresss interface index. | |
u_int32_t | nflog_get_outdev (struct nflog_data *nfad) |
Return egress interface index. | |
u_int32_t | nflog_get_physoutdev (struct nflog_data *nfad) |
Return physical egress interface index. | |
nfulnl_msg_packet_hw * | nflog_get_packet_hw (struct nflog_data *nfad) |
Returns hardware addresss of the packet. | |
int | nflog_get_payload (struct nflog_data *nfad, char **data) |
Retrieve packet payload. | |
char * | nflog_get_prefix (struct nflog_data *nfad) |
Return log prefix. | |
int | nflog_get_uid (struct nflog_data *nfad, u_int32_t *uid) |
Return uid of packet "owner". | |
int | nflog_get_seq (struct nflog_data *nfad, u_int32_t *seq) |
UNUSED. | |
int | nflog_get_seq_global (struct nflog_data *nfad, u_int32_t *seq) |
UNUSED. | |
Variables | |
int | nflog_errno |
|
Callback prototype. nflog_callback function pointeres are registered with libnetfilter_log to handle received packets. The callback function is called for each received packet.
|
|
Returns the netfilter netlink handle used by h.
|
|
Obtains netfilter log connection handle. Obtains netfilter log connection handle. When you are finished with the handle, you should destroy it by calling nflog_close(). A new netlink connection is obtained internally and associated with the queue connection handle returned.
|
|
Obtains netfilter log connection handle. Obtains netfilter log connection handle using an existing netlink connection. This function is used internally to implement nflog_open(), and should typically not be called directly.
|
|
Close netfilter log connection. Close a netfilter log connection associated with the connection handle and free resources.
|
|
Binds the netfilter_log kernel logging backend to PF. Binds the netfilter_log kernel logging bind to the specified protocol family (like PF_INET).
|
|
Unbinds the netfilter_log kernel logging backend from PF. (Dangerous). Unbinds the netfilter_log kernel logging backend from PF. (Dangerous). Calling this function may break other programs using libnetfilter_log. You should not use it! Not to unbind the logger is safe!
|
|
Bind the connection handle to a loggroup. Bind the connection handle to a loggroup. This call returns a group handle, which is usesd for later calls and for identifying the loggroup.
|
|
Unbind and free a group handle. Unbinds the specified group handle from its loggroup. The gh is freed by this call.
|
|
Sets the amount of data copied to userspace for each packet. Sets the amount of data copied to userspace for each packet.
|
|
Set flush timeout. Time before flushing queued packets from kernel to userspace. This prevents packets from never being flushed to userspace if qthreshhold is not request. Packets are either flushed to userspace when the timeout expires or when qthreshold packets are queued. (See nflog_set_qthresh()).
|
|
Set transmit threshold. Number of packet to queue inside kernel. Setting this value to, e.g. 10 accumulates ten packets inside the kernel and transmits them as one netlink multipart message to userspace. Default is 1 (for backwards compatibility). See also nflog_set_timeout().
|
|
Set the kernel buffer size. Set the size of the kernel buffer that are used to packets before they are trasnmitted to userspace. Please note that the netlink message headers are also included, so you have to add this margin to the payload size you want to queue. ???
|
|
Register callback function that receives packets. Register a callback function that receives packets for the given group. This callback will be called for each packet logged to userspace.
|
|
Return fd associated with netfilter log handle. Returns the filedescriptor associated with the netfilter log handle. This fd is used to received logged packets from the kernel using recv(2). The data received from recv is then passed ti nflog_handle_packet()
|
|
Handle packet(s) received from kernel. Packets that have been received from the kernel with recv(2) are handed to nflog_handle_packet(), which will trigger the associated callback functions (see nflog_callback_register()).
|
|
Returns netfilter log packet header. Returns netfilter log packet header for the given nflog_data argument. This function is intended to be called from the callback.
|
|
Returns netfilter mark currently assigned to the packet.
|
|
Returns the timestamp of the packet.
|
|
Return ingresss interface index.
|
|
Return physical ingresss interface index.
|
|
Return egress interface index.
|
|
Return physical egress interface index.
|
|
Returns hardware addresss of the packet. Retrieves the hardware address associated with the given queued packet. For ethernet packets, the hardware address returned (if any) will be the MAC address of the packet source host. Empty for packets generated on the local machine
|
|
Retrieve packet payload. Retrieve the packet data of logged packet, starting with the Layer 3 header (e.g. IP or IPv6). The actual amount of data available depends on the copy mode specified by nflog_set_mode().
|
|
Return log prefix.
|
|
Return uid of packet "owner".
|