64 #include <netlink-private/netlink.h>
65 #include <netlink/netlink.h>
66 #include <netlink/netfilter/nfnl.h>
108 int flags, uint8_t family, uint16_t res_id)
110 struct nfgenmsg hdr = {
111 .nfgen_family = family,
112 .version = NFNETLINK_V0,
113 .res_id = htons(res_id),
133 return NFNL_SUBSYS_ID(nlh->nlmsg_type);
142 return NFNL_MSG_TYPE(nlh->nlmsg_type);
153 return nfg->nfgen_family;
164 return ntohs(nfg->res_id);
174 static int nfnlmsg_append(
struct nl_msg *msg, uint8_t family, uint16_t res_id)
176 struct nfgenmsg *nfg;
182 nfg->nfgen_family = family;
183 nfg->version = NFNETLINK_V0;
184 nfg->res_id = htons(res_id);
185 NL_DBG(2,
"msg %p: Added nfnetlink header family=%d res_id=%d\n",
186 msg, family, res_id);
201 uint8_t family, uint16_t res_id)
209 if (nfnlmsg_append(msg, family, res_id) < 0)
210 goto nla_put_failure;
231 uint8_t subsys_id, uint8_t type,
int flags, uint8_t family,
234 struct nlmsghdr *nlh;
236 nlh =
nlmsg_put(msg, pid, seq, NFNLMSG_TYPE(subsys_id, type), 0, flags);
240 return nfnlmsg_append(msg, family, res_id);