libnetfilter_cthelper  1.0.0
Functions
Netlink message helper functions

Functions

struct nlmsghdr * nfct_helper_nlmsg_build_hdr (char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 
void nfct_helper_nlmsg_build_payload (struct nlmsghdr *nlh, struct nfct_helper *h)
 
int nfct_helper_nlmsg_parse_payload (const struct nlmsghdr *nlh, struct nfct_helper *h)
 

Detailed Description

Function Documentation

struct nlmsghdr* nfct_helper_nlmsg_build_hdr ( char *  buf,
uint8_t  cmd,
uint16_t  flags,
uint32_t  seq 
)

nfct_helper_nlmsg_build_hdr - build netlink message header for nfct_helper subsystem

Parameters
bufbuffer where this function outputs the netlink message.
cmdnfct_helper nfnetlink command.
flagsnetlink flags.
seqsequence number for this message.

Possible commands:

  • NFNL_MSG_ACCT_NEW: new helper object.
  • NFNL_MSG_ACCT_GET: get helper object.
  • NFNL_MSG_ACCT_GET_CTRZERO: get helper object and atomically reset.

Examples:

  • Command NFNL_MSG_ACCT_NEW + flags NLM_F_CREATE | NLM_F_ACK, to create one new helper object (if it does not already exists). You receive one acknoledgment in any case with the result of the operation.
  • Command NFNL_MSG_ACCT_GET + flags NLM_F_DUMP, to obtain all the existing helper objects.
  • Command NFNL_MSG_ACCT_DEL, to delete all existing unused objects.
  • Command NFNL_MSG_ACCT_DEL, to delete one specific nfct_helper object (if unused, otherwise you hit EBUSY).

Definition at line 494 of file libnetfilter_cthelper.c.

void nfct_helper_nlmsg_build_payload ( struct nlmsghdr *  nlh,
struct nfct_helper h 
)

nfct_helper_nlmsg_build_payload - build payload from helper object

Parameters
nlhnetlink message that you want to use to add the payload.
nfct_helperpointer to a helper object

Definition at line 534 of file libnetfilter_cthelper.c.

int nfct_helper_nlmsg_parse_payload ( const struct nlmsghdr *  nlh,
struct nfct_helper h 
)

nfct_helper_nlmsg_parse_payload - set helper object attributes from message

Parameters
nlhnetlink message that you want to use to add the payload.
nfct_helperpointer to a helper object

This function returns -1 in case that some mandatory attributes are missing. On sucess, it returns 0.

Definition at line 799 of file libnetfilter_cthelper.c.