ipc_evt.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /*
  2. * Copyright (c) 2004-2005 Mark Haverkamp
  3. * Copyright (c) 2004-2005 Open Source Development Lab
  4. *
  5. * All rights reserved.
  6. *
  7. * This software licensed under BSD license, the text of which follows:
  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,
  13. * this 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 name of the Open Source Developement Lab 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
  31. * THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #ifndef IPC_EVT_H_DEFINED
  34. #define IPC_EVT_H_DEFINED
  35. #include <netinet/in.h>
  36. #include "ais_types.h"
  37. #include "saEvt.h"
  38. #include "saClm.h"
  39. #include "ipc_gen.h"
  40. enum req_evt_types {
  41. MESSAGE_REQ_EVT_OPEN_CHANNEL = 1,
  42. MESSAGE_REQ_EVT_CLOSE_CHANNEL,
  43. MESSAGE_REQ_EVT_SUBSCRIBE,
  44. MESSAGE_REQ_EVT_UNSUBSCRIBE,
  45. MESSAGE_REQ_EVT_PUBLISH,
  46. MESSAGE_REQ_EVT_CLEAR_RETENTIONTIME,
  47. MESSAGE_REQ_EVT_EVENT_DATA
  48. };
  49. enum res_evt_types {
  50. MESSAGE_RES_EVT_OPEN_CHANNEL = 1,
  51. MESSAGE_RES_EVT_CLOSE_CHANNEL,
  52. MESSAGE_RES_EVT_SUBSCRIBE,
  53. MESSAGE_RES_EVT_UNSUBSCRIBE,
  54. MESSAGE_RES_EVT_PUBLISH,
  55. MESSAGE_RES_EVT_CLEAR_RETENTIONTIME,
  56. MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK,
  57. MESSAGE_RES_EVT_EVENT_DATA,
  58. MESSAGE_RES_EVT_AVAILABLE
  59. };
  60. /*
  61. * MESSAGE_REQ_EVT_OPEN_CHANNEL
  62. *
  63. * ico_head Request head
  64. * ico_open_flag: Channel open flags
  65. * ico_channel_name: Name of channel to open
  66. * ico_c_handle: Local lib channel handle (used in returned event data)
  67. * ico_timeout: Used only by open
  68. * ico_invocation: Used only by async open
  69. *
  70. */
  71. struct req_evt_channel_open {
  72. struct req_header ico_head;
  73. SaUint8T ico_open_flag;
  74. SaNameT ico_channel_name;
  75. SaEvtChannelHandleT ico_c_handle; /* client chan handle */
  76. SaTimeT ico_timeout; /* open only */
  77. SaInvocationT ico_invocation; /* open async only */
  78. };
  79. /*
  80. * MESSAGE_RES_EVT_OPEN_CHANNEL
  81. *
  82. *
  83. * ico_head: Results head
  84. * ico_error: Request results
  85. * ico_channel_handle: Server side channel handle (used in channel ops)
  86. *
  87. */
  88. struct res_evt_channel_open {
  89. struct res_header ico_head;
  90. uint32_t ico_channel_handle;/* svr chan handle */
  91. };
  92. /*
  93. * MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK
  94. *
  95. * TODO: Define this
  96. */
  97. struct res_evt_open_chan_async {
  98. struct res_header ico_head;
  99. };
  100. /*
  101. * MESSAGE_REQ_EVT_CLOSE_CHANNEL
  102. *
  103. * icc_head: Request head
  104. * icc_channel_handle: Server handle of channel to close
  105. *
  106. */
  107. struct req_evt_channel_close {
  108. struct req_header icc_head;
  109. uint32_t icc_channel_handle;
  110. };
  111. /*
  112. * MESSAGE_RES_EVT_CLOSE_CHANNEL
  113. *
  114. * icc_head: Results head
  115. * icc_error: Request result
  116. *
  117. */
  118. struct res_evt_channel_close {
  119. struct res_header icc_head;
  120. };
  121. /*
  122. * MESSAGE_REQ_EVT_SUBSCRIBE
  123. *
  124. * ics_head: Request head
  125. * ics_channel_handle: Server handle of channel
  126. * ics_sub_id: Subscription ID
  127. * ics_filter_size: Size of supplied filter data
  128. * ics_filter_count: Number of filters supplied
  129. * ics_filter_data: Filter data
  130. *
  131. */
  132. struct req_evt_event_subscribe {
  133. struct req_header ics_head;
  134. uint32_t ics_channel_handle;
  135. SaEvtSubscriptionIdT ics_sub_id;
  136. uint32_t ics_filter_size;
  137. uint32_t ics_filter_count;
  138. uint8_t ics_filter_data[0];
  139. };
  140. /*
  141. * MESSAGE_RES_EVT_SUBSCRIBE
  142. *
  143. * ics_head: Result head
  144. * ics_error: Request results
  145. *
  146. */
  147. struct res_evt_event_subscribe {
  148. struct res_header ics_head;
  149. };
  150. /*
  151. * MESSAGE_REQ_EVT_UNSUBSCRIBE
  152. *
  153. * icu_head: Request head
  154. * icu_channel_handle: Server handle of channel
  155. * icu_sub_id: Subscription ID
  156. *
  157. */
  158. struct req_evt_event_unsubscribe {
  159. struct req_header icu_head;
  160. uint32_t icu_channel_handle;
  161. SaEvtSubscriptionIdT icu_sub_id;
  162. };
  163. /*
  164. * MESSAGE_RES_EVT_UNSUBSCRIBE
  165. *
  166. * icu_head: Results head
  167. * icu_error: request result
  168. *
  169. */
  170. struct res_evt_event_unsubscribe {
  171. struct res_header icu_head;
  172. };
  173. /*
  174. * MESSAGE_REQ_EVT_EVENT_DATA
  175. * MESSAGE_RES_EVT_AVAILABLE
  176. *
  177. * evd_head: Request Head
  178. */
  179. struct res_evt_event_data {
  180. struct res_header evd_head;
  181. };
  182. /*
  183. * MESSAGE_REQ_EVT_PUBLISH (1)
  184. * MESSAGE_RES_EVT_EVENT_DATA (2)
  185. * MESSAGE_REQ_EXEC_EVT_EVENTDATA (3)
  186. * MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA (4)
  187. *
  188. * led_head: Request/Results head
  189. * led_in_addr: address of node (4 only)
  190. * led_receive_time: Time that the message was received (4 only)
  191. * led_svr_channel_handle: Server channel handle (1 only)
  192. * led_lib_channel_handle: Lib channel handle (2 only)
  193. * led_chan_name: Channel name (3 and 4 only)
  194. * led_event_id: Event ID (2, 3 and 4 only)
  195. * led_sub_id: Subscription ID (2 only)
  196. * led_publisher_node_id: Node ID of event publisher
  197. * led_publisher_name: Node name of event publisher
  198. * led_retention_time: Event retention time
  199. * led_publish_time: Publication time of the event
  200. * led_priority: Event priority
  201. * led_user_data_offset: Offset to user data
  202. * led_user_data_size: Size of user data
  203. * led_patterns_number: Number of patterns in the event
  204. * led_body: Pattern and user data
  205. */
  206. struct lib_event_data {
  207. struct res_header led_head;
  208. struct in_addr led_in_addr;
  209. SaTimeT led_receive_time;
  210. uint32_t led_svr_channel_handle;
  211. SaEvtChannelHandleT led_lib_channel_handle;
  212. SaNameT led_chan_name;
  213. SaEvtEventIdT led_event_id;
  214. SaEvtSubscriptionIdT led_sub_id;
  215. SaClmNodeIdT led_publisher_node_id;
  216. SaNameT led_publisher_name;
  217. SaTimeT led_retention_time;
  218. SaTimeT led_publish_time;
  219. SaEvtEventPriorityT led_priority;
  220. uint32_t led_user_data_offset;
  221. uint32_t led_user_data_size;
  222. uint32_t led_patterns_number;
  223. uint8_t led_body[0];
  224. };
  225. /*
  226. * MESSAGE_RES_EVT_PUBLISH
  227. *
  228. * iep_head: Result head
  229. * iep_error: Request results
  230. * iep_event_id: Event ID of published message
  231. *
  232. */
  233. struct res_evt_event_publish {
  234. struct res_header iep_head;
  235. SaEvtEventIdT iep_event_id;
  236. };
  237. /*
  238. * MESSAGE_REQ_EVT_CLEAR_RETENTIONTIME
  239. *
  240. * Request message:
  241. *
  242. * iec_head: Request head
  243. * iec_event_id: ID of event to clear
  244. * iec_channel_handle: Server handle of associate channel
  245. *
  246. */
  247. struct req_evt_event_clear_retentiontime {
  248. struct req_header iec_head;
  249. SaEvtEventIdT iec_event_id;
  250. uint32_t iec_channel_handle;
  251. };
  252. /*
  253. * MESSAGE_RES_EVT_CLEAR_RETENTIONTIME
  254. *
  255. * iec_head: Results head
  256. * iec_error: Request result
  257. *
  258. */
  259. struct res_evt_event_clear_retentiontime {
  260. struct res_header iec_head;
  261. };
  262. /*
  263. * MESSAGE_REQ_EXEC_EVT_CHANCMD
  264. *
  265. * chc_header: Request head
  266. * chc_chan: Channel Name
  267. * chc_op: Channel operation (open, close, clear retentiontime)
  268. */
  269. enum evt_chan_ops {
  270. EVT_OPEN_CHAN_OP, /* chc_chan */
  271. EVT_CLOSE_CHAN_OP, /* chc_chan */
  272. EVT_CLEAR_RET_OP, /* chc_event_id */
  273. EVT_SET_ID_OP, /* chc_set_id */
  274. EVT_CONF_DONE, /* no data used */
  275. EVT_OPEN_COUNT, /* chc_set_opens */
  276. EVT_OPEN_COUNT_DONE /* no data used */
  277. };
  278. struct evt_set_id {
  279. struct in_addr chc_addr;
  280. SaEvtEventIdT chc_last_id;
  281. };
  282. struct evt_set_opens {
  283. SaNameT chc_chan_name;
  284. uint32_t chc_open_count;
  285. };
  286. struct req_evt_chan_command {
  287. struct req_header chc_head;
  288. int chc_op;
  289. union {
  290. SaNameT chc_chan;
  291. SaEvtEventIdT chc_event_id;
  292. struct evt_set_id chc_set_id;
  293. struct evt_set_opens chc_set_opens;
  294. } u;
  295. };
  296. #endif /* AIS_EVT_H_DEFINED */
  297. /*
  298. * vi: set autoindent tabstop=4 shiftwidth=4 :
  299. */