2 * include/net/tipc/tipc.h: Main include file for TIPC users
4 * Copyright (c) 2003-2005, Ericsson Research Canada
5 * Copyright (c) 2005, Wind River Systems
6 * Copyright (c) 2005-2006, Ericsson AB
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
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.
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.
39 #include <linux/tipc.h>
40 #include <linux/skbuff.h>
48 * TIPC operating mode routines
51 u32 tipc_get_addr(void);
53 #define TIPC_NOT_RUNNING 0
54 #define TIPC_NODE_MODE 1
55 #define TIPC_NET_MODE 2
57 typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
59 int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
61 void tipc_detach(unsigned int userref);
63 int tipc_get_mode(void);
66 * TIPC port manipulation routines
69 typedef void (*tipc_msg_err_event) (void *usr_handle,
72 unsigned char const *data,
75 struct tipc_portid const *attmpt_destid);
77 typedef void (*tipc_named_msg_err_event) (void *usr_handle,
80 unsigned char const *data,
83 struct tipc_name_seq const *attmpt_dest);
85 typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
88 unsigned char const *data,
92 typedef void (*tipc_msg_event) (void *usr_handle,
95 unsigned char const *data,
97 unsigned int importance,
98 struct tipc_portid const *origin);
100 typedef void (*tipc_named_msg_event) (void *usr_handle,
102 struct sk_buff **buf,
103 unsigned char const *data,
105 unsigned int importance,
106 struct tipc_portid const *orig,
107 struct tipc_name_seq const *dest);
109 typedef void (*tipc_conn_msg_event) (void *usr_handle,
111 struct sk_buff **buf,
112 unsigned char const *data,
115 typedef void (*tipc_continue_event) (void *usr_handle,
118 int tipc_createport(unsigned int tipc_user,
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 */
130 int tipc_deleteport(u32 portref);
132 int tipc_ownidentity(u32 portref, struct tipc_portid *port);
134 int tipc_portimportance(u32 portref, unsigned int *importance);
135 int tipc_set_portimportance(u32 portref, unsigned int importance);
137 int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
138 int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
140 int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
141 int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
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 */
148 int tipc_connect2port(u32 portref, struct tipc_portid const *port);
150 int tipc_disconnect(u32 portref);
152 int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
154 int tipc_isconnected(u32 portref, int *isconnected);
156 int tipc_peer(u32 portref, struct tipc_portid *peer);
158 int tipc_ref_valid(u32 portref);
161 * TIPC messaging routines
164 #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
167 int tipc_send(u32 portref,
168 unsigned int num_sect,
169 struct iovec const *msg_sect);
171 int tipc_send_buf(u32 portref,
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);
181 int tipc_send_buf2name(u32 portref,
182 struct tipc_name const *name,
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);
195 int tipc_forward_buf2name(u32 portref,
196 struct tipc_name const *name,
200 struct tipc_portid const *orig,
201 unsigned int importance);
203 int tipc_send2port(u32 portref,
204 struct tipc_portid const *dest,
205 unsigned int num_sect,
206 struct iovec const *msg_sect);
208 int tipc_send_buf2port(u32 portref,
209 struct tipc_portid const *dest,
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);
220 int tipc_forward_buf2port(u32 portref,
221 struct tipc_portid const *dest,
224 struct tipc_portid const *orig,
225 unsigned int importance);
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);
234 int tipc_multicast_buf(u32 portref,
235 struct tipc_name_seq const *seq,
236 u32 domain, /* 0:own zone */
242 * TIPC subscription routines
245 int tipc_ispublished(struct tipc_name const *name);
248 * Get number of available nodes within specified domain (excluding own node)
251 unsigned int tipc_available_nodes(const u32 domain);