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 "logsys.h"
  61. LOGSYS_DECLARE_SUBSYS ("MSG", LOG_INFO);
  62. enum msg_exec_message_req_types {
  63. MESSAGE_REQ_EXEC_MSG_QUEUEOPEN = 0,
  64. MESSAGE_REQ_EXEC_MSG_QUEUECLOSE = 1,
  65. MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET = 2,
  66. MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK = 3,
  67. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE = 4,
  68. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT = 5,
  69. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE = 6,
  70. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE = 7,
  71. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK = 8,
  72. MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP = 9,
  73. MESSAGE_REQ_EXEC_MSG_MESSAGESEND = 10,
  74. MESSAGE_REQ_EXEC_MSG_MESSAGEGET = 11,
  75. MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL = 12,
  76. MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE = 13,
  77. MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY = 14
  78. };
  79. struct message_queue {
  80. SaNameT name;
  81. int refcount;
  82. struct list_head list;
  83. };
  84. struct queue_group {
  85. SaNameT name;
  86. struct list_head list;
  87. struct list_head message_queue_head;
  88. };
  89. struct queue_group_entry {
  90. struct message_queue *message_queue;
  91. struct list_head list;
  92. };
  93. /*
  94. struct queue_cleanup {
  95. struct message_queue *queue;
  96. SaMsgResourceHandleT queue_handle;
  97. struct list_head queue_lock_list_head;
  98. struct list_head list;
  99. };
  100. */
  101. DECLARE_LIST_INIT(queue_list_head);
  102. DECLARE_LIST_INIT(queue_group_list_head);
  103. static int msg_exec_init_fn (struct objdb_iface_ver0 *objdb);
  104. static int msg_lib_exit_fn (void *conn);
  105. static int msg_lib_init_fn (void *conn);
  106. static void message_handler_req_exec_msg_queueopen (
  107. void *message,
  108. unsigned int nodeid);
  109. static void message_handler_req_exec_msg_queueclose (
  110. void *message,
  111. unsigned int nodeid);
  112. static void message_handler_req_exec_msg_queuestatusget (
  113. void *message,
  114. unsigned int nodeid);
  115. static void message_handler_req_exec_msg_queueunlink (
  116. void *message,
  117. unsigned int nodeid);
  118. static void message_handler_req_exec_msg_queuegroupcreate (
  119. void *message,
  120. unsigned int nodeid);
  121. static void message_handler_req_exec_msg_queuegroupinsert (
  122. void *message,
  123. unsigned int nodeid);
  124. static void message_handler_req_exec_msg_queuegroupremove (
  125. void *message,
  126. unsigned int nodeid);
  127. static void message_handler_req_exec_msg_queuegroupdelete (
  128. void *message,
  129. unsigned int nodeid);
  130. static void message_handler_req_exec_msg_queuegrouptrack (
  131. void *message,
  132. unsigned int nodeid);
  133. static void message_handler_req_exec_msg_queuegrouptrackstop (
  134. void *message,
  135. unsigned int nodeid);
  136. static void message_handler_req_exec_msg_messagesend (
  137. void *message,
  138. unsigned int nodeid);
  139. static void message_handler_req_exec_msg_messageget (
  140. void *message,
  141. unsigned int nodeid);
  142. static void message_handler_req_exec_msg_messagecancel (
  143. void *message,
  144. unsigned int nodeid);
  145. static void message_handler_req_exec_msg_messagesendreceive (
  146. void *message,
  147. unsigned int nodeid);
  148. static void message_handler_req_exec_msg_messagereply (
  149. void *message,
  150. unsigned int nodeid);
  151. static void message_handler_req_lib_msg_queueopen (
  152. void *conn,
  153. void *msg);
  154. static void message_handler_req_lib_msg_queueopenasync (
  155. void *conn,
  156. void *msg);
  157. static void message_handler_req_lib_msg_queueclose (
  158. void *conn,
  159. void *msg);
  160. static void message_handler_req_lib_msg_queuestatusget (
  161. void *conn,
  162. void *msg);
  163. static void message_handler_req_lib_msg_queueunlink (
  164. void *conn,
  165. void *msg);
  166. static void message_handler_req_lib_msg_queuegroupcreate (
  167. void *conn,
  168. void *msg);
  169. static void message_handler_req_lib_msg_queuegroupinsert (
  170. void *conn,
  171. void *msg);
  172. static void message_handler_req_lib_msg_queuegroupremove (
  173. void *conn,
  174. void *msg);
  175. static void message_handler_req_lib_msg_queuegroupdelete (
  176. void *conn,
  177. void *msg);
  178. static void message_handler_req_lib_msg_queuegrouptrack (
  179. void *conn,
  180. void *msg);
  181. static void message_handler_req_lib_msg_queuegrouptrackstop (
  182. void *conn,
  183. void *msg);
  184. static void message_handler_req_lib_msg_messagesend (
  185. void *conn,
  186. void *msg);
  187. static void message_handler_req_lib_msg_messagesendasync (
  188. void *conn,
  189. void *msg);
  190. static void message_handler_req_lib_msg_messageget (
  191. void *conn,
  192. void *msg);
  193. static void message_handler_req_lib_msg_messagecancel (
  194. void *conn,
  195. void *msg);
  196. static void message_handler_req_lib_msg_messagesendreceive (
  197. void *conn,
  198. void *msg);
  199. static void message_handler_req_lib_msg_messagereply (
  200. void *conn,
  201. void *msg);
  202. static void message_handler_req_lib_msg_messagereplyasync (
  203. void *conn,
  204. void *msg);
  205. #ifdef TODO
  206. static void msg_sync_init (void);
  207. #endif
  208. static void msg_sync_activate (void);
  209. static int msg_sync_process (void);
  210. static void msg_sync_abort(void);
  211. void queue_release (struct message_queue *queue);
  212. static void msg_confchg_fn (
  213. enum totem_configuration_type configuration_type,
  214. unsigned int *member_list, int member_list_entries,
  215. unsigned int *left_list, int left_list_entries,
  216. unsigned int *joined_list, int joined_list_entries,
  217. struct memb_ring_id *ring_id);
  218. struct msg_pd {
  219. struct list_head queue_list;
  220. struct list_head queue_cleanup_list;
  221. };
  222. /*
  223. * Executive Handler Definition
  224. */
  225. struct openais_lib_handler msg_lib_service[] =
  226. {
  227. { /* 0 */
  228. .lib_handler_fn = message_handler_req_lib_msg_queueopen,
  229. .response_size = sizeof (struct res_lib_msg_queueopen),
  230. .response_id = MESSAGE_RES_MSG_QUEUEOPEN,
  231. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  232. },
  233. { /* 1 */
  234. .lib_handler_fn = message_handler_req_lib_msg_queueopenasync,
  235. .response_size = sizeof (struct res_lib_msg_queueopenasync),
  236. .response_id = MESSAGE_RES_MSG_QUEUEOPENASYNC,
  237. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  238. },
  239. { /* 2 */
  240. .lib_handler_fn = message_handler_req_lib_msg_queueclose,
  241. .response_size = sizeof (struct res_lib_msg_queueclose),
  242. .response_id = MESSAGE_RES_MSG_QUEUECLOSE,
  243. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  244. },
  245. { /* 3 */
  246. .lib_handler_fn = message_handler_req_lib_msg_queuestatusget,
  247. .response_size = sizeof (struct res_lib_msg_queuestatusget),
  248. .response_id = MESSAGE_RES_MSG_QUEUESTATUSGET,
  249. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  250. },
  251. { /* 4 */
  252. .lib_handler_fn = message_handler_req_lib_msg_queueunlink,
  253. .response_size = sizeof (struct res_lib_msg_queueunlink),
  254. .response_id = MESSAGE_RES_MSG_QUEUEUNLINK,
  255. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  256. },
  257. { /* 5 */
  258. .lib_handler_fn = message_handler_req_lib_msg_queuegroupcreate,
  259. .response_size = sizeof (struct res_lib_msg_queuegroupcreate),
  260. .response_id = MESSAGE_RES_MSG_QUEUEGROUPCREATE,
  261. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  262. },
  263. { /* 6 */
  264. .lib_handler_fn = message_handler_req_lib_msg_queuegroupinsert,
  265. .response_size = sizeof (struct res_lib_msg_queuegroupinsert),
  266. .response_id = MESSAGE_RES_MSG_QUEUEGROUPINSERT,
  267. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  268. },
  269. { /* 7 */
  270. .lib_handler_fn = message_handler_req_lib_msg_queuegroupremove,
  271. .response_size = sizeof (struct res_lib_msg_queuegroupremove),
  272. .response_id = MESSAGE_RES_MSG_QUEUEGROUPREMOVE,
  273. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  274. },
  275. { /* 8 */
  276. .lib_handler_fn = message_handler_req_lib_msg_queuegroupdelete,
  277. .response_size = sizeof (struct res_lib_msg_queuegroupdelete),
  278. .response_id = MESSAGE_RES_MSG_QUEUEGROUPDELETE,
  279. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  280. },
  281. { /* 9 */
  282. .lib_handler_fn = message_handler_req_lib_msg_queuegrouptrack,
  283. .response_size = sizeof (struct res_lib_msg_queuegrouptrack),
  284. .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACK,
  285. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  286. },
  287. { /* 10 */
  288. .lib_handler_fn = message_handler_req_lib_msg_queuegrouptrackstop,
  289. .response_size = sizeof (struct res_lib_msg_queuegrouptrackstop),
  290. .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACKSTOP,
  291. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  292. },
  293. { /* 11 */
  294. .lib_handler_fn = message_handler_req_lib_msg_messagesend,
  295. .response_size = sizeof (struct res_lib_msg_messagesend),
  296. .response_id = MESSAGE_RES_MSG_MESSAGESEND,
  297. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  298. },
  299. { /* 12 */
  300. .lib_handler_fn = message_handler_req_lib_msg_messagesendasync,
  301. .response_size = sizeof (struct res_lib_msg_messagesendasync),
  302. .response_id = MESSAGE_RES_MSG_MESSAGESENDASYNC,
  303. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  304. },
  305. { /* 13 */
  306. .lib_handler_fn = message_handler_req_lib_msg_messageget,
  307. .response_size = sizeof (struct res_lib_msg_messageget),
  308. .response_id = MESSAGE_RES_MSG_MESSAGEGET,
  309. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  310. },
  311. { /* 14 */
  312. .lib_handler_fn = message_handler_req_lib_msg_messagecancel,
  313. .response_size = sizeof (struct res_lib_msg_messagecancel),
  314. .response_id = MESSAGE_RES_MSG_MESSAGECANCEL,
  315. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  316. },
  317. { /* 15 */
  318. .lib_handler_fn = message_handler_req_lib_msg_messagesendreceive,
  319. .response_size = sizeof (struct res_lib_msg_messagesendreceive),
  320. .response_id = MESSAGE_RES_MSG_MESSAGESENDRECEIVE,
  321. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  322. },
  323. { /* 16 */
  324. .lib_handler_fn = message_handler_req_lib_msg_messagereply,
  325. .response_size = sizeof (struct res_lib_msg_messagereply),
  326. .response_id = MESSAGE_RES_MSG_MESSAGEREPLY,
  327. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  328. },
  329. { /* 17 */
  330. .lib_handler_fn = message_handler_req_lib_msg_messagereplyasync,
  331. .response_size = sizeof (struct res_lib_msg_messagereplyasync),
  332. .response_id = MESSAGE_RES_MSG_MESSAGEREPLYASYNC,
  333. .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
  334. },
  335. };
  336. static struct openais_exec_handler msg_exec_service[] = {
  337. {
  338. .exec_handler_fn = message_handler_req_exec_msg_queueopen,
  339. },
  340. {
  341. .exec_handler_fn = message_handler_req_exec_msg_queueclose,
  342. },
  343. {
  344. .exec_handler_fn = message_handler_req_exec_msg_queuestatusget,
  345. },
  346. {
  347. .exec_handler_fn = message_handler_req_exec_msg_queueunlink,
  348. },
  349. {
  350. .exec_handler_fn = message_handler_req_exec_msg_queuegroupcreate,
  351. },
  352. {
  353. .exec_handler_fn = message_handler_req_exec_msg_queuegroupinsert,
  354. },
  355. {
  356. .exec_handler_fn = message_handler_req_exec_msg_queuegroupremove,
  357. },
  358. {
  359. .exec_handler_fn = message_handler_req_exec_msg_queuegroupdelete,
  360. },
  361. {
  362. .exec_handler_fn = message_handler_req_exec_msg_queuegrouptrack,
  363. },
  364. {
  365. .exec_handler_fn = message_handler_req_exec_msg_queuegrouptrackstop,
  366. },
  367. {
  368. .exec_handler_fn = message_handler_req_exec_msg_messagesend,
  369. },
  370. {
  371. .exec_handler_fn = message_handler_req_exec_msg_messageget,
  372. },
  373. {
  374. .exec_handler_fn = message_handler_req_exec_msg_messagecancel,
  375. },
  376. {
  377. .exec_handler_fn = message_handler_req_exec_msg_messagesendreceive,
  378. },
  379. {
  380. .exec_handler_fn = message_handler_req_exec_msg_messagereply
  381. }
  382. };
  383. struct openais_service_handler msg_service_handler = {
  384. .name = "openais message service B.01.01",
  385. .id = MSG_SERVICE,
  386. .private_data_size = sizeof (struct msg_pd),
  387. .flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED,
  388. .lib_init_fn = msg_lib_init_fn,
  389. .lib_exit_fn = msg_lib_exit_fn,
  390. .lib_service = msg_lib_service,
  391. .lib_service_count = sizeof (msg_lib_service) / sizeof (struct openais_lib_handler),
  392. .exec_init_fn = msg_exec_init_fn,
  393. .exec_service = msg_exec_service,
  394. .exec_service_count = sizeof (msg_exec_service) / sizeof (struct openais_exec_handler),
  395. .confchg_fn = msg_confchg_fn,
  396. .exec_dump_fn = NULL,
  397. .sync_init = NULL, // TODO msg_sync_init,
  398. .sync_process = msg_sync_process,
  399. .sync_activate = msg_sync_activate,
  400. .sync_abort = msg_sync_abort
  401. };
  402. static struct openais_service_handler *msg_get_handler_ver0 (void);
  403. static struct openais_service_handler_iface_ver0 msg_service_handler_iface = {
  404. .openais_get_service_handler_ver0 = msg_get_handler_ver0
  405. };
  406. static struct lcr_iface openais_msg_ver0[1] = {
  407. {
  408. .name = "openais_msg",
  409. .version = 0,
  410. .versions_replace = 0,
  411. .versions_replace_count = 0,
  412. .dependencies = 0,
  413. .dependency_count = 0,
  414. .constructor = NULL,
  415. .destructor = NULL,
  416. .interfaces = NULL
  417. }
  418. };
  419. static struct lcr_comp msg_comp_ver0 = {
  420. .iface_count = 1,
  421. .ifaces = openais_msg_ver0
  422. };
  423. static struct openais_service_handler *msg_get_handler_ver0 (void)
  424. {
  425. return (&msg_service_handler);
  426. }
  427. __attribute__ ((constructor)) static void register_this_component (void) {
  428. lcr_interfaces_set (&openais_msg_ver0[0], &msg_service_handler_iface);
  429. lcr_component_register (&msg_comp_ver0);
  430. }
  431. /*
  432. * All data types used for executive messages
  433. */
  434. struct req_exec_msg_queueopen {
  435. mar_req_header_t header;
  436. mar_message_source_t source;
  437. int async_call;
  438. SaNameT queue_name;
  439. SaInvocationT invocation;
  440. SaMsgQueueHandleT queue_handle;
  441. SaMsgQueueCreationAttributesT creation_attributes;
  442. SaMsgQueueOpenFlagsT openFlags;
  443. SaTimeT timeout;
  444. };
  445. struct req_exec_msg_queueclose {
  446. mar_req_header_t header;
  447. mar_message_source_t source;
  448. SaNameT queue_name;
  449. };
  450. struct req_exec_msg_queuestatusget {
  451. mar_req_header_t header;
  452. mar_message_source_t source;
  453. SaNameT queue_name;
  454. };
  455. struct req_exec_msg_queueunlink {
  456. mar_req_header_t header;
  457. mar_message_source_t source;
  458. SaNameT queue_name;
  459. };
  460. struct req_exec_msg_queuegroupcreate {
  461. mar_req_header_t header;
  462. mar_message_source_t source;
  463. SaNameT queue_group_name;
  464. };
  465. struct req_exec_msg_queuegroupinsert {
  466. mar_req_header_t header;
  467. mar_message_source_t source;
  468. SaNameT queue_name;
  469. SaNameT queue_group_name;
  470. };
  471. struct req_exec_msg_queuegroupremove {
  472. mar_req_header_t header;
  473. mar_message_source_t source;
  474. SaNameT queue_name;
  475. SaNameT queue_group_name;
  476. };
  477. struct req_exec_msg_queuegroupdelete {
  478. mar_req_header_t header;
  479. mar_message_source_t source;
  480. SaNameT queue_group_name;
  481. };
  482. struct req_exec_msg_queuegrouptrack {
  483. mar_req_header_t header;
  484. mar_message_source_t source;
  485. SaNameT queue_group_name;
  486. };
  487. struct req_exec_msg_queuegrouptrackstop {
  488. mar_req_header_t header;
  489. mar_message_source_t source;
  490. SaNameT queue_group_name;
  491. };
  492. struct req_exec_msg_messagesend {
  493. mar_req_header_t header;
  494. mar_message_source_t source;
  495. SaNameT destination;
  496. int async_call;
  497. };
  498. struct req_exec_msg_messageget {
  499. mar_req_header_t header;
  500. mar_message_source_t source;
  501. SaNameT queue_name;
  502. };
  503. struct req_exec_msg_messagecancel {
  504. mar_req_header_t header;
  505. mar_message_source_t source;
  506. SaNameT queue_name;
  507. };
  508. struct req_exec_msg_messagesendreceive {
  509. mar_req_header_t header;
  510. mar_message_source_t source;
  511. SaNameT queue_name;
  512. };
  513. struct req_exec_msg_messagereply {
  514. mar_req_header_t header;
  515. mar_message_source_t source;
  516. SaNameT queue_name;
  517. int async_call;
  518. };
  519. #ifdef TODO
  520. static void msg_sync_init (void)
  521. {
  522. return;
  523. }
  524. #endif
  525. static int msg_sync_process (void)
  526. {
  527. return (0);
  528. }
  529. static void msg_sync_activate (void)
  530. {
  531. return;
  532. }
  533. static void msg_sync_abort (void)
  534. {
  535. return;
  536. }
  537. static void msg_confchg_fn (
  538. enum totem_configuration_type configuration_type,
  539. unsigned int *member_list, int member_list_entries,
  540. unsigned int *left_list, int left_list_entries,
  541. unsigned int *joined_list, int joined_list_entries,
  542. struct memb_ring_id *ring_id)
  543. {
  544. }
  545. static struct message_queue *queue_find (SaNameT *name)
  546. {
  547. struct list_head *list;
  548. struct message_queue *queue;
  549. for (list = queue_list_head.next;
  550. list != &queue_list_head;
  551. list = list->next) {
  552. queue = list_entry (list, struct message_queue, list);
  553. if (name_match (name, &queue->name)) {
  554. return (queue);
  555. }
  556. }
  557. return (0);
  558. }
  559. static struct queue_group *queue_group_find (SaNameT *name)
  560. {
  561. struct list_head *list;
  562. struct queue_group *queue_group;
  563. for (list = queue_group_list_head.next;
  564. list != &queue_group_list_head;
  565. list = list->next) {
  566. queue_group = list_entry (list, struct queue_group, list);
  567. if (name_match (name, &queue_group->name)) {
  568. return (queue_group);
  569. }
  570. }
  571. return (0);
  572. }
  573. static struct queue_group_entry *queue_group_entry_find (
  574. struct queue_group *queue_group,
  575. struct message_queue *queue)
  576. {
  577. struct list_head *list;
  578. struct queue_group_entry *queue_group_entry;
  579. for (list = queue_group->message_queue_head.next;
  580. list != &queue_group->message_queue_head;
  581. list = list->next) {
  582. queue_group_entry = list_entry (list, struct queue_group_entry, list);
  583. if (queue_group_entry->message_queue == queue) {
  584. return (queue_group_entry);
  585. }
  586. }
  587. return (0);
  588. }
  589. static int msg_exec_init_fn (struct objdb_iface_ver0 *objdb)
  590. {
  591. /*
  592. * Initialize the saved ring ID.
  593. */
  594. // saved_ring_id.seq = 0;
  595. // saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
  596. return (0);
  597. }
  598. static int msg_lib_exit_fn (void *conn)
  599. {
  600. // struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
  601. #ifdef COMPILE_OUT
  602. struct queue_cleanup *queue_cleanup;
  603. struct list_head *list;
  604. printf ("exit_fn\n");
  605. log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %p\n", conn);
  606. /*
  607. * close all queues opened on this fd
  608. */
  609. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  610. while (!list_empty(&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list)) {
  611. queue_cleanup = list_entry (list, struct queue_cleanup, list);
  612. printf ("queue to cleanup\n");
  613. if (queue_cleanup->queue->name.length > 0) {
  614. msg_queue_cleanup_lock_remove (queue_cleanup);
  615. msg_queue_close (queue_cleanup->queue);
  616. }
  617. printf ("queue cleanup %x\n", queue_cleanup);
  618. list_del (&queue_cleanup->list);
  619. free (queue_cleanup);
  620. list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
  621. }
  622. #endif
  623. return (0);
  624. }
  625. static int msg_lib_init_fn (void *conn)
  626. {
  627. struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
  628. list_init (&msg_pd->queue_list);
  629. list_init (&msg_pd->queue_cleanup_list);
  630. return (0);
  631. }
  632. static void message_handler_req_exec_msg_queueopen (
  633. void *message,
  634. 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. }