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 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
21 * Alternatively, this software may be distributed under the terms of the
22 * GNU General Public License ("GPL") version 2 as published by the Free
23 * Software Foundation.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
43 #include <linux/tipc.h>
44 #include <linux/skbuff.h>
52 * TIPC operating mode routines
55 u32 tipc_get_addr(void);
57 #define TIPC_NOT_RUNNING 0
58 #define TIPC_NODE_MODE 1
59 #define TIPC_NET_MODE 2
61 typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
63 int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
65 void tipc_detach(unsigned int userref);
67 int tipc_get_mode(void);
70 * TIPC port manipulation routines
73 typedef void (*tipc_msg_err_event) (void *usr_handle,
76 unsigned char const *data,
79 struct tipc_portid const *attmpt_destid);
81 typedef void (*tipc_named_msg_err_event) (void *usr_handle,
84 unsigned char const *data,
87 struct tipc_name_seq const *attmpt_dest);
89 typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
92 unsigned char const *data,
96 typedef void (*tipc_msg_event) (void *usr_handle,
99 unsigned char const *data,
101 unsigned int importance,
102 struct tipc_portid const *origin);
104 typedef void (*tipc_named_msg_event) (void *usr_handle,
106 struct sk_buff **buf,
107 unsigned char const *data,
109 unsigned int importance,
110 struct tipc_portid const *orig,
111 struct tipc_name_seq const *dest);
113 typedef void (*tipc_conn_msg_event) (void *usr_handle,
115 struct sk_buff **buf,
116 unsigned char const *data,
119 typedef void (*tipc_continue_event) (void *usr_handle,
122 int tipc_createport(unsigned int tipc_user,
124 unsigned int importance,
125 tipc_msg_err_event error_cb,
126 tipc_named_msg_err_event named_error_cb,
127 tipc_conn_shutdown_event conn_error_cb,
128 tipc_msg_event message_cb,
129 tipc_named_msg_event named_message_cb,
130 tipc_conn_msg_event conn_message_cb,
131 tipc_continue_event continue_event_cb,/* May be zero */
134 int tipc_deleteport(u32 portref);
136 int tipc_ownidentity(u32 portref, struct tipc_portid *port);
138 int tipc_portimportance(u32 portref, unsigned int *importance);
139 int tipc_set_portimportance(u32 portref, unsigned int importance);
141 int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
142 int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
144 int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
145 int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
147 int tipc_publish(u32 portref, unsigned int scope,
148 struct tipc_name_seq const *name_seq);
149 int tipc_withdraw(u32 portref, unsigned int scope,
150 struct tipc_name_seq const *name_seq); /* 0: all */
152 int tipc_connect2port(u32 portref, struct tipc_portid const *port);
154 int tipc_disconnect(u32 portref);
156 int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
158 int tipc_isconnected(u32 portref, int *isconnected);
160 int tipc_peer(u32 portref, struct tipc_portid *peer);
162 int tipc_ref_valid(u32 portref);
165 * TIPC messaging routines
168 #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
171 int tipc_send(u32 portref,
172 unsigned int num_sect,
173 struct iovec const *msg_sect);
175 int tipc_send_buf(u32 portref,
179 int tipc_send2name(u32 portref,
180 struct tipc_name const *name,
181 u32 domain, /* 0:own zone */
182 unsigned int num_sect,
183 struct iovec const *msg_sect);
185 int tipc_send_buf2name(u32 portref,
186 struct tipc_name const *name,
191 int tipc_forward2name(u32 portref,
192 struct tipc_name const *name,
193 u32 domain, /*0: own zone */
194 unsigned int section_count,
195 struct iovec const *msg_sect,
196 struct tipc_portid const *origin,
197 unsigned int importance);
199 int tipc_forward_buf2name(u32 portref,
200 struct tipc_name const *name,
204 struct tipc_portid const *orig,
205 unsigned int importance);
207 int tipc_send2port(u32 portref,
208 struct tipc_portid const *dest,
209 unsigned int num_sect,
210 struct iovec const *msg_sect);
212 int tipc_send_buf2port(u32 portref,
213 struct tipc_portid const *dest,
217 int tipc_forward2port(u32 portref,
218 struct tipc_portid const *dest,
219 unsigned int num_sect,
220 struct iovec const *msg_sect,
221 struct tipc_portid const *origin,
222 unsigned int importance);
224 int tipc_forward_buf2port(u32 portref,
225 struct tipc_portid const *dest,
228 struct tipc_portid const *orig,
229 unsigned int importance);
231 int tipc_multicast(u32 portref,
232 struct tipc_name_seq const *seq,
233 u32 domain, /* 0:own zone */
234 unsigned int section_count,
235 struct iovec const *msg);
238 int tipc_multicast_buf(u32 portref,
239 struct tipc_name_seq const *seq,
240 u32 domain, /* 0:own zone */
246 * TIPC subscription routines
249 int tipc_ispublished(struct tipc_name const *name);
252 * Get number of available nodes within specified domain (excluding own node)
255 unsigned int tipc_available_nodes(const u32 domain);