diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/genetlink.h | 1 | ||||
-rw-r--r-- | include/net/netfilter/ipv4/nf_conntrack_ipv4.h | 3 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 3 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_tuple.h | 2 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 4 | ||||
-rw-r--r-- | include/net/tipc/tipc.h | 257 | ||||
-rw-r--r-- | include/net/tipc/tipc_bearer.h | 121 | ||||
-rw-r--r-- | include/net/tipc/tipc_msg.h | 223 | ||||
-rw-r--r-- | include/net/tipc/tipc_port.h | 108 |
9 files changed, 712 insertions, 10 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index c5b96b2b8155..805de50df00d 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -22,7 +22,6 @@ struct genl_family | |||
22 | char name[GENL_NAMSIZ]; | 22 | char name[GENL_NAMSIZ]; |
23 | unsigned int version; | 23 | unsigned int version; |
24 | unsigned int maxattr; | 24 | unsigned int maxattr; |
25 | struct module * owner; | ||
26 | struct nlattr ** attrbuf; /* private */ | 25 | struct nlattr ** attrbuf; /* private */ |
27 | struct list_head ops_list; /* private */ | 26 | struct list_head ops_list; /* private */ |
28 | struct list_head family_list; /* private */ | 27 | struct list_head family_list; /* private */ |
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h index 25b081a730e6..91684436af8e 100644 --- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h +++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h | |||
@@ -37,7 +37,4 @@ struct nf_conntrack_ipv4 { | |||
37 | struct sk_buff * | 37 | struct sk_buff * |
38 | nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); | 38 | nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); |
39 | 39 | ||
40 | /* call to create an explicit dependency on nf_conntrack_l3proto_ipv4. */ | ||
41 | extern void need_ip_conntrack(void); | ||
42 | |||
43 | #endif /*_NF_CONNTRACK_IPV4_H*/ | 40 | #endif /*_NF_CONNTRACK_IPV4_H*/ |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 64b82b74a650..6d075ca16e6e 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -221,9 +221,6 @@ extern void nf_ct_helper_put(struct nf_conntrack_helper *helper); | |||
221 | extern struct nf_conntrack_helper * | 221 | extern struct nf_conntrack_helper * |
222 | __nf_conntrack_helper_find_byname(const char *name); | 222 | __nf_conntrack_helper_find_byname(const char *name); |
223 | 223 | ||
224 | /* call to create an explicit dependency on nf_conntrack. */ | ||
225 | extern void need_nf_conntrack(void); | ||
226 | |||
227 | extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, | 224 | extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, |
228 | const struct nf_conntrack_tuple *orig); | 225 | const struct nf_conntrack_tuple *orig); |
229 | 226 | ||
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 14ce790e5c65..530ef1f75283 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -111,7 +111,7 @@ struct nf_conntrack_tuple | |||
111 | #ifdef __KERNEL__ | 111 | #ifdef __KERNEL__ |
112 | 112 | ||
113 | #define NF_CT_DUMP_TUPLE(tp) \ | 113 | #define NF_CT_DUMP_TUPLE(tp) \ |
114 | DEBUGP("tuple %p: %u %u %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu -> %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu\n", \ | 114 | DEBUGP("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ |
115 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ | 115 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ |
116 | NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ | 116 | NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ |
117 | NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) | 117 | NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 8f241216f46b..a553f39f6aee 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -225,13 +225,13 @@ extern int sctp_debug_flag; | |||
225 | if (sctp_debug_flag) { \ | 225 | if (sctp_debug_flag) { \ |
226 | if (saddr->sa.sa_family == AF_INET6) { \ | 226 | if (saddr->sa.sa_family == AF_INET6) { \ |
227 | printk(KERN_DEBUG \ | 227 | printk(KERN_DEBUG \ |
228 | lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \ | 228 | lead NIP6_FMT trail, \ |
229 | leadparm, \ | 229 | leadparm, \ |
230 | NIP6(saddr->v6.sin6_addr), \ | 230 | NIP6(saddr->v6.sin6_addr), \ |
231 | otherparms); \ | 231 | otherparms); \ |
232 | } else { \ | 232 | } else { \ |
233 | printk(KERN_DEBUG \ | 233 | printk(KERN_DEBUG \ |
234 | lead "%u.%u.%u.%u" trail, \ | 234 | lead NIPQUAD_FMT trail, \ |
235 | leadparm, \ | 235 | leadparm, \ |
236 | NIPQUAD(saddr->v4.sin_addr.s_addr), \ | 236 | NIPQUAD(saddr->v4.sin_addr.s_addr), \ |
237 | otherparms); \ | 237 | otherparms); \ |
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h new file mode 100644 index 000000000000..9566608c88cf --- /dev/null +++ b/include/net/tipc/tipc.h | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * include/net/tipc/tipc.h: Main include file for TIPC users | ||
3 | * | ||
4 | * Copyright (c) 2003-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _NET_TIPC_H_ | ||
38 | #define _NET_TIPC_H_ | ||
39 | |||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | #include <linux/tipc.h> | ||
43 | #include <linux/skbuff.h> | ||
44 | |||
45 | /* | ||
46 | * Native API | ||
47 | */ | ||
48 | |||
49 | /* | ||
50 | * TIPC operating mode routines | ||
51 | */ | ||
52 | |||
53 | u32 tipc_get_addr(void); | ||
54 | |||
55 | #define TIPC_NOT_RUNNING 0 | ||
56 | #define TIPC_NODE_MODE 1 | ||
57 | #define TIPC_NET_MODE 2 | ||
58 | |||
59 | typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr); | ||
60 | |||
61 | int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle); | ||
62 | |||
63 | void tipc_detach(unsigned int userref); | ||
64 | |||
65 | int tipc_get_mode(void); | ||
66 | |||
67 | /* | ||
68 | * TIPC port manipulation routines | ||
69 | */ | ||
70 | |||
71 | typedef void (*tipc_msg_err_event) (void *usr_handle, | ||
72 | u32 portref, | ||
73 | struct sk_buff **buf, | ||
74 | unsigned char const *data, | ||
75 | unsigned int size, | ||
76 | int reason, | ||
77 | struct tipc_portid const *attmpt_destid); | ||
78 | |||
79 | typedef void (*tipc_named_msg_err_event) (void *usr_handle, | ||
80 | u32 portref, | ||
81 | struct sk_buff **buf, | ||
82 | unsigned char const *data, | ||
83 | unsigned int size, | ||
84 | int reason, | ||
85 | struct tipc_name_seq const *attmpt_dest); | ||
86 | |||
87 | typedef void (*tipc_conn_shutdown_event) (void *usr_handle, | ||
88 | u32 portref, | ||
89 | struct sk_buff **buf, | ||
90 | unsigned char const *data, | ||
91 | unsigned int size, | ||
92 | int reason); | ||
93 | |||
94 | typedef void (*tipc_msg_event) (void *usr_handle, | ||
95 | u32 portref, | ||
96 | struct sk_buff **buf, | ||
97 | unsigned char const *data, | ||
98 | unsigned int size, | ||
99 | unsigned int importance, | ||
100 | struct tipc_portid const *origin); | ||
101 | |||
102 | typedef void (*tipc_named_msg_event) (void *usr_handle, | ||
103 | u32 portref, | ||
104 | struct sk_buff **buf, | ||
105 | unsigned char const *data, | ||
106 | unsigned int size, | ||
107 | unsigned int importance, | ||
108 | struct tipc_portid const *orig, | ||
109 | struct tipc_name_seq const *dest); | ||
110 | |||
111 | typedef void (*tipc_conn_msg_event) (void *usr_handle, | ||
112 | u32 portref, | ||
113 | struct sk_buff **buf, | ||
114 | unsigned char const *data, | ||
115 | unsigned int size); | ||
116 | |||
117 | typedef void (*tipc_continue_event) (void *usr_handle, | ||
118 | u32 portref); | ||
119 | |||
120 | int tipc_createport(unsigned int tipc_user, | ||
121 | void *usr_handle, | ||
122 | unsigned int importance, | ||
123 | tipc_msg_err_event error_cb, | ||
124 | tipc_named_msg_err_event named_error_cb, | ||
125 | tipc_conn_shutdown_event conn_error_cb, | ||
126 | tipc_msg_event message_cb, | ||
127 | tipc_named_msg_event named_message_cb, | ||
128 | tipc_conn_msg_event conn_message_cb, | ||
129 | tipc_continue_event continue_event_cb,/* May be zero */ | ||
130 | u32 *portref); | ||
131 | |||
132 | int tipc_deleteport(u32 portref); | ||
133 | |||
134 | int tipc_ownidentity(u32 portref, struct tipc_portid *port); | ||
135 | |||
136 | int tipc_portimportance(u32 portref, unsigned int *importance); | ||
137 | int tipc_set_portimportance(u32 portref, unsigned int importance); | ||
138 | |||
139 | int tipc_portunreliable(u32 portref, unsigned int *isunreliable); | ||
140 | int tipc_set_portunreliable(u32 portref, unsigned int isunreliable); | ||
141 | |||
142 | int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable); | ||
143 | int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable); | ||
144 | |||
145 | int tipc_publish(u32 portref, unsigned int scope, | ||
146 | struct tipc_name_seq const *name_seq); | ||
147 | int tipc_withdraw(u32 portref, unsigned int scope, | ||
148 | struct tipc_name_seq const *name_seq); /* 0: all */ | ||
149 | |||
150 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); | ||
151 | |||
152 | int tipc_disconnect(u32 portref); | ||
153 | |||
154 | int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */ | ||
155 | |||
156 | int tipc_isconnected(u32 portref, int *isconnected); | ||
157 | |||
158 | int tipc_peer(u32 portref, struct tipc_portid *peer); | ||
159 | |||
160 | int tipc_ref_valid(u32 portref); | ||
161 | |||
162 | /* | ||
163 | * TIPC messaging routines | ||
164 | */ | ||
165 | |||
166 | #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */ | ||
167 | |||
168 | |||
169 | int tipc_send(u32 portref, | ||
170 | unsigned int num_sect, | ||
171 | struct iovec const *msg_sect); | ||
172 | |||
173 | int tipc_send_buf(u32 portref, | ||
174 | struct sk_buff *buf, | ||
175 | unsigned int dsz); | ||
176 | |||
177 | int tipc_send2name(u32 portref, | ||
178 | struct tipc_name const *name, | ||
179 | u32 domain, /* 0:own zone */ | ||
180 | unsigned int num_sect, | ||
181 | struct iovec const *msg_sect); | ||
182 | |||
183 | int tipc_send_buf2name(u32 portref, | ||
184 | struct tipc_name const *name, | ||
185 | u32 domain, | ||
186 | struct sk_buff *buf, | ||
187 | unsigned int dsz); | ||
188 | |||
189 | int tipc_forward2name(u32 portref, | ||
190 | struct tipc_name const *name, | ||
191 | u32 domain, /*0: own zone */ | ||
192 | unsigned int section_count, | ||
193 | struct iovec const *msg_sect, | ||
194 | struct tipc_portid const *origin, | ||
195 | unsigned int importance); | ||
196 | |||
197 | int tipc_forward_buf2name(u32 portref, | ||
198 | struct tipc_name const *name, | ||
199 | u32 domain, | ||
200 | struct sk_buff *buf, | ||
201 | unsigned int dsz, | ||
202 | struct tipc_portid const *orig, | ||
203 | unsigned int importance); | ||
204 | |||
205 | int tipc_send2port(u32 portref, | ||
206 | struct tipc_portid const *dest, | ||
207 | unsigned int num_sect, | ||
208 | struct iovec const *msg_sect); | ||
209 | |||
210 | int tipc_send_buf2port(u32 portref, | ||
211 | struct tipc_portid const *dest, | ||
212 | struct sk_buff *buf, | ||
213 | unsigned int dsz); | ||
214 | |||
215 | int tipc_forward2port(u32 portref, | ||
216 | struct tipc_portid const *dest, | ||
217 | unsigned int num_sect, | ||
218 | struct iovec const *msg_sect, | ||
219 | struct tipc_portid const *origin, | ||
220 | unsigned int importance); | ||
221 | |||
222 | int tipc_forward_buf2port(u32 portref, | ||
223 | struct tipc_portid const *dest, | ||
224 | struct sk_buff *buf, | ||
225 | unsigned int dsz, | ||
226 | struct tipc_portid const *orig, | ||
227 | unsigned int importance); | ||
228 | |||
229 | int tipc_multicast(u32 portref, | ||
230 | struct tipc_name_seq const *seq, | ||
231 | u32 domain, /* 0:own zone */ | ||
232 | unsigned int section_count, | ||
233 | struct iovec const *msg); | ||
234 | |||
235 | #if 0 | ||
236 | int tipc_multicast_buf(u32 portref, | ||
237 | struct tipc_name_seq const *seq, | ||
238 | u32 domain, /* 0:own zone */ | ||
239 | void *buf, | ||
240 | unsigned int size); | ||
241 | #endif | ||
242 | |||
243 | /* | ||
244 | * TIPC subscription routines | ||
245 | */ | ||
246 | |||
247 | int tipc_ispublished(struct tipc_name const *name); | ||
248 | |||
249 | /* | ||
250 | * Get number of available nodes within specified domain (excluding own node) | ||
251 | */ | ||
252 | |||
253 | unsigned int tipc_available_nodes(const u32 domain); | ||
254 | |||
255 | #endif | ||
256 | |||
257 | #endif | ||
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h new file mode 100644 index 000000000000..098607cd4b78 --- /dev/null +++ b/include/net/tipc/tipc_bearer.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * include/net/tipc/tipc_bearer.h: Include file for privileged access to TIPC bearers | ||
3 | * | ||
4 | * Copyright (c) 2003-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _NET_TIPC_BEARER_H_ | ||
38 | #define _NET_TIPC_BEARER_H_ | ||
39 | |||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | #include <linux/tipc_config.h> | ||
43 | #include <linux/skbuff.h> | ||
44 | #include <linux/spinlock.h> | ||
45 | |||
46 | /* | ||
47 | * Identifiers of supported TIPC media types | ||
48 | */ | ||
49 | |||
50 | #define TIPC_MEDIA_TYPE_ETH 1 | ||
51 | |||
52 | struct tipc_media_addr { | ||
53 | __u32 type; | ||
54 | union { | ||
55 | __u8 eth_addr[6]; /* Ethernet bearer */ | ||
56 | #if 0 | ||
57 | /* Prototypes for other possible bearer types */ | ||
58 | |||
59 | struct { | ||
60 | __u16 sin_family; | ||
61 | __u16 sin_port; | ||
62 | struct { | ||
63 | __u32 s_addr; | ||
64 | } sin_addr; | ||
65 | char pad[4]; | ||
66 | } addr_in; /* IP-based bearer */ | ||
67 | __u16 sock_descr; /* generic socket bearer */ | ||
68 | #endif | ||
69 | } dev_addr; | ||
70 | }; | ||
71 | |||
72 | /** | ||
73 | * struct tipc_bearer - TIPC bearer info available to privileged users | ||
74 | * @usr_handle: pointer to additional user-defined information about bearer | ||
75 | * @mtu: max packet size bearer can support | ||
76 | * @blocked: non-zero if bearer is blocked | ||
77 | * @lock: spinlock for controlling access to bearer | ||
78 | * @addr: media-specific address associated with bearer | ||
79 | * @name: bearer name (format = media:interface) | ||
80 | * | ||
81 | * Note: TIPC initializes "name" and "lock" fields; user is responsible for | ||
82 | * initialization all other fields when a bearer is enabled. | ||
83 | */ | ||
84 | |||
85 | struct tipc_bearer { | ||
86 | void *usr_handle; | ||
87 | u32 mtu; | ||
88 | int blocked; | ||
89 | spinlock_t lock; | ||
90 | struct tipc_media_addr addr; | ||
91 | char name[TIPC_MAX_BEARER_NAME]; | ||
92 | }; | ||
93 | |||
94 | |||
95 | int tipc_register_media(u32 media_type, | ||
96 | char *media_name, | ||
97 | int (*enable)(struct tipc_bearer *), | ||
98 | void (*disable)(struct tipc_bearer *), | ||
99 | int (*send_msg)(struct sk_buff *, | ||
100 | struct tipc_bearer *, | ||
101 | struct tipc_media_addr *), | ||
102 | char *(*addr2str)(struct tipc_media_addr *a, | ||
103 | char *str_buf, | ||
104 | int str_size), | ||
105 | struct tipc_media_addr *bcast_addr, | ||
106 | const u32 bearer_priority, | ||
107 | const u32 link_tolerance, /* [ms] */ | ||
108 | const u32 send_window_limit); | ||
109 | |||
110 | void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr); | ||
111 | |||
112 | int tipc_block_bearer(const char *name); | ||
113 | void tipc_continue(struct tipc_bearer *tb_ptr); | ||
114 | |||
115 | int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority); | ||
116 | int tipc_disable_bearer(const char *name); | ||
117 | |||
118 | |||
119 | #endif | ||
120 | |||
121 | #endif | ||
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h new file mode 100644 index 000000000000..4d096eebc93f --- /dev/null +++ b/include/net/tipc/tipc_msg.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /* | ||
2 | * include/net/tipc/tipc_msg.h: Include file for privileged access to TIPC message headers | ||
3 | * | ||
4 | * Copyright (c) 2003-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _NET_TIPC_MSG_H_ | ||
38 | #define _NET_TIPC_MSG_H_ | ||
39 | |||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | struct tipc_msg { | ||
43 | u32 hdr[15]; | ||
44 | }; | ||
45 | |||
46 | |||
47 | /* | ||
48 | TIPC user data message header format, version 2: | ||
49 | |||
50 | |||
51 | 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 | ||
52 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
53 | w0:|vers | user |hdr sz |n|d|s|-| message size | | ||
54 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
55 | w1:|mstyp| error |rer cnt|lsc|opt p| broadcast ack no | | ||
56 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
57 | w2:| link level ack no | broadcast/link level seq no | | ||
58 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
59 | w3:| previous node | | ||
60 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
61 | w4:| originating port | | ||
62 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
63 | w5:| destination port | | ||
64 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
65 | w6:| originating node | | ||
66 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
67 | w7:| destination node | | ||
68 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
69 | w8:| name type / transport sequence number | | ||
70 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
71 | w9:| name instance/multicast lower bound | | ||
72 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
73 | wA:| multicast upper bound | | ||
74 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
75 | / / | ||
76 | \ options \ | ||
77 | / / | ||
78 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
79 | |||
80 | */ | ||
81 | |||
82 | #define TIPC_CONN_MSG 0 | ||
83 | #define TIPC_MCAST_MSG 1 | ||
84 | #define TIPC_NAMED_MSG 2 | ||
85 | #define TIPC_DIRECT_MSG 3 | ||
86 | |||
87 | |||
88 | static inline u32 msg_word(struct tipc_msg *m, u32 pos) | ||
89 | { | ||
90 | return ntohl(m->hdr[pos]); | ||
91 | } | ||
92 | |||
93 | static inline u32 msg_bits(struct tipc_msg *m, u32 w, u32 pos, u32 mask) | ||
94 | { | ||
95 | return (msg_word(m, w) >> pos) & mask; | ||
96 | } | ||
97 | |||
98 | static inline u32 msg_importance(struct tipc_msg *m) | ||
99 | { | ||
100 | return msg_bits(m, 0, 25, 0xf); | ||
101 | } | ||
102 | |||
103 | static inline u32 msg_hdr_sz(struct tipc_msg *m) | ||
104 | { | ||
105 | return msg_bits(m, 0, 21, 0xf) << 2; | ||
106 | } | ||
107 | |||
108 | static inline int msg_short(struct tipc_msg *m) | ||
109 | { | ||
110 | return (msg_hdr_sz(m) == 24); | ||
111 | } | ||
112 | |||
113 | static inline u32 msg_size(struct tipc_msg *m) | ||
114 | { | ||
115 | return msg_bits(m, 0, 0, 0x1ffff); | ||
116 | } | ||
117 | |||
118 | static inline u32 msg_data_sz(struct tipc_msg *m) | ||
119 | { | ||
120 | return (msg_size(m) - msg_hdr_sz(m)); | ||
121 | } | ||
122 | |||
123 | static inline unchar *msg_data(struct tipc_msg *m) | ||
124 | { | ||
125 | return ((unchar *)m) + msg_hdr_sz(m); | ||
126 | } | ||
127 | |||
128 | static inline u32 msg_type(struct tipc_msg *m) | ||
129 | { | ||
130 | return msg_bits(m, 1, 29, 0x7); | ||
131 | } | ||
132 | |||
133 | static inline u32 msg_direct(struct tipc_msg *m) | ||
134 | { | ||
135 | return (msg_type(m) == TIPC_DIRECT_MSG); | ||
136 | } | ||
137 | |||
138 | static inline u32 msg_named(struct tipc_msg *m) | ||
139 | { | ||
140 | return (msg_type(m) == TIPC_NAMED_MSG); | ||
141 | } | ||
142 | |||
143 | static inline u32 msg_mcast(struct tipc_msg *m) | ||
144 | { | ||
145 | return (msg_type(m) == TIPC_MCAST_MSG); | ||
146 | } | ||
147 | |||
148 | static inline u32 msg_connected(struct tipc_msg *m) | ||
149 | { | ||
150 | return (msg_type(m) == TIPC_CONN_MSG); | ||
151 | } | ||
152 | |||
153 | static inline u32 msg_errcode(struct tipc_msg *m) | ||
154 | { | ||
155 | return msg_bits(m, 1, 25, 0xf); | ||
156 | } | ||
157 | |||
158 | static inline u32 msg_prevnode(struct tipc_msg *m) | ||
159 | { | ||
160 | return msg_word(m, 3); | ||
161 | } | ||
162 | |||
163 | static inline u32 msg_origport(struct tipc_msg *m) | ||
164 | { | ||
165 | return msg_word(m, 4); | ||
166 | } | ||
167 | |||
168 | static inline u32 msg_destport(struct tipc_msg *m) | ||
169 | { | ||
170 | return msg_word(m, 5); | ||
171 | } | ||
172 | |||
173 | static inline u32 msg_mc_netid(struct tipc_msg *m) | ||
174 | { | ||
175 | return msg_word(m, 5); | ||
176 | } | ||
177 | |||
178 | static inline u32 msg_orignode(struct tipc_msg *m) | ||
179 | { | ||
180 | if (likely(msg_short(m))) | ||
181 | return msg_prevnode(m); | ||
182 | return msg_word(m, 6); | ||
183 | } | ||
184 | |||
185 | static inline u32 msg_destnode(struct tipc_msg *m) | ||
186 | { | ||
187 | return msg_word(m, 7); | ||
188 | } | ||
189 | |||
190 | static inline u32 msg_nametype(struct tipc_msg *m) | ||
191 | { | ||
192 | return msg_word(m, 8); | ||
193 | } | ||
194 | |||
195 | static inline u32 msg_nameinst(struct tipc_msg *m) | ||
196 | { | ||
197 | return msg_word(m, 9); | ||
198 | } | ||
199 | |||
200 | static inline u32 msg_namelower(struct tipc_msg *m) | ||
201 | { | ||
202 | return msg_nameinst(m); | ||
203 | } | ||
204 | |||
205 | static inline u32 msg_nameupper(struct tipc_msg *m) | ||
206 | { | ||
207 | return msg_word(m, 10); | ||
208 | } | ||
209 | |||
210 | static inline char *msg_options(struct tipc_msg *m, u32 *len) | ||
211 | { | ||
212 | u32 pos = msg_bits(m, 1, 16, 0x7); | ||
213 | |||
214 | if (!pos) | ||
215 | return 0; | ||
216 | pos = (pos * 4) + 28; | ||
217 | *len = msg_hdr_sz(m) - pos; | ||
218 | return (char *)&m->hdr[pos/4]; | ||
219 | } | ||
220 | |||
221 | #endif | ||
222 | |||
223 | #endif | ||
diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h new file mode 100644 index 000000000000..333bba6dc522 --- /dev/null +++ b/include/net/tipc/tipc_port.h | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * include/net/tipc/tipc_port.h: Include file for privileged access to TIPC ports | ||
3 | * | ||
4 | * Copyright (c) 1994-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _NET_TIPC_PORT_H_ | ||
38 | #define _NET_TIPC_PORT_H_ | ||
39 | |||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | #include <linux/tipc.h> | ||
43 | #include <linux/skbuff.h> | ||
44 | #include <net/tipc/tipc_msg.h> | ||
45 | |||
46 | #define TIPC_FLOW_CONTROL_WIN 512 | ||
47 | |||
48 | /** | ||
49 | * struct tipc_port - native TIPC port info available to privileged users | ||
50 | * @usr_handle: pointer to additional user-defined information about port | ||
51 | * @lock: pointer to spinlock for controlling access to port | ||
52 | * @connected: non-zero if port is currently connected to a peer port | ||
53 | * @conn_type: TIPC type used when connection was established | ||
54 | * @conn_instance: TIPC instance used when connection was established | ||
55 | * @conn_unacked: number of unacknowledged messages received from peer port | ||
56 | * @published: non-zero if port has one or more associated names | ||
57 | * @congested: non-zero if cannot send because of link or port congestion | ||
58 | * @ref: unique reference to port in TIPC object registry | ||
59 | * @phdr: preformatted message header used when sending messages | ||
60 | */ | ||
61 | |||
62 | struct tipc_port { | ||
63 | void *usr_handle; | ||
64 | spinlock_t *lock; | ||
65 | int connected; | ||
66 | u32 conn_type; | ||
67 | u32 conn_instance; | ||
68 | u32 conn_unacked; | ||
69 | int published; | ||
70 | u32 congested; | ||
71 | u32 ref; | ||
72 | struct tipc_msg phdr; | ||
73 | }; | ||
74 | |||
75 | |||
76 | /** | ||
77 | * tipc_createport_raw - create a native TIPC port and return it's reference | ||
78 | * | ||
79 | * Note: 'dispatcher' and 'wakeup' deliver a locked port. | ||
80 | */ | ||
81 | |||
82 | u32 tipc_createport_raw(void *usr_handle, | ||
83 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), | ||
84 | void (*wakeup)(struct tipc_port *), | ||
85 | const u32 importance); | ||
86 | |||
87 | /* | ||
88 | * tipc_set_msg_option(): port must be locked. | ||
89 | */ | ||
90 | int tipc_set_msg_option(struct tipc_port *tp_ptr, | ||
91 | const char *opt, | ||
92 | const u32 len); | ||
93 | |||
94 | int tipc_reject_msg(struct sk_buff *buf, u32 err); | ||
95 | |||
96 | int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode); | ||
97 | |||
98 | void tipc_acknowledge(u32 port_ref,u32 ack); | ||
99 | |||
100 | struct tipc_port *tipc_get_port(const u32 ref); | ||
101 | |||
102 | void *tipc_get_handle(const u32 ref); | ||
103 | |||
104 | |||
105 | #endif | ||
106 | |||
107 | #endif | ||
108 | |||