4
0

msg.c 51 KB

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