ipc_evt.h 10 KB

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