| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688 |
- /*
- * Copyright (c) 2005-2006 MontaVista Software, Inc.
- * Copyright (c) 2006 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake@mvista.com)
- *
- * This software licensed under BSD license, the text of which follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
- #include <sys/types.h>
- #include <sys/uio.h>
- #include <sys/socket.h>
- #include <sys/un.h>
- #include <sys/time.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <errno.h>
- #include <signal.h>
- #include <arpa/inet.h>
- #include "../include/saAis.h"
- #include "../include/saMsg.h"
- #include "../include/ipc_msg.h"
- #include "../include/list.h"
- #include "../include/queue.h"
- #include "../lcr/lcr_comp.h"
- #include "objdb.h"
- #include "totem.h"
- #include "service.h"
- #include "mempool.h"
- #include "util.h"
- #include "main.h"
- #include "flow.h"
- #include "tlist.h"
- #include "ipc.h"
- #include "totempg.h"
- #include "logsys.h"
- LOGSYS_DECLARE_SUBSYS ("MSG", LOG_INFO);
- enum msg_exec_message_req_types {
- MESSAGE_REQ_EXEC_MSG_QUEUEOPEN = 0,
- MESSAGE_REQ_EXEC_MSG_QUEUECLOSE = 1,
- MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET = 2,
- MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK = 3,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE = 4,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT = 5,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE = 6,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE = 7,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK = 8,
- MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP = 9,
- MESSAGE_REQ_EXEC_MSG_MESSAGESEND = 10,
- MESSAGE_REQ_EXEC_MSG_MESSAGEGET = 11,
- MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL = 12,
- MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE = 13,
- MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY = 14
- };
- struct message_queue {
- SaNameT name;
- int refcount;
- struct list_head list;
- };
- struct queue_group {
- SaNameT name;
- struct list_head list;
- struct list_head message_queue_head;
- };
- struct queue_group_entry {
- struct message_queue *message_queue;
- struct list_head list;
- };
- /*
- struct queue_cleanup {
- struct message_queue *queue;
- SaMsgResourceHandleT queue_handle;
- struct list_head queue_lock_list_head;
- struct list_head list;
- };
- */
- DECLARE_LIST_INIT(queue_list_head);
- DECLARE_LIST_INIT(queue_group_list_head);
- static int msg_exec_init_fn (struct objdb_iface_ver0 *objdb);
- static int msg_lib_exit_fn (void *conn);
- static int msg_lib_init_fn (void *conn);
- static void message_handler_req_exec_msg_queueopen (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queueclose (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuestatusget (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queueunlink (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegroupcreate (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegroupinsert (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegroupremove (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegroupdelete (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegrouptrack (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_queuegrouptrackstop (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_messagesend (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_messageget (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_messagecancel (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_messagesendreceive (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_exec_msg_messagereply (
- void *message,
- unsigned int nodeid);
- static void message_handler_req_lib_msg_queueopen (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queueopenasync (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queueclose (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuestatusget (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queueunlink (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegroupcreate (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegroupinsert (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegroupremove (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegroupdelete (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegrouptrack (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_queuegrouptrackstop (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagesend (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagesendasync (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messageget (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagecancel (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagesendreceive (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagereply (
- void *conn,
- void *msg);
- static void message_handler_req_lib_msg_messagereplyasync (
- void *conn,
- void *msg);
- #ifdef TODO
- static void msg_sync_init (void);
- #endif
- static void msg_sync_activate (void);
- static int msg_sync_process (void);
- static void msg_sync_abort(void);
- void queue_release (struct message_queue *queue);
- static void msg_confchg_fn (
- enum totem_configuration_type configuration_type,
- unsigned int *member_list, int member_list_entries,
- unsigned int *left_list, int left_list_entries,
- unsigned int *joined_list, int joined_list_entries,
- struct memb_ring_id *ring_id);
- struct msg_pd {
- struct list_head queue_list;
- struct list_head queue_cleanup_list;
- };
- /*
- * Executive Handler Definition
- */
- struct openais_lib_handler msg_lib_service[] =
- {
- { /* 0 */
- .lib_handler_fn = message_handler_req_lib_msg_queueopen,
- .response_size = sizeof (struct res_lib_msg_queueopen),
- .response_id = MESSAGE_RES_MSG_QUEUEOPEN,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 1 */
- .lib_handler_fn = message_handler_req_lib_msg_queueopenasync,
- .response_size = sizeof (struct res_lib_msg_queueopenasync),
- .response_id = MESSAGE_RES_MSG_QUEUEOPENASYNC,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 2 */
- .lib_handler_fn = message_handler_req_lib_msg_queueclose,
- .response_size = sizeof (struct res_lib_msg_queueclose),
- .response_id = MESSAGE_RES_MSG_QUEUECLOSE,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 3 */
- .lib_handler_fn = message_handler_req_lib_msg_queuestatusget,
- .response_size = sizeof (struct res_lib_msg_queuestatusget),
- .response_id = MESSAGE_RES_MSG_QUEUESTATUSGET,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 4 */
- .lib_handler_fn = message_handler_req_lib_msg_queueunlink,
- .response_size = sizeof (struct res_lib_msg_queueunlink),
- .response_id = MESSAGE_RES_MSG_QUEUEUNLINK,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 5 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegroupcreate,
- .response_size = sizeof (struct res_lib_msg_queuegroupcreate),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPCREATE,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 6 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegroupinsert,
- .response_size = sizeof (struct res_lib_msg_queuegroupinsert),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPINSERT,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 7 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegroupremove,
- .response_size = sizeof (struct res_lib_msg_queuegroupremove),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPREMOVE,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 8 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegroupdelete,
- .response_size = sizeof (struct res_lib_msg_queuegroupdelete),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPDELETE,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 9 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegrouptrack,
- .response_size = sizeof (struct res_lib_msg_queuegrouptrack),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACK,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 10 */
- .lib_handler_fn = message_handler_req_lib_msg_queuegrouptrackstop,
- .response_size = sizeof (struct res_lib_msg_queuegrouptrackstop),
- .response_id = MESSAGE_RES_MSG_QUEUEGROUPTRACKSTOP,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 11 */
- .lib_handler_fn = message_handler_req_lib_msg_messagesend,
- .response_size = sizeof (struct res_lib_msg_messagesend),
- .response_id = MESSAGE_RES_MSG_MESSAGESEND,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 12 */
- .lib_handler_fn = message_handler_req_lib_msg_messagesendasync,
- .response_size = sizeof (struct res_lib_msg_messagesendasync),
- .response_id = MESSAGE_RES_MSG_MESSAGESENDASYNC,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 13 */
- .lib_handler_fn = message_handler_req_lib_msg_messageget,
- .response_size = sizeof (struct res_lib_msg_messageget),
- .response_id = MESSAGE_RES_MSG_MESSAGEGET,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 14 */
- .lib_handler_fn = message_handler_req_lib_msg_messagecancel,
- .response_size = sizeof (struct res_lib_msg_messagecancel),
- .response_id = MESSAGE_RES_MSG_MESSAGECANCEL,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 15 */
- .lib_handler_fn = message_handler_req_lib_msg_messagesendreceive,
- .response_size = sizeof (struct res_lib_msg_messagesendreceive),
- .response_id = MESSAGE_RES_MSG_MESSAGESENDRECEIVE,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 16 */
- .lib_handler_fn = message_handler_req_lib_msg_messagereply,
- .response_size = sizeof (struct res_lib_msg_messagereply),
- .response_id = MESSAGE_RES_MSG_MESSAGEREPLY,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- { /* 17 */
- .lib_handler_fn = message_handler_req_lib_msg_messagereplyasync,
- .response_size = sizeof (struct res_lib_msg_messagereplyasync),
- .response_id = MESSAGE_RES_MSG_MESSAGEREPLYASYNC,
- .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
- },
- };
- static struct openais_exec_handler msg_exec_service[] = {
- {
- .exec_handler_fn = message_handler_req_exec_msg_queueopen,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queueclose,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuestatusget,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queueunlink,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegroupcreate,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegroupinsert,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegroupremove,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegroupdelete,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegrouptrack,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_queuegrouptrackstop,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_messagesend,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_messageget,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_messagecancel,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_messagesendreceive,
- },
- {
- .exec_handler_fn = message_handler_req_exec_msg_messagereply
- }
- };
- struct openais_service_handler msg_service_handler = {
- .name = "openais message service B.01.01",
- .id = MSG_SERVICE,
- .private_data_size = sizeof (struct msg_pd),
- .flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED,
- .lib_init_fn = msg_lib_init_fn,
- .lib_exit_fn = msg_lib_exit_fn,
- .lib_service = msg_lib_service,
- .lib_service_count = sizeof (msg_lib_service) / sizeof (struct openais_lib_handler),
- .exec_init_fn = msg_exec_init_fn,
- .exec_service = msg_exec_service,
- .exec_service_count = sizeof (msg_exec_service) / sizeof (struct openais_exec_handler),
- .confchg_fn = msg_confchg_fn,
- .exec_dump_fn = NULL,
- .sync_init = NULL, // TODO msg_sync_init,
- .sync_process = msg_sync_process,
- .sync_activate = msg_sync_activate,
- .sync_abort = msg_sync_abort
- };
- static struct openais_service_handler *msg_get_handler_ver0 (void);
- static struct openais_service_handler_iface_ver0 msg_service_handler_iface = {
- .openais_get_service_handler_ver0 = msg_get_handler_ver0
- };
- static struct lcr_iface openais_msg_ver0[1] = {
- {
- .name = "openais_msg",
- .version = 0,
- .versions_replace = 0,
- .versions_replace_count = 0,
- .dependencies = 0,
- .dependency_count = 0,
- .constructor = NULL,
- .destructor = NULL,
- .interfaces = NULL
- }
- };
- static struct lcr_comp msg_comp_ver0 = {
- .iface_count = 1,
- .ifaces = openais_msg_ver0
- };
- static struct openais_service_handler *msg_get_handler_ver0 (void)
- {
- return (&msg_service_handler);
- }
- __attribute__ ((constructor)) static void register_this_component (void) {
- lcr_interfaces_set (&openais_msg_ver0[0], &msg_service_handler_iface);
- lcr_component_register (&msg_comp_ver0);
- }
- /*
- * All data types used for executive messages
- */
- struct req_exec_msg_queueopen {
- mar_req_header_t header;
- mar_message_source_t source;
- int async_call;
- SaNameT queue_name;
- SaInvocationT invocation;
- SaMsgQueueHandleT queue_handle;
- SaMsgQueueCreationAttributesT creation_attributes;
- SaMsgQueueOpenFlagsT openFlags;
- SaTimeT timeout;
- };
- struct req_exec_msg_queueclose {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_queuestatusget {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_queueunlink {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_queuegroupcreate {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_queuegroupinsert {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_queuegroupremove {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_queuegroupdelete {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_queuegrouptrack {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_queuegrouptrackstop {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_group_name;
- };
- struct req_exec_msg_messagesend {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT destination;
- int async_call;
- };
- struct req_exec_msg_messageget {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_messagecancel {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_messagesendreceive {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- };
- struct req_exec_msg_messagereply {
- mar_req_header_t header;
- mar_message_source_t source;
- SaNameT queue_name;
- int async_call;
- };
- #ifdef TODO
- static void msg_sync_init (void)
- {
- return;
- }
- #endif
- static int msg_sync_process (void)
- {
- return (0);
- }
- static void msg_sync_activate (void)
- {
- return;
- }
- static void msg_sync_abort (void)
- {
- return;
- }
- static void msg_confchg_fn (
- enum totem_configuration_type configuration_type,
- unsigned int *member_list, int member_list_entries,
- unsigned int *left_list, int left_list_entries,
- unsigned int *joined_list, int joined_list_entries,
- struct memb_ring_id *ring_id)
- {
- }
- static struct message_queue *queue_find (SaNameT *name)
- {
- struct list_head *list;
- struct message_queue *queue;
- for (list = queue_list_head.next;
- list != &queue_list_head;
- list = list->next) {
- queue = list_entry (list, struct message_queue, list);
- if (name_match (name, &queue->name)) {
- return (queue);
- }
- }
- return (0);
- }
- static struct queue_group *queue_group_find (SaNameT *name)
- {
- struct list_head *list;
- struct queue_group *queue_group;
- for (list = queue_group_list_head.next;
- list != &queue_group_list_head;
- list = list->next) {
- queue_group = list_entry (list, struct queue_group, list);
- if (name_match (name, &queue_group->name)) {
- return (queue_group);
- }
- }
- return (0);
- }
- static struct queue_group_entry *queue_group_entry_find (
- struct queue_group *queue_group,
- struct message_queue *queue)
- {
- struct list_head *list;
- struct queue_group_entry *queue_group_entry;
- for (list = queue_group->message_queue_head.next;
- list != &queue_group->message_queue_head;
- list = list->next) {
- queue_group_entry = list_entry (list, struct queue_group_entry, list);
- if (queue_group_entry->message_queue == queue) {
- return (queue_group_entry);
- }
- }
- return (0);
- }
- static int msg_exec_init_fn (struct objdb_iface_ver0 *objdb)
- {
- /*
- * Initialize the saved ring ID.
- */
- // saved_ring_id.seq = 0;
- // saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
-
- return (0);
- }
- static int msg_lib_exit_fn (void *conn)
- {
- // struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
- #ifdef COMPILE_OUT
- struct queue_cleanup *queue_cleanup;
- struct list_head *list;
-
- printf ("exit_fn\n");
- log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %p\n", conn);
-
- /*
- * close all queues opened on this fd
- */
- list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
- while (!list_empty(&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list)) {
-
- queue_cleanup = list_entry (list, struct queue_cleanup, list);
-
- printf ("queue to cleanup\n");
- if (queue_cleanup->queue->name.length > 0) {
- msg_queue_cleanup_lock_remove (queue_cleanup);
- msg_queue_close (queue_cleanup->queue);
- }
-
- printf ("queue cleanup %x\n", queue_cleanup);
- list_del (&queue_cleanup->list);
- free (queue_cleanup);
-
- list = conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list.next;
- }
- #endif
- return (0);
- }
- static int msg_lib_init_fn (void *conn)
- {
- struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
- list_init (&msg_pd->queue_list);
- list_init (&msg_pd->queue_cleanup_list);
- return (0);
- }
- static void message_handler_req_exec_msg_queueopen (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queueopen *req_exec_msg_queueopen = (struct req_exec_msg_queueopen *)message;
- struct res_lib_msg_queueopen res_lib_msg_queueopen;
- struct res_lib_msg_queueopenasync res_lib_msg_queueopenasync;
- struct message_queue *queue;
- // struct queue_cleanup *queue_cleanup;
- SaAisErrorT error = SA_AIS_OK;
- log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueOpen %s\n",
- getSaNameT (&req_exec_msg_queueopen->queue_name));
-
- queue = queue_find (&req_exec_msg_queueopen->queue_name);
- printf ("queue %p\n", queue);
- /*
- * If queue doesn't exist, create one
- */
- if (queue == 0) {
- if ((req_exec_msg_queueopen->openFlags & SA_MSG_QUEUE_CREATE) == 0) {
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- queue = malloc (sizeof (struct message_queue));
- if (queue == 0) {
- error = SA_AIS_ERR_NO_MEMORY;
- goto error_exit;
- }
- memset (queue, 0, sizeof (struct message_queue));
- memcpy (&queue->name,
- &req_exec_msg_queueopen->queue_name,
- sizeof (SaNameT));
- list_init (&queue->list);
- list_add (&queue->list, &queue_list_head);
- queue->refcount = 0;
- }
- queue->refcount += 1;
- printf ("Incrementing queue refcount to %d\n", queue->refcount);
- #ifdef COMPILE_OUT
- /*
- * Setup connection information and mark queue as referenced
- */
- log_printf (LOG_LEVEL_DEBUG, "Lock queue opened is %p\n", queue);
- queue_cleanup = malloc (sizeof (struct queue_cleanup));
- if (queue_cleanup == 0) {
- free (queue);
- error = SA_AIS_ERR_NO_MEMORY;
- } else {
- list_init (&queue_cleanup->list);
- list_init (&queue_cleanup->queue_lock_list_head);
- queue_cleanup->queue = queue;
- queue_cleanup->queue_handle = req_exec_msg_queueopen->queue_handle;
- list_add (
- &queue_cleanup->list,
- &req_exec_msg_queueopen->source.conn_info->ais_ci.u.libmsg_ci.queue_cleanup_list);
- }
- queue->refcount += 1;
- printf ("refcount == %d\n", queue->refcount);
- #endif
-
-
- /*
- * Send error result to MSG library
- */
- error_exit:
- /*
- * If this node was the source of the message, respond to this node
- */
- if (message_source_is_local (&req_exec_msg_queueopen->source)) {
- /*
- * If its an async call respond with the invocation and handle
- */
- if (req_exec_msg_queueopen->async_call) {
- res_lib_msg_queueopenasync.header.size = sizeof (struct res_lib_msg_queueopenasync);
- res_lib_msg_queueopenasync.header.id = MESSAGE_RES_MSG_QUEUEOPENASYNC;
- res_lib_msg_queueopenasync.header.error = error;
- res_lib_msg_queueopenasync.invocation = req_exec_msg_queueopen->invocation;
- memcpy (&res_lib_msg_queueopenasync.source,
- &req_exec_msg_queueopen->source,
- sizeof (mar_message_source_t));
- openais_conn_send_response (
- req_exec_msg_queueopen->source.conn,
- &res_lib_msg_queueopenasync,
- sizeof (struct res_lib_msg_queueopenasync));
- openais_conn_send_response (
- openais_conn_partner_get (req_exec_msg_queueopen->source.conn),
- &res_lib_msg_queueopenasync,
- sizeof (struct res_lib_msg_queueopenasync));
- } else {
- /*
- * otherwise respond with the normal queueopen response
- */
- res_lib_msg_queueopen.header.size = sizeof (struct res_lib_msg_queueopen);
- res_lib_msg_queueopen.header.id = MESSAGE_RES_MSG_QUEUEOPEN;
- res_lib_msg_queueopen.header.error = error;
- memcpy (&res_lib_msg_queueopen.source,
- &req_exec_msg_queueopen->source,
- sizeof (mar_message_source_t));
- openais_conn_send_response (
- req_exec_msg_queueopen->source.conn,
- &res_lib_msg_queueopen,
- sizeof (struct res_lib_msg_queueopen));
- }
- }
- }
- static void message_handler_req_exec_msg_queueclose (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queueclose *req_exec_msg_queueclose = (struct req_exec_msg_queueclose *)message;
- struct res_lib_msg_queueclose res_lib_msg_queueclose;
- struct message_queue *queue = 0;
- SaAisErrorT error = SA_AIS_OK;
- log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueClose %s\n",
- getSaNameT (&req_exec_msg_queueclose->queue_name));
- queue = queue_find (&req_exec_msg_queueclose->queue_name);
- if (queue == 0) {
- goto error_exit;
- }
-
- queue->refcount -= 1;
- printf ("decrementing queue refcount to %d\n", queue->refcount);
- if (queue->refcount == 0) {
- printf ("should free queue\n");
- }
- error_exit:
- if (message_source_is_local(&req_exec_msg_queueclose->source)) {
- // TODO msg_queue_cleanup_remove (
- // req_exec_msg_queueclose->source.conn_info,
- // req_exec_msg_queueclose->queue_handle);
- res_lib_msg_queueclose.header.size = sizeof (struct res_lib_msg_queueclose);
- res_lib_msg_queueclose.header.id = MESSAGE_RES_MSG_QUEUECLOSE;
- res_lib_msg_queueclose.header.error = error;
- openais_conn_send_response (req_exec_msg_queueclose->source.conn,
- &res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose));
- }
- }
- static void message_handler_req_exec_msg_queuestatusget (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_queuestatusget *req_exec_msg_queuestatusget =
- (struct req_exec_msg_queuestatusget *)message;
- struct res_lib_msg_queueclose res_lib_msg_queuestatusget;
- #endif
- }
- static void message_handler_req_exec_msg_queueunlink (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_queueunlink *req_exec_msg_queueunlink =
- (struct req_exec_msg_queueunlink *)message;
- struct res_lib_msg_queueclose res_lib_msg_queueunlink;
- #endif
- }
- static void message_handler_req_exec_msg_queuegroupcreate (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queuegroupcreate *req_exec_msg_queuegroupcreate =
- (struct req_exec_msg_queuegroupcreate *)message;
- struct res_lib_msg_queuegroupcreate res_lib_msg_queuegroupcreate;
- struct queue_group *queue_group;
- SaAisErrorT error = SA_AIS_OK;
- queue_group = queue_group_find (&req_exec_msg_queuegroupcreate->queue_group_name);
- if (queue_group == 0) {
- queue_group = malloc (sizeof (struct queue_group));
- if (queue_group == 0) {
- error = SA_AIS_ERR_NO_MEMORY;
- goto error_exit;
- }
- memset (queue_group, 0, sizeof (struct queue_group));
- memcpy (&queue_group->name,
- &req_exec_msg_queuegroupcreate->queue_group_name,
- sizeof (SaNameT));
- list_init (&queue_group->list);
- list_init (&queue_group->message_queue_head);
- list_add (&queue_group->list, &queue_group_list_head);
- } else {
- error = SA_AIS_ERR_EXIST;
- }
- error_exit:
- if (message_source_is_local(&req_exec_msg_queuegroupcreate->source)) {
- res_lib_msg_queuegroupcreate.header.size = sizeof (struct res_lib_msg_queuegroupcreate);
- res_lib_msg_queuegroupcreate.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
- res_lib_msg_queuegroupcreate.header.error = error;
- openais_conn_send_response (
- req_exec_msg_queuegroupcreate->source.conn,
- &res_lib_msg_queuegroupcreate,
- sizeof (struct res_lib_msg_queuegroupcreate));
- }
- }
- static void message_handler_req_exec_msg_queuegroupinsert (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queuegroupinsert *req_exec_msg_queuegroupinsert =
- (struct req_exec_msg_queuegroupinsert *)message;
- struct res_lib_msg_queuegroupinsert res_lib_msg_queuegroupinsert;
- struct message_queue *queue;
- struct queue_group *queue_group;
- struct queue_group_entry *queue_group_entry;
- SaAisErrorT error = SA_AIS_OK;
- queue_group = queue_group_find (&req_exec_msg_queuegroupinsert->queue_group_name);
- if (queue_group == 0) {
- printf ("a\n");
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- queue = queue_find (&req_exec_msg_queuegroupinsert->queue_name);
- if (queue == 0) {
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- queue_group_entry = malloc (sizeof (struct queue_group_entry));
- if (queue_group_entry == 0) {
- printf ("c\n");
- error = SA_AIS_ERR_NO_MEMORY;
- goto error_exit;
- }
- list_init (&queue_group_entry->list);
- list_add (&queue_group_entry->list, &queue_group->message_queue_head);
- list_add (&queue->list, &queue_list_head);
- queue_group_entry->message_queue = queue;
- error_exit:
- if (message_source_is_local(&req_exec_msg_queuegroupinsert->source)) {
- res_lib_msg_queuegroupinsert.header.size = sizeof (struct res_lib_msg_queuegroupinsert);
- res_lib_msg_queuegroupinsert.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
- res_lib_msg_queuegroupinsert.header.error = error;
- openais_conn_send_response (
- req_exec_msg_queuegroupinsert->source.conn,
- &res_lib_msg_queuegroupinsert,
- sizeof (struct res_lib_msg_queuegroupinsert));
- }
- }
- static void message_handler_req_exec_msg_queuegroupremove (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queuegroupremove *req_exec_msg_queuegroupremove =
- (struct req_exec_msg_queuegroupremove *)message;
- struct res_lib_msg_queuegroupremove res_lib_msg_queuegroupremove;
- struct queue_group *queue_group;
- struct message_queue *queue;
- struct queue_group_entry *queue_group_entry;
- SaAisErrorT error = SA_AIS_OK;
- queue_group = queue_group_find (&req_exec_msg_queuegroupremove->queue_group_name);
- if (queue_group == 0) {
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- queue = queue_find (&req_exec_msg_queuegroupremove->queue_name);
- if (queue == 0) {
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- queue_group_entry = queue_group_entry_find (queue_group, queue);
- if (queue_group_entry == 0) {
- error = SA_AIS_ERR_NOT_EXIST;
- goto error_exit;
- }
- list_del (&queue_group_entry->list);
- error_exit:
- if (message_source_is_local(&req_exec_msg_queuegroupremove->source)) {
- res_lib_msg_queuegroupremove.header.size = sizeof (struct res_lib_msg_queuegroupremove);
- res_lib_msg_queuegroupremove.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
- res_lib_msg_queuegroupremove.header.error = error;
- openais_conn_send_response (
- req_exec_msg_queuegroupremove->source.conn,
- &res_lib_msg_queuegroupremove,
- sizeof (struct res_lib_msg_queuegroupremove));
- }
- }
- static void message_handler_req_exec_msg_queuegroupdelete (
- void *message,
- unsigned int nodeid)
- {
- struct req_exec_msg_queuegroupdelete *req_exec_msg_queuegroupdelete =
- (struct req_exec_msg_queuegroupdelete *)message;
- struct res_lib_msg_queuegroupdelete res_lib_msg_queuegroupdelete;
- struct queue_group *queue_group;
- SaAisErrorT error = SA_AIS_OK;
- queue_group = queue_group_find (&req_exec_msg_queuegroupdelete->queue_group_name);
- if (queue_group) {
- list_del (&queue_group->list);
- free (queue_group);
- } else {
- error = SA_AIS_ERR_NOT_EXIST;
- }
- if (message_source_is_local(&req_exec_msg_queuegroupdelete->source)) {
- res_lib_msg_queuegroupdelete.header.size = sizeof (struct res_lib_msg_queuegroupdelete);
- res_lib_msg_queuegroupdelete.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
- res_lib_msg_queuegroupdelete.header.error = error;
- openais_conn_send_response (
- req_exec_msg_queuegroupdelete->source.conn,
- &res_lib_msg_queuegroupdelete,
- sizeof (struct res_lib_msg_queuegroupdelete));
- }
- }
- static void message_handler_req_exec_msg_queuegrouptrack (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_queuegrouptrack *req_exec_msg_queuegrouptrack =
- (struct req_exec_msg_queuegrouptrack *)message;
- struct res_lib_msg_queueclose res_lib_msg_queuegrouptrack;
- #endif
- }
- static void message_handler_req_exec_msg_queuegrouptrackstop (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_queuegrouptrackstop *req_exec_msg_queuegrouptrackstop =
- (struct req_exec_msg_queuegrouptrackstop *)message;
- struct res_lib_msg_queueclose res_lib_msg_queuegrouptrackstop;
- #endif
- }
- static void message_handler_req_exec_msg_messagesend (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_messagesend *req_exec_msg_messagesend =
- (struct req_exec_msg_messagesend *)message;
- struct res_lib_msg_queueclose res_lib_msg_messagesend;
- #endif
- }
- static void message_handler_req_exec_msg_messageget (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_messageget *req_exec_msg_messageget =
- (struct req_exec_msg_messageget *)message;
- struct res_lib_msg_queueclose res_lib_msg_messageget;
- #endif
- }
- static void message_handler_req_exec_msg_messagecancel (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_messagecancel *req_exec_msg_messagecancel =
- (struct req_exec_msg_messagecancel *)message;
- struct res_lib_msg_queueclose res_lib_msg_messagecancel;
- #endif
- }
- static void message_handler_req_exec_msg_messagesendreceive (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_messagesendreceive *req_exec_msg_messagesendreceive =
- (struct req_exec_msg_messagesendreceive *)message;
- struct res_lib_msg_queueclose res_lib_msg_messagesendreceive;
- #endif
- }
- static void message_handler_req_exec_msg_messagereply (
- void *message,
- unsigned int nodeid)
- {
- #if 0
- struct req_exec_msg_messagereply *req_exec_msg_messagereply =
- (struct req_exec_msg_messagereply *)message;
- struct res_lib_msg_queueclose res_lib_msg_messagereply;
- #endif
- }
- static void message_handler_req_lib_msg_queueopen (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
- struct req_exec_msg_queueopen req_exec_msg_queueopen;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpen %s\n",
- getSaNameT (&req_lib_msg_queueopen->queueName));
- req_exec_msg_queueopen.header.size =
- sizeof (struct req_exec_msg_queueopen);
- req_exec_msg_queueopen.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
- message_source_set (&req_exec_msg_queueopen.source, conn);
- memcpy (&req_exec_msg_queueopen.queue_name,
- &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
- memcpy (&req_exec_msg_queueopen.creation_attributes,
- &req_lib_msg_queueopen->creationAttributes,
- sizeof (SaMsgQueueCreationAttributesT));
- req_exec_msg_queueopen.async_call = 0;
- req_exec_msg_queueopen.invocation = 0;
- req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
- req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
- req_exec_msg_queueopen.timeout = req_lib_msg_queueopen->timeout;
- iovec.iov_base = (char *)&req_exec_msg_queueopen;
- iovec.iov_len = sizeof (req_exec_msg_queueopen);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queueopenasync (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
- struct req_exec_msg_queueopen req_exec_msg_queueopen;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueOpenAsync %s\n",
- getSaNameT (&req_lib_msg_queueopen->queueName));
- req_exec_msg_queueopen.header.size =
- sizeof (struct req_exec_msg_queueopen);
- req_exec_msg_queueopen.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
- message_source_set (&req_exec_msg_queueopen.source, conn);
- memcpy (&req_exec_msg_queueopen.queue_name,
- &req_lib_msg_queueopen->queueName, sizeof (SaNameT));
- memcpy (&req_exec_msg_queueopen.creation_attributes,
- &req_lib_msg_queueopen->creationAttributes,
- sizeof (SaMsgQueueCreationAttributesT));
- req_exec_msg_queueopen.async_call = 1;
- req_exec_msg_queueopen.invocation = req_lib_msg_queueopen->invocation;
- req_exec_msg_queueopen.queue_handle = req_lib_msg_queueopen->queueHandle;
- req_exec_msg_queueopen.openFlags = req_lib_msg_queueopen->openFlags;
- req_exec_msg_queueopen.timeout = SA_TIME_END;
- iovec.iov_base = (char *)&req_exec_msg_queueopen;
- iovec.iov_len = sizeof (req_exec_msg_queueopen);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queueclose (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queueclose *req_lib_msg_queueclose = (struct req_lib_msg_queueclose *)msg;
- struct req_exec_msg_queueclose req_exec_msg_queueclose;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueClose %s\n",
- getSaNameT (&req_lib_msg_queueclose->queueName));
- req_exec_msg_queueclose.header.size =
- sizeof (struct req_exec_msg_queueclose);
- req_exec_msg_queueclose.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUECLOSE);
- message_source_set (&req_exec_msg_queueclose.source, conn);
- memcpy (&req_exec_msg_queueclose.queue_name,
- &req_lib_msg_queueclose->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queueclose;
- iovec.iov_len = sizeof (req_exec_msg_queueclose);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuestatusget (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuestatusget *req_lib_msg_queuestatusget =
- (struct req_lib_msg_queuestatusget *)msg;
- struct req_exec_msg_queuestatusget req_exec_msg_queuestatusget;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueStatusGet %s\n",
- getSaNameT (&req_lib_msg_queuestatusget->queueName));
- req_exec_msg_queuestatusget.header.size =
- sizeof (struct req_exec_msg_queuestatusget);
- req_exec_msg_queuestatusget.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET);
- message_source_set (&req_exec_msg_queuestatusget.source, conn);
- memcpy (&req_exec_msg_queuestatusget.queue_name,
- &req_lib_msg_queuestatusget->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuestatusget;
- iovec.iov_len = sizeof (req_exec_msg_queuestatusget);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queueunlink (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queueunlink *req_lib_msg_queueunlink =
- (struct req_lib_msg_queueunlink *)msg;
- struct req_exec_msg_queueunlink req_exec_msg_queueunlink;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueUnlink %s\n",
- getSaNameT (&req_lib_msg_queueunlink->queueName));
- req_exec_msg_queueunlink.header.size =
- sizeof (struct req_exec_msg_queueunlink);
- req_exec_msg_queueunlink.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK);
- message_source_set (&req_exec_msg_queueunlink.source, conn);
- memcpy (&req_exec_msg_queueunlink.queue_name,
- &req_lib_msg_queueunlink->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queueunlink;
- iovec.iov_len = sizeof (req_exec_msg_queueunlink);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegroupcreate (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegroupcreate *req_lib_msg_queuegroupcreate =
- (struct req_lib_msg_queuegroupcreate *)msg;
- struct req_exec_msg_queuegroupcreate req_exec_msg_queuegroupcreate;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupCreate %s\n",
- getSaNameT (&req_lib_msg_queuegroupcreate->queueGroupName));
- req_exec_msg_queuegroupcreate.header.size =
- sizeof (struct req_exec_msg_queuegroupcreate);
- req_exec_msg_queuegroupcreate.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE);
- message_source_set (&req_exec_msg_queuegroupcreate.source, conn);
- memcpy (&req_exec_msg_queuegroupcreate.queue_group_name,
- &req_lib_msg_queuegroupcreate->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegroupcreate;
- iovec.iov_len = sizeof (req_exec_msg_queuegroupcreate);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegroupinsert (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegroupinsert *req_lib_msg_queuegroupinsert =
- (struct req_lib_msg_queuegroupinsert *)msg;
- struct req_exec_msg_queuegroupinsert req_exec_msg_queuegroupinsert;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupInsert %s\n",
- getSaNameT (&req_lib_msg_queuegroupinsert->queueGroupName));
- req_exec_msg_queuegroupinsert.header.size =
- sizeof (struct req_exec_msg_queuegroupinsert);
- req_exec_msg_queuegroupinsert.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT);
- message_source_set (&req_exec_msg_queuegroupinsert.source, conn);
- memcpy (&req_exec_msg_queuegroupinsert.queue_name,
- &req_lib_msg_queuegroupinsert->queueName, sizeof (SaNameT));
- memcpy (&req_exec_msg_queuegroupinsert.queue_group_name,
- &req_lib_msg_queuegroupinsert->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegroupinsert;
- iovec.iov_len = sizeof (req_exec_msg_queuegroupinsert);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegroupremove (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegroupremove *req_lib_msg_queuegroupremove =
- (struct req_lib_msg_queuegroupremove *)msg;
- struct req_exec_msg_queuegroupremove req_exec_msg_queuegroupremove;
- struct iovec iovec;
- req_exec_msg_queuegroupremove.header.size =
- sizeof (struct req_exec_msg_queuegroupremove);
- req_exec_msg_queuegroupremove.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPREMOVE);
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupRemove %s\n",
- getSaNameT (&req_lib_msg_queuegroupremove->queueGroupName));
- message_source_set (&req_exec_msg_queuegroupremove.source, conn);
- memcpy (&req_exec_msg_queuegroupremove.queue_name,
- &req_lib_msg_queuegroupremove->queueName, sizeof (SaNameT));
- memcpy (&req_exec_msg_queuegroupremove.queue_group_name,
- &req_lib_msg_queuegroupremove->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegroupremove;
- iovec.iov_len = sizeof (req_exec_msg_queuegroupremove);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegroupdelete (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegroupdelete *req_lib_msg_queuegroupdelete =
- (struct req_lib_msg_queuegroupdelete *)msg;
- struct req_exec_msg_queuegroupdelete req_exec_msg_queuegroupdelete;
- struct iovec iovec;
- req_exec_msg_queuegroupdelete.header.size =
- sizeof (struct req_exec_msg_queuegroupdelete);
- req_exec_msg_queuegroupdelete.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPDELETE);
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupDelete %s\n",
- getSaNameT (&req_lib_msg_queuegroupdelete->queueGroupName));
- message_source_set (&req_exec_msg_queuegroupdelete.source, conn);
- memcpy (&req_exec_msg_queuegroupdelete.queue_group_name,
- &req_lib_msg_queuegroupdelete->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegroupdelete;
- iovec.iov_len = sizeof (req_exec_msg_queuegroupdelete);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegrouptrack (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegrouptrack *req_lib_msg_queuegrouptrack =
- (struct req_lib_msg_queuegrouptrack *)msg;
- struct req_exec_msg_queuegrouptrack req_exec_msg_queuegrouptrack;
- struct iovec iovec;
- req_exec_msg_queuegrouptrack.header.size =
- sizeof (struct req_exec_msg_queuegrouptrack);
- req_exec_msg_queuegrouptrack.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACK);
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrack %s\n",
- getSaNameT (&req_lib_msg_queuegrouptrack->queueGroupName));
- message_source_set (&req_exec_msg_queuegrouptrack.source, conn);
- memcpy (&req_exec_msg_queuegrouptrack.queue_group_name,
- &req_lib_msg_queuegrouptrack->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegrouptrack;
- iovec.iov_len = sizeof (req_exec_msg_queuegrouptrack);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_queuegrouptrackstop (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_queuegrouptrackstop *req_lib_msg_queuegrouptrackstop =
- (struct req_lib_msg_queuegrouptrackstop *)msg;
- struct req_exec_msg_queuegrouptrackstop req_exec_msg_queuegrouptrackstop;
- struct iovec iovec;
- req_exec_msg_queuegrouptrackstop.header.size =
- sizeof (struct req_exec_msg_queuegrouptrackstop);
- req_exec_msg_queuegrouptrackstop.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPTRACKSTOP);
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrackStop %s\n",
- getSaNameT (&req_lib_msg_queuegrouptrackstop->queueGroupName));
- message_source_set (&req_exec_msg_queuegrouptrackstop.source, conn);
- memcpy (&req_exec_msg_queuegrouptrackstop.queue_group_name,
- &req_lib_msg_queuegrouptrackstop->queueGroupName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_queuegrouptrackstop;
- iovec.iov_len = sizeof (req_exec_msg_queuegrouptrackstop);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagesend (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagesend *req_lib_msg_messagesend =
- (struct req_lib_msg_messagesend *)msg;
- struct req_exec_msg_messagesend req_exec_msg_messagesend;
- struct iovec iovec;
- req_exec_msg_messagesend.header.size =
- sizeof (struct req_exec_msg_messagesend);
- req_exec_msg_messagesend.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
- req_exec_msg_messagesend.async_call = 0;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSend %s\n",
- getSaNameT (&req_lib_msg_messagesend->destination));
- message_source_set (&req_exec_msg_messagesend.source, conn);
- memcpy (&req_exec_msg_messagesend.destination,
- &req_lib_msg_messagesend->destination, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagesend;
- iovec.iov_len = sizeof (req_exec_msg_messagesend);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagesendasync (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagesend *req_lib_msg_messagesend =
- (struct req_lib_msg_messagesend *)msg;
- struct req_exec_msg_messagesend req_exec_msg_messagesend;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendAsync %s\n",
- getSaNameT (&req_lib_msg_messagesend->destination));
- req_exec_msg_messagesend.header.size =
- sizeof (struct req_exec_msg_messagesend);
- req_exec_msg_messagesend.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
- req_exec_msg_messagesend.async_call = 1;
- message_source_set (&req_exec_msg_messagesend.source, conn);
- memcpy (&req_exec_msg_messagesend.destination,
- &req_lib_msg_messagesend->destination, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagesend;
- iovec.iov_len = sizeof (req_exec_msg_messagesend);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messageget (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messageget *req_lib_msg_messageget =
- (struct req_lib_msg_messageget *)msg;
- struct req_exec_msg_messageget req_exec_msg_messageget;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageGet %s\n",
- getSaNameT (&req_lib_msg_messageget->queueName));
- req_exec_msg_messageget.header.size =
- sizeof (struct req_exec_msg_messageget);
- req_exec_msg_messageget.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEGET);
- message_source_set (&req_exec_msg_messageget.source, conn);
- memcpy (&req_exec_msg_messageget.queue_name,
- &req_lib_msg_messageget->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messageget;
- iovec.iov_len = sizeof (req_exec_msg_messageget);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagecancel (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagecancel *req_lib_msg_messagecancel =
- (struct req_lib_msg_messagecancel *)msg;
- struct req_exec_msg_messagecancel req_exec_msg_messagecancel;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageCancel %s\n",
- getSaNameT (&req_lib_msg_messagecancel->queueName));
- req_exec_msg_messagecancel.header.size =
- sizeof (struct req_exec_msg_messagecancel);
- req_exec_msg_messagecancel.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL);
- message_source_set (&req_exec_msg_messagecancel.source, conn);
- memcpy (&req_exec_msg_messagecancel.queue_name,
- &req_lib_msg_messagecancel->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagecancel;
- iovec.iov_len = sizeof (req_exec_msg_messagecancel);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagesendreceive (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagesendreceive *req_lib_msg_messagesendreceive =
- (struct req_lib_msg_messagesendreceive *)msg;
- struct req_exec_msg_messagesendreceive req_exec_msg_messagesendreceive;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSendReceive %s\n",
- getSaNameT (&req_lib_msg_messagesendreceive->queueName));
- req_exec_msg_messagesendreceive.header.size =
- sizeof (struct req_exec_msg_messagesendreceive);
- req_exec_msg_messagesendreceive.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE);
- message_source_set (&req_exec_msg_messagesendreceive.source, conn);
- memcpy (&req_exec_msg_messagesendreceive.queue_name,
- &req_lib_msg_messagesendreceive->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagesendreceive;
- iovec.iov_len = sizeof (req_exec_msg_messagesendreceive);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagereply (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagereply *req_lib_msg_messagereply =
- (struct req_lib_msg_messagereply *)msg;
- struct req_exec_msg_messagereply req_exec_msg_messagereply;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReply %s\n",
- getSaNameT (&req_lib_msg_messagereply->queueName));
- req_exec_msg_messagereply.header.size =
- sizeof (struct req_exec_msg_messagereply);
- req_exec_msg_messagereply.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
- req_exec_msg_messagereply.async_call = 0;
- message_source_set (&req_exec_msg_messagereply.source, conn);
- memcpy (&req_exec_msg_messagereply.queue_name,
- &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagereply;
- iovec.iov_len = sizeof (req_exec_msg_messagereply);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
- static void message_handler_req_lib_msg_messagereplyasync (
- void *conn,
- void *msg)
- {
- struct req_lib_msg_messagereply *req_lib_msg_messagereply =
- (struct req_lib_msg_messagereply *)msg;
- struct req_exec_msg_messagereply req_exec_msg_messagereply;
- struct iovec iovec;
- log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageReplyAsync %s\n",
- getSaNameT (&req_lib_msg_messagereply->queueName));
- req_exec_msg_messagereply.header.size =
- sizeof (struct req_exec_msg_messagereply);
- req_exec_msg_messagereply.header.id =
- SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
- req_exec_msg_messagereply.async_call = 1;
- message_source_set (&req_exec_msg_messagereply.source, conn);
- memcpy (&req_exec_msg_messagereply.queue_name,
- &req_lib_msg_messagereply->queueName, sizeof (SaNameT));
- iovec.iov_base = (char *)&req_exec_msg_messagereply;
- iovec.iov_len = sizeof (req_exec_msg_messagereply);
- assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
- TOTEMPG_AGREED) == 0);
- }
|