blob: 560a329660fdb89f5f51420e4cb8e3aefca6d8b4 [file] [log] [blame]
Per Lidenb97bf3f2006-01-02 19:04:38 +01001/*
2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 *
Per Liden9da1c8b2006-01-11 18:40:41 +01004 * Copyright (c) 2003-2006, Ericsson AB
Per Lidenb97bf3f2006-01-02 19:04:38 +01005 * Copyright (c) 2005, Wind River Systems
Per Lidenb97bf3f2006-01-02 19:04:38 +01006 * All rights reserved.
7 *
Per Liden9ea1fd32006-01-11 13:30:43 +01008 * Redistribution and use in source and binary forms, with or without
Per Lidenb97bf3f2006-01-02 19:04:38 +01009 * modification, are permitted provided that the following conditions are met:
10 *
Per Liden9ea1fd32006-01-11 13:30:43 +010011 * 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.
Per Lidenb97bf3f2006-01-02 19:04:38 +010019 *
Per Liden9ea1fd32006-01-11 13:30:43 +010020 * 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
Per Lidenb97bf3f2006-01-02 19:04:38 +010034 * 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/*
51 * TIPC operating mode routines
52 */
53
54u32 tipc_get_addr(void);
55
56#define TIPC_NOT_RUNNING 0
57#define TIPC_NODE_MODE 1
58#define TIPC_NET_MODE 2
59
60typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
61
62int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
63
64void tipc_detach(unsigned int userref);
65
66int tipc_get_mode(void);
67
68/*
69 * TIPC port manipulation routines
70 */
71
72typedef void (*tipc_msg_err_event) (void *usr_handle,
73 u32 portref,
74 struct sk_buff **buf,
75 unsigned char const *data,
76 unsigned int size,
77 int reason,
78 struct tipc_portid const *attmpt_destid);
79
80typedef void (*tipc_named_msg_err_event) (void *usr_handle,
81 u32 portref,
82 struct sk_buff **buf,
83 unsigned char const *data,
84 unsigned int size,
85 int reason,
86 struct tipc_name_seq const *attmpt_dest);
87
88typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
89 u32 portref,
90 struct sk_buff **buf,
91 unsigned char const *data,
92 unsigned int size,
93 int reason);
94
95typedef void (*tipc_msg_event) (void *usr_handle,
96 u32 portref,
97 struct sk_buff **buf,
98 unsigned char const *data,
99 unsigned int size,
100 unsigned int importance,
101 struct tipc_portid const *origin);
102
103typedef void (*tipc_named_msg_event) (void *usr_handle,
104 u32 portref,
105 struct sk_buff **buf,
106 unsigned char const *data,
107 unsigned int size,
108 unsigned int importance,
109 struct tipc_portid const *orig,
110 struct tipc_name_seq const *dest);
111
112typedef void (*tipc_conn_msg_event) (void *usr_handle,
113 u32 portref,
114 struct sk_buff **buf,
115 unsigned char const *data,
116 unsigned int size);
117
118typedef void (*tipc_continue_event) (void *usr_handle,
119 u32 portref);
120
121int tipc_createport(unsigned int tipc_user,
122 void *usr_handle,
123 unsigned int importance,
124 tipc_msg_err_event error_cb,
125 tipc_named_msg_err_event named_error_cb,
126 tipc_conn_shutdown_event conn_error_cb,
127 tipc_msg_event message_cb,
128 tipc_named_msg_event named_message_cb,
129 tipc_conn_msg_event conn_message_cb,
130 tipc_continue_event continue_event_cb,/* May be zero */
131 u32 *portref);
132
133int tipc_deleteport(u32 portref);
134
135int tipc_ownidentity(u32 portref, struct tipc_portid *port);
136
137int tipc_portimportance(u32 portref, unsigned int *importance);
138int tipc_set_portimportance(u32 portref, unsigned int importance);
139
140int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
141int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
142
143int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
144int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
145
146int tipc_publish(u32 portref, unsigned int scope,
147 struct tipc_name_seq const *name_seq);
148int tipc_withdraw(u32 portref, unsigned int scope,
149 struct tipc_name_seq const *name_seq); /* 0: all */
150
151int tipc_connect2port(u32 portref, struct tipc_portid const *port);
152
153int tipc_disconnect(u32 portref);
154
155int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
156
157int tipc_isconnected(u32 portref, int *isconnected);
158
159int tipc_peer(u32 portref, struct tipc_portid *peer);
160
161int tipc_ref_valid(u32 portref);
162
163/*
164 * TIPC messaging routines
165 */
166
167#define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
168
169
170int tipc_send(u32 portref,
171 unsigned int num_sect,
172 struct iovec const *msg_sect);
173
174int tipc_send_buf(u32 portref,
175 struct sk_buff *buf,
176 unsigned int dsz);
177
178int tipc_send2name(u32 portref,
179 struct tipc_name const *name,
180 u32 domain, /* 0:own zone */
181 unsigned int num_sect,
182 struct iovec const *msg_sect);
183
184int tipc_send_buf2name(u32 portref,
185 struct tipc_name const *name,
186 u32 domain,
187 struct sk_buff *buf,
188 unsigned int dsz);
189
190int tipc_forward2name(u32 portref,
191 struct tipc_name const *name,
192 u32 domain, /*0: own zone */
193 unsigned int section_count,
194 struct iovec const *msg_sect,
195 struct tipc_portid const *origin,
196 unsigned int importance);
197
198int tipc_forward_buf2name(u32 portref,
199 struct tipc_name const *name,
200 u32 domain,
201 struct sk_buff *buf,
202 unsigned int dsz,
203 struct tipc_portid const *orig,
204 unsigned int importance);
205
206int tipc_send2port(u32 portref,
207 struct tipc_portid const *dest,
208 unsigned int num_sect,
209 struct iovec const *msg_sect);
210
211int tipc_send_buf2port(u32 portref,
212 struct tipc_portid const *dest,
213 struct sk_buff *buf,
214 unsigned int dsz);
215
216int tipc_forward2port(u32 portref,
217 struct tipc_portid const *dest,
218 unsigned int num_sect,
219 struct iovec const *msg_sect,
220 struct tipc_portid const *origin,
221 unsigned int importance);
222
223int tipc_forward_buf2port(u32 portref,
224 struct tipc_portid const *dest,
225 struct sk_buff *buf,
226 unsigned int dsz,
227 struct tipc_portid const *orig,
228 unsigned int importance);
229
230int tipc_multicast(u32 portref,
231 struct tipc_name_seq const *seq,
232 u32 domain, /* 0:own zone */
233 unsigned int section_count,
234 struct iovec const *msg);
235
236#if 0
237int tipc_multicast_buf(u32 portref,
238 struct tipc_name_seq const *seq,
239 u32 domain, /* 0:own zone */
240 void *buf,
241 unsigned int size);
242#endif
243
244/*
245 * TIPC subscription routines
246 */
247
248int tipc_ispublished(struct tipc_name const *name);
249
250/*
251 * Get number of available nodes within specified domain (excluding own node)
252 */
253
254unsigned int tipc_available_nodes(const u32 domain);
255
256#endif
257
258#endif