]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/linux-26-headers/include/net/tipc/tipc.h
Inital import
[l4.git] / l4 / pkg / linux-26-headers / include / net / tipc / tipc.h
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