Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 1 | #ifndef _NFNETLINK_H |
| 2 | #define _NFNETLINK_H |
Patrick McHardy | ac6d439 | 2005-08-14 19:29:52 -0700 | [diff] [blame] | 3 | |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 4 | |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 5 | #include <linux/netlink.h> |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 6 | #include <linux/capability.h> |
Patrick McHardy | df6fb86 | 2007-09-28 14:37:03 -0700 | [diff] [blame] | 7 | #include <net/netlink.h> |
David Howells | 94d0ec5 | 2012-10-09 09:48:54 +0100 | [diff] [blame] | 8 | #include <uapi/linux/netfilter/nfnetlink.h> |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 9 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 10 | struct nfnl_callback { |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 11 | int (*call)(struct sock *nl, struct sk_buff *skb, |
Patrick McHardy | 3993832 | 2009-08-25 16:07:58 +0200 | [diff] [blame] | 12 | const struct nlmsghdr *nlh, |
| 13 | const struct nlattr * const cda[]); |
Eric Dumazet | 6b75e3e | 2011-07-18 16:08:07 +0200 | [diff] [blame] | 14 | int (*call_rcu)(struct sock *nl, struct sk_buff *skb, |
| 15 | const struct nlmsghdr *nlh, |
| 16 | const struct nlattr * const cda[]); |
Patrick McHardy | e373057 | 2007-09-28 14:38:52 -0700 | [diff] [blame] | 17 | const struct nla_policy *policy; /* netlink attribute policy */ |
| 18 | const u_int16_t attr_count; /* number of nlattr's */ |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 19 | }; |
| 20 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 21 | struct nfnetlink_subsystem { |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 22 | const char *name; |
Patrick McHardy | 7c8d4cb | 2007-09-28 14:15:45 -0700 | [diff] [blame] | 23 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
| 24 | __u8 cb_count; /* number of callbacks */ |
| 25 | const struct nfnl_callback *cb; /* callback for individual types */ |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
Patrick McHardy | 7c8d4cb | 2007-09-28 14:15:45 -0700 | [diff] [blame] | 28 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
| 29 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 30 | |
Alexey Dobriyan | cd8c20b | 2010-01-13 16:02:14 +0100 | [diff] [blame] | 31 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
Patrick McHardy | 3ab1f68 | 2013-04-17 06:47:09 +0000 | [diff] [blame] | 32 | extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, |
| 33 | u32 dst_portid, gfp_t gfp_mask); |
Patrick McHardy | ec464e5 | 2013-04-17 06:47:08 +0000 | [diff] [blame] | 34 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, |
| 35 | unsigned int group, int echo, gfp_t flags); |
| 36 | extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); |
| 37 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, |
| 38 | u32 portid, int flags); |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 39 | |
Pablo Neira Ayuso | c14b78e | 2013-02-05 01:50:26 +0100 | [diff] [blame] | 40 | extern void nfnl_lock(__u8 subsys_id); |
| 41 | extern void nfnl_unlock(__u8 subsys_id); |
Pablo Neira Ayuso | e6a7d3c | 2008-10-14 11:58:31 -0700 | [diff] [blame] | 42 | |
Harald Welte | 0ab43f8 | 2005-08-09 19:43:44 -0700 | [diff] [blame] | 43 | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ |
| 44 | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) |
| 45 | |
Harald Welte | f9e815b | 2005-08-09 19:30:24 -0700 | [diff] [blame] | 46 | #endif /* _NFNETLINK_H */ |