msg.c 51 KB

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