msg.c 51 KB

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