tipc.h 7.5 KB

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