tipc.h 7.4 KB

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