msg.c 51 KB

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