]>
Commit | Line | Data |
---|---|---|
f9e815b3 HW |
1 | #ifndef _NFNETLINK_H |
2 | #define _NFNETLINK_H | |
3 | #include <linux/types.h> | |
df6fb868 | 4 | #include <linux/netfilter/nfnetlink_compat.h> |
ac6d439d PM |
5 | |
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, | |
22 | }; | |
23 | #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) | |
f9e815b3 | 24 | |
f9e815b3 HW |
25 | /* General form of address family dependent message. |
26 | */ | |
27 | struct nfgenmsg { | |
28 | u_int8_t nfgen_family; /* AF_xxx */ | |
29 | u_int8_t version; /* nfnetlink version */ | |
98a4a861 | 30 | __be16 res_id; /* resource id */ |
53e26658 | 31 | }; |
f9e815b3 | 32 | |
080774a2 | 33 | #define NFNETLINK_V0 0 |
f9e815b3 | 34 | |
f9e815b3 HW |
35 | /* netfilter netlink message types are split in two pieces: |
36 | * 8 bit subsystem, 8bit operation. | |
37 | */ | |
38 | ||
39 | #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) | |
40 | #define NFNL_MSG_TYPE(x) (x & 0x00ff) | |
41 | ||
0ab43f84 HW |
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_COUNT 5 | |
f9e815b3 HW |
50 | |
51 | #ifdef __KERNEL__ | |
52 | ||
080774a2 | 53 | #include <linux/netlink.h> |
f9e815b3 | 54 | #include <linux/capability.h> |
df6fb868 | 55 | #include <net/netlink.h> |
f9e815b3 HW |
56 | |
57 | struct nfnl_callback | |
58 | { | |
f9e815b3 | 59 | int (*call)(struct sock *nl, struct sk_buff *skb, |
df6fb868 | 60 | struct nlmsghdr *nlh, struct nlattr *cda[]); |
e3730578 PM |
61 | const struct nla_policy *policy; /* netlink attribute policy */ |
62 | const u_int16_t attr_count; /* number of nlattr's */ | |
f9e815b3 HW |
63 | }; |
64 | ||
65 | struct nfnetlink_subsystem | |
66 | { | |
67 | const char *name; | |
7c8d4cb4 PM |
68 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
69 | __u8 cb_count; /* number of callbacks */ | |
70 | const struct nfnl_callback *cb; /* callback for individual types */ | |
f9e815b3 HW |
71 | }; |
72 | ||
7c8d4cb4 PM |
73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | |
f9e815b3 | 75 | |
a2427692 | 76 | extern int nfnetlink_has_listeners(unsigned int group); |
f9e815b3 HW |
77 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, |
78 | int echo); | |
79 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | |
80 | ||
0ab43f84 HW |
81 | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ |
82 | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) | |
83 | ||
f9e815b3 HW |
84 | #endif /* __KERNEL__ */ |
85 | #endif /* _NFNETLINK_H */ |