1 #ifndef _NFNETLINK_H
2 #define _NFNETLINK_H
3 
4 
5 #include <linux/netlink.h>
6 #include <linux/capability.h>
7 #include <net/netlink.h>
8 #include <uapi/linux/netfilter/nfnetlink.h>
9 
10 struct nfnl_callback {
11 	int (*call)(struct sock *nl, struct sk_buff *skb,
12 		    const struct nlmsghdr *nlh,
13 		    const struct nlattr * const cda[]);
14 	int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
15 		    const struct nlmsghdr *nlh,
16 		    const struct nlattr * const cda[]);
17 	const struct nla_policy *policy;	/* netlink attribute policy */
18 	const u_int16_t attr_count;		/* number of nlattr's */
19 };
20 
21 struct nfnetlink_subsystem {
22 	const char *name;
23 	__u8 subsys_id;			/* nfnetlink subsystem ID */
24 	__u8 cb_count;			/* number of callbacks */
25 	const struct nfnl_callback *cb;	/* callback for individual types */
26 };
27 
28 extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29 extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30 
31 extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
32 extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group,
33 			  int echo, gfp_t flags);
34 extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
35 extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
36 
37 extern void nfnl_lock(void);
38 extern void nfnl_unlock(void);
39 
40 #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
41 	MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
42 
43 #endif	/* _NFNETLINK_H */
44