]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/net/tipc/tipc.h
[TIPC] Initial merge
[mirror_ubuntu-jammy-kernel.git] / include / net / tipc / tipc.h
1 /*
2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 *
4 * Copyright (c) 2003-2005, Ericsson Research Canada
5 * Copyright (c) 2005, Wind River Systems
6 * Copyright (c) 2005-2006, Ericsson AB
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef _NET_TIPC_H_
35 #define _NET_TIPC_H_
36
37 #ifdef __KERNEL__
38
39 #include <linux/tipc.h>
40 #include <linux/skbuff.h>
41
42 /*
43 * Native API
44 * ----------
45 */
46
47 /*
48 * TIPC operating mode routines
49 */
50
51 u32 tipc_get_addr(void);
52
53 #define TIPC_NOT_RUNNING 0
54 #define TIPC_NODE_MODE 1
55 #define TIPC_NET_MODE 2
56
57 typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
58
59 int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
60
61 void tipc_detach(unsigned int userref);
62
63 int tipc_get_mode(void);
64
65 /*
66 * TIPC port manipulation routines
67 */
68
69 typedef void (*tipc_msg_err_event) (void *usr_handle,
70 u32 portref,
71 struct sk_buff **buf,
72 unsigned char const *data,
73 unsigned int size,
74 int reason,
75 struct tipc_portid const *attmpt_destid);
76
77 typedef void (*tipc_named_msg_err_event) (void *usr_handle,
78 u32 portref,
79 struct sk_buff **buf,
80 unsigned char const *data,
81 unsigned int size,
82 int reason,
83 struct tipc_name_seq const *attmpt_dest);
84
85 typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
86 u32 portref,
87 struct sk_buff **buf,
88 unsigned char const *data,
89 unsigned int size,
90 int reason);
91
92 typedef void (*tipc_msg_event) (void *usr_handle,
93 u32 portref,
94 struct sk_buff **buf,
95 unsigned char const *data,
96 unsigned int size,
97 unsigned int importance,
98 struct tipc_portid const *origin);
99
100 typedef void (*tipc_named_msg_event) (void *usr_handle,
101 u32 portref,
102 struct sk_buff **buf,
103 unsigned char const *data,
104 unsigned int size,
105 unsigned int importance,
106 struct tipc_portid const *orig,
107 struct tipc_name_seq const *dest);
108
109 typedef void (*tipc_conn_msg_event) (void *usr_handle,
110 u32 portref,
111 struct sk_buff **buf,
112 unsigned char const *data,
113 unsigned int size);
114
115 typedef void (*tipc_continue_event) (void *usr_handle,
116 u32 portref);
117
118 int tipc_createport(unsigned int tipc_user,
119 void *usr_handle,
120 unsigned int importance,
121 tipc_msg_err_event error_cb,
122 tipc_named_msg_err_event named_error_cb,
123 tipc_conn_shutdown_event conn_error_cb,
124 tipc_msg_event message_cb,
125 tipc_named_msg_event named_message_cb,
126 tipc_conn_msg_event conn_message_cb,
127 tipc_continue_event continue_event_cb,/* May be zero */
128 u32 *portref);
129
130 int tipc_deleteport(u32 portref);
131
132 int tipc_ownidentity(u32 portref, struct tipc_portid *port);
133
134 int tipc_portimportance(u32 portref, unsigned int *importance);
135 int tipc_set_portimportance(u32 portref, unsigned int importance);
136
137 int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
138 int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
139
140 int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
141 int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
142
143 int tipc_publish(u32 portref, unsigned int scope,
144 struct tipc_name_seq const *name_seq);
145 int tipc_withdraw(u32 portref, unsigned int scope,
146 struct tipc_name_seq const *name_seq); /* 0: all */
147
148 int tipc_connect2port(u32 portref, struct tipc_portid const *port);
149
150 int tipc_disconnect(u32 portref);
151
152 int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
153
154 int tipc_isconnected(u32 portref, int *isconnected);
155
156 int tipc_peer(u32 portref, struct tipc_portid *peer);
157
158 int tipc_ref_valid(u32 portref);
159
160 /*
161 * TIPC messaging routines
162 */
163
164 #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
165
166
167 int tipc_send(u32 portref,
168 unsigned int num_sect,
169 struct iovec const *msg_sect);
170
171 int tipc_send_buf(u32 portref,
172 struct sk_buff *buf,
173 unsigned int dsz);
174
175 int tipc_send2name(u32 portref,
176 struct tipc_name const *name,
177 u32 domain, /* 0:own zone */
178 unsigned int num_sect,
179 struct iovec const *msg_sect);
180
181 int tipc_send_buf2name(u32 portref,
182 struct tipc_name const *name,
183 u32 domain,
184 struct sk_buff *buf,
185 unsigned int dsz);
186
187 int tipc_forward2name(u32 portref,
188 struct tipc_name const *name,
189 u32 domain, /*0: own zone */
190 unsigned int section_count,
191 struct iovec const *msg_sect,
192 struct tipc_portid const *origin,
193 unsigned int importance);
194
195 int tipc_forward_buf2name(u32 portref,
196 struct tipc_name const *name,
197 u32 domain,
198 struct sk_buff *buf,
199 unsigned int dsz,
200 struct tipc_portid const *orig,
201 unsigned int importance);
202
203 int tipc_send2port(u32 portref,
204 struct tipc_portid const *dest,
205 unsigned int num_sect,
206 struct iovec const *msg_sect);
207
208 int tipc_send_buf2port(u32 portref,
209 struct tipc_portid const *dest,
210 struct sk_buff *buf,
211 unsigned int dsz);
212
213 int tipc_forward2port(u32 portref,
214 struct tipc_portid const *dest,
215 unsigned int num_sect,
216 struct iovec const *msg_sect,
217 struct tipc_portid const *origin,
218 unsigned int importance);
219
220 int tipc_forward_buf2port(u32 portref,
221 struct tipc_portid const *dest,
222 struct sk_buff *buf,
223 unsigned int dsz,
224 struct tipc_portid const *orig,
225 unsigned int importance);
226
227 int tipc_multicast(u32 portref,
228 struct tipc_name_seq const *seq,
229 u32 domain, /* 0:own zone */
230 unsigned int section_count,
231 struct iovec const *msg);
232
233 #if 0
234 int tipc_multicast_buf(u32 portref,
235 struct tipc_name_seq const *seq,
236 u32 domain, /* 0:own zone */
237 void *buf,
238 unsigned int size);
239 #endif
240
241 /*
242 * TIPC subscription routines
243 */
244
245 int tipc_ispublished(struct tipc_name const *name);
246
247 /*
248 * Get number of available nodes within specified domain (excluding own node)
249 */
250
251 unsigned int tipc_available_nodes(const u32 domain);
252
253 #endif
254
255 #endif