table of contents
nlmsg(3) | libnetfilter_log | nlmsg(3) |
NAME¶
nflog_nlmsg_put_header, nflog_attr_put_cfg_mode, nflog_attr_put_cfg_cmd, nflog_nlmsg_parse, nflog_nlmsg_snprintf - Netlink message helper functions
SYNOPSIS¶
#include <netinet/in.h> #include <libnetfilter_log/libnetfilter_log.h>
struct nlmsghdr * nflog_nlmsg_put_header (char *buf, uint8_t type, uint8_t family, uint16_t gnum)
int nflog_attr_put_cfg_mode (struct nlmsghdr *nlh, uint8_t mode, uint32_t range)
int nflog_attr_put_cfg_cmd (struct nlmsghdr *nlh, uint8_t cmd)
int nflog_nlmsg_parse (const struct nlmsghdr *nlh, struct nlattr **attr)
int nflog_nlmsg_snprintf (char *buf, size_t bufsiz, const struct nlmsghdr *nlh, struct nlattr **attr, enum nflog_output_type type, uint32_t flags)
Function Documentation¶
int nflog_attr_put_cfg_cmd (struct nlmsghdr * nlh, uint8_t cmd)¶
nflog_attr_put_cfg_cmd - add a command attribute to nflog netlink message
Parameters
cmd one of the enum nfulnl_msg_config_cmds
Returns
Definition at line 84 of file nlmsg.c.
int nflog_attr_put_cfg_mode (struct nlmsghdr * nlh, uint8_t mode, uint32_t range)¶
nflog_attr_put_cfg_mode - add a mode attribute to nflog netlink message
Parameters
mode copy mode: NFULNL_COPY_NONE, NFULNL_COPY_META or NFULNL_COPY_PACKET
range copy range
Returns
Definition at line 64 of file nlmsg.c.
int nflog_nlmsg_parse (const struct nlmsghdr * nlh, struct nlattr ** attr)¶
nflog_nlmsg_parse - set nlattrs from netlink message
Parameters
attr pointer to an array of nlattr of size NFULA_MAX + 1
Returns
Definition at line 162 of file nlmsg.c.
struct nlmsghdr * nflog_nlmsg_put_header (char * buf, uint8_t type, uint8_t family, uint16_t gnum)¶
nflog_nlmsg_put_header - populate memory buffer with nflog Netlink headers
Parameters
type either NFULNL_MSG_PACKET or NFULNL_MSG_CONFIG (enum nfulnl_msg_types)
family protocol family
gnum group number
Initialises buf to start with a netlink header for the log subsystem followed by an nfnetlink header with the log group
Returns
Definition at line 39 of file nlmsg.c.
int nflog_nlmsg_snprintf (char * buf, size_t bufsiz, const struct nlmsghdr * nlh, struct nlattr ** attr, enum nflog_output_type type, uint32_t flags)¶
nflog_nlmsg_snprintf - print a nflog nlattrs to a buffer
Parameters
bufsiz size of the buffer
nlh pointer to netlink message (to get queue num in the future)
attr pointer to an array of nlattr of size NFULA_MAX + 1
type print message type in enum nflog_output_type
flags The flag that tell what to print into the buffer
This function supports the following types / flags:
type: NFLOG_OUTPUT_XML
- NFLOG_XML_PREFIX: include the string prefix
- NFLOG_XML_HW: include the hardware link layer address
- NFLOG_XML_MARK: include the packet mark
- NFLOG_XML_DEV: include the device information
- NFLOG_XML_PHYSDEV: include the physical device information
- NFLOG_XML_PAYLOAD: include the payload (in hexadecimal)
- NFLOG_XML_TIME: include the timestamp
- NFLOG_XML_ALL: include all the logging information (all flags set)
You can combine these flags with a bitwise OR.
Returns
Errors
See also
Definition at line 196 of file nlmsg.c.
Author¶
Generated automatically by Doxygen for libnetfilter_log from the source code.
Wed Aug 9 2023 | Version 1.0.2 |