msg.c 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662
  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 "service.h"
  54. #include "aispoll.h"
  55. #include "mempool.h"
  56. #include "util.h"
  57. #include "main.h"
  58. #include "totempg.h"
  59. #define LOG_SERVICE LOG_SERVICE_MSG
  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 openais_config *);
  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. struct totem_ip_address *source_addr);
  108. static void message_handler_req_exec_msg_queueclose (
  109. void *message,
  110. struct totem_ip_address *source_addr);
  111. static void message_handler_req_exec_msg_queuestatusget (
  112. void *message,
  113. struct totem_ip_address *source_addr);
  114. static void message_handler_req_exec_msg_queueunlink (
  115. void *message,
  116. struct totem_ip_address *source_addr);
  117. static void message_handler_req_exec_msg_queuegroupcreate (
  118. void *message,
  119. struct totem_ip_address *source_addr);
  120. static void message_handler_req_exec_msg_queuegroupinsert (
  121. void *message,
  122. struct totem_ip_address *source_addr);
  123. static void message_handler_req_exec_msg_queuegroupremove (
  124. void *message,
  125. struct totem_ip_address *source_addr);
  126. static void message_handler_req_exec_msg_queuegroupdelete (
  127. void *message,
  128. struct totem_ip_address *source_addr);
  129. static void message_handler_req_exec_msg_queuegrouptrack (
  130. void *message,
  131. struct totem_ip_address *source_addr);
  132. static void message_handler_req_exec_msg_queuegrouptrackstop (
  133. void *message,
  134. struct totem_ip_address *source_addr);
  135. static void message_handler_req_exec_msg_messagesend (
  136. void *message,
  137. struct totem_ip_address *source_addr);
  138. static void message_handler_req_exec_msg_messageget (
  139. void *message,
  140. struct totem_ip_address *source_addr);
  141. static void message_handler_req_exec_msg_messagecancel (
  142. void *message,
  143. struct totem_ip_address *source_addr);
  144. static void message_handler_req_exec_msg_messagesendreceive (
  145. void *message,
  146. struct totem_ip_address *source_addr);
  147. static void message_handler_req_exec_msg_messagereply (
  148. void *message,
  149. struct totem_ip_address *source_addr);
  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. struct totem_ip_address *member_list, int member_list_entries,
  214. struct totem_ip_address *left_list, int left_list_entries,
  215. struct totem_ip_address *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. 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. 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_component_register (&msg_comp_ver0);
  427. }
  428. /*
  429. * All data types used for executive messages
  430. */
  431. struct req_exec_msg_queueopen {
  432. struct req_header header;
  433. struct message_source source;
  434. int async_call;
  435. SaNameT queue_name;
  436. SaInvocationT invocation;
  437. SaMsgQueueHandleT queue_handle;
  438. SaMsgQueueCreationAttributesT creation_attributes;
  439. SaMsgQueueOpenFlagsT openFlags;
  440. SaTimeT timeout;
  441. };
  442. struct req_exec_msg_queueclose {
  443. struct req_header header;
  444. struct message_source source;
  445. SaNameT queue_name;
  446. };
  447. struct req_exec_msg_queuestatusget {
  448. struct req_header header;
  449. struct message_source source;
  450. SaNameT queue_name;
  451. };
  452. struct req_exec_msg_queueunlink {
  453. struct req_header header;
  454. struct message_source source;
  455. SaNameT queue_name;
  456. };
  457. struct req_exec_msg_queuegroupcreate {
  458. struct req_header header;
  459. struct message_source source;
  460. SaNameT queue_group_name;
  461. };
  462. struct req_exec_msg_queuegroupinsert {
  463. struct req_header header;
  464. struct message_source source;
  465. SaNameT queue_name;
  466. SaNameT queue_group_name;
  467. };
  468. struct req_exec_msg_queuegroupremove {
  469. struct req_header header;
  470. struct message_source source;
  471. SaNameT queue_name;
  472. SaNameT queue_group_name;
  473. };
  474. struct req_exec_msg_queuegroupdelete {
  475. struct req_header header;
  476. struct message_source source;
  477. SaNameT queue_group_name;
  478. };
  479. struct req_exec_msg_queuegrouptrack {
  480. struct req_header header;
  481. struct message_source source;
  482. SaNameT queue_group_name;
  483. };
  484. struct req_exec_msg_queuegrouptrackstop {
  485. struct req_header header;
  486. struct message_source source;
  487. SaNameT queue_group_name;
  488. };
  489. struct req_exec_msg_messagesend {
  490. struct req_header header;
  491. struct message_source source;
  492. SaNameT destination;
  493. int async_call;
  494. };
  495. struct req_exec_msg_messageget {
  496. struct req_header header;
  497. struct message_source source;
  498. SaNameT queue_name;
  499. };
  500. struct req_exec_msg_messagecancel {
  501. struct req_header header;
  502. struct message_source source;
  503. SaNameT queue_name;
  504. };
  505. struct req_exec_msg_messagesendreceive {
  506. struct req_header header;
  507. struct message_source source;
  508. SaNameT queue_name;
  509. };
  510. struct req_exec_msg_messagereply {
  511. struct req_header header;
  512. struct message_source source;
  513. SaNameT queue_name;
  514. int async_call;
  515. };
  516. #ifdef TODO
  517. static void msg_sync_init (void)
  518. {
  519. return;
  520. }
  521. #endif
  522. static int msg_sync_process (void)
  523. {
  524. return (0);
  525. }
  526. static void msg_sync_activate (void)
  527. {
  528. return;
  529. }
  530. static void msg_sync_abort (void)
  531. {
  532. return;
  533. }
  534. static void msg_confchg_fn (
  535. enum totem_configuration_type configuration_type,
  536. struct totem_ip_address *member_list, int member_list_entries,
  537. struct totem_ip_address *left_list, int left_list_entries,
  538. struct totem_ip_address *joined_list, int joined_list_entries,
  539. struct memb_ring_id *ring_id)
  540. {
  541. }
  542. static struct message_queue *queue_find (SaNameT *name)
  543. {
  544. struct list_head *list;
  545. struct message_queue *queue;
  546. for (list = queue_list_head.next;
  547. list != &queue_list_head;
  548. list = list->next) {
  549. queue = list_entry (list, struct message_queue, list);
  550. if (name_match (name, &queue->name)) {
  551. return (queue);
  552. }
  553. }
  554. return (0);
  555. }
  556. static struct queue_group *queue_group_find (SaNameT *name)
  557. {
  558. struct list_head *list;
  559. struct queue_group *queue_group;
  560. for (list = queue_group_list_head.next;
  561. list != &queue_group_list_head;
  562. list = list->next) {
  563. queue_group = list_entry (list, struct queue_group, list);
  564. if (name_match (name, &queue_group->name)) {
  565. return (queue_group);
  566. }
  567. }
  568. return (0);
  569. }
  570. static struct queue_group_entry *queue_group_entry_find (
  571. struct queue_group *queue_group,
  572. struct message_queue *queue)
  573. {
  574. struct list_head *list;
  575. struct queue_group_entry *queue_group_entry;
  576. for (list = queue_group->message_queue_head.next;
  577. list != &queue_group->message_queue_head;
  578. list = list->next) {
  579. queue_group_entry = list_entry (list, struct queue_group_entry, list);
  580. if (queue_group_entry->message_queue == queue) {
  581. return (queue_group_entry);
  582. }
  583. }
  584. return (0);
  585. }
  586. static int msg_exec_init_fn (struct openais_config *openais_config)
  587. {
  588. /*
  589. * Initialize the saved ring ID.
  590. */
  591. // saved_ring_id.seq = 0;
  592. // saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
  593. return (0);
  594. }
  595. static int msg_lib_exit_fn (void *conn)
  596. {
  597. // struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
  598. #ifdef COMPILE_OUT
  599. struct queue_cleanup *queue_cleanup;
  600. struct list_head *list;
  601. printf ("exit_fn\n");
  602. log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %p\n", conn);
  603. /*
  604. * close all queues opened on this fd
  605. */
  606. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  607. while (!list_empty(&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list)) {
  608. queue_cleanup = list_entry (list, struct queue_cleanup, list);
  609. printf ("queue to cleanup\n");
  610. if (queue_cleanup->queue->name.length > 0) {
  611. msg_queue_cleanup_lock_remove (queue_cleanup);
  612. msg_queue_close (queue_cleanup->queue);
  613. }
  614. printf ("queue cleanup %x\n", queue_cleanup);
  615. list_del (&queue_cleanup->list);
  616. free (queue_cleanup);
  617. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  618. }
  619. #endif
  620. return (0);
  621. }
  622. static int msg_lib_init_fn (void *conn)
  623. {
  624. struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
  625. list_init (&msg_pd->queue_list);
  626. list_init (&msg_pd->queue_cleanup_list);
  627. return (0);
  628. }
  629. static void message_handler_req_exec_msg_queueopen (
  630. void *message,
  631. struct totem_ip_address *source_addr)
  632. {
  633. struct req_exec_msg_queueopen *req_exec_msg_queueopen = (struct req_exec_msg_queueopen *)message;
  634. struct res_lib_msg_queueopen res_lib_msg_queueopen;
  635. struct res_lib_msg_queueopenasync res_lib_msg_queueopenasync;
  636. struct message_queue *queue;
  637. // struct queue_cleanup *queue_cleanup;
  638. SaAisErrorT error = SA_AIS_OK;
  639. log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueOpen %s\n",
  640. getSaNameT (&req_exec_msg_queueopen->queue_name));
  641. queue = queue_find (&req_exec_msg_queueopen->queue_name);
  642. printf ("queue %p\n", queue);
  643. /*
  644. * If queue doesn't exist, create one
  645. */
  646. if (queue == 0) {
  647. if ((req_exec_msg_queueopen->openFlags & SA_MSG_QUEUE_CREATE) == 0) {
  648. error = SA_AIS_ERR_NOT_EXIST;
  649. goto error_exit;
  650. }
  651. queue = malloc (sizeof (struct message_queue));
  652. if (queue == 0) {
  653. error = SA_AIS_ERR_NO_MEMORY;
  654. goto error_exit;
  655. }
  656. memset (queue, 0, sizeof (struct message_queue));
  657. memcpy (&queue->name,
  658. &req_exec_msg_queueopen->queue_name,
  659. sizeof (SaNameT));
  660. list_init (&queue->list);
  661. list_add (&queue->list, &queue_list_head);
  662. queue->refcount = 0;
  663. }
  664. queue->refcount += 1;
  665. printf ("Incrementing queue refcount to %d\n", queue->refcount);
  666. #ifdef COMPILE_OUT
  667. /*
  668. * Setup connection information and mark queue as referenced
  669. */
  670. log_printf (LOG_LEVEL_DEBUG, "Lock queue opened is %p\n", queue);
  671. queue_cleanup = malloc (sizeof (struct queue_cleanup));
  672. if (queue_cleanup == 0) {
  673. free (queue);
  674. error = SA_AIS_ERR_NO_MEMORY;
  675. } else {
  676. list_init (&queue_cleanup->list);
  677. list_init (&queue_cleanup->queue_lock_list_head);
  678. queue_cleanup->queue = queue;
  679. queue_cleanup->queue_handle = req_exec_msg_queueopen->queue_handle;
  680. list_add (
  681. &queue_cleanup->list,
  682. &req_exec_msg_queueopen->source.conn_info->ais_ci.u.libmsg_ci.queue_cleanup_list);
  683. }
  684. queue->refcount += 1;
  685. printf ("refcount == %d\n", queue->refcount);
  686. #endif
  687. /*
  688. * Send error result to MSG library
  689. */
  690. error_exit:
  691. /*
  692. * If this node was the source of the message, respond to this node
  693. */
  694. if (message_source_is_local (&req_exec_msg_queueopen->source)) {
  695. /*
  696. * If its an async call respond with the invocation and handle
  697. */
  698. if (req_exec_msg_queueopen->async_call) {
  699. res_lib_msg_queueopenasync.header.size = sizeof (struct res_lib_msg_queueopenasync);
  700. res_lib_msg_queueopenasync.header.id = MESSAGE_RES_MSG_QUEUEOPENASYNC;
  701. res_lib_msg_queueopenasync.header.error = error;
  702. res_lib_msg_queueopenasync.invocation = req_exec_msg_queueopen->invocation;
  703. memcpy (&res_lib_msg_queueopenasync.source,
  704. &req_exec_msg_queueopen->source,
  705. sizeof (struct message_source));
  706. openais_conn_send_response (
  707. req_exec_msg_queueopen->source.conn,
  708. &res_lib_msg_queueopenasync,
  709. sizeof (struct res_lib_msg_queueopenasync));
  710. openais_conn_send_response (
  711. openais_conn_partner_get (req_exec_msg_queueopen->source.conn),
  712. &res_lib_msg_queueopenasync,
  713. sizeof (struct res_lib_msg_queueopenasync));
  714. } else {
  715. /*
  716. * otherwise respond with the normal queueopen response
  717. */
  718. res_lib_msg_queueopen.header.size = sizeof (struct res_lib_msg_queueopen);
  719. res_lib_msg_queueopen.header.id = MESSAGE_RES_MSG_QUEUEOPEN;
  720. res_lib_msg_queueopen.header.error = error;
  721. memcpy (&res_lib_msg_queueopen.source,
  722. &req_exec_msg_queueopen->source,
  723. sizeof (struct message_source));
  724. openais_conn_send_response (
  725. req_exec_msg_queueopen->source.conn,
  726. &res_lib_msg_queueopen,
  727. sizeof (struct res_lib_msg_queueopen));
  728. }
  729. }
  730. }
  731. static void message_handler_req_exec_msg_queueclose (
  732. void *message,
  733. struct totem_ip_address *source_addr)
  734. {
  735. struct req_exec_msg_queueclose *req_exec_msg_queueclose = (struct req_exec_msg_queueclose *)message;
  736. struct res_lib_msg_queueclose res_lib_msg_queueclose;
  737. struct message_queue *queue = 0;
  738. SaAisErrorT error = SA_AIS_OK;
  739. log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueClose %s\n",
  740. getSaNameT (&req_exec_msg_queueclose->queue_name));
  741. queue = queue_find (&req_exec_msg_queueclose->queue_name);
  742. if (queue == 0) {
  743. goto error_exit;
  744. }
  745. queue->refcount -= 1;
  746. printf ("decrementing queue refcount to %d\n", queue->refcount);
  747. if (queue->refcount == 0) {
  748. printf ("should free queue\n");
  749. }
  750. error_exit:
  751. if (message_source_is_local(&req_exec_msg_queueclose->source)) {
  752. // TODO msg_queue_cleanup_remove (
  753. // req_exec_msg_queueclose->source.conn_info,
  754. // req_exec_msg_queueclose->queue_handle);
  755. res_lib_msg_queueclose.header.size = sizeof (struct res_lib_msg_queueclose);
  756. res_lib_msg_queueclose.header.id = MESSAGE_RES_MSG_QUEUECLOSE;
  757. res_lib_msg_queueclose.header.error = error;
  758. openais_conn_send_response (req_exec_msg_queueclose->source.conn,
  759. &res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose));
  760. }
  761. }
  762. static void message_handler_req_exec_msg_queuestatusget (
  763. void *message,
  764. struct totem_ip_address *source_addr)
  765. {
  766. struct req_exec_msg_queuestatusget *req_exec_msg_queuestatusget =
  767. (struct req_exec_msg_queuestatusget *)message;
  768. struct res_lib_msg_queueclose res_lib_msg_queuestatusget;
  769. }
  770. static void message_handler_req_exec_msg_queueunlink (
  771. void *message,
  772. struct totem_ip_address *source_addr)
  773. {
  774. struct req_exec_msg_queueunlink *req_exec_msg_queueunlink =
  775. (struct req_exec_msg_queueunlink *)message;
  776. struct res_lib_msg_queueclose res_lib_msg_queueunlink;
  777. }
  778. static void message_handler_req_exec_msg_queuegroupcreate (
  779. void *message,
  780. struct totem_ip_address *source_addr)
  781. {
  782. struct req_exec_msg_queuegroupcreate *req_exec_msg_queuegroupcreate =
  783. (struct req_exec_msg_queuegroupcreate *)message;
  784. struct res_lib_msg_queuegroupcreate res_lib_msg_queuegroupcreate;
  785. struct queue_group *queue_group;
  786. SaAisErrorT error = SA_AIS_OK;
  787. queue_group = queue_group_find (&req_exec_msg_queuegroupcreate->queue_group_name);
  788. if (queue_group == 0) {
  789. queue_group = malloc (sizeof (struct queue_group));
  790. if (queue_group == 0) {
  791. error = SA_AIS_ERR_NO_MEMORY;
  792. goto error_exit;
  793. }
  794. memset (queue_group, 0, sizeof (struct queue_group));
  795. memcpy (&queue_group->name,
  796. &req_exec_msg_queuegroupcreate->queue_group_name,
  797. sizeof (SaNameT));
  798. list_init (&queue_group->list);
  799. list_init (&queue_group->message_queue_head);
  800. list_add (&queue_group->list, &queue_group_list_head);
  801. } else {
  802. error = SA_AIS_ERR_EXIST;
  803. }
  804. error_exit:
  805. if (message_source_is_local(&req_exec_msg_queuegroupcreate->source)) {
  806. res_lib_msg_queuegroupcreate.header.size = sizeof (struct res_lib_msg_queuegroupcreate);
  807. res_lib_msg_queuegroupcreate.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  808. res_lib_msg_queuegroupcreate.header.error = error;
  809. openais_conn_send_response (
  810. req_exec_msg_queuegroupcreate->source.conn,
  811. &res_lib_msg_queuegroupcreate,
  812. sizeof (struct res_lib_msg_queuegroupcreate));
  813. }
  814. }
  815. static void message_handler_req_exec_msg_queuegroupinsert (
  816. void *message,
  817. struct totem_ip_address *source_addr)
  818. {
  819. struct req_exec_msg_queuegroupinsert *req_exec_msg_queuegroupinsert =
  820. (struct req_exec_msg_queuegroupinsert *)message;
  821. struct res_lib_msg_queuegroupinsert res_lib_msg_queuegroupinsert;
  822. struct message_queue *queue;
  823. struct queue_group *queue_group;
  824. struct queue_group_entry *queue_group_entry;
  825. SaAisErrorT error = SA_AIS_OK;
  826. queue_group = queue_group_find (&req_exec_msg_queuegroupinsert->queue_group_name);
  827. if (queue_group == 0) {
  828. printf ("a\n");
  829. error = SA_AIS_ERR_NOT_EXIST;
  830. goto error_exit;
  831. }
  832. queue = queue_find (&req_exec_msg_queuegroupinsert->queue_name);
  833. if (queue == 0) {
  834. error = SA_AIS_ERR_NOT_EXIST;
  835. goto error_exit;
  836. }
  837. queue_group_entry = malloc (sizeof (struct queue_group_entry));
  838. if (queue_group_entry == 0) {
  839. printf ("c\n");
  840. error = SA_AIS_ERR_NO_MEMORY;
  841. goto error_exit;
  842. }
  843. list_init (&queue_group_entry->list);
  844. list_add (&queue_group_entry->list, &queue_group->message_queue_head);
  845. list_add (&queue->list, &queue_list_head);
  846. queue_group_entry->message_queue = queue;
  847. error_exit:
  848. if (message_source_is_local(&req_exec_msg_queuegroupinsert->source)) {
  849. res_lib_msg_queuegroupinsert.header.size = sizeof (struct res_lib_msg_queuegroupinsert);
  850. res_lib_msg_queuegroupinsert.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  851. res_lib_msg_queuegroupinsert.header.error = error;
  852. openais_conn_send_response (
  853. req_exec_msg_queuegroupinsert->source.conn,
  854. &res_lib_msg_queuegroupinsert,
  855. sizeof (struct res_lib_msg_queuegroupinsert));
  856. }
  857. }
  858. static void message_handler_req_exec_msg_queuegroupremove (
  859. void *message,
  860. struct totem_ip_address *source_addr)
  861. {
  862. struct req_exec_msg_queuegroupremove *req_exec_msg_queuegroupremove =
  863. (struct req_exec_msg_queuegroupremove *)message;
  864. struct res_lib_msg_queuegroupremove res_lib_msg_queuegroupremove;
  865. struct queue_group *queue_group;
  866. struct message_queue *queue;
  867. struct queue_group_entry *queue_group_entry;
  868. SaAisErrorT error = SA_AIS_OK;
  869. queue_group = queue_group_find (&req_exec_msg_queuegroupremove->queue_group_name);
  870. if (queue_group == 0) {
  871. error = SA_AIS_ERR_NOT_EXIST;
  872. goto error_exit;
  873. }
  874. queue = queue_find (&req_exec_msg_queuegroupremove->queue_name);
  875. if (queue == 0) {
  876. error = SA_AIS_ERR_NOT_EXIST;
  877. goto error_exit;
  878. }
  879. queue_group_entry = queue_group_entry_find (queue_group, queue);
  880. if (queue_group_entry == 0) {
  881. error = SA_AIS_ERR_NOT_EXIST;
  882. goto error_exit;
  883. }
  884. list_del (&queue_group_entry->list);
  885. error_exit:
  886. if (message_source_is_local(&req_exec_msg_queuegroupremove->source)) {
  887. res_lib_msg_queuegroupremove.header.size = sizeof (struct res_lib_msg_queuegroupremove);
  888. res_lib_msg_queuegroupremove.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  889. res_lib_msg_queuegroupremove.header.error = error;
  890. openais_conn_send_response (
  891. req_exec_msg_queuegroupremove->source.conn,
  892. &res_lib_msg_queuegroupremove,
  893. sizeof (struct res_lib_msg_queuegroupremove));
  894. }
  895. }
  896. static void message_handler_req_exec_msg_queuegroupdelete (
  897. void *message,
  898. struct totem_ip_address *source_addr)
  899. {
  900. struct req_exec_msg_queuegroupdelete *req_exec_msg_queuegroupdelete =
  901. (struct req_exec_msg_queuegroupdelete *)message;
  902. struct res_lib_msg_queuegroupdelete res_lib_msg_queuegroupdelete;
  903. struct queue_group *queue_group;
  904. SaAisErrorT error = SA_AIS_OK;
  905. queue_group = queue_group_find (&req_exec_msg_queuegroupdelete->queue_group_name);
  906. if (queue_group) {
  907. list_del (&queue_group->list);
  908. free (queue_group);
  909. } else {
  910. error = SA_AIS_ERR_NOT_EXIST;
  911. }
  912. if (message_source_is_local(&req_exec_msg_queuegroupdelete->source)) {
  913. res_lib_msg_queuegroupdelete.header.size = sizeof (struct res_lib_msg_queuegroupdelete);
  914. res_lib_msg_queuegroupdelete.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
  915. res_lib_msg_queuegroupdelete.header.error = error;
  916. openais_conn_send_response (
  917. req_exec_msg_queuegroupdelete->source.conn,
  918. &res_lib_msg_queuegroupdelete,
  919. sizeof (struct res_lib_msg_queuegroupdelete));
  920. }
  921. }
  922. static void message_handler_req_exec_msg_queuegrouptrack (
  923. void *message,
  924. struct totem_ip_address *source_addr)
  925. {
  926. struct req_exec_msg_queuegrouptrack *req_exec_msg_queuegrouptrack =
  927. (struct req_exec_msg_queuegrouptrack *)message;
  928. struct res_lib_msg_queueclose res_lib_msg_queuegrouptrack;
  929. }
  930. static void message_handler_req_exec_msg_queuegrouptrackstop (
  931. void *message,
  932. struct totem_ip_address *source_addr)
  933. {
  934. struct req_exec_msg_queuegrouptrackstop *req_exec_msg_queuegrouptrackstop =
  935. (struct req_exec_msg_queuegrouptrackstop *)message;
  936. struct res_lib_msg_queueclose res_lib_msg_queuegrouptrackstop;
  937. }
  938. static void message_handler_req_exec_msg_messagesend (
  939. void *message,
  940. struct totem_ip_address *source_addr)
  941. {
  942. struct req_exec_msg_messagesend *req_exec_msg_messagesend =
  943. (struct req_exec_msg_messagesend *)message;
  944. struct res_lib_msg_queueclose res_lib_msg_messagesend;
  945. }
  946. static void message_handler_req_exec_msg_messageget (
  947. void *message,
  948. struct totem_ip_address *source_addr)
  949. {
  950. struct req_exec_msg_messageget *req_exec_msg_messageget =
  951. (struct req_exec_msg_messageget *)message;
  952. struct res_lib_msg_queueclose res_lib_msg_messageget;
  953. }
  954. static void message_handler_req_exec_msg_messagecancel (
  955. void *message,
  956. struct totem_ip_address *source_addr)
  957. {
  958. struct req_exec_msg_messagecancel *req_exec_msg_messagecancel =
  959. (struct req_exec_msg_messagecancel *)message;
  960. struct res_lib_msg_queueclose res_lib_msg_messagecancel;
  961. }
  962. static void message_handler_req_exec_msg_messagesendreceive (
  963. void *message,
  964. struct totem_ip_address *source_addr)
  965. {
  966. struct req_exec_msg_messagesendreceive *req_exec_msg_messagesendreceive =
  967. (struct req_exec_msg_messagesendreceive *)message;
  968. struct res_lib_msg_queueclose res_lib_msg_messagesendreceive;
  969. }
  970. static void message_handler_req_exec_msg_messagereply (
  971. void *message,
  972. struct totem_ip_address *source_addr)
  973. {
  974. struct req_exec_msg_messagereply *req_exec_msg_messagereply =
  975. (struct req_exec_msg_messagereply *)message;
  976. struct res_lib_msg_queueclose res_lib_msg_messagereply;
  977. }
  978. static void message_handler_req_lib_msg_queueopen (
  979. void *conn,
  980. void *msg)
  981. {
  982. struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
  983. struct req_exec_msg_queueopen req_exec_msg_queueopen;
  984. struct iovec iovec;
  985. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpen %s\n",
  986. getSaNameT (&req_lib_msg_queueopen->queueName));
  987. req_exec_msg_queueopen.header.size =
  988. sizeof (struct req_exec_msg_queueopen);
  989. req_exec_msg_queueopen.header.id =
  990. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
  991. message_source_set (&req_exec_msg_queueopen.source, conn);
  992. memcpy (&req_exec_msg_queueopen.queue_name,
  993. &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
  994. memcpy (&req_exec_msg_queueopen.creation_attributes,
  995. &req_lib_msg_queueopen->creationAttributes,
  996. sizeof (SaMsgQueueCreationAttributesT));
  997. req_exec_msg_queueopen.async_call = 0;
  998. req_exec_msg_queueopen.invocation = 0;
  999. req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
  1000. req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
  1001. req_exec_msg_queueopen.timeout = req_lib_msg_queueopen->timeout;
  1002. iovec.iov_base = (char *)&req_exec_msg_queueopen;
  1003. iovec.iov_len = sizeof (req_exec_msg_queueopen);
  1004. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1005. TOTEMPG_AGREED) == 0);
  1006. }
  1007. static void message_handler_req_lib_msg_queueopenasync (
  1008. void *conn,
  1009. void *msg)
  1010. {
  1011. struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
  1012. struct req_exec_msg_queueopen req_exec_msg_queueopen;
  1013. struct iovec iovec;
  1014. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpenAsync %s\n",
  1015. getSaNameT (&req_lib_msg_queueopen->queueName));
  1016. req_exec_msg_queueopen.header.size =
  1017. sizeof (struct req_exec_msg_queueopen);
  1018. req_exec_msg_queueopen.header.id =
  1019. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
  1020. message_source_set (&req_exec_msg_queueopen.source, conn);
  1021. memcpy (&req_exec_msg_queueopen.queue_name,
  1022. &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
  1023. memcpy (&req_exec_msg_queueopen.creation_attributes,
  1024. &req_lib_msg_queueopen->creationAttributes,
  1025. sizeof (SaMsgQueueCreationAttributesT));
  1026. req_exec_msg_queueopen.async_call = 1;
  1027. req_exec_msg_queueopen.invocation = req_lib_msg_queueopen->invocation;
  1028. req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
  1029. req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
  1030. req_exec_msg_queueopen.timeout = SA_TIME_END;
  1031. iovec.iov_base = (char *)&req_exec_msg_queueopen;
  1032. iovec.iov_len = sizeof (req_exec_msg_queueopen);
  1033. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1034. TOTEMPG_AGREED) == 0);
  1035. }
  1036. static void message_handler_req_lib_msg_queueclose (
  1037. void *conn,
  1038. void *msg)
  1039. {
  1040. struct req_lib_msg_queueclose *req_lib_msg_queueclose = (struct req_lib_msg_queueclose *)msg;
  1041. struct req_exec_msg_queueclose req_exec_msg_queueclose;
  1042. struct iovec iovec;
  1043. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueClose %s\n",
  1044. getSaNameT (&req_lib_msg_queueclose->queueName));
  1045. req_exec_msg_queueclose.header.size =
  1046. sizeof (struct req_exec_msg_queueclose);
  1047. req_exec_msg_queueclose.header.id =
  1048. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUECLOSE);
  1049. message_source_set (&req_exec_msg_queueclose.source, conn);
  1050. memcpy (&req_exec_msg_queueclose.queue_name,
  1051. &req_lib_msg_queueclose->queueName, sizeof (SaNameT));
  1052. iovec.iov_base = (char *)&req_exec_msg_queueclose;
  1053. iovec.iov_len = sizeof (req_exec_msg_queueclose);
  1054. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1055. TOTEMPG_AGREED) == 0);
  1056. }
  1057. static void message_handler_req_lib_msg_queuestatusget (
  1058. void *conn,
  1059. void *msg)
  1060. {
  1061. struct req_lib_msg_queuestatusget *req_lib_msg_queuestatusget =
  1062. (struct req_lib_msg_queuestatusget *)msg;
  1063. struct req_exec_msg_queuestatusget req_exec_msg_queuestatusget;
  1064. struct iovec iovec;
  1065. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueStatusGet %s\n",
  1066. getSaNameT (&req_lib_msg_queuestatusget->queueName));
  1067. req_exec_msg_queuestatusget.header.size =
  1068. sizeof (struct req_exec_msg_queuestatusget);
  1069. req_exec_msg_queuestatusget.header.id =
  1070. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET);
  1071. message_source_set (&req_exec_msg_queuestatusget.source, conn);
  1072. memcpy (&req_exec_msg_queuestatusget.queue_name,
  1073. &req_lib_msg_queuestatusget->queueName, sizeof (SaNameT));
  1074. iovec.iov_base = (char *)&req_exec_msg_queuestatusget;
  1075. iovec.iov_len = sizeof (req_exec_msg_queuestatusget);
  1076. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1077. TOTEMPG_AGREED) == 0);
  1078. }
  1079. static void message_handler_req_lib_msg_queueunlink (
  1080. void *conn,
  1081. void *msg)
  1082. {
  1083. struct req_lib_msg_queueunlink *req_lib_msg_queueunlink =
  1084. (struct req_lib_msg_queueunlink *)msg;
  1085. struct req_exec_msg_queueunlink req_exec_msg_queueunlink;
  1086. struct iovec iovec;
  1087. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueUnlink %s\n",
  1088. getSaNameT (&req_lib_msg_queueunlink->queueName));
  1089. req_exec_msg_queueunlink.header.size =
  1090. sizeof (struct req_exec_msg_queueunlink);
  1091. req_exec_msg_queueunlink.header.id =
  1092. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK);
  1093. message_source_set (&req_exec_msg_queueunlink.source, conn);
  1094. memcpy (&req_exec_msg_queueunlink.queue_name,
  1095. &req_lib_msg_queueunlink->queueName, sizeof (SaNameT));
  1096. iovec.iov_base = (char *)&req_exec_msg_queueunlink;
  1097. iovec.iov_len = sizeof (req_exec_msg_queueunlink);
  1098. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1099. TOTEMPG_AGREED) == 0);
  1100. }
  1101. static void message_handler_req_lib_msg_queuegroupcreate (
  1102. void *conn,
  1103. void *msg)
  1104. {
  1105. struct req_lib_msg_queuegroupcreate *req_lib_msg_queuegroupcreate =
  1106. (struct req_lib_msg_queuegroupcreate *)msg;
  1107. struct req_exec_msg_queuegroupcreate req_exec_msg_queuegroupcreate;
  1108. struct iovec iovec;
  1109. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupCreate %s\n",
  1110. getSaNameT (&req_lib_msg_queuegroupcreate->queueGroupName));
  1111. req_exec_msg_queuegroupcreate.header.size =
  1112. sizeof (struct req_exec_msg_queuegroupcreate);
  1113. req_exec_msg_queuegroupcreate.header.id =
  1114. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE);
  1115. message_source_set (&req_exec_msg_queuegroupcreate.source, conn);
  1116. memcpy (&req_exec_msg_queuegroupcreate.queue_group_name,
  1117. &req_lib_msg_queuegroupcreate->queueGroupName, sizeof (SaNameT));
  1118. iovec.iov_base = (char *)&req_exec_msg_queuegroupcreate;
  1119. iovec.iov_len = sizeof (req_exec_msg_queuegroupcreate);
  1120. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1121. TOTEMPG_AGREED) == 0);
  1122. }
  1123. static void message_handler_req_lib_msg_queuegroupinsert (
  1124. void *conn,
  1125. void *msg)
  1126. {
  1127. struct req_lib_msg_queuegroupinsert *req_lib_msg_queuegroupinsert =
  1128. (struct req_lib_msg_queuegroupinsert *)msg;
  1129. struct req_exec_msg_queuegroupinsert req_exec_msg_queuegroupinsert;
  1130. struct iovec iovec;
  1131. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupInsert %s\n",
  1132. getSaNameT (&req_lib_msg_queuegroupinsert->queueGroupName));
  1133. req_exec_msg_queuegroupinsert.header.size =
  1134. sizeof (struct req_exec_msg_queuegroupinsert);
  1135. req_exec_msg_queuegroupinsert.header.id =
  1136. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT);
  1137. message_source_set (&req_exec_msg_queuegroupinsert.source, conn);
  1138. memcpy (&req_exec_msg_queuegroupinsert.queue_name,
  1139. &req_lib_msg_queuegroupinsert->queueName, sizeof (SaNameT));
  1140. memcpy (&req_exec_msg_queuegroupinsert.queue_group_name,
  1141. &req_lib_msg_queuegroupinsert->queueGroupName, sizeof (SaNameT));
  1142. iovec.iov_base = (char *)&req_exec_msg_queuegroupinsert;
  1143. iovec.iov_len = sizeof (req_exec_msg_queuegroupinsert);
  1144. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1145. TOTEMPG_AGREED) == 0);
  1146. }
  1147. static void message_handler_req_lib_msg_queuegroupremove (
  1148. void *conn,
  1149. void *msg)
  1150. {
  1151. struct req_lib_msg_queuegroupremove *req_lib_msg_queuegroupremove =
  1152. (struct req_lib_msg_queuegroupremove *)msg;
  1153. struct req_exec_msg_queuegroupremove req_exec_msg_queuegroupremove;
  1154. struct iovec iovec;
  1155. req_exec_msg_queuegroupremove.header.size =
  1156. sizeof (struct req_exec_msg_queuegroupremove);
  1157. req_exec_msg_queuegroupremove.header.id =
  1158. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE);
  1159. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupRemove %s\n",
  1160. getSaNameT (&req_lib_msg_queuegroupremove->queueGroupName));
  1161. message_source_set (&req_exec_msg_queuegroupremove.source, conn);
  1162. memcpy (&req_exec_msg_queuegroupremove.queue_name,
  1163. &req_lib_msg_queuegroupremove->queueName, sizeof (SaNameT));
  1164. memcpy (&req_exec_msg_queuegroupremove.queue_group_name,
  1165. &req_lib_msg_queuegroupremove->queueGroupName, sizeof (SaNameT));
  1166. iovec.iov_base = (char *)&req_exec_msg_queuegroupremove;
  1167. iovec.iov_len = sizeof (req_exec_msg_queuegroupremove);
  1168. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1169. TOTEMPG_AGREED) == 0);
  1170. }
  1171. static void message_handler_req_lib_msg_queuegroupdelete (
  1172. void *conn,
  1173. void *msg)
  1174. {
  1175. struct req_lib_msg_queuegroupdelete *req_lib_msg_queuegroupdelete =
  1176. (struct req_lib_msg_queuegroupdelete *)msg;
  1177. struct req_exec_msg_queuegroupdelete req_exec_msg_queuegroupdelete;
  1178. struct iovec iovec;
  1179. req_exec_msg_queuegroupdelete.header.size =
  1180. sizeof (struct req_exec_msg_queuegroupdelete);
  1181. req_exec_msg_queuegroupdelete.header.id =
  1182. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE);
  1183. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupDelete %s\n",
  1184. getSaNameT (&req_lib_msg_queuegroupdelete->queueGroupName));
  1185. message_source_set (&req_exec_msg_queuegroupdelete.source, conn);
  1186. memcpy (&req_exec_msg_queuegroupdelete.queue_group_name,
  1187. &req_lib_msg_queuegroupdelete->queueGroupName, sizeof (SaNameT));
  1188. iovec.iov_base = (char *)&req_exec_msg_queuegroupdelete;
  1189. iovec.iov_len = sizeof (req_exec_msg_queuegroupdelete);
  1190. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1191. TOTEMPG_AGREED) == 0);
  1192. }
  1193. static void message_handler_req_lib_msg_queuegrouptrack (
  1194. void *conn,
  1195. void *msg)
  1196. {
  1197. struct req_lib_msg_queuegrouptrack *req_lib_msg_queuegrouptrack =
  1198. (struct req_lib_msg_queuegrouptrack *)msg;
  1199. struct req_exec_msg_queuegrouptrack req_exec_msg_queuegrouptrack;
  1200. struct iovec iovec;
  1201. req_exec_msg_queuegrouptrack.header.size =
  1202. sizeof (struct req_exec_msg_queuegrouptrack);
  1203. req_exec_msg_queuegrouptrack.header.id =
  1204. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK);
  1205. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrack %s\n",
  1206. getSaNameT (&req_lib_msg_queuegrouptrack->queueGroupName));
  1207. message_source_set (&req_exec_msg_queuegrouptrack.source, conn);
  1208. memcpy (&req_exec_msg_queuegrouptrack.queue_group_name,
  1209. &req_lib_msg_queuegrouptrack->queueGroupName, sizeof (SaNameT));
  1210. iovec.iov_base = (char *)&req_exec_msg_queuegrouptrack;
  1211. iovec.iov_len = sizeof (req_exec_msg_queuegrouptrack);
  1212. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1213. TOTEMPG_AGREED) == 0);
  1214. }
  1215. static void message_handler_req_lib_msg_queuegrouptrackstop (
  1216. void *conn,
  1217. void *msg)
  1218. {
  1219. struct req_lib_msg_queuegrouptrackstop *req_lib_msg_queuegrouptrackstop =
  1220. (struct req_lib_msg_queuegrouptrackstop *)msg;
  1221. struct req_exec_msg_queuegrouptrackstop req_exec_msg_queuegrouptrackstop;
  1222. struct iovec iovec;
  1223. req_exec_msg_queuegrouptrackstop.header.size =
  1224. sizeof (struct req_exec_msg_queuegrouptrackstop);
  1225. req_exec_msg_queuegrouptrackstop.header.id =
  1226. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP);
  1227. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrackStop %s\n",
  1228. getSaNameT (&req_lib_msg_queuegrouptrackstop->queueGroupName));
  1229. message_source_set (&req_exec_msg_queuegrouptrackstop.source, conn);
  1230. memcpy (&req_exec_msg_queuegrouptrackstop.queue_group_name,
  1231. &req_lib_msg_queuegrouptrackstop->queueGroupName, sizeof (SaNameT));
  1232. iovec.iov_base = (char *)&req_exec_msg_queuegrouptrackstop;
  1233. iovec.iov_len = sizeof (req_exec_msg_queuegrouptrackstop);
  1234. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1235. TOTEMPG_AGREED) == 0);
  1236. }
  1237. static void message_handler_req_lib_msg_messagesend (
  1238. void *conn,
  1239. void *msg)
  1240. {
  1241. struct req_lib_msg_messagesend *req_lib_msg_messagesend =
  1242. (struct req_lib_msg_messagesend *)msg;
  1243. struct req_exec_msg_messagesend req_exec_msg_messagesend;
  1244. struct iovec iovec;
  1245. req_exec_msg_messagesend.header.size =
  1246. sizeof (struct req_exec_msg_messagesend);
  1247. req_exec_msg_messagesend.header.id =
  1248. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
  1249. req_exec_msg_messagesend.async_call = 0;
  1250. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSend %s\n",
  1251. getSaNameT (&req_lib_msg_messagesend->destination));
  1252. message_source_set (&req_exec_msg_messagesend.source, conn);
  1253. memcpy (&req_exec_msg_messagesend.destination,
  1254. &req_lib_msg_messagesend->destination, sizeof (SaNameT));
  1255. iovec.iov_base = (char *)&req_exec_msg_messagesend;
  1256. iovec.iov_len = sizeof (req_exec_msg_messagesend);
  1257. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1258. TOTEMPG_AGREED) == 0);
  1259. }
  1260. static void message_handler_req_lib_msg_messagesendasync (
  1261. void *conn,
  1262. void *msg)
  1263. {
  1264. struct req_lib_msg_messagesend *req_lib_msg_messagesend =
  1265. (struct req_lib_msg_messagesend *)msg;
  1266. struct req_exec_msg_messagesend req_exec_msg_messagesend;
  1267. struct iovec iovec;
  1268. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendAsync %s\n",
  1269. getSaNameT (&req_lib_msg_messagesend->destination));
  1270. req_exec_msg_messagesend.header.size =
  1271. sizeof (struct req_exec_msg_messagesend);
  1272. req_exec_msg_messagesend.header.id =
  1273. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
  1274. req_exec_msg_messagesend.async_call = 1;
  1275. message_source_set (&req_exec_msg_messagesend.source, conn);
  1276. memcpy (&req_exec_msg_messagesend.destination,
  1277. &req_lib_msg_messagesend->destination, sizeof (SaNameT));
  1278. iovec.iov_base = (char *)&req_exec_msg_messagesend;
  1279. iovec.iov_len = sizeof (req_exec_msg_messagesend);
  1280. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1281. TOTEMPG_AGREED) == 0);
  1282. }
  1283. static void message_handler_req_lib_msg_messageget (
  1284. void *conn,
  1285. void *msg)
  1286. {
  1287. struct req_lib_msg_messageget *req_lib_msg_messageget =
  1288. (struct req_lib_msg_messageget *)msg;
  1289. struct req_exec_msg_messageget req_exec_msg_messageget;
  1290. struct iovec iovec;
  1291. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageGet %s\n",
  1292. getSaNameT (&req_lib_msg_messageget->queueName));
  1293. req_exec_msg_messageget.header.size =
  1294. sizeof (struct req_exec_msg_messageget);
  1295. req_exec_msg_messageget.header.id =
  1296. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEGET);
  1297. message_source_set (&req_exec_msg_messageget.source, conn);
  1298. memcpy (&req_exec_msg_messageget.queue_name,
  1299. &req_lib_msg_messageget->queueName, sizeof (SaNameT));
  1300. iovec.iov_base = (char *)&req_exec_msg_messageget;
  1301. iovec.iov_len = sizeof (req_exec_msg_messageget);
  1302. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1303. TOTEMPG_AGREED) == 0);
  1304. }
  1305. static void message_handler_req_lib_msg_messagecancel (
  1306. void *conn,
  1307. void *msg)
  1308. {
  1309. struct req_lib_msg_messagecancel *req_lib_msg_messagecancel =
  1310. (struct req_lib_msg_messagecancel *)msg;
  1311. struct req_exec_msg_messagecancel req_exec_msg_messagecancel;
  1312. struct iovec iovec;
  1313. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageCancel %s\n",
  1314. getSaNameT (&req_lib_msg_messagecancel->queueName));
  1315. req_exec_msg_messagecancel.header.size =
  1316. sizeof (struct req_exec_msg_messagecancel);
  1317. req_exec_msg_messagecancel.header.id =
  1318. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL);
  1319. message_source_set (&req_exec_msg_messagecancel.source, conn);
  1320. memcpy (&req_exec_msg_messagecancel.queue_name,
  1321. &req_lib_msg_messagecancel->queueName, sizeof (SaNameT));
  1322. iovec.iov_base = (char *)&req_exec_msg_messagecancel;
  1323. iovec.iov_len = sizeof (req_exec_msg_messagecancel);
  1324. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1325. TOTEMPG_AGREED) == 0);
  1326. }
  1327. static void message_handler_req_lib_msg_messagesendreceive (
  1328. void *conn,
  1329. void *msg)
  1330. {
  1331. struct req_lib_msg_messagesendreceive *req_lib_msg_messagesendreceive =
  1332. (struct req_lib_msg_messagesendreceive *)msg;
  1333. struct req_exec_msg_messagesendreceive req_exec_msg_messagesendreceive;
  1334. struct iovec iovec;
  1335. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendReceive %s\n",
  1336. getSaNameT (&req_lib_msg_messagesendreceive->queueName));
  1337. req_exec_msg_messagesendreceive.header.size =
  1338. sizeof (struct req_exec_msg_messagesendreceive);
  1339. req_exec_msg_messagesendreceive.header.id =
  1340. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE);
  1341. message_source_set (&req_exec_msg_messagesendreceive.source, conn);
  1342. memcpy (&req_exec_msg_messagesendreceive.queue_name,
  1343. &req_lib_msg_messagesendreceive->queueName, sizeof (SaNameT));
  1344. iovec.iov_base = (char *)&req_exec_msg_messagesendreceive;
  1345. iovec.iov_len = sizeof (req_exec_msg_messagesendreceive);
  1346. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1347. TOTEMPG_AGREED) == 0);
  1348. }
  1349. static void message_handler_req_lib_msg_messagereply (
  1350. void *conn,
  1351. void *msg)
  1352. {
  1353. struct req_lib_msg_messagereply *req_lib_msg_messagereply =
  1354. (struct req_lib_msg_messagereply *)msg;
  1355. struct req_exec_msg_messagereply req_exec_msg_messagereply;
  1356. struct iovec iovec;
  1357. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReply %s\n",
  1358. getSaNameT (&req_lib_msg_messagereply->queueName));
  1359. req_exec_msg_messagereply.header.size =
  1360. sizeof (struct req_exec_msg_messagereply);
  1361. req_exec_msg_messagereply.header.id =
  1362. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
  1363. req_exec_msg_messagereply.async_call = 0;
  1364. message_source_set (&req_exec_msg_messagereply.source, conn);
  1365. memcpy (&req_exec_msg_messagereply.queue_name,
  1366. &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
  1367. iovec.iov_base = (char *)&req_exec_msg_messagereply;
  1368. iovec.iov_len = sizeof (req_exec_msg_messagereply);
  1369. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1370. TOTEMPG_AGREED) == 0);
  1371. }
  1372. static void message_handler_req_lib_msg_messagereplyasync (
  1373. void *conn,
  1374. void *msg)
  1375. {
  1376. struct req_lib_msg_messagereply *req_lib_msg_messagereply =
  1377. (struct req_lib_msg_messagereply *)msg;
  1378. struct req_exec_msg_messagereply req_exec_msg_messagereply;
  1379. struct iovec iovec;
  1380. log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReplyAsync %s\n",
  1381. getSaNameT (&req_lib_msg_messagereply->queueName));
  1382. req_exec_msg_messagereply.header.size =
  1383. sizeof (struct req_exec_msg_messagereply);
  1384. req_exec_msg_messagereply.header.id =
  1385. SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
  1386. req_exec_msg_messagereply.async_call = 1;
  1387. message_source_set (&req_exec_msg_messagereply.source, conn);
  1388. memcpy (&req_exec_msg_messagereply.queue_name,
  1389. &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
  1390. iovec.iov_base = (char *)&req_exec_msg_messagereply;
  1391. iovec.iov_len = sizeof (req_exec_msg_messagereply);
  1392. assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
  1393. TOTEMPG_AGREED) == 0);
  1394. }