ipc_evt.h 8.8 KB

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