msg.c 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725
  1. /*
  2. * Copyright (c) 2005 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@mvista.com)
  7. *
  8. * This software licensed under BSD license, the text of which follows:
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * - Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * 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. #include <sys/types.h>
  34. #include <sys/uio.h>
  35. #include <sys/socket.h>
  36. #include <sys/un.h>
  37. #include <sys/time.h>
  38. #include <netinet/in.h>
  39. #include <unistd.h>
  40. #include <fcntl.h>
  41. #include <stdlib.h>
  42. #include <stdio.h>
  43. #include <errno.h>
  44. #include <signal.h>
  45. #include <arpa/inet.h>
  46. #include "../include/saAis.h"
  47. #include "../include/saMsg.h"
  48. #include "../include/ipc_msg.h"
  49. #include "../include/list.h"
  50. #include "../include/queue.h"
  51. #include "../lcr/lcr_comp.h"
  52. #include "aispoll.h"
  53. #include "mempool.h"
  54. #include "util.h"
  55. #include "main.h"
  56. #include "totempg.h"
  57. #define LOG_SERVICE LOG_SERVICE_MSG
  58. #include "print.h"
  59. enum msg_exec_message_req_types {
  60. MESSAGE_REQ_EXEC_MSG_QUEUEOPEN = 0,
  61. MESSAGE_REQ_EXEC_MSG_QUEUECLOSE = 1,
  62. MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET = 2,
  63. MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK = 3,
  64. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE = 4,
  65. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT = 5,
  66. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE = 6,
  67. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE = 7,
  68. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK = 8,
  69. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP = 9,
  70. MESSAGE_REQ_EXEC_MSG_MESSAGESEND = 10,
  71. MESSAGE_REQ_EXEC_MSG_MESSAGEGET = 11,
  72. MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL = 12,
  73. MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE = 13,
  74. MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY = 14
  75. };
  76. struct message_queue {
  77. SaNameT name;
  78. int refcount;
  79. struct list_head list;
  80. };
  81. struct queue_group {
  82. SaNameT name;
  83. struct list_head list;
  84. struct list_head message_queue_head;
  85. };
  86. struct queue_group_entry {
  87. struct message_queue *message_queue;
  88. struct list_head list;
  89. };
  90. /*
  91. struct queue_cleanup {
  92. struct message_queue *queue;
  93. SaMsgResourceHandleT queue_handle;
  94. struct list_head queue_lock_list_head;
  95. struct list_head list;
  96. };
  97. */
  98. DECLARE_LIST_INIT(queue_list_head);
  99. DECLARE_LIST_INIT(queue_group_list_head);
  100. static int msg_exec_init_fn (struct openais_config *);
  101. static int msg_exit_fn (struct conn_info *conn_info);
  102. static int msg_init_two_fn (struct conn_info *conn_info);
  103. static int message_handler_req_exec_msg_queueopen (
  104. void *message,
  105. struct totem_ip_address *source_addr,
  106. int endian_conversion_required);
  107. static int message_handler_req_exec_msg_queueclose (
  108. void *message,
  109. struct totem_ip_address *source_addr,
  110. int endian_conversion_required);
  111. static int message_handler_req_exec_msg_queuestatusget (
  112. void *message,
  113. struct totem_ip_address *source_addr,
  114. int endian_conversion_required);
  115. static int message_handler_req_exec_msg_queueunlink (
  116. void *message,
  117. struct totem_ip_address *source_addr,
  118. int endian_conversion_required);
  119. static int message_handler_req_exec_msg_queuegroupcreate (
  120. void *message,
  121. struct totem_ip_address *source_addr,
  122. int endian_conversion_required);
  123. static int message_handler_req_exec_msg_queuegroupinsert (
  124. void *message,
  125. struct totem_ip_address *source_addr,
  126. int endian_conversion_required);
  127. static int message_handler_req_exec_msg_queuegroupremove (
  128. void *message,
  129. struct totem_ip_address *source_addr,
  130. int endian_conversion_required);
  131. static int message_handler_req_exec_msg_queuegroupdelete (
  132. void *message,
  133. struct totem_ip_address *source_addr,
  134. int endian_conversion_required);
  135. static int message_handler_req_exec_msg_queuegrouptrack (
  136. void *message,
  137. struct totem_ip_address *source_addr,
  138. int endian_conversion_required);
  139. static int message_handler_req_exec_msg_queuegrouptrackstop (
  140. void *message,
  141. struct totem_ip_address *source_addr,
  142. int endian_conversion_required);
  143. static int message_handler_req_exec_msg_messagesend (
  144. void *message,
  145. struct totem_ip_address *source_addr,
  146. int endian_conversion_required);
  147. static int message_handler_req_exec_msg_messageget (
  148. void *message,
  149. struct totem_ip_address *source_addr,
  150. int endian_conversion_required);
  151. static int message_handler_req_exec_msg_messagecancel (
  152. void *message,
  153. struct totem_ip_address *source_addr,
  154. int endian_conversion_required);
  155. static int message_handler_req_exec_msg_messagesendreceive (
  156. void *message,
  157. struct totem_ip_address *source_addr,
  158. int endian_conversion_required);
  159. static int message_handler_req_exec_msg_messagereply (
  160. void *message,
  161. struct totem_ip_address *source_addr,
  162. int endian_conversion_required);
  163. static int message_handler_req_lib_msg_queueopen (
  164. struct conn_info *conn_info,
  165. void *message);
  166. static int message_handler_req_lib_msg_queueopenasync (
  167. struct conn_info *conn_info,
  168. void *message);
  169. static int message_handler_req_lib_msg_queueclose (
  170. struct conn_info *conn_info,
  171. void *message);
  172. static int message_handler_req_lib_msg_queuestatusget (
  173. struct conn_info *conn_info,
  174. void *message);
  175. static int message_handler_req_lib_msg_queueunlink (
  176. struct conn_info *conn_info,
  177. void *message);
  178. static int message_handler_req_lib_msg_queuegroupcreate (
  179. struct conn_info *conn_info,
  180. void *message);
  181. static int message_handler_req_lib_msg_queuegroupinsert (
  182. struct conn_info *conn_info,
  183. void *message);
  184. static int message_handler_req_lib_msg_queuegroupremove (
  185. struct conn_info *conn_info,
  186. void *message);
  187. static int message_handler_req_lib_msg_queuegroupdelete (
  188. struct conn_info *conn_info,
  189. void *message);
  190. static int message_handler_req_lib_msg_queuegrouptrack (
  191. struct conn_info *conn_info,
  192. void *message);
  193. static int message_handler_req_lib_msg_queuegrouptrackstop (
  194. struct conn_info *conn_info,
  195. void *message);
  196. static int message_handler_req_lib_msg_messagesend (
  197. struct conn_info *conn_info,
  198. void *message);
  199. static int message_handler_req_lib_msg_messagesendasync (
  200. struct conn_info *conn_info,
  201. void *message);
  202. static int message_handler_req_lib_msg_messageget (
  203. struct conn_info *conn_info,
  204. void *message);
  205. static int message_handler_req_lib_msg_messagecancel (
  206. struct conn_info *conn_info,
  207. void *message);
  208. static int message_handler_req_lib_msg_messagesendreceive (
  209. struct conn_info *conn_info,
  210. void *message);
  211. static int message_handler_req_lib_msg_messagereply (
  212. struct conn_info *conn_info,
  213. void *message);
  214. static int message_handler_req_lib_msg_messagereplyasync (
  215. struct conn_info *conn_info,
  216. void *message);
  217. static void msg_recovery_activate (void);
  218. static void msg_recovery_initialize (void);
  219. static int msg_recovery_process (void);
  220. static void msg_recovery_finalize();
  221. static void msg_recovery_abort(void);
  222. void queue_release (struct message_queue *queue);
  223. /*
  224. static struct list_head *recovery_msg_next = 0;
  225. static struct list_head *recovery_msg_section_next = 0;
  226. static int recovery_section_data_offset = 0;
  227. static int recovery_section_send_flag = 0;
  228. static int recovery_abort = 0;
  229. */
  230. static struct memb_ring_id saved_ring_id;
  231. static int msg_confchg_fn (
  232. enum totem_configuration_type configuration_type,
  233. struct totem_ip_address *member_list, int member_list_entries,
  234. struct totem_ip_address *left_list, int left_list_entries,
  235. struct totem_ip_address *joined_list, int joined_list_entries,
  236. struct memb_ring_id *ring_id);
  237. /*
  238. * Executive Handler Definition
  239. */
  240. struct libais_handler msg_libais_handlers[] =
  241. {
  242. { /* 0 */
  243. .libais_handler_fn = message_handler_req_lib_msg_queueopen,
  244. .response_size = sizeof (struct res_lib_msg_queueopen),
  245. .response_id = MESSAGE_RES_MSG_QUEUEOPEN,
  246. .flow_control = FLOW_CONTROL_REQUIRED
  247. },
  248. { /* 1 */
  249. .libais_handler_fn = message_handler_req_lib_msg_queueopenasync,
  250. .response_size = sizeof (struct res_lib_msg_queueopenasync),
  251. .response_id = MESSAGE_RES_MSG_QUEUEOPENASYNC,
  252. .flow_control = FLOW_CONTROL_REQUIRED
  253. },
  254. { /* 2 */
  255. .libais_handler_fn = message_handler_req_lib_msg_queueclose,
  256. .response_size = sizeof (struct res_lib_msg_queueclose),
  257. .response_id = MESSAGE_RES_MSG_QUEUECLOSE,
  258. .flow_control = FLOW_CONTROL_REQUIRED
  259. },
  260. { /* 3 */
  261. .libais_handler_fn = message_handler_req_lib_msg_queuestatusget,
  262. .response_size = sizeof (struct res_lib_msg_queuestatusget),
  263. .response_id = MESSAGE_RES_MSG_QUEUESTATUSGET,
  264. .flow_control = FLOW_CONTROL_REQUIRED
  265. },
  266. { /* 4 */
  267. .libais_handler_fn = message_handler_req_lib_msg_queueunlink,
  268. .response_size = sizeof (struct res_lib_msg_queueunlink),
  269. .response_id = MESSAGE_RES_MSG_QUEUEUNLINK,
  270. .flow_control = FLOW_CONTROL_REQUIRED
  271. },
  272. { /* 5 */
  273. .libais_handler_fn = message_handler_req_lib_msg_queuegroupcreate,
  274. .response_size = sizeof (struct res_lib_msg_queuegroupcreate),
  275. .response_id = MESSAGE_RES_MSG_QUEUEGROUPCREATE,
  276. .flow_control = FLOW_CONTROL_REQUIRED
  277. },
  278. { /* 6 */
  279. .libais_handler_fn = message_handler_req_lib_msg_queuegroupinsert,
  280. .response_size = sizeof (struct res_lib_msg_queuegroupinsert),
  281. .response_id = MESSAGE_RES_MSG_QUEUEGROUPINSERT,
  282. .flow_control = FLOW_CONTROL_REQUIRED
  283. },
  284. { /* 7 */
  285. .libais_handler_fn = message_handler_req_lib_msg_queuegroupremove,
  286. .response_size = sizeof (struct res_lib_msg_queuegroupremove),
  287. .response_id = MESSAGE_RES_MSG_QUEUEGROUPREMOVE,
  288. .flow_control = FLOW_CONTROL_REQUIRED
  289. },
  290. { /* 8 */
  291. .libais_handler_fn = message_handler_req_lib_msg_queuegroupdelete,
  292. .response_size = sizeof (struct res_lib_msg_queuegroupdelete),
  293. .response_id = MESSAGE_RES_MSG_QUEUEGROUPDELETE,
  294. .flow_control = FLOW_CONTROL_REQUIRED
  295. },
  296. { /* 9 */
  297. .libais_handler_fn = message_handler_req_lib_msg_queuegrouptrack,
  298. .response_size = sizeof (struct res_lib_msg_queuegrouptrack),
  299. .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACK,
  300. .flow_control = FLOW_CONTROL_REQUIRED
  301. },
  302. { /* 10 */
  303. .libais_handler_fn = message_handler_req_lib_msg_queuegrouptrackstop,
  304. .response_size = sizeof (struct res_lib_msg_queuegrouptrackstop),
  305. .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACKSTOP,
  306. .flow_control = FLOW_CONTROL_REQUIRED
  307. },
  308. { /* 11 */
  309. .libais_handler_fn = message_handler_req_lib_msg_messagesend,
  310. .response_size = sizeof (struct res_lib_msg_messagesend),
  311. .response_id = MESSAGE_RES_MSG_MESSAGESEND,
  312. .flow_control = FLOW_CONTROL_REQUIRED
  313. },
  314. { /* 12 */
  315. .libais_handler_fn = message_handler_req_lib_msg_messagesendasync,
  316. .response_size = sizeof (struct res_lib_msg_messagesendasync),
  317. .response_id = MESSAGE_RES_MSG_MESSAGESENDASYNC,
  318. .flow_control = FLOW_CONTROL_REQUIRED
  319. },
  320. { /* 13 */
  321. .libais_handler_fn = message_handler_req_lib_msg_messageget,
  322. .response_size = sizeof (struct res_lib_msg_messageget),
  323. .response_id = MESSAGE_RES_MSG_MESSAGEGET,
  324. .flow_control = FLOW_CONTROL_REQUIRED
  325. },
  326. { /* 14 */
  327. .libais_handler_fn = message_handler_req_lib_msg_messagecancel,
  328. .response_size = sizeof (struct res_lib_msg_messagecancel),
  329. .response_id = MESSAGE_RES_MSG_MESSAGECANCEL,
  330. .flow_control = FLOW_CONTROL_REQUIRED
  331. },
  332. { /* 15 */
  333. .libais_handler_fn = message_handler_req_lib_msg_messagesendreceive,
  334. .response_size = sizeof (struct res_lib_msg_messagesendreceive),
  335. .response_id = MESSAGE_RES_MSG_MESSAGESENDRECEIVE,
  336. .flow_control = FLOW_CONTROL_REQUIRED
  337. },
  338. { /* 16 */
  339. .libais_handler_fn = message_handler_req_lib_msg_messagereply,
  340. .response_size = sizeof (struct res_lib_msg_messagereply),
  341. .response_id = MESSAGE_RES_MSG_MESSAGEREPLY,
  342. .flow_control = FLOW_CONTROL_REQUIRED
  343. },
  344. { /* 17 */
  345. .libais_handler_fn = message_handler_req_lib_msg_messagereplyasync,
  346. .response_size = sizeof (struct res_lib_msg_messagereplyasync),
  347. .response_id = MESSAGE_RES_MSG_MESSAGEREPLYASYNC,
  348. .flow_control = FLOW_CONTROL_REQUIRED
  349. },
  350. };
  351. static int (*msg_aisexec_handler_fns[]) (void *msg, struct totem_ip_address *source_addr, int endian_conversion_required) = {
  352. message_handler_req_exec_msg_queueopen,
  353. message_handler_req_exec_msg_queueclose,
  354. message_handler_req_exec_msg_queuestatusget,
  355. message_handler_req_exec_msg_queueunlink,
  356. message_handler_req_exec_msg_queuegroupcreate,
  357. message_handler_req_exec_msg_queuegroupinsert,
  358. message_handler_req_exec_msg_queuegroupremove,
  359. message_handler_req_exec_msg_queuegroupdelete,
  360. message_handler_req_exec_msg_queuegrouptrack,
  361. message_handler_req_exec_msg_queuegrouptrackstop,
  362. message_handler_req_exec_msg_messagesend,
  363. message_handler_req_exec_msg_messageget,
  364. message_handler_req_exec_msg_messagecancel,
  365. message_handler_req_exec_msg_messagesendreceive,
  366. message_handler_req_exec_msg_messagereply
  367. };
  368. struct service_handler msg_service_handler = {
  369. .name = "openais message service",
  370. .id = MSG_SERVICE,
  371. .libais_handlers = msg_libais_handlers,
  372. .libais_handlers_count = sizeof (msg_libais_handlers) / sizeof (struct libais_handler),
  373. .aisexec_handler_fns = msg_aisexec_handler_fns,
  374. .aisexec_handler_fns_count = sizeof (msg_aisexec_handler_fns) / sizeof (int (*)),
  375. .confchg_fn = msg_confchg_fn,
  376. .libais_init_two_fn = msg_init_two_fn,
  377. .libais_exit_fn = msg_exit_fn,
  378. .exec_init_fn = msg_exec_init_fn,
  379. .exec_dump_fn = 0,
  380. .sync_init = msg_recovery_initialize,
  381. .sync_process = msg_recovery_process,
  382. .sync_activate = msg_recovery_activate,
  383. .sync_abort = msg_recovery_abort,
  384. };
  385. #ifdef BUILD_DYNAMIC
  386. struct service_handler *msg_get_handler_ver0 (void);
  387. struct aisexec_iface_ver0 msg_service_handler_iface = {
  388. .test = NULL,
  389. .get_handler_ver0 = msg_get_handler_ver0
  390. };
  391. struct lcr_iface openais_msg_ver0[1] = {
  392. {
  393. .name = "openais_msg",
  394. .version = 0,
  395. .versions_replace = 0,
  396. .versions_replace_count = 0,
  397. .dependencies = 0,
  398. .dependency_count = 0,
  399. .constructor = NULL,
  400. .destructor = NULL,
  401. .interfaces = (void **)&msg_service_handler_iface,
  402. }
  403. };
  404. struct lcr_comp msg_comp_ver0 = {
  405. .iface_count = 1,
  406. .ifaces = openais_msg_ver0
  407. };
  408. extern int lcr_comp_get (struct lcr_comp **component)
  409. {
  410. *component = &msg_comp_ver0;
  411. return (0);
  412. }
  413. struct service_handler *msg_get_handler_ver0 (void)
  414. {
  415. return (&msg_service_handler);
  416. }
  417. #endif /* BUILD_DYNAMIC */
  418. /*
  419. * All data types used for executive messages
  420. */
  421. struct req_exec_msg_queueopen {
  422. struct req_header header;
  423. struct message_source source;
  424. int async_call;
  425. SaNameT queue_name;
  426. SaInvocationT invocation;
  427. SaMsgQueueHandleT queue_handle;
  428. SaMsgQueueCreationAttributesT creation_attributes;
  429. SaMsgQueueOpenFlagsT openFlags;
  430. SaTimeT timeout;
  431. };
  432. struct req_exec_msg_queueclose {
  433. struct req_header header;
  434. struct message_source source;
  435. SaNameT queue_name;
  436. };
  437. struct req_exec_msg_queuestatusget {
  438. struct req_header header;
  439. struct message_source source;
  440. SaNameT queue_name;
  441. };
  442. struct req_exec_msg_queueunlink {
  443. struct req_header header;
  444. struct message_source source;
  445. SaNameT queue_name;
  446. };
  447. struct req_exec_msg_queuegroupcreate {
  448. struct req_header header;
  449. struct message_source source;
  450. SaNameT queue_group_name;
  451. };
  452. struct req_exec_msg_queuegroupinsert {
  453. struct req_header header;
  454. struct message_source source;
  455. SaNameT queue_name;
  456. SaNameT queue_group_name;
  457. };
  458. struct req_exec_msg_queuegroupremove {
  459. struct req_header header;
  460. struct message_source source;
  461. SaNameT queue_name;
  462. SaNameT queue_group_name;
  463. };
  464. struct req_exec_msg_queuegroupdelete {
  465. struct req_header header;
  466. struct message_source source;
  467. SaNameT queue_group_name;
  468. };
  469. struct req_exec_msg_queuegrouptrack {
  470. struct req_header header;
  471. struct message_source source;
  472. SaNameT queue_group_name;
  473. };
  474. struct req_exec_msg_queuegrouptrackstop {
  475. struct req_header header;
  476. struct message_source source;
  477. SaNameT queue_group_name;
  478. };
  479. struct req_exec_msg_messagesend {
  480. struct req_header header;
  481. struct message_source source;
  482. SaNameT destination;
  483. int async_call;
  484. };
  485. struct req_exec_msg_messageget {
  486. struct req_header header;
  487. struct message_source source;
  488. SaNameT queue_name;
  489. };
  490. struct req_exec_msg_messagecancel {
  491. struct req_header header;
  492. struct message_source source;
  493. SaNameT queue_name;
  494. };
  495. struct req_exec_msg_messagesendreceive {
  496. struct req_header header;
  497. struct message_source source;
  498. SaNameT queue_name;
  499. };
  500. struct req_exec_msg_messagereply {
  501. struct req_header header;
  502. struct message_source source;
  503. SaNameT queue_name;
  504. int async_call;
  505. };
  506. static void msg_recovery_initialize (void)
  507. {
  508. return;
  509. }
  510. static int msg_recovery_process (void)
  511. {
  512. return (0);
  513. }
  514. static void msg_recovery_finalize ()
  515. {
  516. return;
  517. }
  518. static void msg_recovery_activate (void)
  519. {
  520. return;
  521. }
  522. static void msg_recovery_abort (void)
  523. {
  524. return;
  525. }
  526. static int msg_confchg_fn (
  527. enum totem_configuration_type configuration_type,
  528. struct totem_ip_address *member_list, int member_list_entries,
  529. struct totem_ip_address *left_list, int left_list_entries,
  530. struct totem_ip_address *joined_list, int joined_list_entries,
  531. struct memb_ring_id *ring_id)
  532. {
  533. return (0);
  534. }
  535. static struct message_queue *queue_find (SaNameT *name)
  536. {
  537. struct list_head *list;
  538. struct message_queue *queue;
  539. for (list = queue_list_head.next;
  540. list != &queue_list_head;
  541. list = list->next) {
  542. queue = list_entry (list, struct message_queue, list);
  543. if (name_match (name, &queue->name)) {
  544. return (queue);
  545. }
  546. }
  547. return (0);
  548. }
  549. static struct queue_group *queue_group_find (SaNameT *name)
  550. {
  551. struct list_head *list;
  552. struct queue_group *queue_group;
  553. for (list = queue_group_list_head.next;
  554. list != &queue_group_list_head;
  555. list = list->next) {
  556. queue_group = list_entry (list, struct queue_group, list);
  557. if (name_match (name, &queue_group->name)) {
  558. return (queue_group);
  559. }
  560. }
  561. return (0);
  562. }
  563. static struct queue_group_entry *queue_group_entry_find (
  564. struct queue_group *queue_group,
  565. struct message_queue *queue)
  566. {
  567. struct list_head *list;
  568. struct queue_group_entry *queue_group_entry;
  569. for (list = queue_group->message_queue_head.next;
  570. list != &queue_group->message_queue_head;
  571. list = list->next) {
  572. queue_group_entry = list_entry (list, struct queue_group_entry, list);
  573. if (queue_group_entry->message_queue == queue) {
  574. return (queue_group_entry);
  575. }
  576. }
  577. return (0);
  578. }
  579. static int msg_exec_init_fn (struct openais_config *openais_config)
  580. {
  581. /*
  582. * Initialize the saved ring ID.
  583. */
  584. // saved_ring_id.seq = 0;
  585. // saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
  586. return (0);
  587. }
  588. static int msg_exit_fn (struct conn_info *conn_info)
  589. {
  590. #ifdef COMPILE_OUT
  591. struct queue_cleanup *queue_cleanup;
  592. struct list_head *list;
  593. printf ("exit_fn\n");
  594. if (conn_info->conn_info_partner->service != MSG_SERVICE) {
  595. return 0;
  596. }
  597. log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %#x, with fd = %d\n", conn_info, conn_info->fd);
  598. /*
  599. * close all queues opened on this fd
  600. */
  601. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  602. while (!list_empty(&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list)) {
  603. queue_cleanup = list_entry (list, struct queue_cleanup, list);
  604. printf ("queue to cleanup\n");
  605. if (queue_cleanup->queue->name.length > 0) {
  606. msg_queue_cleanup_lock_remove (queue_cleanup);
  607. msg_queue_close (queue_cleanup->queue);
  608. }
  609. printf ("queue cleanup %x\n", queue_cleanup);
  610. list_del (&queue_cleanup->list);
  611. free (queue_cleanup);
  612. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  613. }
  614. #endif
  615. return (0);
  616. }
  617. static int msg_init_two_fn (struct conn_info *conn_info)
  618. {
  619. list_init (&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_list);
  620. list_init (&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list);
  621. return (0);
  622. }
  623. static int message_handler_req_exec_msg_queueopen (
  624. void *message,
  625. struct totem_ip_address *source_addr,
  626. int endian_conversion_required)
  627. {
  628. struct req_exec_msg_queueopen *req_exec_msg_queueopen = (struct req_exec_msg_queueopen *)message;
  629. struct res_lib_msg_queueopen res_lib_msg_queueopen;
  630. struct res_lib_msg_queueopenasync res_lib_msg_queueopenasync;
  631. struct message_queue *queue;
  632. // struct queue_cleanup *queue_cleanup;
  633. SaErrorT error = SA_AIS_OK;
  634. log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueOpen %s\n",
  635. getSaNameT (&req_exec_msg_queueopen->queue_name));
  636. queue = queue_find (&req_exec_msg_queueopen->queue_name);
  637. printf ("queue %x\n", queue);
  638. /*
  639. * If queue doesn't exist, create one
  640. */
  641. if (queue == 0) {
  642. if ((req_exec_msg_queueopen->openFlags & SA_MSG_QUEUE_CREATE) == 0) {
  643. error = SA_AIS_ERR_NOT_EXIST;
  644. goto error_exit;
  645. }
  646. queue = malloc (sizeof (struct message_queue));
  647. if (queue == 0) {
  648. error = SA_AIS_ERR_NO_MEMORY;
  649. goto error_exit;
  650. }
  651. memset (queue, 0, sizeof (struct message_queue));
  652. memcpy (&queue->name,
  653. &req_exec_msg_queueopen->queue_name,
  654. sizeof (SaNameT));
  655. list_init (&queue->list);
  656. list_add (&queue->list, &queue_list_head);
  657. queue->refcount = 0;
  658. }
  659. queue->refcount += 1;
  660. printf ("Incrementing queue refcount to %d\n", queue->refcount);
  661. #ifdef COMPILE_OUT
  662. /*
  663. * Setup connection information and mark queue as referenced
  664. */
  665. log_printf (LOG_LEVEL_DEBUG, "Lock queue opened is %p\n", queue);
  666. queue_cleanup = malloc (sizeof (struct queue_cleanup));
  667. if (queue_cleanup == 0) {
  668. free (queue);
  669. error = SA_AIS_ERR_NO_MEMORY;
  670. } else {
  671. list_init (&queue_cleanup->list);
  672. list_init (&queue_cleanup->queue_lock_list_head);
  673. queue_cleanup->queue = queue;
  674. queue_cleanup->queue_handle = req_exec_msg_queueopen->queue_handle;
  675. list_add (
  676. &queue_cleanup->list,
  677. &req_exec_msg_queueopen->source.conn_info->ais_ci.u.libmsg_ci.queue_cleanup_list);
  678. }
  679. queue->refcount += 1;
  680. printf ("refcount == %d\n", queue->refcount);
  681. #endif
  682. /*
  683. * Send error result to MSG library
  684. */
  685. error_exit:
  686. /*
  687. * If this node was the source of the message, respond to this node
  688. */
  689. if (message_source_is_local (&req_exec_msg_queueopen->source)) {
  690. /*
  691. * If its an async call respond with the invocation and handle
  692. */
  693. if (req_exec_msg_queueopen->async_call) {
  694. res_lib_msg_queueopenasync.header.size = sizeof (struct res_lib_msg_queueopenasync);
  695. res_lib_msg_queueopenasync.header.id = MESSAGE_RES_MSG_QUEUEOPENASYNC;
  696. res_lib_msg_queueopenasync.header.error = error;
  697. res_lib_msg_queueopenasync.invocation = req_exec_msg_queueopen->invocation;
  698. memcpy (&res_lib_msg_queueopenasync.source,
  699. &req_exec_msg_queueopen->source,
  700. sizeof (struct message_source));
  701. libais_send_response (
  702. req_exec_msg_queueopen->source.conn_info,
  703. &res_lib_msg_queueopenasync,
  704. sizeof (struct res_lib_msg_queueopenasync));
  705. libais_send_response (
  706. req_exec_msg_queueopen->source.conn_info->conn_info_partner,
  707. &res_lib_msg_queueopenasync,
  708. sizeof (struct res_lib_msg_queueopenasync));
  709. } else {
  710. /*
  711. * otherwise respond with the normal queueopen response
  712. */
  713. res_lib_msg_queueopen.header.size = sizeof (struct res_lib_msg_queueopen);
  714. res_lib_msg_queueopen.header.id = MESSAGE_RES_MSG_QUEUEOPEN;
  715. res_lib_msg_queueopen.header.error = error;
  716. memcpy (&res_lib_msg_queueopen.source,
  717. &req_exec_msg_queueopen->source,
  718. sizeof (struct message_source));
  719. libais_send_response (req_exec_msg_queueopen->source.conn_info, &res_lib_msg_queueopen,
  720. sizeof (struct res_lib_msg_queueopen));
  721. }
  722. }
  723. return (0);
  724. }
  725. static int message_handler_req_exec_msg_queueclose (
  726. void *message,
  727. struct totem_ip_address *source_addr,
  728. int endian_conversion_required)
  729. {
  730. struct req_exec_msg_queueclose *req_exec_msg_queueclose = (struct req_exec_msg_queueclose *)message;
  731. struct res_lib_msg_queueclose res_lib_msg_queueclose;
  732. struct message_queue *queue = 0;
  733. SaAisErrorT error = SA_AIS_OK;
  734. log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueClose %s\n",
  735. getSaNameT (&req_exec_msg_queueclose->queue_name));
  736. queue = queue_find (&req_exec_msg_queueclose->queue_name);
  737. if (queue == 0) {
  738. goto error_exit;
  739. }
  740. queue->refcount -= 1;
  741. printf ("decrementing queue refcount to %d\n", queue->refcount);
  742. if (queue->refcount == 0) {
  743. printf ("should free queue\n");
  744. }
  745. error_exit:
  746. if (message_source_is_local(&req_exec_msg_queueclose->source)) {
  747. // TODO msg_queue_cleanup_remove (
  748. // req_exec_msg_queueclose->source.conn_info,
  749. // req_exec_msg_queueclose->queue_handle);
  750. res_lib_msg_queueclose.header.size = sizeof (struct res_lib_msg_queueclose);
  751. res_lib_msg_queueclose.header.id = MESSAGE_RES_MSG_QUEUECLOSE;
  752. res_lib_msg_queueclose.header.error = error;
  753. libais_send_response (req_exec_msg_queueclose->source.conn_info,
  754. &res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose));
  755. }
  756. return (0);
  757. }
  758. static int message_handler_req_exec_msg_queuestatusget (
  759. void *message,
  760. struct totem_ip_address *source_addr,
  761. int endian_conversion_required)
  762. {
  763. struct req_exec_msg_queuestatusget *req_exec_msg_queuestatusget =
  764. (struct req_exec_msg_queuestatusget *)message;
  765. struct res_lib_msg_queueclose res_lib_msg_queuestatusget;
  766. return (0);
  767. }
  768. static int message_handler_req_exec_msg_queueunlink (
  769. void *message,
  770. struct totem_ip_address *source_addr,
  771. int endian_conversion_required)
  772. {
  773. struct req_exec_msg_queueunlink *req_exec_msg_queueunlink =
  774. (struct req_exec_msg_queueunlink *)message;
  775. struct res_lib_msg_queueclose res_lib_msg_queueunlink;
  776. return (0);
  777. }
  778. static int message_handler_req_exec_msg_queuegroupcreate (
  779. void *message,
  780. struct totem_ip_address *source_addr,
  781. int endian_conversion_required)
  782. {
  783. struct req_exec_msg_queuegroupcreate *req_exec_msg_queuegroupcreate =
  784. (struct req_exec_msg_queuegroupcreate *)message;
  785. struct res_lib_msg_queuegroupcreate res_lib_msg_queuegroupcreate;
  786. struct queue_group *queue_group;
  787. SaAisErrorT error = SA_AIS_OK;
  788. queue_group = queue_group_find (&req_exec_msg_queuegroupcreate->queue_group_name);
  789. if (queue_group == 0) {
  790. queue_group = malloc (sizeof (struct queue_group));
  791. if (queue_group == 0) {
  792. error = SA_AIS_ERR_NO_MEMORY;
  793. goto error_exit;
  794. }
  795. memset (queue_group, 0, sizeof (struct queue_group));
  796. memcpy (&queue_group->name,
  797. &req_exec_msg_queuegroupcreate->queue_group_name,
  798. sizeof (SaNameT));
  799. list_init (&queue_group->list);
  800. list_init (&queue_group->message_queue_head);
  801. list_add (&queue_group->list, &queue_group_list_head);
  802. } else {
  803. error = SA_AIS_ERR_EXIST;
  804. }
  805. error_exit:
  806. if (message_source_is_local(&req_exec_msg_queuegroupcreate->source)) {
  807. res_lib_msg_queuegroupcreate.header.size = sizeof (struct res_lib_msg_queuegroupcreate);
  808. res_lib_msg_queuegroupcreate.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  809. res_lib_msg_queuegroupcreate.header.error = error;
  810. libais_send_response (
  811. req_exec_msg_queuegroupcreate->source.conn_info,
  812. &res_lib_msg_queuegroupcreate,
  813. sizeof (struct res_lib_msg_queuegroupcreate));
  814. }
  815. return (0);
  816. }
  817. static int message_handler_req_exec_msg_queuegroupinsert (
  818. void *message,
  819. struct totem_ip_address *source_addr,
  820. int endian_conversion_required)
  821. {
  822. struct req_exec_msg_queuegroupinsert *req_exec_msg_queuegroupinsert =
  823. (struct req_exec_msg_queuegroupinsert *)message;
  824. struct res_lib_msg_queuegroupinsert res_lib_msg_queuegroupinsert;
  825. struct message_queue *queue;
  826. struct queue_group *queue_group;
  827. struct queue_group_entry *queue_group_entry;
  828. SaAisErrorT error = SA_AIS_OK;
  829. queue_group = queue_group_find (&req_exec_msg_queuegroupinsert->queue_group_name);
  830. if (queue_group == 0) {
  831. printf ("a\n");
  832. error = SA_AIS_ERR_NOT_EXIST;
  833. goto error_exit;
  834. }
  835. queue = queue_find (&req_exec_msg_queuegroupinsert->queue_name);
  836. if (queue == 0) {
  837. error = SA_AIS_ERR_NOT_EXIST;
  838. goto error_exit;
  839. }
  840. queue_group_entry = malloc (sizeof (struct queue_group_entry));
  841. if (queue_group_entry == 0) {
  842. printf ("c\n");
  843. error = SA_AIS_ERR_NO_MEMORY;
  844. goto error_exit;
  845. }
  846. list_init (&queue_group_entry->list);
  847. list_add (&queue_group_entry->list, &queue_group->message_queue_head);
  848. list_add (&queue->list, &queue_list_head);
  849. queue_group_entry->message_queue = queue;
  850. error_exit:
  851. if (message_source_is_local(&req_exec_msg_queuegroupinsert->source)) {
  852. res_lib_msg_queuegroupinsert.header.size = sizeof (struct res_lib_msg_queuegroupinsert);
  853. res_lib_msg_queuegroupinsert.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  854. res_lib_msg_queuegroupinsert.header.error = error;
  855. libais_send_response (
  856. req_exec_msg_queuegroupinsert->source.conn_info,
  857. &res_lib_msg_queuegroupinsert,
  858. sizeof (struct res_lib_msg_queuegroupinsert));
  859. }
  860. return (0);
  861. }
  862. static int message_handler_req_exec_msg_queuegroupremove (
  863. void *message,
  864. struct totem_ip_address *source_addr,
  865. int endian_conversion_required)
  866. {
  867. struct req_exec_msg_queuegroupremove *req_exec_msg_queuegroupremove =
  868. (struct req_exec_msg_queuegroupremove *)message;
  869. struct res_lib_msg_queuegroupremove res_lib_msg_queuegroupremove;
  870. struct queue_group *queue_group;
  871. struct message_queue *queue;
  872. struct queue_group_entry *queue_group_entry;
  873. SaAisErrorT error = SA_AIS_OK;
  874. queue_group = queue_group_find (&req_exec_msg_queuegroupremove->queue_group_name);
  875. if (queue_group == 0) {
  876. error = SA_AIS_ERR_NOT_EXIST;
  877. goto error_exit;
  878. }
  879. queue = queue_find (&req_exec_msg_queuegroupremove->queue_name);
  880. if (queue == 0) {
  881. error = SA_AIS_ERR_NOT_EXIST;
  882. goto error_exit;
  883. }
  884. queue_group_entry = queue_group_entry_find (queue_group, queue);
  885. if (queue_group_entry == 0) {
  886. error = SA_AIS_ERR_NOT_EXIST;
  887. goto error_exit;
  888. }
  889. list_del (&queue_group_entry->list);
  890. error_exit:
  891. if (message_source_is_local(&req_exec_msg_queuegroupremove->source)) {
  892. res_lib_msg_queuegroupremove.header.size = sizeof (struct res_lib_msg_queuegroupremove);
  893. res_lib_msg_queuegroupremove.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  894. res_lib_msg_queuegroupremove.header.error = error;
  895. libais_send_response (
  896. req_exec_msg_queuegroupremove->source.conn_info,
  897. &res_lib_msg_queuegroupremove,
  898. sizeof (struct res_lib_msg_queuegroupremove));
  899. }
  900. return (0);
  901. }
  902. static int message_handler_req_exec_msg_queuegroupdelete (
  903. void *message,
  904. struct totem_ip_address *source_addr,
  905. int endian_conversion_required)
  906. {
  907. struct req_exec_msg_queuegroupdelete *req_exec_msg_queuegroupdelete =
  908. (struct req_exec_msg_queuegroupdelete *)message;
  909. struct res_lib_msg_queuegroupdelete res_lib_msg_queuegroupdelete;
  910. struct queue_group *queue_group;
  911. SaAisErrorT error = SA_AIS_OK;
  912. queue_group = queue_group_find (&req_exec_msg_queuegroupdelete->queue_group_name);
  913. if (queue_group) {
  914. list_del (&queue_group->list);
  915. free (queue_group);
  916. } else {
  917. error = SA_AIS_ERR_NOT_EXIST;
  918. }
  919. if (message_source_is_local(&req_exec_msg_queuegroupdelete->source)) {
  920. res_lib_msg_queuegroupdelete.header.size = sizeof (struct res_lib_msg_queuegroupdelete);
  921. res_lib_msg_queuegroupdelete.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  922. res_lib_msg_queuegroupdelete.header.error = error;
  923. libais_send_response (
  924. req_exec_msg_queuegroupdelete->source.conn_info,
  925. &res_lib_msg_queuegroupdelete,
  926. sizeof (struct res_lib_msg_queuegroupdelete));
  927. }
  928. return (0);
  929. }
  930. static int message_handler_req_exec_msg_queuegrouptrack (
  931. void *message,
  932. struct totem_ip_address *source_addr,
  933. int endian_conversion_required)
  934. {
  935. struct req_exec_msg_queuegrouptrack *req_exec_msg_queuegrouptrack =
  936. (struct req_exec_msg_queuegrouptrack *)message;
  937. struct res_lib_msg_queueclose res_lib_msg_queuegrouptrack;
  938. return (0);
  939. }
  940. static int message_handler_req_exec_msg_queuegrouptrackstop (
  941. void *message,
  942. struct totem_ip_address *source_addr,
  943. int endian_conversion_required)
  944. {
  945. struct req_exec_msg_queuegrouptrackstop *req_exec_msg_queuegrouptrackstop =
  946. (struct req_exec_msg_queuegrouptrackstop *)message;
  947. struct res_lib_msg_queueclose res_lib_msg_queuegrouptrackstop;
  948. return (0);
  949. }
  950. static int message_handler_req_exec_msg_messagesend (
  951. void *message,
  952. struct totem_ip_address *source_addr,
  953. int endian_conversion_required)
  954. {
  955. struct req_exec_msg_messagesend *req_exec_msg_messagesend =
  956. (struct req_exec_msg_messagesend *)message;
  957. struct res_lib_msg_queueclose res_lib_msg_messagesend;
  958. return (0);
  959. }
  960. static int message_handler_req_exec_msg_messageget (
  961. void *message,
  962. struct totem_ip_address *source_addr,
  963. int endian_conversion_required)
  964. {
  965. struct req_exec_msg_messageget *req_exec_msg_messageget =
  966. (struct req_exec_msg_messageget *)message;
  967. struct res_lib_msg_queueclose res_lib_msg_messageget;
  968. return (0);
  969. }
  970. static int message_handler_req_exec_msg_messagecancel (
  971. void *message,
  972. struct totem_ip_address *source_addr,
  973. int endian_conversion_required)
  974. {
  975. struct req_exec_msg_messagecancel *req_exec_msg_messagecancel =
  976. (struct req_exec_msg_messagecancel *)message;
  977. struct res_lib_msg_queueclose res_lib_msg_messagecancel;
  978. return (0);
  979. }
  980. static int message_handler_req_exec_msg_messagesendreceive (
  981. void *message,
  982. struct totem_ip_address *source_addr,
  983. int endian_conversion_required)
  984. {
  985. struct req_exec_msg_messagesendreceive *req_exec_msg_messagesendreceive =
  986. (struct req_exec_msg_messagesendreceive *)message;
  987. struct res_lib_msg_queueclose res_lib_msg_messagesendreceive;
  988. return (0);
  989. }
  990. static int message_handler_req_exec_msg_messagereply (
  991. void *message,
  992. struct totem_ip_address *source_addr,
  993. int endian_conversion_required)
  994. {
  995. struct req_exec_msg_messagereply *req_exec_msg_messagereply =
  996. (struct req_exec_msg_messagereply *)message;
  997. struct res_lib_msg_queueclose res_lib_msg_messagereply;
  998. return (0);
  999. }
  1000. static int message_handler_req_lib_msg_queueopen (struct conn_info *conn_info, void *message)
  1001. {
  1002. struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)message;
  1003. struct req_exec_msg_queueopen req_exec_msg_queueopen;
  1004. struct iovec iovec;
  1005. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpen %s\n",
  1006. getSaNameT (&req_lib_msg_queueopen->queueName));
  1007. req_exec_msg_queueopen.header.size =
  1008. sizeof (struct req_exec_msg_queueopen);
  1009. req_exec_msg_queueopen.header.id =
  1010. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
  1011. message_source_set (&req_exec_msg_queueopen.source, conn_info);
  1012. memcpy (&req_exec_msg_queueopen.queue_name,
  1013. &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
  1014. memcpy (&req_exec_msg_queueopen.creation_attributes,
  1015. &req_lib_msg_queueopen->creationAttributes,
  1016. sizeof (SaMsgQueueCreationAttributesT));
  1017. req_exec_msg_queueopen.async_call = 0;
  1018. req_exec_msg_queueopen.invocation = 0;
  1019. req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
  1020. req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
  1021. req_exec_msg_queueopen.timeout = req_lib_msg_queueopen->timeout;
  1022. iovec.iov_base = (char *)&req_exec_msg_queueopen;
  1023. iovec.iov_len = sizeof (req_exec_msg_queueopen);
  1024. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1025. TOTEMPG_AGREED) == 0);
  1026. return (0);
  1027. }
  1028. static int message_handler_req_lib_msg_queueopenasync (struct conn_info *conn_info, void *message)
  1029. {
  1030. struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)message;
  1031. struct req_exec_msg_queueopen req_exec_msg_queueopen;
  1032. struct iovec iovec;
  1033. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpenAsync %s\n",
  1034. getSaNameT (&req_lib_msg_queueopen->queueName));
  1035. req_exec_msg_queueopen.header.size =
  1036. sizeof (struct req_exec_msg_queueopen);
  1037. req_exec_msg_queueopen.header.id =
  1038. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
  1039. message_source_set (&req_exec_msg_queueopen.source, conn_info);
  1040. memcpy (&req_exec_msg_queueopen.queue_name,
  1041. &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
  1042. memcpy (&req_exec_msg_queueopen.creation_attributes,
  1043. &req_lib_msg_queueopen->creationAttributes,
  1044. sizeof (SaMsgQueueCreationAttributesT));
  1045. req_exec_msg_queueopen.async_call = 1;
  1046. req_exec_msg_queueopen.invocation = req_lib_msg_queueopen->invocation;
  1047. req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
  1048. req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
  1049. req_exec_msg_queueopen.timeout = SA_TIME_END;
  1050. iovec.iov_base = (char *)&req_exec_msg_queueopen;
  1051. iovec.iov_len = sizeof (req_exec_msg_queueopen);
  1052. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1053. TOTEMPG_AGREED) == 0);
  1054. return (0);
  1055. }
  1056. static int message_handler_req_lib_msg_queueclose (struct conn_info *conn_info, void *message) {
  1057. struct req_lib_msg_queueclose *req_lib_msg_queueclose = (struct req_lib_msg_queueclose *)message;
  1058. struct req_exec_msg_queueclose req_exec_msg_queueclose;
  1059. struct iovec iovec;
  1060. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueClose %s\n",
  1061. getSaNameT (&req_lib_msg_queueclose->queueName));
  1062. req_exec_msg_queueclose.header.size =
  1063. sizeof (struct req_exec_msg_queueclose);
  1064. req_exec_msg_queueclose.header.id =
  1065. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUECLOSE);
  1066. message_source_set (&req_exec_msg_queueclose.source, conn_info);
  1067. memcpy (&req_exec_msg_queueclose.queue_name,
  1068. &req_lib_msg_queueclose->queueName, sizeof (SaNameT));
  1069. iovec.iov_base = (char *)&req_exec_msg_queueclose;
  1070. iovec.iov_len = sizeof (req_exec_msg_queueclose);
  1071. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1072. TOTEMPG_AGREED) == 0);
  1073. return (0);
  1074. }
  1075. static int message_handler_req_lib_msg_queuestatusget (
  1076. struct conn_info *conn_info,
  1077. void *message)
  1078. {
  1079. struct req_lib_msg_queuestatusget *req_lib_msg_queuestatusget =
  1080. (struct req_lib_msg_queuestatusget *)message;
  1081. struct req_exec_msg_queuestatusget req_exec_msg_queuestatusget;
  1082. struct iovec iovec;
  1083. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueStatusGet %s\n",
  1084. getSaNameT (&req_lib_msg_queuestatusget->queueName));
  1085. req_exec_msg_queuestatusget.header.size =
  1086. sizeof (struct req_exec_msg_queuestatusget);
  1087. req_exec_msg_queuestatusget.header.id =
  1088. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET);
  1089. message_source_set (&req_exec_msg_queuestatusget.source, conn_info);
  1090. memcpy (&req_exec_msg_queuestatusget.queue_name,
  1091. &req_lib_msg_queuestatusget->queueName, sizeof (SaNameT));
  1092. iovec.iov_base = (char *)&req_exec_msg_queuestatusget;
  1093. iovec.iov_len = sizeof (req_exec_msg_queuestatusget);
  1094. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1095. TOTEMPG_AGREED) == 0);
  1096. return (0);
  1097. }
  1098. static int message_handler_req_lib_msg_queueunlink (
  1099. struct conn_info *conn_info,
  1100. void *message)
  1101. {
  1102. struct req_lib_msg_queueunlink *req_lib_msg_queueunlink =
  1103. (struct req_lib_msg_queueunlink *)message;
  1104. struct req_exec_msg_queueunlink req_exec_msg_queueunlink;
  1105. struct iovec iovec;
  1106. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueUnlink %s\n",
  1107. getSaNameT (&req_lib_msg_queueunlink->queueName));
  1108. req_exec_msg_queueunlink.header.size =
  1109. sizeof (struct req_exec_msg_queueunlink);
  1110. req_exec_msg_queueunlink.header.id =
  1111. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK);
  1112. message_source_set (&req_exec_msg_queueunlink.source, conn_info);
  1113. memcpy (&req_exec_msg_queueunlink.queue_name,
  1114. &req_lib_msg_queueunlink->queueName, sizeof (SaNameT));
  1115. iovec.iov_base = (char *)&req_exec_msg_queueunlink;
  1116. iovec.iov_len = sizeof (req_exec_msg_queueunlink);
  1117. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1118. TOTEMPG_AGREED) == 0);
  1119. return (0);
  1120. }
  1121. static int message_handler_req_lib_msg_queuegroupcreate (
  1122. struct conn_info *conn_info,
  1123. void *message)
  1124. {
  1125. struct req_lib_msg_queuegroupcreate *req_lib_msg_queuegroupcreate =
  1126. (struct req_lib_msg_queuegroupcreate *)message;
  1127. struct req_exec_msg_queuegroupcreate req_exec_msg_queuegroupcreate;
  1128. struct iovec iovec;
  1129. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupCreate %s\n",
  1130. getSaNameT (&req_lib_msg_queuegroupcreate->queueGroupName));
  1131. req_exec_msg_queuegroupcreate.header.size =
  1132. sizeof (struct req_exec_msg_queuegroupcreate);
  1133. req_exec_msg_queuegroupcreate.header.id =
  1134. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE);
  1135. message_source_set (&req_exec_msg_queuegroupcreate.source, conn_info);
  1136. memcpy (&req_exec_msg_queuegroupcreate.queue_group_name,
  1137. &req_lib_msg_queuegroupcreate->queueGroupName, sizeof (SaNameT));
  1138. iovec.iov_base = (char *)&req_exec_msg_queuegroupcreate;
  1139. iovec.iov_len = sizeof (req_exec_msg_queuegroupcreate);
  1140. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1141. TOTEMPG_AGREED) == 0);
  1142. return (0);
  1143. }
  1144. static int message_handler_req_lib_msg_queuegroupinsert (
  1145. struct conn_info *conn_info,
  1146. void *message)
  1147. {
  1148. struct req_lib_msg_queuegroupinsert *req_lib_msg_queuegroupinsert =
  1149. (struct req_lib_msg_queuegroupinsert *)message;
  1150. struct req_exec_msg_queuegroupinsert req_exec_msg_queuegroupinsert;
  1151. struct iovec iovec;
  1152. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupInsert %s\n",
  1153. getSaNameT (&req_lib_msg_queuegroupinsert->queueGroupName));
  1154. req_exec_msg_queuegroupinsert.header.size =
  1155. sizeof (struct req_exec_msg_queuegroupinsert);
  1156. req_exec_msg_queuegroupinsert.header.id =
  1157. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT);
  1158. message_source_set (&req_exec_msg_queuegroupinsert.source, conn_info);
  1159. memcpy (&req_exec_msg_queuegroupinsert.queue_name,
  1160. &req_lib_msg_queuegroupinsert->queueName, sizeof (SaNameT));
  1161. memcpy (&req_exec_msg_queuegroupinsert.queue_group_name,
  1162. &req_lib_msg_queuegroupinsert->queueGroupName, sizeof (SaNameT));
  1163. iovec.iov_base = (char *)&req_exec_msg_queuegroupinsert;
  1164. iovec.iov_len = sizeof (req_exec_msg_queuegroupinsert);
  1165. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1166. TOTEMPG_AGREED) == 0);
  1167. return (0);
  1168. }
  1169. static int message_handler_req_lib_msg_queuegroupremove (
  1170. struct conn_info *conn_info,
  1171. void *message)
  1172. {
  1173. struct req_lib_msg_queuegroupremove *req_lib_msg_queuegroupremove =
  1174. (struct req_lib_msg_queuegroupremove *)message;
  1175. struct req_exec_msg_queuegroupremove req_exec_msg_queuegroupremove;
  1176. struct iovec iovec;
  1177. req_exec_msg_queuegroupremove.header.size =
  1178. sizeof (struct req_exec_msg_queuegroupremove);
  1179. req_exec_msg_queuegroupremove.header.id =
  1180. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE);
  1181. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupRemove %s\n",
  1182. getSaNameT (&req_lib_msg_queuegroupremove->queueGroupName));
  1183. message_source_set (&req_exec_msg_queuegroupremove.source, conn_info);
  1184. memcpy (&req_exec_msg_queuegroupremove.queue_name,
  1185. &req_lib_msg_queuegroupremove->queueName, sizeof (SaNameT));
  1186. memcpy (&req_exec_msg_queuegroupremove.queue_group_name,
  1187. &req_lib_msg_queuegroupremove->queueGroupName, sizeof (SaNameT));
  1188. iovec.iov_base = (char *)&req_exec_msg_queuegroupremove;
  1189. iovec.iov_len = sizeof (req_exec_msg_queuegroupremove);
  1190. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1191. TOTEMPG_AGREED) == 0);
  1192. return (0);
  1193. }
  1194. static int message_handler_req_lib_msg_queuegroupdelete (
  1195. struct conn_info *conn_info,
  1196. void *message)
  1197. {
  1198. struct req_lib_msg_queuegroupdelete *req_lib_msg_queuegroupdelete =
  1199. (struct req_lib_msg_queuegroupdelete *)message;
  1200. struct req_exec_msg_queuegroupdelete req_exec_msg_queuegroupdelete;
  1201. struct iovec iovec;
  1202. req_exec_msg_queuegroupdelete.header.size =
  1203. sizeof (struct req_exec_msg_queuegroupdelete);
  1204. req_exec_msg_queuegroupdelete.header.id =
  1205. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE);
  1206. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupDelete %s\n",
  1207. getSaNameT (&req_lib_msg_queuegroupdelete->queueGroupName));
  1208. message_source_set (&req_exec_msg_queuegroupdelete.source, conn_info);
  1209. memcpy (&req_exec_msg_queuegroupdelete.queue_group_name,
  1210. &req_lib_msg_queuegroupdelete->queueGroupName, sizeof (SaNameT));
  1211. iovec.iov_base = (char *)&req_exec_msg_queuegroupdelete;
  1212. iovec.iov_len = sizeof (req_exec_msg_queuegroupdelete);
  1213. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1214. TOTEMPG_AGREED) == 0);
  1215. return (0);
  1216. }
  1217. static int message_handler_req_lib_msg_queuegrouptrack (
  1218. struct conn_info *conn_info,
  1219. void *message)
  1220. {
  1221. struct req_lib_msg_queuegrouptrack *req_lib_msg_queuegrouptrack =
  1222. (struct req_lib_msg_queuegrouptrack *)message;
  1223. struct req_exec_msg_queuegrouptrack req_exec_msg_queuegrouptrack;
  1224. struct iovec iovec;
  1225. req_exec_msg_queuegrouptrack.header.size =
  1226. sizeof (struct req_exec_msg_queuegrouptrack);
  1227. req_exec_msg_queuegrouptrack.header.id =
  1228. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK);
  1229. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrack %s\n",
  1230. getSaNameT (&req_lib_msg_queuegrouptrack->queueGroupName));
  1231. message_source_set (&req_exec_msg_queuegrouptrack.source, conn_info);
  1232. memcpy (&req_exec_msg_queuegrouptrack.queue_group_name,
  1233. &req_lib_msg_queuegrouptrack->queueGroupName, sizeof (SaNameT));
  1234. iovec.iov_base = (char *)&req_exec_msg_queuegrouptrack;
  1235. iovec.iov_len = sizeof (req_exec_msg_queuegrouptrack);
  1236. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1237. TOTEMPG_AGREED) == 0);
  1238. return (0);
  1239. }
  1240. static int message_handler_req_lib_msg_queuegrouptrackstop (
  1241. struct conn_info *conn_info,
  1242. void *message)
  1243. {
  1244. struct req_lib_msg_queuegrouptrackstop *req_lib_msg_queuegrouptrackstop =
  1245. (struct req_lib_msg_queuegrouptrackstop *)message;
  1246. struct req_exec_msg_queuegrouptrackstop req_exec_msg_queuegrouptrackstop;
  1247. struct iovec iovec;
  1248. req_exec_msg_queuegrouptrackstop.header.size =
  1249. sizeof (struct req_exec_msg_queuegrouptrackstop);
  1250. req_exec_msg_queuegrouptrackstop.header.id =
  1251. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP);
  1252. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrackStop %s\n",
  1253. getSaNameT (&req_lib_msg_queuegrouptrackstop->queueGroupName));
  1254. message_source_set (&req_exec_msg_queuegrouptrackstop.source, conn_info);
  1255. memcpy (&req_exec_msg_queuegrouptrackstop.queue_group_name,
  1256. &req_lib_msg_queuegrouptrackstop->queueGroupName, sizeof (SaNameT));
  1257. iovec.iov_base = (char *)&req_exec_msg_queuegrouptrackstop;
  1258. iovec.iov_len = sizeof (req_exec_msg_queuegrouptrackstop);
  1259. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1260. TOTEMPG_AGREED) == 0);
  1261. return (0);
  1262. }
  1263. static int message_handler_req_lib_msg_messagesend (
  1264. struct conn_info *conn_info,
  1265. void *message)
  1266. {
  1267. struct req_lib_msg_messagesend *req_lib_msg_messagesend =
  1268. (struct req_lib_msg_messagesend *)message;
  1269. struct req_exec_msg_messagesend req_exec_msg_messagesend;
  1270. struct iovec iovec;
  1271. req_exec_msg_messagesend.header.size =
  1272. sizeof (struct req_exec_msg_messagesend);
  1273. req_exec_msg_messagesend.header.id =
  1274. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
  1275. req_exec_msg_messagesend.async_call = 0;
  1276. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSend %s\n",
  1277. getSaNameT (&req_lib_msg_messagesend->destination));
  1278. message_source_set (&req_exec_msg_messagesend.source, conn_info);
  1279. memcpy (&req_exec_msg_messagesend.destination,
  1280. &req_lib_msg_messagesend->destination, sizeof (SaNameT));
  1281. iovec.iov_base = (char *)&req_exec_msg_messagesend;
  1282. iovec.iov_len = sizeof (req_exec_msg_messagesend);
  1283. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1284. TOTEMPG_AGREED) == 0);
  1285. return (0);
  1286. }
  1287. static int message_handler_req_lib_msg_messagesendasync (
  1288. struct conn_info *conn_info,
  1289. void *message)
  1290. {
  1291. struct req_lib_msg_messagesend *req_lib_msg_messagesend =
  1292. (struct req_lib_msg_messagesend *)message;
  1293. struct req_exec_msg_messagesend req_exec_msg_messagesend;
  1294. struct iovec iovec;
  1295. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendAsync %s\n",
  1296. getSaNameT (&req_lib_msg_messagesend->destination));
  1297. req_exec_msg_messagesend.header.size =
  1298. sizeof (struct req_exec_msg_messagesend);
  1299. req_exec_msg_messagesend.header.id =
  1300. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
  1301. req_exec_msg_messagesend.async_call = 1;
  1302. message_source_set (&req_exec_msg_messagesend.source, conn_info);
  1303. memcpy (&req_exec_msg_messagesend.destination,
  1304. &req_lib_msg_messagesend->destination, sizeof (SaNameT));
  1305. iovec.iov_base = (char *)&req_exec_msg_messagesend;
  1306. iovec.iov_len = sizeof (req_exec_msg_messagesend);
  1307. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1308. TOTEMPG_AGREED) == 0);
  1309. return (0);
  1310. }
  1311. static int message_handler_req_lib_msg_messageget (
  1312. struct conn_info *conn_info,
  1313. void *message)
  1314. {
  1315. struct req_lib_msg_messageget *req_lib_msg_messageget =
  1316. (struct req_lib_msg_messageget *)message;
  1317. struct req_exec_msg_messageget req_exec_msg_messageget;
  1318. struct iovec iovec;
  1319. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageGet %s\n",
  1320. getSaNameT (&req_lib_msg_messageget->queueName));
  1321. req_exec_msg_messageget.header.size =
  1322. sizeof (struct req_exec_msg_messageget);
  1323. req_exec_msg_messageget.header.id =
  1324. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEGET);
  1325. message_source_set (&req_exec_msg_messageget.source, conn_info);
  1326. memcpy (&req_exec_msg_messageget.queue_name,
  1327. &req_lib_msg_messageget->queueName, sizeof (SaNameT));
  1328. iovec.iov_base = (char *)&req_exec_msg_messageget;
  1329. iovec.iov_len = sizeof (req_exec_msg_messageget);
  1330. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1331. TOTEMPG_AGREED) == 0);
  1332. return (0);
  1333. }
  1334. static int message_handler_req_lib_msg_messagecancel (
  1335. struct conn_info *conn_info,
  1336. void *message)
  1337. {
  1338. struct req_lib_msg_messagecancel *req_lib_msg_messagecancel =
  1339. (struct req_lib_msg_messagecancel *)message;
  1340. struct req_exec_msg_messagecancel req_exec_msg_messagecancel;
  1341. struct iovec iovec;
  1342. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageCancel %s\n",
  1343. getSaNameT (&req_lib_msg_messagecancel->queueName));
  1344. req_exec_msg_messagecancel.header.size =
  1345. sizeof (struct req_exec_msg_messagecancel);
  1346. req_exec_msg_messagecancel.header.id =
  1347. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL);
  1348. message_source_set (&req_exec_msg_messagecancel.source, conn_info);
  1349. memcpy (&req_exec_msg_messagecancel.queue_name,
  1350. &req_lib_msg_messagecancel->queueName, sizeof (SaNameT));
  1351. iovec.iov_base = (char *)&req_exec_msg_messagecancel;
  1352. iovec.iov_len = sizeof (req_exec_msg_messagecancel);
  1353. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1354. TOTEMPG_AGREED) == 0);
  1355. return (0);
  1356. }
  1357. static int message_handler_req_lib_msg_messagesendreceive (
  1358. struct conn_info *conn_info,
  1359. void *message)
  1360. {
  1361. struct req_lib_msg_messagesendreceive *req_lib_msg_messagesendreceive =
  1362. (struct req_lib_msg_messagesendreceive *)message;
  1363. struct req_exec_msg_messagesendreceive req_exec_msg_messagesendreceive;
  1364. struct iovec iovec;
  1365. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendReceive %s\n",
  1366. getSaNameT (&req_lib_msg_messagesendreceive->queueName));
  1367. req_exec_msg_messagesendreceive.header.size =
  1368. sizeof (struct req_exec_msg_messagesendreceive);
  1369. req_exec_msg_messagesendreceive.header.id =
  1370. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE);
  1371. message_source_set (&req_exec_msg_messagesendreceive.source, conn_info);
  1372. memcpy (&req_exec_msg_messagesendreceive.queue_name,
  1373. &req_lib_msg_messagesendreceive->queueName, sizeof (SaNameT));
  1374. iovec.iov_base = (char *)&req_exec_msg_messagesendreceive;
  1375. iovec.iov_len = sizeof (req_exec_msg_messagesendreceive);
  1376. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1377. TOTEMPG_AGREED) == 0);
  1378. return (0);
  1379. }
  1380. static int message_handler_req_lib_msg_messagereply (
  1381. struct conn_info *conn_info,
  1382. void *message)
  1383. {
  1384. struct req_lib_msg_messagereply *req_lib_msg_messagereply =
  1385. (struct req_lib_msg_messagereply *)message;
  1386. struct req_exec_msg_messagereply req_exec_msg_messagereply;
  1387. struct iovec iovec;
  1388. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReply %s\n",
  1389. getSaNameT (&req_lib_msg_messagereply->queueName));
  1390. req_exec_msg_messagereply.header.size =
  1391. sizeof (struct req_exec_msg_messagereply);
  1392. req_exec_msg_messagereply.header.id =
  1393. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
  1394. req_exec_msg_messagereply.async_call = 0;
  1395. message_source_set (&req_exec_msg_messagereply.source, conn_info);
  1396. memcpy (&req_exec_msg_messagereply.queue_name,
  1397. &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
  1398. iovec.iov_base = (char *)&req_exec_msg_messagereply;
  1399. iovec.iov_len = sizeof (req_exec_msg_messagereply);
  1400. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1401. TOTEMPG_AGREED) == 0);
  1402. return (0);
  1403. }
  1404. static int message_handler_req_lib_msg_messagereplyasync (
  1405. struct conn_info *conn_info,
  1406. void *message)
  1407. {
  1408. struct req_lib_msg_messagereply *req_lib_msg_messagereply =
  1409. (struct req_lib_msg_messagereply *)message;
  1410. struct req_exec_msg_messagereply req_exec_msg_messagereply;
  1411. struct iovec iovec;
  1412. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReplyAsync %s\n",
  1413. getSaNameT (&req_lib_msg_messagereply->queueName));
  1414. req_exec_msg_messagereply.header.size =
  1415. sizeof (struct req_exec_msg_messagereply);
  1416. req_exec_msg_messagereply.header.id =
  1417. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
  1418. req_exec_msg_messagereply.async_call = 1;
  1419. message_source_set (&req_exec_msg_messagereply.source, conn_info);
  1420. memcpy (&req_exec_msg_messagereply.queue_name,
  1421. &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
  1422. iovec.iov_base = (char *)&req_exec_msg_messagereply;
  1423. iovec.iov_len = sizeof (req_exec_msg_messagereply);
  1424. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1425. TOTEMPG_AGREED) == 0);
  1426. return (0);
  1427. }