msg.c 51 KB

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