msg.c 52 KB

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