5 #include <libmnl/libmnl.h>
6 #include <libnetfilter_cthelper/libnetfilter_cthelper.h>
8 int main(
int argc,
char *argv[])
10 struct mnl_socket *nl;
11 char buf[MNL_SOCKET_BUFFER_SIZE];
18 fprintf(stderr,
"Usage: %s [name]\n", argv[0]);
23 if (nfct_helper == NULL) {
37 nl = mnl_socket_open(NETLINK_NETFILTER);
39 perror(
"mnl_socket_open");
43 if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) {
44 perror(
"mnl_socket_bind");
47 portid = mnl_socket_get_portid(nl);
49 if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
50 perror(
"mnl_socket_send");
54 ret = mnl_socket_recvfrom(nl, buf,
sizeof(buf));
56 ret = mnl_cb_run(buf, ret, seq, portid, NULL, NULL);
59 ret = mnl_socket_recvfrom(nl, buf,
sizeof(buf));
struct nfct_helper * nfct_helper_alloc(void)
void nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *nfct_helper)
struct nlmsghdr * nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
void nfct_helper_attr_set(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type, const void *data)
void nfct_helper_free(struct nfct_helper *h)