libnl  3.5.0
nfnl.h
1 /*
2  * netlink/nfnl/nfnl.h Netfilter Netlink
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation version 2.1
7  * of the License.
8  *
9  * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
10  * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
11  * Copyright (c) 2007 Secure Computing Corporation
12  */
13 
14 #ifndef NETLINK_NFNL_H_
15 #define NETLINK_NFNL_H_
16 
17 #include <netlink/netlink.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define NFNL_HDRLEN NLMSG_ALIGN(sizeof(struct nfgenmsg))
24 #define NFNLMSG_TYPE(subsys, subtype) (((subsys) << 8) | (subtype))
25 
26 extern int nfnl_connect(struct nl_sock *);
27 
28 extern uint8_t nfnlmsg_subsys(struct nlmsghdr *);
29 extern uint8_t nfnlmsg_subtype(struct nlmsghdr *);
30 extern uint8_t nfnlmsg_family(struct nlmsghdr *);
31 extern uint16_t nfnlmsg_res_id(struct nlmsghdr *);
32 
33 extern int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t,
34  int, uint8_t, uint16_t);
35 extern struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int,
36  uint8_t, uint16_t);
37 extern int nfnlmsg_put(struct nl_msg *, uint32_t, uint32_t,
38  uint8_t, uint8_t, int, uint8_t, uint16_t);
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 #endif
uint8_t nfnlmsg_subsys(struct nlmsghdr *)
Get netfilter subsystem id from message.
Definition: nfnl.c:135
uint8_t nfnlmsg_subtype(struct nlmsghdr *)
Get netfilter message type from message.
Definition: nfnl.c:144
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:234
int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t, int, uint8_t, uint16_t)
Send trivial netfilter netlink message.
Definition: nfnl.c:111
uint8_t nfnlmsg_family(struct nlmsghdr *)
Get netfilter family from message.
Definition: nfnl.c:153
int nfnl_connect(struct nl_sock *)
Create and connect netfilter netlink socket.
Definition: nfnl.c:87
struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int, uint8_t, uint16_t)
Allocate a new netfilter netlink message.
Definition: nfnl.c:204
uint16_t nfnlmsg_res_id(struct nlmsghdr *)
Get netfilter resource id from message.
Definition: nfnl.c:164