msg.c 51 KB

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