tipc.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. * 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.
  20. *
  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.
  24. *
  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.
  36. */
  37. #ifndef _NET_TIPC_H_
  38. #define _NET_TIPC_H_
  39. #ifdef __KERNEL__
  40. #include <linux/tipc.h>
  41. #include <linux/skbuff.h>
  42. /*
  43. * Native API
  44. * ----------
  45. */
  46. /*
  47. * TIPC operating mode routines
  48. */
  49. u32 tipc_get_addr(void);
  50. #define TIPC_NOT_RUNNING 0
  51. #define TIPC_NODE_MODE 1
  52. #define TIPC_NET_MODE 2
  53. typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
  54. int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
  55. void tipc_detach(unsigned int userref);
  56. int tipc_get_mode(void);
  57. /*
  58. * TIPC port manipulation routines
  59. */
  60. typedef void (*tipc_msg_err_event) (void *usr_handle,
  61. u32 portref,
  62. struct sk_buff **buf,
  63. unsigned char const *data,
  64. unsigned int size,
  65. int reason,
  66. struct tipc_portid const *attmpt_destid);
  67. typedef void (*tipc_named_msg_err_event) (void *usr_handle,
  68. u32 portref,
  69. struct sk_buff **buf,
  70. unsigned char const *data,
  71. unsigned int size,
  72. int reason,
  73. struct tipc_name_seq const *attmpt_dest);
  74. typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
  75. u32 portref,
  76. struct sk_buff **buf,
  77. unsigned char const *data,
  78. unsigned int size,
  79. int reason);
  80. typedef void (*tipc_msg_event) (void *usr_handle,
  81. u32 portref,
  82. struct sk_buff **buf,
  83. unsigned char const *data,
  84. unsigned int size,
  85. unsigned int importance,
  86. struct tipc_portid const *origin);
  87. typedef void (*tipc_named_msg_event) (void *usr_handle,
  88. u32 portref,
  89. struct sk_buff **buf,
  90. unsigned char const *data,
  91. unsigned int size,
  92. unsigned int importance,
  93. struct tipc_portid const *orig,
  94. struct tipc_name_seq const *dest);
  95. typedef void (*tipc_conn_msg_event) (void *usr_handle,
  96. u32 portref,
  97. struct sk_buff **buf,
  98. unsigned char const *data,
  99. unsigned int size);
  100. typedef void (*tipc_continue_event) (void *usr_handle,
  101. u32 portref);
  102. int tipc_createport(unsigned int tipc_user,
  103. void *usr_handle,
  104. unsigned int importance,
  105. tipc_msg_err_event error_cb,
  106. tipc_named_msg_err_event named_error_cb,
  107. tipc_conn_shutdown_event conn_error_cb,
  108. tipc_msg_event message_cb,
  109. tipc_named_msg_event named_message_cb,
  110. tipc_conn_msg_event conn_message_cb,
  111. tipc_continue_event continue_event_cb,/* May be zero */
  112. u32 *portref);
  113. int tipc_deleteport(u32 portref);
  114. int tipc_ownidentity(u32 portref, struct tipc_portid *port);
  115. int tipc_portimportance(u32 portref, unsigned int *importance);
  116. int tipc_set_portimportance(u32 portref, unsigned int importance);
  117. int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
  118. int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
  119. int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
  120. int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
  121. int tipc_publish(u32 portref, unsigned int scope,
  122. struct tipc_name_seq const *name_seq);
  123. int tipc_withdraw(u32 portref, unsigned int scope,
  124. struct tipc_name_seq const *name_seq); /* 0: all */
  125. int tipc_connect2port(u32 portref, struct tipc_portid const *port);
  126. int tipc_disconnect(u32 portref);
  127. int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
  128. int tipc_isconnected(u32 portref, int *isconnected);
  129. int tipc_peer(u32 portref, struct tipc_portid *peer);
  130. int tipc_ref_valid(u32 portref);
  131. /*
  132. * TIPC messaging routines
  133. */
  134. #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
  135. int tipc_send(u32 portref,
  136. unsigned int num_sect,
  137. struct iovec const *msg_sect);
  138. int tipc_send_buf(u32 portref,
  139. struct sk_buff *buf,
  140. unsigned int dsz);
  141. int tipc_send2name(u32 portref,
  142. struct tipc_name const *name,
  143. u32 domain, /* 0:own zone */
  144. unsigned int num_sect,
  145. struct iovec const *msg_sect);
  146. int tipc_send_buf2name(u32 portref,
  147. struct tipc_name const *name,
  148. u32 domain,
  149. struct sk_buff *buf,
  150. unsigned int dsz);
  151. int tipc_forward2name(u32 portref,
  152. struct tipc_name const *name,
  153. u32 domain, /*0: own zone */
  154. unsigned int section_count,
  155. struct iovec const *msg_sect,
  156. struct tipc_portid const *origin,
  157. unsigned int importance);
  158. int tipc_forward_buf2name(u32 portref,
  159. struct tipc_name const *name,
  160. u32 domain,
  161. struct sk_buff *buf,
  162. unsigned int dsz,
  163. struct tipc_portid const *orig,
  164. unsigned int importance);
  165. int tipc_send2port(u32 portref,
  166. struct tipc_portid const *dest,
  167. unsigned int num_sect,
  168. struct iovec const *msg_sect);
  169. int tipc_send_buf2port(u32 portref,
  170. struct tipc_portid const *dest,
  171. struct sk_buff *buf,
  172. unsigned int dsz);
  173. int tipc_forward2port(u32 portref,
  174. struct tipc_portid const *dest,
  175. unsigned int num_sect,
  176. struct iovec const *msg_sect,
  177. struct tipc_portid const *origin,
  178. unsigned int importance);
  179. int tipc_forward_buf2port(u32 portref,
  180. struct tipc_portid const *dest,
  181. struct sk_buff *buf,
  182. unsigned int dsz,
  183. struct tipc_portid const *orig,
  184. unsigned int importance);
  185. int tipc_multicast(u32 portref,
  186. struct tipc_name_seq const *seq,
  187. u32 domain, /* 0:own zone */
  188. unsigned int section_count,
  189. struct iovec const *msg);
  190. #if 0
  191. int tipc_multicast_buf(u32 portref,
  192. struct tipc_name_seq const *seq,
  193. u32 domain, /* 0:own zone */
  194. void *buf,
  195. unsigned int size);
  196. #endif
  197. /*
  198. * TIPC subscription routines
  199. */
  200. int tipc_ispublished(struct tipc_name const *name);
  201. /*
  202. * Get number of available nodes within specified domain (excluding own node)
  203. */
  204. unsigned int tipc_available_nodes(const u32 domain);
  205. #endif
  206. #endif