netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
libnetfilter_log.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 <libnetfilter_log/linux_nfnetlink_log.h>
#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_log/libnetfilter_log.h>
Include dependency graph for libnetfilter_log.c:

Data Structures

struct  nflog_handle
 
struct  nflog_g_handle
 
struct  nflog_data
 

Macros

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

Functions

struct nfnl_handlenflog_nfnlh (struct nflog_handle *h)
 
int nflog_fd (struct nflog_handle *h)
 nflog_fd - get the file descriptor associated with the nflog handler More...
 
struct nflog_handlenflog_open_nfnl (struct nfnl_handle *nfnlh)
 
struct nflog_handlenflog_open (void)
 nflog_open - open a nflog handler More...
 
int nflog_callback_register (struct nflog_g_handle *gh, nflog_callback *cb, void *data)
 
int nflog_handle_packet (struct nflog_handle *h, char *buf, int len)
 
int nflog_close (struct nflog_handle *h)
 nflog_close - close a nflog handler More...
 
int nflog_bind_pf (struct nflog_handle *h, u_int16_t pf)
 nflog_bind_pf - bind a nflog handler to a given protocol family More...
 
int nflog_unbind_pf (struct nflog_handle *h, u_int16_t pf)
 nflog_unbind_pf - unbind nflog handler from a protocol family More...
 
struct nflog_g_handlenflog_bind_group (struct nflog_handle *h, u_int16_t num)
 nflog_bind_group - bind a new handle to a specific group number. More...
 
int nflog_unbind_group (struct nflog_g_handle *gh)
 nflog_unbind_group - unbind a group handle. More...
 
int nflog_set_mode (struct nflog_g_handle *gh, u_int8_t mode, u_int32_t range)
 nflog_set_mode - set the amount of packet data that nflog copies to userspace More...
 
int nflog_set_timeout (struct nflog_g_handle *gh, u_int32_t timeout)
 nflog_set_timeout - set the maximum time to push log buffer for this group More...
 
int nflog_set_qthresh (struct nflog_g_handle *gh, u_int32_t qthresh)
 nflog_set_qthresh - set the maximum amount of logs in buffer for this group More...
 
int nflog_set_nlbufsiz (struct nflog_g_handle *gh, u_int32_t nlbufsiz)
 nflog_set_nlbufsiz - set the size of the nflog buffer for this group More...
 
int nflog_set_flags (struct nflog_g_handle *gh, u_int16_t flags)
 nflog_set_flags - set the nflog flags for this group More...
 
struct nfulnl_msg_packet_hdrnflog_get_msg_packet_hdr (struct nflog_data *nfad)
 nflog_get_msg_packet_hdr - return the metaheader that wraps the packet More...
 
u_int16_t nflog_get_hwtype (struct nflog_data *nfad)
 nflog_get_hwtype - get the hardware link layer type from logging data More...
 
u_int16_t nflog_get_msg_packet_hwhdrlen (struct nflog_data *nfad)
 nflog_get_hwhdrlen - get the length of the hardware link layer header More...
 
char * nflog_get_msg_packet_hwhdr (struct nflog_data *nfad)
 nflog_get_msg_packet_hwhdr - get the hardware link layer header More...
 
u_int32_t nflog_get_nfmark (struct nflog_data *nfad)
 nflog_get_nfmark - get the packet mark More...
 
int nflog_get_timestamp (struct nflog_data *nfad, struct timeval *tv)
 nflog_get_timestamp - get the packet timestamp More...
 
u_int32_t nflog_get_indev (struct nflog_data *nfad)
 nflog_get_indev - get the interface that the packet was received through More...
 
u_int32_t nflog_get_physindev (struct nflog_data *nfad)
 nflog_get_physindev - get the physical interface that the packet was received More...
 
u_int32_t nflog_get_outdev (struct nflog_data *nfad)
 nflog_get_outdev - gets the interface that the packet will be routed out More...
 
u_int32_t nflog_get_physoutdev (struct nflog_data *nfad)
 nflog_get_physoutdev - get the physical interface that the packet output More...
 
struct nfulnl_msg_packet_hwnflog_get_packet_hw (struct nflog_data *nfad)
 nflog_get_packet_hw - get hardware address More...
 
int nflog_get_payload (struct nflog_data *nfad, char **data)
 nflog_get_payload - get payload of the logged packet More...
 
char * nflog_get_prefix (struct nflog_data *nfad)
 nflog_get_prefix - get the logging string prefix More...
 
int nflog_get_uid (struct nflog_data *nfad, u_int32_t *uid)
 nflog_get_uid - get the UID of the user that has generated the packet More...
 
int nflog_get_gid (struct nflog_data *nfad, u_int32_t *gid)
 nflog_get_gid - get the GID of the user that has generated the packet More...
 
int nflog_get_seq (struct nflog_data *nfad, u_int32_t *seq)
 nflog_get_seq - get the local nflog sequence number More...
 
int nflog_get_seq_global (struct nflog_data *nfad, u_int32_t *seq)
 nflog_get_seq_global - get the global nflog sequence number More...
 
int nflog_snprintf_xml (char *buf, size_t rem, struct nflog_data *tb, int flags)
 nflog_snprintf_xml - print the logged packet in XML format into a buffer More...
 

Variables

int nflog_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 nflog_snprintf_xml().

Function Documentation

int nflog_callback_register ( struct nflog_g_handle gh,
nflog_callback cb,
void *  data 
)

References nflog_g_handle::cb, nflog_g_handle::data, and data.

Referenced by main().

Here is the caller graph for this function:

int nflog_handle_packet ( struct nflog_handle h,
char *  buf,
int  len 
)

References nfnl_handle_packet(), and nflog_handle::nfnlh.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

struct nfnl_handle* nflog_nfnlh ( struct nflog_handle h)

References nflog_handle::nfnlh.

Referenced by ipulog_get_packet(), ipulog_read(), and nflog_fd().

Here is the caller graph for this function:

struct nflog_handle* nflog_open_nfnl ( struct nfnl_handle nfnlh)

References nfnl_callback::data, nflog_errno, nfnl_callback_register(), nfnl_close(), nfnl_subsys_open(), NFNL_SUBSYS_ULOG, nflog_handle::nfnlh, nflog_handle::nfnlssh, NFULNL_MSG_MAX, NFULNL_MSG_PACKET, and NULL.

Referenced by nflog_open().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int nflog_errno

Referenced by nflog_open_nfnl().