include: replace linux/module.h with "struct module" wherever possible
[linux-2.6/next.git] / include / linux / netfilter / nfnetlink.h
blob74d33861473ce5af0a3b6e7b4067d18d363db294
1 #ifndef _NFNETLINK_H
2 #define _NFNETLINK_H
3 #include <linux/types.h>
4 #include <linux/netfilter/nfnetlink_compat.h>
6 enum nfnetlink_groups {
7 NFNLGRP_NONE,
8 #define NFNLGRP_NONE NFNLGRP_NONE
9 NFNLGRP_CONNTRACK_NEW,
10 #define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW
11 NFNLGRP_CONNTRACK_UPDATE,
12 #define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE
13 NFNLGRP_CONNTRACK_DESTROY,
14 #define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY
15 NFNLGRP_CONNTRACK_EXP_NEW,
16 #define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW
17 NFNLGRP_CONNTRACK_EXP_UPDATE,
18 #define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
19 NFNLGRP_CONNTRACK_EXP_DESTROY,
20 #define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 __NFNLGRP_MAX,
23 #define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
25 /* General form of address family dependent message.
27 struct nfgenmsg {
28 __u8 nfgen_family; /* AF_xxx */
29 __u8 version; /* nfnetlink version */
30 __be16 res_id; /* resource id */
33 #define NFNETLINK_V0 0
35 /* netfilter netlink message types are split in two pieces:
36 * 8 bit subsystem, 8bit operation.
39 #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8)
40 #define NFNL_MSG_TYPE(x) (x & 0x00ff)
42 /* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
43 * won't work anymore */
44 #define NFNL_SUBSYS_NONE 0
45 #define NFNL_SUBSYS_CTNETLINK 1
46 #define NFNL_SUBSYS_CTNETLINK_EXP 2
47 #define NFNL_SUBSYS_QUEUE 3
48 #define NFNL_SUBSYS_ULOG 4
49 #define NFNL_SUBSYS_OSF 5
50 #define NFNL_SUBSYS_IPSET 6
51 #define NFNL_SUBSYS_COUNT 7
53 #ifdef __KERNEL__
55 #include <linux/netlink.h>
56 #include <linux/capability.h>
57 #include <net/netlink.h>
59 struct nfnl_callback {
60 int (*call)(struct sock *nl, struct sk_buff *skb,
61 const struct nlmsghdr *nlh,
62 const struct nlattr * const cda[]);
63 int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
64 const struct nlmsghdr *nlh,
65 const struct nlattr * const cda[]);
66 const struct nla_policy *policy; /* netlink attribute policy */
67 const u_int16_t attr_count; /* number of nlattr's */
70 struct nfnetlink_subsystem {
71 const char *name;
72 __u8 subsys_id; /* nfnetlink subsystem ID */
73 __u8 cb_count; /* number of callbacks */
74 const struct nfnl_callback *cb; /* callback for individual types */
77 extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
78 extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
80 extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
81 extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group,
82 int echo, gfp_t flags);
83 extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
84 extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
86 extern void nfnl_lock(void);
87 extern void nfnl_unlock(void);
89 #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
90 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
92 #endif /* __KERNEL__ */
93 #endif /* _NFNETLINK_H */