[ PATCH ] OpenMAMA Dummy Bridge Implementation.
Jacobraj Benet <JBenet@...>
This patch provides the dummy bridge implementation.
The change does not have any direct impact on the rest of the Middleware Bridge subsystem.
Signed-off-by: Jacobraj Benet <jbenet@...>
----
diff --git a/mama/c_cpp/src/c/bridge/dummy/Makefile.am b/mama/c_cpp/src/c/bridge/dummy/Makefile.am
new file mode 100644 index 0000000..08fbfc2 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/Makefile.am @@ -0,0 +1,55 @@ +# $Id: Makefile.am,v 1.1.2.9 2011/09/29 09:19:22 emmapollock Exp $ +# +# OpenMAMA: The open middleware agnostic messaging API +# Copyright (C) 2011 NYSE Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA +# + +srcdir = @srcdir@ +VPATH = @srcdir@ + +# Targets to be installed: +lib_LTLIBRARIES = libmamadummyimpl.la + + +CPPFLAGS += \ + -I$(srcdir)/../../ \ + -I$(srcdir)/../../../../../../common/c_cpp/src/c + +LDFLAGS += \ + -L../../ \ + -L$(srcdir)/../../../../../../common/c_cpp/src/c + +if USE_GCC_FLAGS +CFLAGS += -Wimplicit -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wall +CPPFLAGS += -Wno-long-long -Wimplicit -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wall +endif + +LIBS = -luuid -lmama -lm -lwombatcommon + +libmamadummyimpl_la_SOURCES = \ + bridge.c \ + transportbridge.c \ + queue.c \ + publisher.c \ + sub.c \ + msg.c \ + io.c \ + timer.c \ + subinitial.c + + diff --git a/mama/c_cpp/src/c/bridge/dummy/bridge.c b/mama/c_cpp/src/c/bridge/dummy/bridge.c new file mode 100644 index 0000000..1fb2996 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/bridge.c @@ -0,0 +1,196 @@ +/* $Id: bridge.c,v 1.1.2.7 2011/10/02 19:02:18 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + +#ifdef WIN32 +#include <wombat/wincompat.h> +#endif /* WIN32 */ + +#include "dummybridgefunctions.h" +#include "dummydefs.h" +#include <mama/mama.h> +#include <timers.h> +#include <queueimpl.h> + +timerHeap gTimerHeap; + +/*Responsible for creating the bridge impl structure*/ +void dummyBridge_createImpl (mamaBridge* result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "qdummyBridge_createImpl(): Entering."); + if (!result) return; + *result = NULL; + + mamaBridgeImpl* impl = (mamaBridgeImpl*)calloc (1, sizeof (mamaBridgeImpl)); + if (!impl) + { + mama_log (MAMA_LOG_LEVEL_SEVERE, "dummyBridge_createImpl(): " + "Could not allocate mem for impl."); + return; + } + + dummyBridgeImpl* dummyBridge = (dummyBridgeImpl*) calloc(1, sizeof(dummyBridgeImpl)); + + /*Populate the bridge impl structure with the function pointers*/ + INITIALIZE_BRIDGE (impl, dummy); + + mamaBridgeImpl_setClosure((mamaBridge) impl, dummyBridge); + + *result = (mamaBridge)impl; +} + +const char* +dummyBridge_getVersion (void) +{ + return "0.0.0"; +} + +const char* +dummyBridge_getName (void) +{ + return "dummy"; +} + +#define DEFAULT_PAYLOAD_NAME "stubmsg" +#define DEFAULT_PAYLOAD_ID MAMA_PAYLOAD_QPID +static const char* PAYLOAD_NAMES[] = {"stubmsg",NULL}; +static const char PAYLOAD_IDS[] = {MAMA_PAYLOAD_STUB,NULL}; + +mama_status +dummyBridge_getDefaultPayloadId (char***name, char** id) +{ + *name=PAYLOAD_NAMES; + *id=PAYLOAD_IDS; + + return MAMA_STATUS_OK; +} + + +mama_status +dummyBridge_open (mamaBridge bridgeImpl) +{ + mama_status status = MAMA_STATUS_OK; + + mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl; + + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridge_open(): Entering."); + + if (MAMA_STATUS_OK != + (status = mamaQueue_create (&impl->mDefaultEventQueue, bridgeImpl))) + { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_open():" + "Failed to create QPID queue."); + return status; + } + + mamaQueue_setQueueName (impl->mDefaultEventQueue, + "DUMMY_DEFAULT_MAMA_QUEUE"); + + mama_log (MAMA_LOG_LEVEL_NORMAL, + "dummyBridge_open(): Successfully created QPID queue"); + + if (0 != createTimerHeap (&gTimerHeap)) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, + "dummyBridge_open(): Failed to initialize timers."); + return MAMA_STATUS_PLATFORM; + } + + if (0 != startDispatchTimerHeap (gTimerHeap)) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, + "dummyBridge_open(): Failed to start timer thread."); + return MAMA_STATUS_PLATFORM; + } + + return MAMA_STATUS_OK; +} + +mama_status +dummyBridge_close (mamaBridge bridgeImpl) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridge_close(): Entering."); + + mama_status status = MAMA_STATUS_OK; + mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl; + + + if (0 != destroyHeap (gTimerHeap)) + { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_close():" + "Failed to destroy QPID timer heap."); + status = MAMA_STATUS_PLATFORM; + } + + mamaQueue_destroyWait(impl->mDefaultEventQueue); + + free (impl); + return status; +} + + +mama_status +dummyBridge_start(mamaQueue defaultEventQueue) +{ + mama_log (MAMA_LOG_LEVEL_FINER, "dummyBridge_start(): Start dispatching on default event queue."); + mama_status status = MAMA_STATUS_OK; + + // start Qpid event loop(s) + dummyBridgeImpl* dummyBridge; + if (MAMA_STATUS_OK != (status = mamaBridgeImpl_getClosure((mamaBridge) mamaQueueImpl_getBridgeImpl(defaultEventQueue), (void**) &dummyBridge))) { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_start(): Could not get QPID object"); + return status; + } + if (MAMA_STATUS_OK != (status = dummyTransportBridge_start(dummyBridge->mTransportBridge))) { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_start(): Could not start dispatching on QPID"); + return status; + } + + // start Mama event loop + return mamaQueue_dispatch(defaultEventQueue); + +} + +mama_status +dummyBridge_stop(mamaQueue defaultEventQueue) +{ + mama_log (MAMA_LOG_LEVEL_FINER, "dummyBridge_stop(): Stopping bridge."); + + mama_status status = MAMA_STATUS_OK; + + dummyBridgeImpl* dummyBridge; + if (MAMA_STATUS_OK != (status = mamaBridgeImpl_getClosure((mamaBridge) mamaQueueImpl_getBridgeImpl(defaultEventQueue), (void**) &dummyBridge))) { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_stop(): Could not get QPID object"); + return status; + } + if (MAMA_STATUS_OK != (status = dummyTransportBridge_stop(dummyBridge->mTransportBridge))) { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_stop(): Could not stop dispatching on QPID %d", status); + return status; + } + + // stop Mama event loop + status = mamaQueue_stopDispatch (defaultEventQueue); + if (status != MAMA_STATUS_OK) + { + mama_log (MAMA_LOG_LEVEL_ERROR, "dummyBridge_stop(): Failed to unblock queue."); + return status; + } +} diff --git a/mama/c_cpp/src/c/bridge/dummy/dummybridgefunctions.h b/mama/c_cpp/src/c/bridge/dummy/dummybridgefunctions.h new file mode 100644 index 0000000..581cc34 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/dummybridgefunctions.h @@ -0,0 +1,447 @@ +/* $Id: dummybridgefunctions.h,v 1.1.2.3 2011/09/07 11:01:05 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef QPID_BRIDGE_FUNCTIONS__ +#define QPID_BRIDGE_FUNCTIONS__ + +#include <mama/mama.h> +#include <bridge.h> + +#if defined(__cplusplus) +extern "C" { +#endif + +/*Definitions for all of the QPID bridge functions which will be used by the + * code MAMA code when delegating calls to the bridge*/ + + /*========================================================================= + = Functions for the bridge = + =========================================================================*/ +MAMAExpDLL +extern void +dummyBridge_createImpl (mamaBridge* result); + +extern const char* +dummyBridge_getVersion (void); + +mama_status +dummyBridge_getDefaultPayloadId (char***name, char** id); + +extern mama_status +dummyBridge_open (mamaBridge bridgeImpl); + +extern mama_status +dummyBridge_close (mamaBridge bridgeImpl); + +extern mama_status +dummyBridge_start (mamaQueue defaultEventQueue); + +extern mama_status +dummyBridge_stop (mamaQueue defaultEventQueue); + +extern const char* +dummyBridge_getName (void); + + +/*========================================================================= + = Functions for the mamaQueue = + =========================================================================*/ +extern mama_status +dummyBridgeMamaQueue_create (queueBridge *queue, mamaQueue parent); + +extern mama_status +dummyBridgeMamaQueue_create_usingNative (queueBridge *queue, mamaQueue parent, void* nativeQueue); + +extern mama_status +dummyBridgeMamaQueue_destroy (queueBridge queue); + +extern mama_status +dummyBridgeMamaQueue_getEventCount (queueBridge queue, size_t* count); + +extern mama_status +dummyBridgeMamaQueue_dispatch (queueBridge queue); + +extern mama_status +dummyBridgeMamaQueue_timedDispatch (queueBridge queue, uint64_t timeout); + +extern mama_status +dummyBridgeMamaQueue_dispatchEvent (queueBridge queue); + +extern mama_status +dummyBridgeMamaQueue_enqueueEvent (queueBridge queue, + mamaQueueEnqueueCB callback, + void* closure); + +extern mama_status +dummyBridgeMamaQueue_stopDispatch (queueBridge queue); + +extern mama_status +dummyBridgeMamaQueue_setEnqueueCallback (queueBridge queue, + mamaQueueEnqueueCB callback, + void* closure); + +extern mama_status +dummyBridgeMamaQueue_removeEnqueueCallback (queueBridge queue); + +extern mama_status +dummyBridgeMamaQueue_getNativeHandle (queueBridge queue, + void** result); + +extern mama_status +dummyBridgeMamaQueue_setLowWatermark (queueBridge queue, + size_t lowWatermark); +extern mama_status +dummyBridgeMamaQueue_setHighWatermark (queueBridge queue, + size_t highWatermark); +/*========================================================================= + = Functions for the mamaTransport = + =========================================================================*/ +extern int +dummyBridgeMamaTransport_isValid (transportBridge transport); + +extern mama_status +dummyBridgeMamaTransport_destroy (transportBridge transport); + +extern mama_status +dummyBridgeMamaTransport_create (transportBridge* result, + const char* name, + mamaTransport parent); +extern mama_status +dummyBridgeMamaTransport_findConnection (transportBridge* transports, + int numTransports, + mamaConnection* result, + const char* ipAddress, + uint16_t port); +extern mama_status +dummyBridgeMamaTransport_getAllConnections (transportBridge* transports, + int numTransports, + mamaConnection** result, + uint32_t* len); + +extern mama_status +dummyBridgeMamaTransport_getAllConnectionsForTopic (transportBridge* transports, + int numTransports, + const char* topic, + mamaConnection** result, + uint32_t* len); +extern mama_status +dummyBridgeMamaTransport_freeAllConnections (transportBridge* transports, + int numTransports, + mamaConnection* connections, + uint32_t len); +extern mama_status +dummyBridgeMamaTransport_getAllServerConnections ( + transportBridge* transports, + int numTransports, + mamaServerConnection** result, + uint32_t* len); + +extern mama_status +dummyBridgeMamaTransport_freeAllServerConnections ( + transportBridge* transports, + int numTransports, + mamaServerConnection* connections, + uint32_t len); + +extern mama_status +dummyBridgeMamaTransport_getNumLoadBalanceAttributes ( + const char* name, + int* numLoadBalanceAttributes); +extern mama_status +dummyBridgeMamaTransport_getLoadBalanceSharedObjectName ( + const char* name, + const char** loadBalanceSharedObjectName); + +extern mama_status +dummyBridgeMamaTransport_getLoadBalanceScheme (const char* name, + tportLbScheme* scheme); + +extern mama_status +dummyBridgeMamaTransport_sendMsgToConnection ( + transportBridge transport, + mamaConnection connection, + mamaMsg msg, + const char* topic); +extern mama_status +dummyBridgeMamaTransport_isConnectionIntercepted ( + mamaConnection connection, + uint8_t* result); + +extern mama_status +dummyBridgeMamaTransport_installConnectConflateMgr ( + transportBridge transport, + mamaConflationManager mgr, + mamaConnection connection, + conflateProcessCb processCb, + conflateGetMsgCb msgCb); + +extern mama_status +dummyBridgeMamaTransport_uninstallConnectConflateMgr ( + transportBridge transport, + mamaConflationManager mgr, + mamaConnection connection); + +extern mama_status +dummyBridgeMamaTransport_startConnectionConflation ( + transportBridge transport, + mamaConflationManager mgr, + mamaConnection connection); + +extern mama_status +dummyBridgeMamaTransport_requestConflation (transportBridge* transports, + int numTransports); +extern mama_status +dummyBridgeMamaTransport_requestEndConflation (transportBridge* transports, + int numTransports); + +extern mama_status +dummyBridgeMamaTransport_getNativeTransport (transportBridge transport, + void** result); +extern mama_status +dummyBridgeMamaTransport_getNativeTransportNamingCtx (transportBridge transport, + void** result); + +extern mama_status +dummyBridgeMamaTransport_forceClientDisconnect ( + transportBridge* transports, + int numTransports, + const char* ipAddress, + uint16_t port); + +/*========================================================================= + = Functions for the mamaSubscription = + =========================================================================*/ +extern mama_status dummyBridgeMamaSubscription_create + (subscriptionBridge* subsc_, + const char* source, + const char* symbol, + mamaTransport transport, + mamaQueue queue, + mamaMsgCallbacks callback, + mamaSubscription subscription, + void* closure ); + +extern mama_status +dummyBridgeMamaSubscription_createWildCard ( + subscriptionBridge* subsc_, + const char* source, + const char* symbol, + mamaTransport transport, + mamaQueue queue, + mamaMsgCallbacks callback, + mamaSubscription subscription, + void* closure ); + +extern mama_status dummyBridgeMamaSubscription_mute + (subscriptionBridge subscriber); + +extern mama_status dummyBridgeMamaSubscription_destroy + (subscriptionBridge subscriber); + +extern int dummyBridgeMamaSubscription_isValid + (subscriptionBridge bridge); + +extern mama_status dummyBridgeMamaSubscription_getSubject + (subscriptionBridge subscriber, + const char** subject); + +extern int dummyBridgeMamaSubscription_hasWildcards + (subscriptionBridge subscriber); + +extern mama_status dummyBridgeMamaSubscription_getPlatformError + (subscriptionBridge subsc, void** error); + +extern mama_status dummyBridgeMamaSubscription_setTopicClosure + (subscriptionBridge subsc, void* closure); + +extern mama_status dummyBridgeMamaSubscription_muteCurrentTopic + (subscriptionBridge subsc); + +extern int dummyBridgeMamaSubscription_isTportDisconnected + (subscriptionBridge subsc); + +/*========================================================================= + = Functions for the mamaTimer = + =========================================================================*/ +extern mama_status dummyBridgeMamaTimer_create (timerBridge* timer, + void* nativeQueueHandle, + mamaTimerCb action, + mamaTimerCb onTimerDestroyed, + mama_f64_t interval, + mamaTimer parent, + void* closure); + +extern mama_status dummyBridgeMamaTimer_destroy (timerBridge timer); + +extern mama_status dummyBridgeMamaTimer_reset (timerBridge timer); + +extern mama_status dummyBridgeMamaTimer_setInterval (timerBridge timer, + mama_f64_t interval); + +extern mama_status dummyBridgeMamaTimer_getInterval (timerBridge timer, + mama_f64_t* interval); + +/*========================================================================= + = Functions for the mamaIo = + =========================================================================*/ +extern mama_status +dummyBridgeMamaIo_create (ioBridge* result, + void* nativeQueueHandle, + uint32_t descriptor, + mamaIoCb action, + mamaIoType ioType, + mamaIo parent, + void* closure); + +extern mama_status +dummyBridgeMamaIo_destroy (ioBridge io); + +extern mama_status +dummyBridgeMamaIo_getDescriptor (ioBridge io, uint32_t* result); + + +/*========================================================================= + = Functions for the mamaPublisher = + =========================================================================*/ +extern mama_status +dummyBridgeMamaPublisher_createByIndex ( + publisherBridge* result, + mamaTransport tport, + int tportIndex, + const char* topic, + const char* source, + const char* root, + void* nativeQueueHandle, + mamaPublisher parent); + +extern mama_status +dummyBridgeMamaPublisher_create (publisherBridge* result, + mamaTransport tport, + const char* topic, + const char* source, + const char* root, + void* nativeQueueHandle, + mamaPublisher parent); + +extern mama_status +dummyBridgeMamaPublisher_destroy (publisherBridge publisher); + +extern mama_status +dummyBridgeMamaPublisher_send (publisherBridge publisher, mamaMsg msg); + +extern mama_status +dummyBridgeMamaPublisher_sendReplyToInbox (publisherBridge publisher, + mamaMsg request, + mamaMsg reply); + +extern mama_status +dummyBridgeMamaPublisher_sendFromInbox (publisherBridge publisher, + mamaInbox inbox, + mamaMsg msg); +extern mama_status +dummyBridgeMamaPublisher_sendFromInboxByIndex (publisherBridge publisher, + int tportIndex, + mamaInbox inbox, + mamaMsg msg); +extern mama_status +dummyBridgeMamaPublisher_sendReplyToInboxHandle (publisherBridge publisher, + void * wmwReply, + mamaMsg reply); +/*========================================================================= + = Functions for the mamaInbox = + =========================================================================*/ +extern mama_status +dummyBridgeMamaInbox_create ( + inboxBridge* bridge, + mamaTransport tport, + mamaQueue queue, + mamaInboxMsgCallback msgCB, + mamaInboxErrorCallback errorCB, + mamaInboxDestroyCallback onInboxDestroyed, + void* closure, + mamaInbox parent); + +extern mama_status +dummyBridgeMamaInbox_createByIndex ( + inboxBridge* bridge, + mamaTransport tport, + int tportIndex, + mamaQueue queue, + mamaInboxMsgCallback msgCB, + mamaInboxErrorCallback errorCB, + mamaInboxDestroyCallback onInboxDestroyed, + void* closure, + mamaInbox parent); + +extern mama_status +dummyBridgeMamaInbox_destroy (inboxBridge inbox); + +/*========================================================================= + = Functions for the mamaMsg = + =========================================================================*/ +extern mama_status +dummyBridgeMamaMsg_create (msgBridge* msg, mamaMsg parent); + +extern int +dummyBridgeMamaMsg_isFromInbox (msgBridge msg); + +extern mama_status +dummyBridgeMamaMsg_destroy (msgBridge msg, int destroyMsg); + +extern mama_status +dummyBridgeMamaMsg_destroyMiddlewareMsg (msgBridge msg); + +extern mama_status +dummyBridgeMamaMsg_detach (msgBridge msg); + +extern mama_status +dummyBridgeMamaMsg_getPlatformError (msgBridge msg, void** error); + +extern mama_status +dummyBridgeMamaMsg_setSendSubject (msgBridge msg, + const char* symbol, + const char* subject); + +extern mama_status +dummyBridgeMamaMsg_getNativeHandle (msgBridge msg, void** result); + +extern mama_status +dummyBridgeMamaMsg_duplicateReplyHandle (msgBridge msg, void** result); + +extern mama_status +dummyBridgeMamaMsg_copyReplyHandle (void* src, void** dest); + +extern mama_status +dummyBridgeMamaMsg_destroyReplyHandle (void* result); + +extern mama_status +dummyBridgeMamaMsgImpl_setReplyHandle (msgBridge msg, void* result); + +extern mama_status +dummyBridgeMamaMsgImpl_setReplyHandleAndIncrement (msgBridge msg, void* result); + +extern mama_status +dummyBridgeMamaMsgImpl_setAttributesAndSecure (msgBridge msg, void* attributes, uint8_t secure); +#if defined(__cplusplus) +} +#endif + +#endif /*QPID_BRIDGE_FUNCTIONS__*/ diff --git a/mama/c_cpp/src/c/bridge/dummy/dummydefs.h b/mama/c_cpp/src/c/bridge/dummy/dummydefs.h new file mode 100644 index 0000000..07ca5e2 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/dummydefs.h @@ -0,0 +1,49 @@ +/* $Id: dummydefs.h,v 1.1.2.7 2011/09/16 19:42:31 billtorpey Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef QPIDDEFS_H__ +#define QPIDDEFS_H__ + +#include <wombat/wSemaphore.h> + +#if defined(__cplusplus) +extern "C" { +#endif + + +#define MAX_SUBJECT_LENGTH 256 + +typedef struct dummyTransportBridge +{ + mamaTransport mTransport; +} dummyTransportBridge; + + +typedef struct dummyBridgeImpl +{ + dummyTransportBridge* mTransportBridge; +} dummyBridgeImpl; + +#if defined(__cplusplus) +} +#endif + +#endif /* QPIDDEFS_H__ */ diff --git a/mama/c_cpp/src/c/bridge/dummy/io.c b/mama/c_cpp/src/c/bridge/dummy/io.c new file mode 100644 index 0000000..7df3de8 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/io.c @@ -0,0 +1,55 @@ +/* $Id: io.c,v 1.1.2.2 2011/08/30 15:51:49 billtorpey Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <mama/mama.h> +#include <mama/io.h> +#include <bridge.h> +#include "dummybridgefunctions.h" + +mama_status +dummyBridgeMamaIo_create(ioBridge* result, + void* nativeQueueHandle, + uint32_t descriptor, + mamaIoCb action, + mamaIoType ioType, + mamaIo parent, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "qBridgeMamaIo_creat(): Entering."); + *result = 0; + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaIo_destroy (ioBridge io) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "qBridgeMamaIo_destroy(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaIo_getDescriptor (ioBridge io, uint32_t *result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "qdummyBridgeMamaIo_getDescriptor(): Entering."); + *result = 0; + return MAMA_STATUS_NOT_IMPLEMENTED; +} + diff --git a/mama/c_cpp/src/c/bridge/dummy/msg.c b/mama/c_cpp/src/c/bridge/dummy/msg.c new file mode 100644 index 0000000..0919420 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/msg.c @@ -0,0 +1,145 @@ +/* $Id: msg.c,v 1.1.2.8 2011/10/10 16:02:16 emmapollock Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <stdlib.h> +#include <string.h> + +#ifdef WIN32 +#include <wombat/wincompat.h> +#endif /* WIN32 */ + +#include <mama/mama.h> +#include <msgimpl.h> +#include "dummydefs.h" +#include "dummybridgefunctions.h" + +#if 0 +typedef struct dummyMsgImpl +{ + mamaMsg mParent; +} dummyMsgImpl; +#endif + +mama_status +dummyBridgeMamaMsg_create (msgBridge* msg, mamaMsg parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_create (): Entering."); + return MAMA_STATUS_OK; +} + + +mama_status +dummyBridgeMamaMsg_destroy (msgBridge msg, int destroyMsg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_destroy(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_destroyMiddlewareMsg (msgBridge msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_destroyMiddlewareMsg(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_detach (msgBridge msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_detach(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_getPlatformError (msgBridge msg, void** error) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_getPlatformError(): Entering."); + if (error) *error = NULL; + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaMsgImpl_setReplyHandle (msgBridge msg, void* result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsgImpl_setReplyHandle(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsgImpl_setReplyHandleAndIncrement (msgBridge msg, void* result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsgImpl_setReplyHandleAndIncrement(): Entering."); + return dummyBridgeMamaMsgImpl_setReplyHandle(msg, result); +} + +int +dummyBridgeMamaMsg_isFromInbox (msgBridge msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_isFromInbox(): Entering."); + const char* dummy; + return 1; +} + +mama_status +dummyBridgeMamaMsg_setSendSubject (msgBridge msg, + const char* symbol, + const char* subject) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_setSendSubject(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_getNativeHandle (msgBridge msg, void** result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_getNativeHandle(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_duplicateReplyHandle (msgBridge msg, void** result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_duplicateReplyHandle(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_copyReplyHandle (void* src, void** dest) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_copyReplyHandle(): Entering."); + const char* replyAddr = (const char*) src; + *dest = (void*) strdup(replyAddr); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaMsg_destroyReplyHandle (void* result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsg_destroyReplyHandle(): Entering."); + char* replyAddr = (char*) result; + free(replyAddr); + return MAMA_STATUS_OK; +} +mama_status +dummyBridgeMamaMsgImpl_setAttributesAndSecure (msgBridge msg, void* attributes, uint8_t secure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaMsgImpl_setAttributesAndSecure(): Entering."); + return MAMA_STATUS_OK; +} diff --git a/mama/c_cpp/src/c/bridge/dummy/publisher.c b/mama/c_cpp/src/c/bridge/dummy/publisher.c new file mode 100644 index 0000000..3684ad4 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/publisher.c @@ -0,0 +1,145 @@ +/* $Id: publisher.c,v 1.1.2.10 2011/10/02 19:02:18 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <string.h> + +#include <mama/mama.h> +#include <mama/inbox.h> +#include <mama/publisher.h> +#include <bridge.h> +#include <inboximpl.h> +//#include "subinitial.h" +#include "dummybridgefunctions.h" +//#include "transportbridge.h" +//#include "msgimpl.h" +#include "dummydefs.h" + +typedef struct dummyPublisherBridge +{ + mamaTransport mTransport; + const char* mTopic; + const char* mSource; + const char* mRoot; + char* mSubject; +} dummyPublisherBridge; + +static mama_status +dummyBridgeMamaPublisherImpl_buildSendSubject (dummyPublisherBridge* impl); + + +mama_status +dummyBridgeMamaPublisher_createByIndex (publisherBridge* result, + mamaTransport tport, + int tportIndex, + const char* topic, + const char* source, + const char* root, + void* nativeQueueHandle, + mamaPublisher parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_createByIndex(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaPublisher_create (publisherBridge* result, + mamaTransport tport, + const char* topic, + const char* source, + const char* root, + void* nativeQueueHandle, + mamaPublisher parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_create(): Entering."); + return dummyBridgeMamaPublisher_createByIndex (result, + tport, + 0, + topic, + source, + root, + nativeQueueHandle, + parent); +} + +/* Build up the RV subject. This should only need to be set once for the + publisher. Duplication of some of the logic */ +static mama_status +dummyBridgeMamaPublisherImpl_buildSendSubject (dummyPublisherBridge* impl) +{ + char lSubject[256]; + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisherImpl_buildSendSubject(): Entering."); + return MAMA_STATUS_OK; +} + +/*Send a message.*/ +mama_status +dummyBridgeMamaPublisher_send (publisherBridge publisher, mamaMsg msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_send(): Entering."); + return MAMA_STATUS_OK; +} + +/* Send reply to inbox. */ +mama_status +dummyBridgeMamaPublisher_sendReplyToInbox (publisherBridge publisher, + mamaMsg request, + mamaMsg reply) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_sendReplyToInbox(): Entering."); + return MAMA_STATUS_OK; +} + +/* Destroy the publisher.*/ +mama_status +dummyBridgeMamaPublisher_destroy (publisherBridge publisher) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_destroy(): Entering."); + return MAMA_STATUS_OK; +} + +/* Send a message from the specified inbox using the throttle. */ +mama_status +dummyBridgeMamaPublisher_sendFromInboxByIndex (publisherBridge publisher, + int tportIndex, + mamaInbox inbox, + mamaMsg msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_sendFromInboxByIndex(): Entering."); + return MAMA_STATUS_OK; +} +mama_status +dummyBridgeMamaPublisher_sendFromInbox (publisherBridge publisher, + mamaInbox inbox, + mamaMsg msg) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_sendFromInbox(): Entering."); + return dummyBridgeMamaPublisher_sendFromInboxByIndex ( + publisher, 0, inbox, msg); +} + +mama_status +dummyBridgeMamaPublisher_sendReplyToInboxHandle (publisherBridge publisher, + void * inbox, + mamaMsg reply) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaPublisher_sendReplyToInboxHandle(): Entering."); + return MAMA_STATUS_OK; +} diff --git a/mama/c_cpp/src/c/bridge/dummy/queue.c b/mama/c_cpp/src/c/bridge/dummy/queue.c new file mode 100644 index 0000000..809dfa8 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/queue.c @@ -0,0 +1,149 @@ +/* $Id: queue.c,v 1.1.2.6 2011/10/02 19:02:18 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <mama/mama.h> +#include <bridge.h> +//#include "queueimpl.h" +#include "dummybridgefunctions.h" +#include <wombat/queue.h> + + +#if 0 +typedef struct dummyQueueBridge { + mamaQueue mParent; + wombatQueue mQueue; + uint8_t mIsNative; +} dummyQueueBridge; + +typedef struct dummyQueueClosure { + dummyQueueBridge* mImpl; + mamaQueueEventCB mCb; + void* mUserClosure; +} dummyQueueClosure; +#endif + +mama_status +dummyBridgeMamaQueue_create (queueBridge* queue, + mamaQueue parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_create(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_create_usingNative (queueBridge* queue, + mamaQueue parent, + void* nativeQueue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_create_usingNative(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_destroy (queueBridge queue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_destroy(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_dispatch (queueBridge queue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_dispatch(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_timedDispatch (queueBridge queue, uint64_t timeout) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_timedDispatch(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_dispatchEvent (queueBridge queue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_dispatchEvent(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_enqueueEvent (queueBridge queue, + mamaQueueEventCB callback, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_enqueueEvent(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_stopDispatch (queueBridge queue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_stopDispatch(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_setEnqueueCallback (queueBridge queue, + mamaQueueEnqueueCB callback, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_setEnqueueCallback(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaQueue_removeEnqueueCallback (queueBridge queue) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_removeEnqueueCallback(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaQueue_getNativeHandle (queueBridge queue, + void** result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_getNativeHandle(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaQueue_setHighWatermark (queueBridge queue, + size_t highWatermark) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_setHighWatermark(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaQueue_setLowWatermark (queueBridge queue, + size_t lowWatermark) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_setLowWatermark(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaQueue_getEventCount (queueBridge queue, size_t* count) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaQueue_getEventCount(): Entering."); + return MAMA_STATUS_OK; +} diff --git a/mama/c_cpp/src/c/bridge/dummy/sub.c b/mama/c_cpp/src/c/bridge/dummy/sub.c new file mode 100644 index 0000000..dc1caf0 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/sub.c @@ -0,0 +1,139 @@ +/* $Id: sub.c,v 1.1.2.10 2011/10/02 19:02:18 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <string.h> +#include <mama/mama.h> +#include <subscriptionimpl.h> +#include <transportimpl.h> +#include <msgimpl.h> +#include <queueimpl.h> +#include <wombat/queue.h> +#include "dummybridgefunctions.h" +//#include "transportbridge.h" +#include "dummydefs.h" +//#include "subinitial.h" + +#if 0 +typedef struct dummySubscription +{ + mamaMsgCallbacks mMamaCallback; + mamaSubscription mMamaSubscription; + mamaQueue mQueue; + mamaTransport mTransport; + const char* mSource; + const char* mSymbol; + char mSubject[256]; + void* mClosure; + int mIsNotMuted; + int mIsValid; + +} dummySubscription; +#endif + +mama_status +dummyBridgeMamaSubscription_create (subscriptionBridge* subscriber, + const char* source, + const char* symbol, + mamaTransport transport, + mamaQueue queue, + mamaMsgCallbacks callback, + mamaSubscription subscription, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_create(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaSubscription_createWildCard ( + subscriptionBridge* subscriber, + const char* source, + const char* symbol, + mamaTransport transport, + mamaQueue queue, + mamaMsgCallbacks callback, + mamaSubscription subscription, + void* closure ) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_createWildCard(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaSubscription_destroy (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_destroy(): Entering."); + mama_status status = MAMA_STATUS_OK; + return status; +} + + +mama_status +dummyBridgeMamaSubscription_mute (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_mute(): Entering."); + return MAMA_STATUS_OK; +} + + +int +dummyBridgeMamaSubscription_isValid (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_isValid(): Entering."); + return 0; +} + +mama_status +dummyBridgeMamaSubscription_getPlatformError (subscriptionBridge subscriber, + void** error) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_getPlatformError(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaSubscription_setTopicClosure (subscriptionBridge subscriber, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_setTopicClosure(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaSubscription_muteCurrentTopic (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_muteCurrentTopic(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +int +dummyBridgeMamaSubscription_hasWildcards (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_hasWildcards(): Entering."); + return 0; +} + +int +dummyBridgeMamaSubscription_isTportDisconnected (subscriptionBridge subscriber) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaSubscription_isTportDisconnected(): Entering."); + return 0; +} diff --git a/mama/c_cpp/src/c/bridge/dummy/subinitial.c b/mama/c_cpp/src/c/bridge/dummy/subinitial.c new file mode 100644 index 0000000..1516c2e --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/subinitial.c @@ -0,0 +1,95 @@ +/* $Id: subinitial.c,v 1.1.2.4 2011/09/27 11:39:48 emmapollock Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <uuid/uuid.h> + +#include <mama/mama.h> +#include <bridge.h> +#include <string.h> +#include "dummybridgefunctions.h" +#include "dummydefs.h" +//#include "subinitial.h" + +static const size_t uuidStringLen = 36; + +#if 0 +typedef struct dummyInboxImpl +{ + char mInbox[MAX_SUBJECT_LENGTH]; + mamaSubscription mSubscription; + void* mClosure; + mamaInboxMsgCallback mMsgCB; + mamaInboxErrorCallback mErrCB; + mamaInboxDestroyCallback mOnInboxDestroyed; + mamaInbox mParent; +} dummyInboxImpl; +#endif + +mama_status +dummyBridgeMamaInbox_createByIndex (inboxBridge* bridge, + mamaTransport transport, + int tportIndex, + mamaQueue queue, + mamaInboxMsgCallback msgCB, + mamaInboxErrorCallback errorCB, + mamaInboxDestroyCallback onInboxDestroyed, + void* closure, + mamaInbox parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaInbox_createByIndex(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaInbox_create (inboxBridge* bridge, + mamaTransport transport, + mamaQueue queue, + mamaInboxMsgCallback msgCB, + mamaInboxErrorCallback errorCB, + mamaInboxDestroyCallback onInboxDestroyed, + void* closure, + mamaInbox parent) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaInbox_create(): Entering."); + return dummyBridgeMamaInbox_createByIndex (bridge, + transport, + 0, + queue, + msgCB, + errorCB, + onInboxDestroyed, + closure, + parent); +} + +mama_status +dummyBridgeMamaInbox_destroy (inboxBridge inbox) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaInbox_destroy(): Entering."); + return MAMA_STATUS_OK; +} + + +const char* +dummyInboxImpl_getReplySubject(inboxBridge inbox) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyInboxImpl_getReplySubject(): Entering."); +} diff --git a/mama/c_cpp/src/c/bridge/dummy/timer.c b/mama/c_cpp/src/c/bridge/dummy/timer.c new file mode 100644 index 0000000..7319625 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/timer.c @@ -0,0 +1,88 @@ +/* $Id: timer.c,v 1.1.2.4 2011/09/23 12:35:42 ianbell Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <mama/mama.h> +#include <mama/timer.h> +#include <timers.h> +#include "dummybridgefunctions.h" +#include <wombat/queue.h> + +#if 0 +typedef struct dummyTimerImpl_ +{ + timerElement mTimerElement; + double mInterval; + mamaTimerCb mAction; + void* mClosure; + mamaTimer mParent; + wombatQueue mQueue; + + /* This callback will be invoked whenever the timer has been completely destroyed. */ + mamaTimerCb mOnTimerDestroyed; + + /* TODO: add queue */ +} dummyTimerImpl; +#endif + +mama_status +dummyBridgeMamaTimer_create (timerBridge* result, + void* nativeQueueHandle, + mamaTimerCb action, + mamaTimerCb onTimerDestroyed, + double interval, + mamaTimer parent, + void* closure) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTimer_create(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTimer_destroy (timerBridge timer) +{ + mama_status returnStatus = MAMA_STATUS_OK; + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTimer_destroy(): Entering."); + return returnStatus; +} + +mama_status +dummyBridgeMamaTimer_reset (timerBridge timer) +{ + mama_status status = MAMA_STATUS_OK; + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTimer_reset(): Entering."); + return status; +} + +mama_status +dummyBridgeMamaTimer_setInterval (timerBridge timer, + mama_f64_t interval) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTimer_setInterval(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTimer_getInterval (timerBridge timer, + mama_f64_t* interval) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTimer_getInterval(): Entering."); + return MAMA_STATUS_OK; +} diff --git a/mama/c_cpp/src/c/bridge/dummy/transportbridge.c b/mama/c_cpp/src/c/bridge/dummy/transportbridge.c new file mode 100644 index 0000000..8e99bf6 --- /dev/null +++ b/mama/c_cpp/src/c/bridge/dummy/transportbridge.c @@ -0,0 +1,277 @@ +/* $Id: transportbridge.c,v 1.1.2.6 2011/09/27 11:39:48 emmapollock Exp $ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + +#ifdef WIN32 +#include <wombat/wincompat.h> +#endif /* WIN32 */ + + +#include <property.h> +#include <mama/mama.h> +#include <mama/types.h> +#include <transportimpl.h> +#include <timers.h> +#if 0 +#include "transportbridge.h" +#endif +#include "dummybridgefunctions.h" +#include "dummydefs.h" + +#define TPORT_PREFIX "mama.dummy.transport" + +#define dummyTransport(transport) ((dummyTransportBridge*) transport) + +mamaMsg gMsg; + +timerHeap gTimerHeap; + +mama_status dummyTransportBridge_start(dummyTransportBridge* transportBridge) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyTransportBridge_star(): Entering."); + return MAMA_STATUS_OK; +} + + + +mama_status dummyTransportBridge_stop(dummyTransportBridge* transportBridge) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyTransportBridge_stop(): Entering."); + return MAMA_STATUS_OK; +} + +/*========================================================================= + = Functions for the mamaTransport = + =========================================================================*/ + +mama_status +dummyBridgeMamaTransport_getNumLoadBalanceAttributes ( + const char* name, + int* numLoadBalanceAttributes) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getNumLoadBalanceAttributes(): Entering."); + *numLoadBalanceAttributes = 0; + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTransport_getLoadBalanceSharedObjectName ( + const char* name, + const char** loadBalanceSharedObjectName) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getLoadBalanceSharedObjectName(): Entering."); + *loadBalanceSharedObjectName = NULL; + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTransport_getLoadBalanceScheme ( + const char* name, + tportLbScheme* scheme) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getLoadBalanceScheme(): Entering."); + *scheme = TPORT_LB_SCHEME_STATIC; + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTransport_create (transportBridge* result, + const char* name, + mamaTransport mamaTport ) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_create(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTransport_destroy (transportBridge transport) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_destroy(): Entering."); + return MAMA_STATUS_OK; +} + + +int +dummyBridgeMamaTransport_isValid (transportBridge transport) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_isValid(): Entering."); + return 1; +} + +mama_status +dummyBridgeMamaTransport_findConnection (transportBridge* transports, + int numTransports, + mamaConnection* result, + const char* ipAddress, + uint16_t port) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_findConnection(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_getAllConnections (transportBridge* transports, + int numTransports, + mamaConnection** result, + uint32_t* len) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getAllConnections(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_getAllConnectionsForTopic (transportBridge* transports, + int numTransports, + const char* topic, + mamaConnection** result, + uint32_t* len) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getAllConnectionsForTopic(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_freeAllConnections ( + transportBridge* transports, + int numTransports, + mamaConnection* result, + uint32_t len) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_freeAllConnections(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_getAllServerConnections ( + transportBridge* transports, + int numTransports, + mamaServerConnection** result, + uint32_t* len) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getAllServerConnections(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_freeAllServerConnections ( + transportBridge* transports, + int numTransports, + mamaServerConnection* result, + uint32_t len) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_freeAllServerConnections(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_sendMsgToConnection (transportBridge tport, + mamaConnection connection, + mamaMsg msg, + const char* topic) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_sendMsgToConnection(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_installConnectConflateMgr ( + transportBridge handle, + mamaConflationManager mgr, + mamaConnection connection, + conflateProcessCb processCb, + conflateGetMsgCb msgCb) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_installConnectConflateMgr(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + + +mama_status +dummyBridgeMamaTransport_uninstallConnectConflateMgr ( + transportBridge handle, + mamaConflationManager mgr, + mamaConnection connection) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_uninstallConnectConflateMgr(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_isConnectionIntercepted (mamaConnection connection, + uint8_t* result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_isConnectionIntercepted(): Entering."); + *result = 0; + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_startConnectionConflation ( + transportBridge tport, + mamaConflationManager mgr, + mamaConnection connection) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_startConnectionConflation(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_getNativeTransport (transportBridge transport, + void** result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getNativeTransport(): Entering."); + return MAMA_STATUS_OK; +} + +mama_status +dummyBridgeMamaTransport_getNativeTransportNamingCtx (transportBridge transport, + void** result) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_getNativeTransportNamingCtx(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_requestConflation (transportBridge* transports, + int numTransports) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_requestConflation(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +mama_status +dummyBridgeMamaTransport_requestEndConflation (transportBridge* transports, + int numTransports) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_requestEndConflation(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} + +extern mama_status +dummyBridgeMamaTransport_forceClientDisconnect ( + transportBridge* transports, + int numTransports, + const char* ipAddress, + uint16_t port) +{ + mama_log (MAMA_LOG_LEVEL_FINEST, "dummyBridgeMamaTransport_forceClientDisconnect(): Entering."); + return MAMA_STATUS_NOT_IMPLEMENTED; +} -- Jacob Please consider the environment before printing this email. Visit our website at http://www.nyse.com
|
|