.TH "nlmsg" 3 "Wed May 11 2022" "Version 1.0.2" "libnetfilter_log" \" -*- nroff -*- .ad l .nh .SH 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 .SH SYNOPSIS .nf \fB #include #include .in +1c .ti -1c .RI "struct nlmsghdr * \fBnflog_nlmsg_put_header\fP (char *buf, uint8_t type, uint8_t family, uint16_t gnum)" .br .ti -1c .RI "int \fBnflog_attr_put_cfg_mode\fP (struct nlmsghdr *nlh, uint8_t mode, uint32_t range)" .br .ti -1c .RI "int \fBnflog_attr_put_cfg_cmd\fP (struct nlmsghdr *nlh, uint8_t cmd)" .br .ti -1c .RI "int \fBnflog_nlmsg_parse\fP (const struct nlmsghdr *nlh, struct nlattr **attr)" .br .ti -1c .RI "int \fBnflog_nlmsg_snprintf\fP (char *buf, size_t bufsiz, const struct nlmsghdr *nlh, struct nlattr **attr, enum nflog_output_type type, uint32_t flags)" .br .in -1c .SH "Function Documentation" .PP .SS "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 .PP \fBParameters\fP .RS 4 \fInlh\fP pointer to netlink message .br \fIcmd\fP one of the enum nfulnl_msg_config_cmds .RE .PP \fBReturns\fP .RS 4 0 .RE .PP .SS "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 .PP \fBParameters\fP .RS 4 \fInlh\fP pointer to netlink message .br \fImode\fP copy mode: NFULNL_COPY_NONE, NFULNL_COPY_META or NFULNL_COPY_PACKET .br \fIrange\fP copy range .RE .PP \fBReturns\fP .RS 4 0 .RE .PP .SS "int nflog_nlmsg_parse (const struct nlmsghdr * nlh, struct nlattr ** attr)" nflog_nlmsg_parse - set nlattrs from netlink message .PP \fBParameters\fP .RS 4 \fInlh\fP pointer to netlink message .br \fIattr\fP pointer to an array of nlattr of size NFULA_MAX + 1 .RE .PP \fBReturns\fP .RS 4 0 .RE .PP .SS "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 .PP \fBParameters\fP .RS 4 \fIbuf\fP pointer to memory buffer .br \fItype\fP either NFULNL_MSG_PACKET or NFULNL_MSG_CONFIG (enum nfulnl_msg_types) .br \fIfamily\fP protocol family .br \fIgnum\fP group number .RE .PP Initialises \fIbuf\fP to start with a netlink header for the log subsystem followed by an nfnetlink header with the log group .PP \fBReturns\fP .RS 4 pointer to created Netlink header structure .RE .PP .SS "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 .PP \fBParameters\fP .RS 4 \fIbuf\fP buffer used to build the printable nflog .br \fIbufsiz\fP size of the buffer .br \fInlh\fP pointer to netlink message (to get queue num in the future) .br \fIattr\fP pointer to an array of nlattr of size NFULA_MAX + 1 .br \fItype\fP print message type in enum nflog_output_type .br \fIflags\fP The flag that tell what to print into the buffer .RE .PP This function supports the following types / flags: .PP type: NFLOG_OUTPUT_XML .IP "\(bu" 2 NFLOG_XML_PREFIX: include the string prefix .IP "\(bu" 2 NFLOG_XML_HW: include the hardware link layer address .IP "\(bu" 2 NFLOG_XML_MARK: include the packet mark .IP "\(bu" 2 NFLOG_XML_DEV: include the device information .IP "\(bu" 2 NFLOG_XML_PHYSDEV: include the physical device information .IP "\(bu" 2 NFLOG_XML_PAYLOAD: include the payload (in hexadecimal) .IP "\(bu" 2 NFLOG_XML_TIME: include the timestamp .IP "\(bu" 2 NFLOG_XML_ALL: include all the logging information (all flags set) .PP .PP You can combine these flags with a bitwise OR\&. .PP \fBReturns\fP .RS 4 -1 on failure else same as snprintf .RE .PP \fBErrors\fP .RS 4 \fBEOPNOTSUPP\fP \fItype\fP is unsupported (i\&.e\&. not \fBNFLOG_OUTPUT_XML\fP) .RE .PP \fBSee also\fP .RS 4 \fBsnprintf\fP(3) .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libnetfilter_log from the source code\&.