• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33 					   u32 dst_portid, gfp_t gfp_mask);
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);
39 
40 extern void nfnl_lock(__u8 subsys_id);
41 extern void nfnl_unlock(__u8 subsys_id);
42 
43 #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
44 	MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
45 
46 #endif	/* _NFNETLINK_H */
47