libnl  3.7.0
nfnl.h
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3  * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
4  * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
5  * Copyright (c) 2007 Secure Computing Corporation
6  */
7 
8 #ifndef NETLINK_NFNL_H_
9 #define NETLINK_NFNL_H_
10 
11 #include <netlink/netlink.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #define NFNL_HDRLEN NLMSG_ALIGN(sizeof(struct nfgenmsg))
18 #define NFNLMSG_TYPE(subsys, subtype) (((subsys) << 8) | (subtype))
19 
20 extern int nfnl_connect(struct nl_sock *);
21 
22 extern uint8_t nfnlmsg_subsys(struct nlmsghdr *);
23 extern uint8_t nfnlmsg_subtype(struct nlmsghdr *);
24 extern uint8_t nfnlmsg_family(struct nlmsghdr *);
25 extern uint16_t nfnlmsg_res_id(struct nlmsghdr *);
26 
27 extern int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t,
28  int, uint8_t, uint16_t);
29 extern struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int,
30  uint8_t, uint16_t);
31 extern int nfnlmsg_put(struct nl_msg *, uint32_t, uint32_t,
32  uint8_t, uint8_t, int, uint8_t, uint16_t);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif
uint16_t nfnlmsg_res_id(struct nlmsghdr *)
Get netfilter resource id from message.
Definition: nfnl.c:157
uint8_t nfnlmsg_subsys(struct nlmsghdr *)
Get netfilter subsystem id from message.
Definition: nfnl.c:128
uint8_t nfnlmsg_family(struct nlmsghdr *)
Get netfilter family from message.
Definition: nfnl.c:146
int nfnlmsg_put(struct nl_msg *, uint32_t, uint32_t, uint8_t, uint8_t, int, uint8_t, uint16_t)
Add netlink and netfilter netlink headers to netlink message.
Definition: nfnl.c:227
int nfnl_connect(struct nl_sock *)
Create and connect netfilter netlink socket.
Definition: nfnl.c:80
int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t, int, uint8_t, uint16_t)
Send trivial netfilter netlink message.
Definition: nfnl.c:104
uint8_t nfnlmsg_subtype(struct nlmsghdr *)
Get netfilter message type from message.
Definition: nfnl.c:137
struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int, uint8_t, uint16_t)
Allocate a new netfilter netlink message.
Definition: nfnl.c:197