msg.c 51 KB

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