13#include <netinet/in.h>
15#include <libmnl/libmnl.h>
16#include <linux/netfilter/nfnetlink_cttimeout.h>
17#include <libnetfilter_cttimeout/libnetfilter_cttimeout.h>
19int main(
int argc,
char *argv[])
21 struct mnl_socket *nl;
22 char buf[MNL_SOCKET_BUFFER_SIZE];
25 struct nfct_timeout *t;
29 fprintf(stderr,
"Usage: %s [name] [l3proto] [l4proto]\n",
31 fprintf(stderr,
"Example: %s test 2 255\n", argv[0]);
49 NLM_F_CREATE | NLM_F_ACK, seq);
54 nl = mnl_socket_open(NETLINK_NETFILTER);
56 perror(
"mnl_socket_open");
60 if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) {
61 perror(
"mnl_socket_bind");
64 portid = mnl_socket_get_portid(nl);
66 if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
67 perror(
"mnl_socket_send");
71 ret = mnl_socket_recvfrom(nl, buf,
sizeof(buf));
73 ret = mnl_cb_run(buf, ret, seq, portid, NULL, NULL);
76 ret = mnl_socket_recvfrom(nl, buf,
sizeof(buf));
int nfct_timeout_policy_attr_set_u32(struct nfct_timeout *, uint32_t type, uint32_t data)
int nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data)
void nfct_timeout_free(struct nfct_timeout *)
struct nfct_timeout * nfct_timeout_alloc(void)
int nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data)
int nfct_timeout_attr_set_u8(struct nfct_timeout *t, uint32_t type, uint8_t data)
struct nlmsghdr * nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
void nfct_timeout_nlmsg_build_payload(struct nlmsghdr *, const struct nfct_timeout *)