[PATCH 1.1] Windows Interlock: Function wInterlocked set to return 0
John Gray <jgray@...>
Function wInterlocked set to return 0 for windows. Not an operation (no-op) in Unix.
Index: queue.c =================================================================== RCS file: /cvsroot/products/mama/c_cpp/src/c/queue.c,v retrieving revision 1.35.4.5.2.1.4.11 diff -w -u -r1.35.4.5.2.1.4.11 queue.c --- queue.c 27 Sep 2011 12:38:50 -0000 1.35.4.5.2.1.4.11 +++ queue.c 14 Jan 2012 09:41:43 -0000 @@ -198,6 +198,7 @@ impl->mQueueMonitorClosure = NULL;
/* Create the counter lock. */ + wInterlocked_initialize(&impl->mNumberOpenObjects); wInterlocked_set(0, &impl->mNumberOpenObjects);
@@ -436,7 +437,7 @@ int newCount = wInterlocked_decrement(&impl->mNumberOpenObjects);
/* Write a log if something has gone wrong. */ - if(impl->mNumberOpenObjects < 0) + if(newCount < 0) { mama_log(MAMA_LOG_LEVEL_ERROR, "Queue 0x%p has been dereferenced too many times.", queue); } @@ -719,6 +720,9 @@ impl->mMamaQueueBridgeImpl = NULL; impl->mMsg = NULL;
+ /* Destroy the counter lock */ + wInterlocked_destroy(&impl->mNumberOpenObjects); + free (impl);
mama_log (MAMA_LOG_LEVEL_FINEST, "Leaving mamaQueue_destroy for queue 0x%X.", queue);
Signed-off-by: John Gray <jgray@...>
|
|
[PATCH 1.1] Properties: Fixed Memory Leaks in Properties
John Gray <jgray@...>
Free memory and fail if realloc fails in propertiesImpl_addKey(). When we replace a value in the hash table in propertiesImpl_addProperty(), free the old value.
Index: c_cpp/src/c/property.c =================================================================== RCS file: /cvsroot/products/common/c_cpp/src/c/property.c,v retrieving revision 1.22.2.2.2.1.2.4 diff -u -r1.22.2.2.2.1.2.4 property.c --- c_cpp/src/c/property.c 7 Sep 2011 09:45:08 -0000 1.22.2.2.2.1.2.4 +++ c_cpp/src/c/property.c 18 Jan 2012 02:56:09 -0000 @@ -326,7 +326,7 @@ propertiesImpl_ *this = (propertiesImpl_ *)handle; const char* rval = NULL;
- if( name == NULL || strlen( name ) == 0 ) + if( name == NULL || NULL == this || strlen( name ) == 0 ) { return NULL; } @@ -554,9 +554,19 @@ } else { - this->mKeys = (const char* *)realloc( - (void* )this->mKeys, - allocSize * sizeof( const char* ) ); + void* reallocBlock = + realloc((void* )this->mKeys, (allocSize * sizeof(const char*))); + + if(NULL != reallocBlock) + { + this->mKeys = (const char**)reallocBlock; + } + else + { + free((void* )this->mKeys); + this->mKeys = NULL; + return 0; + } } }
@@ -571,28 +581,36 @@ const char* value ) { propertiesImpl_ *this = (propertiesImpl_*)properties; + void* data = NULL; + int ret = 0;
- if( gPropertyDebug ) - { - fprintf (stderr, - "\nAddProperty KEY: %s, VALUE: %s\n", - name, - value); - } + if( NULL == this ) + return 0;
- if ( NULL == wtable_lookup( this->mTable, (char* )name )) + if ( NULL == (data = wtable_lookup(this->mTable, (char*)name))) { if( !propertiesImpl_AddKey( this, name )) return 0; }
- if (-1==wtable_insert( this->mTable, (char* )name, (caddr_t)value )) + if(-1 == (ret = wtable_insert( this->mTable, (char* )name, (caddr_t)value))) { return 0; }
+ if(0 == ret) /* If 0 is returned then data has been replaced. */ + { + /* If existing data in the table has now been replaced then the old data must be freed. */ + if(NULL != data) + { + free(data); + } + + if(gPropertyDebug) + { + fprintf(stderr, "\nAddProperty KEY: %s, VALUE: %s\n", name, value); + } + }
return 1; } - -
Signed-off-by: John Gray <jgray@...>
|
|
[PATCH 1.1] mamainternal.h: Added types.h to includes
John Gray <jgray@...>
Needed to include types.h to mamainternal.h to enable building
Index: c_cpp/src/c/mamainternal.h =================================================================== RCS file: /cvsroot/products/mama/c_cpp/src/c/mamainternal.h,v retrieving revision 1.16.22.6 diff -u -r1.16.22.6 mamainternal.h --- c_cpp/src/c/mamainternal.h 18 Aug 2011 10:54:08 -0000 1.16.22.6 +++ c_cpp/src/c/mamainternal.h 6 Jan 2012 21:21:27 -0000 @@ -23,6 +23,7 @@ #define MamaInternalH__
#include <property.h> +#include "mama/types.h"
#if defined(__cplusplus) extern "C"
Signed-off-by: John Gray <jgray@...>
|
|
Re: Bridge API doc
Daniel Cegiełka <daniel.cegielka@...>
Hi Alex,
2012/1/20 <alex.stovboun@...> Mike, There is already an idea to add support for RDMA/IB in ZeroMQ - that would cut latency into 2-3 us. Any plans to implement a bridge for it? If yes, is there a timeline? I'm planning to get involved in the preparation of support for ZeroMQ and I hope that in future the ZeroMQ bridge will be a part of the MAMA. It would be very good if we could build for ZeroMQ active and stable support - especially look forward to working here with NYSE Technologies.
I am also looking into writing a bridge for our proprietary middleware. MAMA is based on the dlopen() function but it's very important to prepare bridge with a deep understanding of the messages, which is necessary for MAMDA:
There is also a lot of questions about how to prepare ZeroMQ bridge - using raw zmq C API (zmq.h) or maybe C++ (zmq.hpp) with MAMA C++ wrapper (not published yet by NYSE).. or C API with czmq?
best regards, Daniel
|
|
Re: Bridge API doc
alex.stovboun@...
Mike,
I am researching various middleware options. ZeroMQ looks promising. Any plans to implement a bridge for it? If yes, is there a timeline? I am also looking into writing a bridge for our proprietary middleware. If you could briefly describe the bridge interface functions (at least the most important ones) - that would already be a great starting point for anyone trying to write a bridge. Regards, Alex PLEASE READ: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please delete it and all copies from your system, destroy any hard copies and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Nomura Holding America Inc., Nomura Securities International, Inc, and their respective subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state the views of such entity. Unless otherwise stated, any pricing information in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation.
|
|
Re: Bridge API doc
Mike Schonberg <mschonberg@...>
Alex,
toggle quoted messageShow quoted text
I started working on the bridge documentation; however, at the moment we are very busy getting the remaining components of MAMA and MAMDA ready for open source: C++, Java, Windows support etc. I plan to return to the bridge documentation as soon as I get some spare cycles. I will post a draft when I have some content worthy of review. Is there a particular middleware or payload that interests you? Regards, -Mike
-----Original Message-----Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
Bridge API doc
alex.stovboun@...
Mike,
When do you plan to publish the first cut of the bridge API doc?
Regards,
Alex
PLEASE READ: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please delete it and all copies from your system, destroy any hard copies and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Nomura Holding America Inc., Nomura Securities International, Inc, and their respective subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state the views of such entity. Unless otherwise stated, any pricing information in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation.
|
|
Re: Questions about rodmap & bridge creation
Mike Schonberg <mschonberg@...>
Benjamin,
toggle quoted messageShow quoted text
See my answers inline.
-----Original Message-----We are currently working on the C++ MAMA wrappers and MAMDA C++. Our intention is to have all of the components (MAMDA C++, MAMA C++, MAMA JNI, MAMDA JAVA, etc.) complete by April. MAMA C++ and MAMDA C++ will be the first to be completed. I can not commit to a specific date at this point, but I will send an update to the list when I can. I am working on the bridge documentation. This is correct. The mamaBridgeImpl structure contains all the methods required by MAMA for a fully functional bridge. Some middlewares may not support all of the functionality and return MAMA_STATUS_NOT_IMPLEMENTED. For example Avis does not implement the mama_bridgeMamaIO_create, method mentioned below because it does not have the ability to process IO events (read/write readiness on a file descriptor). In this case and some others, we may at some point add capabilities at the MAMA level for middlewares that do not support features natively. The bridge documentation, when complete, will address which functions and capabilities are optional. bridgeOpen of the mamaBridgeImpl struct is a pointer to solBridge_openRegards, -Mike Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
Questions about rodmap & bridge creation
Benjamin Taieb
Hi, I'm working for a hardware based MOM vendor (Solace Systems) and we are thinking about developing a mw bridge for openMama. I've some questions :
1)When I look at http://www.openmama.org/what-is-openmama/openmama-roadmaps, C++ wrapper and MAMDA C++ should be released by now. Do you have any update you can share on the roadmap ?
2) As previously mentioned on this list, there is no documentation at the moment regarding building a middleware bridge. From my reading of the avis example, below is my understanding, Mike, could you please comment ? -A MW bridge implement all the stuff defined in the mamaBridgeImpl structure, for example if the implIdentifier is sol, bridgeOpen of the mamaBridgeImpl struct is a pointer to solBridge_open function...
-The signature of each function is given in bridge.h as well. For example : typedef mama_status (*bridgeMamaIo_create)(ioBridge* result, void* nativeQueueHandle, uint32_t descriptor, mamaIoCb action, mamaIoType ioType, mamaIo parent, void* closure);
is implemented in io.c of the avis bridge :
mama_status avisBridgeMamaIo_create(ioBridge* result, void* nativeQueueHandle, uint32_t descriptor, mamaIoCb action, mamaIoType ioType, mamaIo parent, void* closure) { *result = 0; return MAMA_STATUS_NOT_IMPLEMENTED; }
Thanks,
Benjamin Taieb. Senior Systems Engineer - EMEA 9 Devonshire Square London, EC2M 4YF +44 203 178 5579 (w) +44 793 995 6731 (m)
|
|
Re: Loading bridges at runtime
Mike Schonberg <mschonberg@...>
toggle quoted messageShow quoted text
-----Original Message-----I am working on the bridge developer's documentation, and I will post it to this list and the web site once it is complete. When you load a middleware bridge, OpenMAMA will query the middleware bridge for a default payload bridge and load that automatically. This is for backwards compatibility, and new applications should explicitly load each payload that they use. There is no "WithPath" variant for payloads. The mama_loadXXXBridge functions call dlopen() which searches the LD_LIBRARY_PATH for the shared object. If your payload bridge .so is in the LD_LIBRARY_PATH, mama_loadPayloadBridge() should find it. Regards, -Mike Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
Loading bridges at runtime
Alessandro Bellina
Could someone please post a quick example on how to use/load payload
bridges at runtime? The docs point to mama_loadPayloadBridge, however this function doesn't seem to have a "WithPath" variant. As I understand it, the payload bridge is just like a middleware bridge and could be loaded dynamically too. It seems that Avis specifies its default, at first glance it isn't clear to me how this is done. I read another message around the release of documentation for payload bridges, I would be interested in seeing this too. Thank you, Alessandro
|
|
[Patch 1.1 1/1] Mama: Add support for Citihub permission server abstraction API
David Sewell
This patch adds support for the Citihub permission server abstraction API which provides integration with multiple 3rd party entitlement systems (e.g. Thomson Reuters DACS, Bloomberg). This new feature will allow OpenMAMA API to integrate with existing permission systems, making the adoption of OpenMAMA easier and more attractive for large enterprises with existing market data systems and compliance control systems.
The change does not have any direct impact on the rest of the OpenMAMA API, all code changes are encompassed within the #ifdef WITH_CHUB_PERMSVR ... #endif pre-processor directives which is enabled with the build configuration option '--with-chub-permsvr=<path to libPermSvr>'. No existing APIs have been modified, deprecated or removed in this patch. The inclusion of this new feature was discussed on the mailing lists here: http://lists.openmama.org/pipermail/openmama-dev/2011-December/000011.html. Documentation for Citihub's Permission Server software can be downloaded from the following URLs: Overview http://server1.citihub.com/downloads/Citihub%20Permission%20Server%20Brochure%20v1.2.pdf API Developers Guide http://server1.citihub.com/downloads/libPermSvr_APIGuide_v17_3.pdf Permission Server Admin Guide http://server1.citihub.com/downloads/PermSvr_Installation_and_Admin_Guide_17_2.pdf Instructions for testing Citihub Permission Server integration with OpenMAMA 1. Download Citihub libPermSvr library from the following URL (built on Ubuntu 11.10 32bit but should be portable and Citihub can provide binaries for most popular versions of Linux, Solaris and Windows) http://server1.citihub.com/downloads/libPermSvr_12.0.17.7-beta-r205.linux.tar.gz 2. Download demo Citihub Permission Server from one of the following URLs (built on Ubuntu 11.10 32bit but should be portable and Citihub can provide binaries for most popular versions of Linux and Solaris) - With file based permissions (used for testing only) http://server1.citihub.com/downloads/PermSvr_12.0.17.4-beta-demo-fileonly-r278.linux.tar.gz - With support for Thomason Reuters DACS (requires RFA and DACS software and licenses which are not included) http://server1.citihub.com/downloads/PermSvr_12.0.17.4-beta-demo-withDACS-r278.linux.tar.gz 3. Uncompress the Permission Server software tar xzvf PermSvr_12.0.17.4-beta-demo-fileonly-r278.linux.tar.gz./PermSvr_12.0.17.4-beta-demo-fileonly-r278 : 4. Configure and start Permission Server cd PermSvr_12.0.17.4-beta-demo-fileonly-r278PermSvr Admin GUI - http://<hostname>:7141 5. Uncompress the libPermSvr software package tar xzvf libPermSvr_12.0.17.7-beta-r205.linux.tar.gz./libPermSvr_12.0.17.7-beta-r205 : 6. Build OpenMAMA with libPermSvr enabled cd <root of OpenMama source code>7. Configure Permission Server host and port details in the mama.entitlement.servers parameter, see full list of libPermSvr configuration parameters below. 8. Run OpenMAMA test client, e.g. cd /opt/openmamaStarting Subscriber with: topic: MAMA_TOPIC transport: sub 2011-12-09 13:45:58: ******************************************************************************** Warning: This is a developer release and has only undergone basic sanity checks. It is for testing only and should not be used in a production environment ********************************************************************************** 2011-12-09 13:45:58: openmama DEVRELEASE.. (1.2.4) (entitled libPermSvr) 2011-12-09 13:45:58: libPermSvr Build 17.7 r204 Dec 4 2011 12:40:31 (c) Citihub Ltd. [2011-12-09 13:45:58.754779] libPermSvr Build 17.7 r204 Dec 4 2011 12:40:31 (c) Citihub Ltd. [2011-12-09 13:45:58.755084] Logging enabled: stdout [level 2] [2011-12-09 13:45:58.755262] [INFO] CHUB_GetLibAttr() 2011-12-09 13:45:58: Entitlement position ID : testuser 2011-12-09 13:45:58: Attempting to connect to entitlement server : testhost4:9990,testhost1:9990 [2011-12-09 13:45:58.756147] [INFO] CHUB_InitializeSingleUser( testhost4:9990,testhost1:9990, testuser ) [2011-12-09 13:45:58.756326] [INFO] CHUB_Initialize( testhost4:9990,testhost1:9990 ) [2011-12-09 13:45:58.756903] [INFO] CHUB_SetLibAttr() [2011-12-09 13:45:58.757120] [INFO] CHUB_Connect() [2011-12-09 13:45:58.758309] [WARNING] testhost4:9990 connected [2011-12-09 13:45:58.758588] [INFO] SO_RCVBUF : Grow from 87552 to 262142 [2011-12-09 13:45:58.759924] [INFO] CBK CONNECT : testhost4:9990 [2011-12-09 13:45:58.760145] [INFO] CHUB_WaitOnConnect( 3 ) [2011-12-09 13:45:58.761579] [INFO] CHUB_WaitOnUserReady( testuser, 2 ) [2011-12-09 13:45:58.859171] [INFO] IOCTL : CPE=0; SFN=1 [2011-12-09 13:45:58.859640] [INFO] LOGIN : testuser; ID=158.760650-a8c085e9; PING=60 [2011-12-09 13:45:58.860141] [INFO] CBK LOGIN : testuser [2011-12-09 13:45:58.863638] [INFO] GETALL : testuser ID=158.760650-a8c085e9; TTL=43200; STATE=READY [2011-12-09 13:45:58.865290] [INFO] CBK GETALL testuser; nSBE=12; nCBE=3; STATE=READY 2011-12-09 13:45:58: Creating transport: [sub] 2011-12-09 13:45:58: Setting mama.entitlement.transport.sub.source=WOMBAT 2011-12-09 13:45:58: initializing Avis transport: sub 2011-12-09 13:45:58: sub: Using default preinitial strategy: ON_GAP [2011-12-09 13:45:58.879395] [INFO] CHUB_IsPermissioned( testuser,WOMBAT,MAMA_TOPIC,0 ) = PERMIT 2011-12-09 13:45:58: setupBasic(): MAMA_TOPIC: subscription (0x8276018) mamasubscriberc: Created inbound subscription. mamasubscriberc: Recieved msg. 10002 10002 STRING MAMA_TOPIC 10 10 I32 290 2 2 I32 0 Citihub Permission Server configuration parameters in mama.properties: mama.entitlement.servers = <host:port>,<host:port> mama.entitlement.altposid = <userid>+<appid>+<ipaddr/net>:<entitlement_system>+<siteid> Override below parameters e.g. testuser+256+127.0.0.1/net:DACS+DACS mama.entitlement.altuserid = <userid> defaults to runtime user name mama.entitlement.appid = <num> application id known to permission system mama.entitlement.effective_ip_address= <ip address> adress to use in position id mama.entitlement.entitlement_system = <FILE|DACS> entitlement system used in position id mama.entitlement.siteid = <string> site id or domain used in position id mama.entitlement.transport.<name>.source = <string> source name for transport used by basic subscriber (TOPIC only subscription) mama.entitlement.log.level = <0-6> 0-None,1-Error,2-API calls,3-XML,4-Debug,5-Pump,6-Mutex mama.entitlement.log.filename = <filename or stdout/stderr> mama.entitlement.log.size = <num K> max log file size in K before rolling mama.entitlement.log.max_backup = <num> max number of rolled log files to retain> mama.entitlement.cache_filename = <filename> file to store local PE cache mama.entitlement.user_timeout = <seconds> timeout for login and getall mama.entitlement.connect_timeout = <seconds> timeout for server connection mama.entitlement.getpe_all = <true/false> enable ALL switch for getall mama.entitlement.getpe_timeout = <seconds> timeout for getpe mama.entitlement.auto_getall = <true/false> enable automatic getall mama.entitlement.enable_ping = <true/false> enable ping mama.entitlement.enable_events = <true/false> enable automatic event updates mama.entitlement.enable_getpe = <true/false> enable getpe mama.entitlement.failover_notify = <true/false> enable server failover notify Signed-off-by: David Sewell david.sewell@... --- diff --git a/mama/c_cpp/configure.ac b/mama/c_cpp/configure.ac index 1bae611..daadc23 100644 --- a/mama/c_cpp/configure.ac +++ b/mama/c_cpp/configure.ac @@ -178,6 +178,44 @@ then fi ################################################## +# CHUB_PERMSVR: --with-chub-permsvr +# Whether or not to link in libPermSvr +################################################## +AC_ARG_WITH( + chub_permsvr, + [AC_HELP_STRING([--with-chub-permsvr=DIR], + [Location of libPermSvr SRC in DIR])], + [ + if test -d "$withval"; then + CHUB_HOME="$withval" + fi + ] + AC_CHECK_FILE( + [$CHUB_HOME/include/libPermSvr.h], + [ + CPPFLAGS="$CPPFLAGS -DWITH_CHUB_PERMSVR -I$CHUB_HOME/include" + LDFLAGS="$LDFLAGS -L$WOMBATMSG_HOME/lib -L$CHUB_HOME/lib" + LIBS="$LIBS -lPermSvr" + with_chub_permsvr=true + ], + [ + AC_MSG_FAILURE([Building with libPermSvr Failed.]) + ]) + ) +AC_SUBST(chub_permsvr_dir,[$CHUB_HOME]) +AM_CONDITIONAL(WITH_CHUB_PERMSVR, test x$with_chub_permsvr = "xtrue") + +if test x$with_chub_permsvr = xtrue +then + AC_MSG_CHECKING(for Solaris) + case "$host" in + *-solaris*) + LIBS="$LIBS -lnsl -lsocket" + ;; + esac +fi + +################################################## # AVIS: --with-avis # Whether or not to link in the Avis middleware ################################################## diff --git a/mama/c_cpp/src/c/listenermsgcallback.c b/mama/c_cpp/src/c/listenermsgcallback.c index 4ff9ea4..108031e 100644 --- a/mama/c_cpp/src/c/listenermsgcallback.c +++ b/mama/c_cpp/src/c/listenermsgcallback.c @@ -38,6 +38,9 @@ #ifdef WITH_ENTITLEMENTS #include <OeaClient.h> extern oeaClient * gEntitlementClient; +#elif WITH_CHUB_PERMSVR +#include <libPermSvr.h> +extern int gEntitlementClient; #endif /* WITH_ENTITLEMENTS */ @@ -84,6 +87,11 @@ listenerMsgCallback_create( listenerMsgCallback *result, { return MAMA_ENTITLE_NO_SERVERS_SPECIFIED; } +#elif WITH_CHUB_PERMSVR + if( gEntitlementClient == 0 ) + { + return MAMA_ENTITLE_NO_SERVERS_SPECIFIED; + } #endif /* WITH_ENTITLEMENTS */ if( callback == NULL ) @@ -549,6 +557,90 @@ checkEntitlement( msgCallback *callback, mamaMsg msg, SubjectContext* ctx ) } return result; +#elif WITH_CHUB_PERMSVR + int result = 0; + int32_t value; + int32_t count; + if( ctx->mEntitlementAlreadyVerified ) + { + return 1; + } + + if( MAMA_STATUS_OK == mamaMsg_getEntitleCode( msg, + &value ) ) + { + if ((gMamaLogLevel >= MAMA_LOG_LEVEL_FINER) || + (mamaSubscription_checkDebugLevel (self->mSubscription, + MAMA_LOG_LEVEL_FINER))) + { + mama_log (MAMA_LOG_LEVEL_FINER, + "Checking injected entitlement: %d\n", value); + } + + if( value == 0 ) + { + return 1; + } + const char* userSymbol = NULL; + const char* userSource = NULL; + void* closure = NULL; + + mamaSubscription_getSymbol (self->mSubscription, &userSymbol); + mamaSubscription_getSource (self->mSubscription, &userSource); + mamaSubscription_getClosure (self->mSubscription, &closure); + ctx->mEntitleCode = value; + result = CHUB_IsPermissionedPE( gEntitlementClient, + (char *)0, + userSource, + userSymbol, + &ctx->mEntitleCode, + &count); + printf ("svc=%s, ric=%s, pe=%d %s\n", userSource, + userSymbol, + ctx->mEntitleCode, + CHUB_GetPermCodeStr(result)); + if ((gMamaLogLevel >= MAMA_LOG_LEVEL_FINER) || + (mamaSubscription_checkDebugLevel (self->mSubscription, + MAMA_LOG_LEVEL_FINER))) + { + mama_log (MAMA_LOG_LEVEL_FINER, + "Entitlement: source=%s, symbol=%s, code=%d, count=%d, permission=%s\n", + userSource, + userSymbol, + ctx->mEntitleCode, + CHUB_GetPermCodeStr(result) + ); + } + if (!result) + { + + mamaMsgCallbacks *cbs = + mamaSubscription_getUserCallbacks (self->mSubscription); + + mama_setLastError (MAMA_ERROR_NOT_ENTITLED); + + mamaSubscription_deactivate (self->mSubscription); + + cbs->onError (self->mSubscription, + MAMA_STATUS_NOT_ENTITLED, + NULL, + userSymbol, + closure); + } + } + else + { + /* This is only temporary until the entitle code is sent with + * every message. */ + return 1; + } + + if( result ) + { + ctx->mEntitlementAlreadyVerified = 1; + } + + return result; #else return 1; #endif /* WITH_ENTITLEMENTS */ diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c index ee0d6a0..59c2233 100644 --- a/mama/c_cpp/src/c/mama.c +++ b/mama/c_cpp/src/c/mama.c @@ -104,6 +104,16 @@ static const char* gServerProperty = NULL; static const char* gServers[MAX_ENTITLEMENT_SERVERS]; static mama_status enableEntitlements (const char **servers); static const char* gEntitled = "entitled"; +#elif WITH_CHUB_PERMSVR +#include <libPermSvr.h> +#define SERVERS_PROPERTY "entitlement.servers" +#define MAX_ENTITLEMENT_SERVERS 32 +#define MAX_USER_NAME_STR_LEN 64 +#define MAX_HOST_NAME_STR_LEN 64 +CHUBLibAttr *gCHUBLibAttr = (CHUBLibAttr *)0; +int gEntitlementClient = 0; +static mama_status enableEntitlements (const char *servers); +static const char* gEntitled = "entitled libPermSvr"; #else static const char* gEntitled = "not entitled"; #endif /*WITH_ENTITLEMENTS */ @@ -858,13 +868,7 @@ mama_openWithProperties (const char* path, return MAMA_STATUS_NO_BRIDGE_IMPL; } -#ifndef WITH_ENTITLEMENTS - mama_log (MAMA_LOG_LEVEL_WARN, - "\n********************************************************************************\n" - "Note: This build of the MAMA API is not enforcing entitlement checks.\n" - "Please see the Licensing file for details\n" - "**********************************************************************************"); -#else +#ifdef WITH_ENTITLEMENTS result = enableEntitlements (NULL); if (result != MAMA_STATUS_OK) { @@ -874,6 +878,22 @@ mama_openWithProperties (const char* path, mama_close(); return result; } +#elif WITH_CHUB_PERMSVR + result = enableEntitlements (NULL); + if (result != MAMA_STATUS_OK) + { + mama_log (MAMA_LOG_LEVEL_SEVERE, + "mama_openWithProperties(): " + "Error connecting to Entitlements Server"); + mama_close(); + return result; + } +#else + mama_log (MAMA_LOG_LEVEL_WARN, + "\n********************************************************************************\n" + "Note: This build of the MAMA API is not enforcing entitlement checks.\n" + "Please see the Licensing file for details\n" + "**********************************************************************************"); #endif /* WITH_ENTITLEMENTS */ if (strtobool(statsLogging)) @@ -1058,6 +1078,12 @@ mama_close () oeaClient_destroy( gEntitlementClient ); gEntitlementClient = 0; } +#elif WITH_CHUB_PERMSVR + if( gEntitlementClient != 0 ) + { + CHUB_Destroy( gEntitlementClient ); + gEntitlementClient = 0; + } #endif /* WITH_ENTITLEMENTS */ pthread_key_delete(last_err_key); @@ -1668,6 +1694,201 @@ enableEntitlements (const char **servers) return MAMA_STATUS_OK; } +#elif WITH_CHUB_PERMSVR +static mama_status +enableEntitlements (const char *servers) +{ + char buf[K]; + int32_t iDbg = 0; + int32_t iSize = K; + int32_t iMaxBkup = 3; + const char* pDbg = NULL; + const char* userID = (const char *)0; + char* posID = buf; + const char* ipAddr = (const char *)0; + const char* appID = (const char *)0; + const char* pServers = servers; + const char* pPropertyValue = (const char *)0; + + + if (gEntitlementClient != 0) + { + CHUB_Destroy(gEntitlementClient); + gEntitlementClient = 0; + } + + mama_getUserName (&userID); + lookupIPAddress(); + + pPropertyValue = properties_Get (gProperties, "mama.entitlement.servers"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + pServers = strdup ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.altposid"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + posID += sprintf( posID, "%s", pPropertyValue ); + } + else + { + pPropertyValue = properties_Get (gProperties, "mama.entitlement.altuserid"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + userID = strdup ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.appid" ); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + appID = strdup ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.effective_ip_address"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + ipAddr = strdup ( pPropertyValue ); + } + else + { + ipAddr = gIPAddress; + } + if ( userID ) + { + posID += sprintf( posID, "%s", userID ); + if ( appID ) + { + posID += sprintf( posID, "+%s", appID ); + if ( ipAddr ) + { + posID += sprintf( posID, "+%s/net", ipAddr ); + } + else + { + posID += sprintf( posID, "+127.0.0.1/net" ); + } + } + } + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.entitlement_system"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + posID += sprintf ( posID, ":%s", pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.siteid"); + if ( pPropertyValue && strlen(pPropertyValue)>0 ) + { + posID += sprintf ( posID, "+%s", pPropertyValue ); + } + posID = strdup ( buf ); + pPropertyValue = properties_Get (gProperties, "mama.entitlement.log.level" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + iDbg = atoi ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.log.filename" ); + if( pPropertyValue ) + { + pDbg = strdup ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.log.size" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) { + iSize = atoi ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.log.max_backup" ); + if( pPropertyValue && isdigit( pPropertyValue ) ) + { + iMaxBkup = atoi ( pPropertyValue ); + } + + mama_log (MAMA_LOG_LEVEL_NORMAL, + "%s", CHUB_Version()); + + if ( iDbg ) { + CHUB_RollingLog( (const char*)pDbg, iDbg, iSize*K, iMaxBkup ); + sprintf( buf, "%s\n", CHUB_Version()); + CHUB_Logger( 0, buf ); + sprintf( buf, "Logging enabled: %s [level %d]\n", pDbg, iDbg ); + CHUB_Logger( 0, buf ); + } + + gCHUBLibAttr = (CHUBLibAttr *)calloc( 1, sizeof( CHUBLibAttr ) ); + CHUB_GetLibAttr( 0, gCHUBLibAttr ); + + if ( !gCHUBLibAttr ) + { + return MAMA_STATUS_SYSTEM_ERROR; + } + + pPropertyValue = properties_Get (gProperties, "mama.entitlement.cache_filename" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_pCBEFile = strdup ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.user_timeout" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_nUserTout = strtod ( pPropertyValue, NULL ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.connect_timeout" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_nConnectTout = atoi ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.getpe_all" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bGetPEAll = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.getpe_timeout" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_nGetPETout = atoi ( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.auto_getall" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bAutoGetAll = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.enable_ping" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bChannelPing = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.enable_events" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bChannelEvent = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.enable_getpe" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bChannelGetPE = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + pPropertyValue = properties_Get (gProperties, "mama.entitlement.failover_notify" ); + if( pPropertyValue && strlen(pPropertyValue)>0 ) + { + gCHUBLibAttr->_bSFN = properties_GetPropertyValueAsBoolean( pPropertyValue ); + } + + mama_log (MAMA_LOG_LEVEL_NORMAL, + "Entitlement position ID : %s", posID ); + mama_log (MAMA_LOG_LEVEL_NORMAL, + "Attempting to connect to entitlement server : %s", + pServers ); + + if ( !pServers || !strlen( pServers ) ) + { + return MAMA_ENTITLE_NO_SERVERS_SPECIFIED; + } + + gEntitlementClient = CHUB_InitializeSingleUser( pServers, posID, gCHUBLibAttr ); + + if (!gEntitlementClient) + { + return MAMA_ENTITLE_SERVER_NOT_FOUND; + } + + return MAMA_STATUS_OK; +} #endif diff --git a/mama/c_cpp/src/c/mama/mama.h b/mama/c_cpp/src/c/mama/mama.h index 658bce6..65bfd49 100644 --- a/mama/c_cpp/src/c/mama/mama.h +++ b/mama/c_cpp/src/c/mama/mama.h @@ -67,6 +67,8 @@ extern "C" #define MAMA_MAX_SYMBOL_LEN 128 #define MAMA_MAX_SOURCE_LEN 64 #define MAMA_MAX_TRANSPORT_LEN 64 +#define K 1024 + /** * \mainpage Middleware Agnostic Messaging API (MAMA) C API diff --git a/mama/c_cpp/src/c/mama/status.h b/mama/c_cpp/src/c/mama/status.h index bccb7e0..2ad75b7 100644 --- a/mama/c_cpp/src/c/mama/status.h +++ b/mama/c_cpp/src/c/mama/status.h @@ -27,6 +27,8 @@ #ifdef WITH_ENTITLEMENTS #include <OeaStatus.h> +#elif WITH_CHUB_PERMSVR +#include <libPermSvr.h> #endif @@ -163,6 +165,9 @@ typedef enum MAMA_ENTITLE_NO_USER = MAMA_ENTITLE_HTTP_OVERLOAD + 1, /* 9029 */ MAMA_ENTITLE_NO_SERVERS_SPECIFIED = MAMA_ENTITLE_NO_USER + 1, /* 9030 */ MAMA_ENTITLE_SITE_NOT_FOUND = MAMA_STATUS_BASE + OEA_STATUS_SITE_NOT_FOUND /* 9032 */ +#elif WITH_CHUB_PERMSVR + ,MAMA_ENTITLE_NO_SERVERS_SPECIFIED = MAMA_STATUS_BASE + 1, /* 9006 */ + MAMA_ENTITLE_SERVER_NOT_FOUND = MAMA_ENTITLE_NO_SERVERS_SPECIFIED + 1 /* 9008 */ #endif } mama_status; diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c index 500465e..91683b2 100644 --- a/mama/c_cpp/src/c/publisher.c +++ b/mama/c_cpp/src/c/publisher.c @@ -21,6 +21,7 @@ #include "mama/mama.h" #include "mama/publisher.h" +#include "mama/types.h" #include "bridge.h" #include "throttle.h" @@ -31,6 +32,13 @@ #include "list.h" +#ifdef WITH_CHUB_PERMSVR + +#include <libPermSvr.h> +extern int gEntitlementClient; + +#endif /* WITH_CHUB_PERMSVR */ + /*Main mamaPublisher structure for the API*/ typedef struct mamaPublisherImpl_ { @@ -57,6 +65,38 @@ struct publisherClosure void* mSendCompleteClosure; }; +/* *************************************************** */ +/* Internal Functions. */ +/* *************************************************** */ +#ifdef WITH_CHUB_PERMSVR +static int +isEntitledToPublish (const char *source, const char*symbol) +{ + int result = 0; + int count = 0; +#define MAX_PUBLISH_SOURCE_SIZE 261 /* 256 + 5 */ + char tsource[MAX_PUBLISH_SOURCE_SIZE]; + if ( NULL!=source) + { + snprintf( tsource, MAX_PUBLISH_SOURCE_SIZE, "_pub.%s", source ); + } + + if (gEntitlementClient == 0) /* Not enforcing entitlements. */ + { + return 1; + } + + result = CHUB_IsPermissionedPE( gEntitlementClient, + (char *)0, + tsource, + symbol, + 0, + 0 ); + + return result; +} +#endif /* WITH_ENTITLEMENTS */ + static mama_status _createByIndex (mamaPublisher* result, mamaTransport tport, @@ -91,6 +131,23 @@ _createByIndex (mamaPublisher* result, source ? source : "", symbol ? symbol : ""); +#ifdef WITH_CHUB_PERMSVR + const char *tsource; + if ( NULL!=source) + { + tsource = source; + } + else + { + mamaTransport_getDefSource(tport, &tsource); + } + /*Up from entitlement check based on string compare on symbol*/ + if (!isEntitledToPublish (tsource, symbol)) + { + return MAMA_STATUS_NOT_ENTITLED; + } +#endif + /*Get the bridge impl from the transport - mandatory*/ bridgeImpl = mamaTransportImpl_getBridgeImpl (tport); if (!bridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL; diff --git a/mama/c_cpp/src/c/status.c b/mama/c_cpp/src/c/status.c index 1c394e3..b3aea59 100644 --- a/mama/c_cpp/src/c/status.c +++ b/mama/c_cpp/src/c/status.c @@ -113,6 +113,9 @@ mamaStatus_stringForStatus (mama_status status) case MAMA_ENTITLE_NO_USER : return "ENTITLE_NO_USER"; case MAMA_ENTITLE_NO_SERVERS_SPECIFIED : return "ENTITLE_NO_SERVERS_SPECIFIED"; case MAMA_ENTITLE_SITE_NOT_FOUND : return "ENTITLE_SITE_NOT_FOUND"; +#elif WITH_CHUB_PERMSVR + case MAMA_ENTITLE_NO_SERVERS_SPECIFIED : return "MAMA_ENTITLE_NO_SERVERS_SPECIFIED"; + case MAMA_ENTITLE_SERVER_NOT_FOUND : return "MAMA_ENTITLE_SERVER_NOT_FOUND"; #endif } return "unknown"; diff --git a/mama/c_cpp/src/c/subscription.c b/mama/c_cpp/src/c/subscription.c index d6d0c00..8eaa248 100644 --- a/mama/c_cpp/src/c/subscription.c +++ b/mama/c_cpp/src/c/subscription.c @@ -52,6 +52,11 @@ #include <OeaSubscription.h> extern oeaClient * gEntitlementClient; +#elif WITH_CHUB_PERMSVR + +#include <libPermSvr.h> +extern int gEntitlementClient; + #endif /* WITH_ENTITLEMENTS */ /* *************************************************** */ @@ -525,6 +530,24 @@ isEntitledToSymbol (const char *source, const char*symbol, mamaSubscription subs result = oeaSubscription_isAllowed (impl->mSubjectContext.mOeaSubscription); return result; +#elif WITH_CHUB_PERMSVR + int result = 0; + int count = 0; + mamaSubscriptionImpl *impl = (mamaSubscriptionImpl *)subscription; + + if (gEntitlementClient == 0) /* Not enforcing entitlements. */ + { + return 1; + } + + result = CHUB_IsPermissionedPE( gEntitlementClient, + (char *)0, + source, + symbol, + &impl->mSubjectContext.mEntitleCode, + &count ); + + return result; #else return 1; #endif /* WITH_ENTITLEMENTS */ @@ -951,6 +974,8 @@ mama_status mamaSubscription_processMsg(mamaSubscription subscription, mamaMsg m #ifdef WITH_ENTITLEMENTS mamaMsg_getEntitleCode (message, &entitleCode); +#elif WITH_CHUB_PERMSVR + mamaMsg_getEntitleCode (message, &entitleCode); #endif if (entitleCode == 0) { @@ -993,6 +1018,8 @@ mama_status mamaSubscription_processTportMsg(mamaSubscription subscription, mama #ifdef WITH_ENTITLEMENTS mamaMsg_getEntitleCode (msg, &entitleCode); +#elif WITH_CHUB_PERMSVR + mamaMsg_getEntitleCode (msg, &entitleCode); #endif if (entitleCode == 0) { @@ -1038,6 +1065,8 @@ mama_status mamaSubscription_processWildCardMsg(mamaSubscription subscription, m #ifdef WITH_ENTITLEMENTS mamaMsg_getEntitleCode (msg, &entitleCode); +#elif WITH_CHUB_PERMSVR + mamaMsg_getEntitleCode (msg, &entitleCode); #endif if (entitleCode == 0) { @@ -2656,6 +2685,17 @@ mama_status mamaSubscription_createBasic(mamaSubscription subscription, mamaTran else { +#ifdef WITH_CHUB_PERMSVR + /* Get entitlements source from transport */ + const char *tsource; + mamaTransport_getDefSource(transport, &tsource); + /*Up from entitlement check based on string compare on symbol*/ + if (!isEntitledToSymbol (tsource, topic, impl)) + { + setSubscInfo (impl, transport, NULL, tsource, topic); + return MAMA_STATUS_NOT_ENTITLED; + } +#endif /* Initialise the impl. */ impl->mClosure = closure; impl->mQueue = queue; diff --git a/mama/c_cpp/src/c/subscriptionimpl.h b/mama/c_cpp/src/c/subscriptionimpl.h index eaad852..63cd6b7 100644 --- a/mama/c_cpp/src/c/subscriptionimpl.h +++ b/mama/c_cpp/src/c/subscriptionimpl.h @@ -93,6 +93,10 @@ typedef struct SubjectContext_ int32_t mEntitleCode; uint8_t mEntitlementAlreadyVerified; oeaSubscription* mOeaSubscription; +#elif WITH_CHUB_PERMSVR + EntitleStatus mEntitlement; /* default to NOT_DETERMINED! */ + int32_t mEntitleCode; + uint8_t mEntitlementAlreadyVerified; #endif /* The data quality context includes a recap request. */ mamaDqContext mDqContext; diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c index de92a56..fe18ee2 100644 --- a/mama/c_cpp/src/c/transport.c +++ b/mama/c_cpp/src/c/transport.c @@ -116,6 +116,9 @@ typedef struct transportImpl_ refreshTransport mRefreshTransport; char mName[MAX_TPORT_NAME_LEN]; +#ifdef WITH_CHUB_PERMSVR + char mDefSource[MAX_TPORT_NAME_LEN]; +#endif mamaCmResponder mCmResponder; char* mDescription; @@ -526,6 +529,28 @@ mamaTransport_create (mamaTransport transport, mama_log (MAMA_LOG_LEVEL_FINE, "Creating transport: [%s]", name ? name : ""); +#ifdef WITH_CHUB_PERMSVR + const char* propValue = NULL; + char propNameBuf[MAX_TPORT_NAME_LEN]; + + snprintf (propNameBuf, MAX_TPORT_NAME_LEN, "mama.entitlement.transport.%s.source", self->mName); + + propValue = properties_Get (mamaInternal_getProperties (), + propNameBuf); + + if (NULL!=propValue) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, "Setting %s=%s", + propNameBuf, propValue); + snprintf (self->mDefSource, MAX_TPORT_NAME_LEN, "%s", propValue); + self->mDefSource[MAX_TPORT_NAME_LEN-1] = '\0'; + } + else + { + snprintf (self->mDefSource, MAX_TPORT_NAME_LEN, "%s", self->mName); + self->mDefSource[MAX_TPORT_NAME_LEN-1] = '\0'; + } +#endif if (MAMA_STATUS_OK!=(status=mama_getDefaultEventQueue ( (mamaBridge)(self->mBridgeImpl), &defaultQueue))) @@ -1236,6 +1261,28 @@ mamaTransport_setName (mamaTransport transport, { mamaStatsCollector_setName (*self->mStatsCollector, self->mName); } +#ifdef WITH_CHUB_PERMSVR + const char* propValue = NULL; + char propNameBuf[MAX_TPORT_NAME_LEN]; + + snprintf (propNameBuf, MAX_TPORT_NAME_LEN, "mama.entitlement.transport.%s.source", self->mName); + + propValue = properties_Get (mamaInternal_getProperties (), + propNameBuf); + + if (NULL!=propValue) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, "Setting %s=%s", + propNameBuf, propValue); + snprintf (self->mDefSource, MAX_TPORT_NAME_LEN, "%s", propValue); + self->mDefSource[MAX_TPORT_NAME_LEN-1] = '\0'; + } + else + { + snprintf (self->mDefSource, MAX_TPORT_NAME_LEN, "%s", self->mName); + self->mDefSource[MAX_TPORT_NAME_LEN-1] = '\0'; + } +#endif return MAMA_STATUS_OK; } @@ -1253,6 +1300,21 @@ mamaTransport_getName (mamaTransport transport, return MAMA_STATUS_OK; } +#ifdef WITH_CHUB_PERMSVR +mama_status +mamaTransport_getDefSource (mamaTransport transport, + const char** result) +{ + if (!self) + { + *result = NULL; + return MAMA_STATUS_NULL_ARG; + } + *result = self->mDefSource; + return MAMA_STATUS_OK; +} +#endif + const char * mamaTransport_getMiddleware (mamaTransport transport) { This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Citihub. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.
|
|
Re: documentation for bridges
Daniel Cegiełka <daniel.cegielka@...>
thx Mike Absolutely I'm interested to add such support for ZeroMQ. ZeroMQ gives the possibility to add support at the same level as RV, wmw or lbm - this means support for TCP, IPC and multicast.
The first step to think of such a bridge for ZeroMQ is good documentation. I also hope that such a ZeroMQ bridge would be part of MAMA (like Avis). So I'm waiting when the NYSE will provide more detailed documentation for the bridges.
Best regards, Daniel Cegielka W dniu 7 grudnia 2011 22:14 użytkownik Mike Schonberg <mschonberg@...> napisał:
Daniel,
|
|
[PATCH] Edits and corrections to README file
Michael Schonberg <mschonberg@...>
From: Mike Schonberg <mschonberg@...>
Adding edits and corrections suggested by a technical writer who reviewed the README file. Signed-off-by: Michael Schonberg <mschonberg@...> --- README | 184 +++++++++++++++++++++++++++++++++++----------------------------- 1 files changed, 100 insertions(+), 84 deletions(-) diff --git a/README b/README index 68a443e..5ebfa70 100644 --- a/README +++ b/README @@ -1,41 +1,42 @@ OpenMAMA Client Library ============================ -http:// +Project Page +------------ + +http://www.openmama.org Overview -------- -OpenMAMA provides a lightweight wrapper to give a common API interface -across different middleware and messaging solutions across a variety of -platforms and languages. +OpenMAMA is a lightweight wrapper that provides a common API interface to +different middleware and messaging solutions across a variety of platforms and +languages. -Please see the project page above for more information as well as the -mailing list for questions, discussions, and development. +Please see the project page above for more information, as well as the mailing +list for questions, discussions, and development. Supported Platforms ------------------- -Currently C on Linux is the only supported platform. Supported -distributions are +Currently C on Linux is the only supported platform. Supported distributions +are * Redhat 4 * Redhat 5 * SLERT * SuSe 10 - Requirements for End Users -------------------------- -OpenMama is designed to have fairly minimal requirements to build, -but there are some. +OpenMAMA is designed to have minimal build requirements. Linux ----- -These are the base requirements to build and use OpenMama from a source -package (as described below): +These are the base requirements to build and use OpenMAMA from a source package +(as described below): * GNU-compatible Make or gmake * POSIX-standard shell @@ -46,22 +47,22 @@ package (as described below): * libtool * uuid-dev -To use OpenMama you will need a middleware/payload. An example -middleware bridge and payload is included for Avis which can be -obtianed from the following website. +To use OpenMAMA you will need a middleware/payload. An example middleware +bridge and payload is included for Avis. Avis can be obtained from the following +website: http://avis.sourceforge.net. -OpenMAMA reference documentation has dependancy on +OpenMAMA API reference documentation depends on: * doxygen -Unittests are dependant on Google Testing Framework which is -available from +Unittests are dependent on the Google Testing Framework, which is available +from: http://code.google.com/p/googletest/ -OpenMAMA's own regression tests also relie on +OpenMAMA's own regression tests also rely on: *Python version 2.3 or newer @@ -72,21 +73,20 @@ Getting the Source There are two primary ways of getting OpenMAMA's source code: * Download a stable source release in archive format - * check out the source from our GIT repositary. + * Check out the source from our GIT repository. -The GIT checkout requires a few extra steps and some extra software -packages on your system, but lets you track the latest development and -make patches much more easily. +The GIT checkout requires a few extra steps, and extra software packages to be +installed on your system. However, it provides easier tracking of the latest +development and make patches. ### Source Package ### -OpenMAMA is released in versioned source packages which can be -downloaded from: +OpenMAMA is released in versioned source packages which can be downloaded from: - http:// + http://www.openmama.org/downloads -Once the package is downloaded, expand it. This will result in a - new directory with the name +Once the package is downloaded, expand it. This will result in a new directory +with the name openmama-X.Y.Z @@ -94,9 +94,9 @@ which contains all of the source code. ### GIT Checkout ### -To check out the main branch of OpenMAMA, run the following -GIT command: +To check out the main branch of OpenMAMA, run the following GIT command: + git clone http://git.openmama.org/OpenMAMA-1.1.git Distribution Layout ------------------- @@ -117,19 +117,19 @@ mama/c_cpp/ configure.ac autoconf script Makefile.am autoconf makefile doxyconfig-c.in doxygen config - doc referance guide style - doc/images referance guide images + doc reference guide style + doc/images reference guide images mama/c_cpp/src/c c files for mama library bridge/avis c files for avis middleware bridge implementation conflation c files for mama conflation component mama header files for mama payload/avismsg c files for avis payload bridge implementation - payload/playback c files for mama playback component + playback c files for mama playback component mama/c_cpp/src/examples - mama.properties exmaple mama.properties file + mama.properties example mama.properties file c c files for mama example applications c/Makefile.sample Makefile to build examples only @@ -138,11 +138,10 @@ mama/c_cpp/src/examples c/tools test apps for c API c/* tests and expected results for c API - mama/c_cpp/src/testtools - c test tools for c API - c/capturereplay capture adn replay apps using c API - c/load load testing apps for c API - c/performance performance testing apps for c API + mama/c_cpp/src/testtools test tools for c API + capturereplay capture and replay apps using c API + load load testing apps for c API + performance performance testing apps for c API Building OpenMAMA @@ -150,13 +149,13 @@ Building OpenMAMA ### Avis Install ### -Curretnly OpenMAMA assumes Avis is the middleware to be built with as -this is currently the only opensource middleware supported. Therefore -the Avis client libraries must be available. +Currently OpenMAMA assumes Avis is the middleware to be built with as this is +currently the only opensource middleware supported. Therefore the Avis client +libraries must be available. -The default install of Avis missing a header file and this needs to be -moved manually in the include directory. The OpenMAMA configure script -checks for this header and will exit with an error if not found. +The default install of Avis is missing a header file. This needs to be moved +manually in the include directory. The OpenMAMA configure script checks for +this header and will exit with an error if not found. mv ${AVIS_SOURCE}/lib/avis_client_config.h ${AVIS_HOME}/include/avis @@ -164,8 +163,8 @@ checks for this header and will exit with an error if not found. ### Google Test Install ### -OpenMAMA uses the static google test library and expects the files to be -in the following format. +OpenMAMA uses the static google test library and expects the files to be in the +following format. ${GTEST_HOME}/include - include files ${GTEST_HOME}/lib - library files @@ -174,9 +173,9 @@ ${GTEST_HOME}/lib - library files ### GNU Automake Instructions ### -The following uses teh defualt settings to build the OpenMAMA library -and exmaple applications. This assumes that Avis middleware is avialble -in /usr/local and will install OpenMAMA to /opt/OpenMAMA +The following uses the default settings to build the OpenMAMA library and +example applications. This assumes that Avis middleware is available in +/usr/local, and will install OpenMAMA to /opt/OpenMAMA ./configure make @@ -185,43 +184,42 @@ in /usr/local and will install OpenMAMA to /opt/OpenMAMA ### Configure arguments ### -The following arguments can be passed to configure if you wish to use -non-default paths or build extra components of OpenMAMA +The following arguments can be passed to the configure script if you wish to use +non-default paths, or build extra components of OpenMAMA: -specify an alternative install location +specify an alternative install location: --prefix=${INSTALL_DIR} -specify non defualt Avis install +specify non default Avis install: --avis-path=${AVIS_HOME} -build unittests, specify google test location +build unittests, specify google test location: --gtest-path=${GTEST_HOME} -build testtools +build testtools: --with-testtools ### Building reference guide ### - If you wish to build the latest refernce guide use the following command - after configure +To build the latest reference guide, use the following command after Configure: make docs - This will build the docs in the mama/c_cpp/src/doc folder. +This will build the docs in the mama/c_cpp/src/doc folder. ### Running Unit tests ### - After the build is complete an extra binary can be found in the bin - folder of the install. +After the build is complete an extra binary can be found in the bin folder of +the install. MainUnitTestC - This runs the full set of unit tests using the google test framework. +This runs the full set of unit tests using the google test framework. - The following commar line arguments are available as well as the - normal google test options +The following command line arguments are available, as well as the normal Google +test options: -m ${MIDDLEWARE} @@ -229,34 +227,55 @@ build testtools ### Running regression tests ### - The regression tests do full end to end testing using a specific set of test - applications and a predetermined input output scenario. +The regression tests do full end to end testing using a specific set of test +applications and a predetermined input output scenario. - In-order to run the regression scripts an elvin router must be available. If - it is not running on the defaulkt port on localhost then the mama.properties - file provided in examples should be used with the ${WOMBAT_PATH} variable to - give the location of the router. +In-order to run the regression scripts Avis should be running on the same +machine with the elvin router listening on the default port on localhost. If it +is not running on the default port on localhost, then the mama.properties file +provided in examples should be used with the ${WOMBAT_PATH} variable to give the +location of the router. - To build the regression tests move into teh regression/tols folder. Modify - the makefile with your install path if is non-default. The execute the following commnad +NOTE: The publish/subscribe regression test is based on comparing the output +file against an expected results file. The intial expected results file should +be created by running the test with unmodified OpenMAMA code - steps listed +below. - make +Setting up regression tests: +1) Build required binaries: + - cd src/regression/c/tools + - Edit Makefile: Set API_HOME to the path of the build/root directory of built API + +2) Run 'make'. + +3) Set AVIS_PATH: + - export AVIS_PATH=/path_to_avis_client + eg. export AVIS_PATH=/usr/local/avis-client-1.2.4 - After the tests apps are sucessfully built move into the directory of the - test you wish to run and execute the python file +4) Set OPENMAMA_PATH: + - export OPENMAMA_PATH=/path_to_openmama_build_directory + eg. export OPENMAMA_PATH=/usr/local/openmama/build - eg - cd ../basicpubsub - ./regression.sh +5) Set PYTHON_PATH: + - export PYTHON_PATH=/path_to_python_binary + eg. export PYTHON_PATH=/usr/bin/python2.4 +6) Run the test script: + - cd src/regression/c/basicpubsub + - run regression.sh - NOTE: python 2.3 or higher required for regression tests +7) FOR THE FIRST RUN OF TESTS create the expectedsub_out file + - after step 6) create the expectedsub_out from the sub_out file + ie. mv sub_out expectedsub_out + - run step 6) again to run tests + + NOTE: python 2.3 or higher required for regression tests. Contributing ------------- - +see: www.openmama.org License -------- @@ -264,6 +283,3 @@ build testtools The OpenMAMA library is distributed under the terms of the GNU Lesser General Public license version 2. Please see COPYING for full licence text. - - - -- 1.7.5.4
|
|
Re: documentation for bridges
Mike Schonberg <mschonberg@...>
Daniel,
toggle quoted messageShow quoted text
We selected Avis because we already had a bridge implementation from a previous project, and it was much easier to provide the Avis bridge than to write a new one for a middleware with which we were not familiar. When we considered other open source bridges, ZeroMQ was at the top of our list. I agree that ZeroMQ is a better choice in general and for market data specifically. It is my hope that the community will provide several open source alternatives to Avis including ZeroMQ. If you are interested in implementing a bridge, I will provide as much support as you require. Regards, -Mike Michael Schonberg OpenMAMA Maintainer NYSE Technologies mschonberg@...
-----Original Message-----Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
Re: documentation for bridges
Daniel Cegiełka <daniel.cegielka@...>
Thank you for your response. I think that bridge for ZeroMQ is worth to prepare. I'm a little surprised that you have chosen Avis instead ZeroMQ. ZeroMQ from the beginning was designed as a messaging for market data:
Best regards, Daniel
2011/12/7 Mike Schonberg <mschonberg@...>
|
|
Re: documentation for bridges
Mike Schonberg <mschonberg@...>
toggle quoted messageShow quoted text
-----Original Message-----Daniel, We currently do not have documentation that addresses how to write new payload or messaging bridges for OpenMAMA as the bridge APIs were internal until now; however, we definitely intend to provide bridge API documentation in the near future. In the meantime, I am more than happy to assist you in any way necessary through this mailing list. Your experiences will certainly prove valuable as we develop the documentation. The Avis bridge, included as part of OpenMAMA, provides a simple example that might prove useful. Regards, -Mike Michael Schonberg OpenMAMA Maintainer NYSE Technologies mschonberg@... Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
documentation for bridges
Daniel Cegiełka <daniel.cegielka@...>
Hi, Do you plan to make available any documentation on how to write new bridges for MAMA (and when one can expect such documentation)? Best regards, Daniel
|
|
Re: OpenMAMA integration with Citihub Permission Server API
Mike Schonberg <mschonberg@...>
David,
toggle quoted messageShow quoted text
-----Original Message----- Please submit your patches as a patch as described at http://www.openmama.org/developers/patch-submission. If the changes are extensive, you should consider breaking them down logical series that can be applied incrementally. It is very important that your change provide generic support for 3rd party entitlement systems as other entitlement vendors will surely follow your lead and add support to OpenMAMA. Will it be necessary to add C++, Java and C# support for your changes as we release the corresponding support in OpenMAMA? I think that support for 3rd party entitlement systems is an excellent idea and I look forward to reviewing your patches. Regards, Mike Michael Schonberg OpenMAMA Maintainer mschonberg@... Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
|
|
OpenMAMA integration with Citihub Permission Server API
David Sewell
Citihub have integrated the OpenMAMA API source code with the Citihub Permission Server API, and would like to submit the OpenMAMA code changes for review and integration into the main OpenMAMA release.
The Citihub Permission Server API (libPermSvr) and associated server process (PermSvr) is a proxy for enterprise permission systems and allows clients to be permissioned for market data and other data sources using proprietary or 3rd party permission systems like Thomson Reuters DACS. So, with libPermSvr integrated into OpenMAMA, applications can be entitled for market data using existing market data permission systems, making the adoption of OpenMAMA easier and more attractive for large enterprises with existing market data systems.
The libPermSvr API integration provides the same features as the current OpenMAMA entitlement capability, but adds support for multiple proprietary and 3rd party permission systems. We have also added support for permissioning of basic subscriptions (Topic only) and publication, and we have update the build process and GNU automake scripts, so the build process includes an option to enable the libPermSvr code, e.g. ./configure –with-chub-permsvr=<path to libpermsvr libs and header>.
The Citihub Permission Server API is used by a number of large investment banks for market data entitlement control and usage reporting. The API has been integrated with various proprietary market data API’s and deployed in low latency market data environments, and we have had strong interest from clients for the integration of the Citihub Permission Server API into OpenMAMA to make the adoption of OpenMAMA more attractive to the development community.
The Permission Server software is licensed and maintained by Citihub and is distributed, with support, as binaries for Linux, Solaris and Windows with API support for C/C++, C# and Java. We also share the source code with clients with unrestricted rights to change and reuse source code.
If there is interest in the OpenMAMA community for this feature, we will submit source code patches for review and inclusion in a future release.
Regards,
David Sewell CTO, Citihub
London ● New York ● Singapore ● Hong Kong ● Dubai
1 Canada Square, Canary Wharf, London E14 5AB t: +44 800 0281901 m: +44 7808 584684 e: david.sewell@...
This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Citihub. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.
|
|