Classes Files

mama/mama.h

Classes

  Name
struct mamaEntitlementCallbacks_

Types

  Name
enum sessionDisconnectReason { SESSION_DISCONNECT_REASON_ADMIN = 0, SESSION_DISCONNECT_REASON_NEW_CONNECTION = 1, SESSION_DISCONNECT_REASON_ENTITLEMENTS_UPDATE = 2, SESSION_DISCONNECT_REASON_INVALID = 101}
typedef void(MAMACALLTYPE *)(mama_status status) mamaStartCB
typedef void(MAMACALLTYPE *)(mama_status) mamaStopCB
typedef void(MAMACALLTYPE *)(mama_status, mamaBridge, void *) mamaStopCBEx
typedef void(MAMACALLTYPE *)(const sessionDisconnectReason reason, const char *userId, const char *host, const char *appName) onSessionDisconnectCB
typedef void(MAMACALLTYPE *)(void) onEntitlementUpdateCB
typedef void(MAMACALLTYPE *)(const int isEntitlementCheckingDisabled) onEntitlementCheckingSwitchCB
typedef struct mamaEntitlementCallbacks_ mamaEntitlementCallbacks
typedef void(MAMACALLTYPE *)(mamaBridge bridgeImpl, const char *message) bridgeInfoCallback

Functions

  Name
mama_status mama_setDefaultPayload(char id)
MAMAExpDLL mama_status mama_loadBridge(mamaBridge * impl, const char * middleware)
MAMAExpDLL mama_status mama_loadPayloadBridge(mamaPayloadBridge * bridge, const char * payloadName)
MAMAExpDLL mama_status mama_loadBridgeWithPath(mamaBridge * impl, const char * middleware, const char * path)
MAMAExpDLL mama_status mama_open(void )
MAMAExpDLL mama_status mama_openCount(unsigned int * count)
MAMAExpDLL mama_status mama_openWithProperties(const char * path, const char * filename)
MAMAExpDLL mama_status mama_openWithPropertiesCount(const char * path, const char * filename, unsigned int * count)
MAMAExpDLL mama_status mama_setProperty(const char * name, const char * value)
MAMAExpDLL mama_status mama_setPropertiesFromFile(const char * path, const char * filename)
MAMAExpDLL const char * mama_getProperty(const char * name)
MAMAExpDLL void mama_loadDefaultProperties(void )
MAMAExpDLL const char * mama_getPropertiesAsString(void )
MAMAExpDLL mama_status mama_close(void )
MAMAExpDLL mama_status mama_closeCount(unsigned int * count)
MAMAExpDLL const char * mama_getVersion(mamaBridge bridgeImpl)
MAMAExpDLL mama_status mama_start(mamaBridge bridgeImpl)
MAMAExpDLL mama_status mama_startAll(mama_bool_t isBlocking)
MAMAExpDLL mama_status mama_startBackground(mamaBridge bridgeImpl, mamaStartCB callback)
MAMAExpDLL mama_status mama_startBackgroundEx(mamaBridge bridgeImpl, mamaStopCBEx callback, void * closure)
MAMAExpDLL mama_status mama_stop(mamaBridge bridgeImpl)
MAMAExpDLL mama_status mama_stopAll(void )
MAMAExpDLL mama_status mama_setApplicationName(const char * applicationName)
MAMAExpDLL mama_status mama_setApplicationClassName(const char * className)
MAMAExpDLL mama_status mama_registerEntitlementCallbacks(const mamaEntitlementCallbacks * entitlementCallbacks)
MAMAExpDLL mama_status mama_getApplicationName(const char ** applicationName)
MAMAExpDLL mama_status mama_getApplicationClassName(const char ** className)
MAMAExpDLL mama_status mama_getUserName(const char ** userName)
MAMAExpDLL mama_status mama_getHostName(const char ** hostName)
MAMAExpDLL mama_status mama_getIpAddress(const char ** ipAddress)
MAMAExpDLL mama_status mama_getDefaultEventQueue(mamaBridge bridgeImpl, mamaQueue * defaultQueue)
MAMAExpDLL void mama_setLastError(mamaError error)
MAMAExpDLL mamaError mama_getLastErrorCode(void )
MAMAExpDLL const char * mama_getLastErrorText(void )
MAMAExpDLL mama_status mama_setBridgeInfoCallback(mamaBridge bridgeImpl, bridgeInfoCallback callback)
MAMAExpDLL mama_status mama_addStatsCollector(mamaStatsCollector statsCollector)
MAMAExpDLL mama_status mama_removeStatsCollector(mamaStatsCollector statsCollector)
MAMAExpDLL int mama_getGenerateTransportStats(void )
MAMAExpDLL mama_status mama_getMiddlewareBridge(mamaBridge * bridge, const char * middlewareName)
MAMAExpDLL mama_status mama_getPayloadBridge(mamaPayloadBridge * payloadBridge, const char * payloadName)
MAMAExpDLL mama_status mama_getAvailableTransportNames(char transports[][MAMA_MAX_TRANSPORT_LEN], size_t maxCount, size_t * count)

Defines

  Name
  MAMA_OPEN_MD
  MAMA_OPEN_PUB_SUB
  MAMA_DEFAULT_THROTTLE_RATE
  MAMA_DEFAULT_RECAP_THROTTLE_RATE
  MAMA_DEFAULT_RETRIES
  MAMA_DEFAULT_TIMEOUT
  MAMA_MAX_SYMBOL_LEN
  MAMA_MAX_ROOT_LEN
  MAMA_MAX_SOURCE_LEN
  MAMA_MAX_TRANSPORT_LEN
  MAMA_MAX_BRIDGE_NAME_LEN
  MAMA_MAX_RESOURCE_POOL_LEN
  MAMA_MAX_TOTAL_SYMBOL_LEN
  MAMA_LINK_BRIDGE(implIdentifier, impl)
  MAMA_CREATE_BRIDGE(implIdentifier, impl)

Types Documentation

enum sessionDisconnectReason

Enumerator Value Description
SESSION_DISCONNECT_REASON_ADMIN 0  
SESSION_DISCONNECT_REASON_NEW_CONNECTION 1  
SESSION_DISCONNECT_REASON_ENTITLEMENTS_UPDATE 2  
SESSION_DISCONNECT_REASON_INVALID 101  

Entitlement disconnect status codes

typedef mamaStartCB

typedef void(MAMACALLTYPE * mamaStartCB) (mama_status status);

The callback invoked if an error occurs calling mama_startBackground() or when mama_startBackground() exits normally in which case status will be MAMA_STATUS_OK.

typedef mamaStopCB

typedef void(MAMACALLTYPE * mamaStopCB) (mama_status);

Callback invoked when default thread for middleware has finished processing.

typedef mamaStopCBEx

typedef void(MAMACALLTYPE * mamaStopCBEx) (mama_status, mamaBridge, void *);

Extended stop callback that improves on mamaStopCB by including a bridge impl pointer and closure in the signature.

typedef onSessionDisconnectCB

typedef void( MAMACALLTYPE * onSessionDisconnectCB) (const sessionDisconnectReason reason, const char *userId, const char *host, const char *appName);

Parameters:

  • reason Reason disconnect request was sent
  • userId ID of user who initiated the disconnection, either by attempting to initiate a new connection or an admin user explicitly issuing a disconnect
  • host Hostname/IP address of the site server or where userId is attempting to connect from
  • appName “site server” or application name of application that userId is using to connect (possibly NULL)

Callback passed to registerEntitlementCallbacks(). Will be invoked when a disconnect request is recevied from the entitlements server

typedef onEntitlementUpdateCB

typedef void( MAMACALLTYPE * onEntitlementUpdateCB) (void);

Callback invoked after dynamic entitlements update has occurred

typedef onEntitlementCheckingSwitchCB

typedef void( MAMACALLTYPE * onEntitlementCheckingSwitchCB) (const int isEntitlementCheckingDisabled);

Parameters:

  • isEntitlementsCheckingDisabled Holds 1 if entitlements checking has been switched to disabled, otherwise 0.

Callback invoked when entitlements checking has been switched, for example, from enabled to disabled.

typedef mamaEntitlementCallbacks

typedef struct mamaEntitlementCallbacks_ mamaEntitlementCallbacks;

Convenience structure for registering entitlement callbacks to MAMA

typedef bridgeInfoCallback

typedef void(MAMACALLTYPE * bridgeInfoCallback) (mamaBridge bridgeImpl, const char *message);

Callback passed to mama_setBridgeInfoCallback (). This will be invoked when info messages are logged at the bridge level. Currently only invoked for LBM log messages.

Functions Documentation

function mama_setDefaultPayload

mama_status mama_setDefaultPayload(
    char id
)

The Mama data type provides methods global initialization and manipulating global options.

Related Mama functions also provide means for creating transports, dictionaries, and subscriptions.

function mama_loadBridge

MAMAExpDLL mama_status mama_loadBridge(
    mamaBridge * impl,
    const char * middleware
)

Parameters:

  • impl The bridge object
  • middleware The middleware string. Can be “wmw”, “lbm” or “tibrv”.

Return: mama_status Whether the call was successful or not.

Load the bridge specified by middleware string. If the bridge has already been loaded then the existing bridge instance will be returned.

function mama_loadPayloadBridge

MAMAExpDLL mama_status mama_loadPayloadBridge(
    mamaPayloadBridge * bridge,
    const char * payloadName
)

function mama_loadBridgeWithPath

MAMAExpDLL mama_status mama_loadBridgeWithPath(
    mamaBridge * impl,
    const char * middleware,
    const char * path
)

Parameters:

  • impl The bridge object
  • middleware The middleware string. Can be “wmw”, “lbm” or “tibrv”.
  • path The path to the bridge library

Return: mama_status Whether the call was successful or not.

Load the bridge specified by middleware string using the path specified by the user. If the bridge has already been loaded then the existing bridge instance will be returned.

function mama_open

MAMAExpDLL mama_status mama_open(
    void 
)

Initialize MAMA.

MAMA employs a reference count to track multiple calls to mama_open() and mama_close(). The count is incremented every time mama_open() is called and decremented when mama_close() is called. The resources are not actually released until the count reaches zero.

function mama_openCount

MAMAExpDLL mama_status mama_openCount(
    unsigned int * count
)

Parameters:

  • count The reference count for the MAMA library after opening once. This will be non-zero and will match the amount of times a mama_open() variant has been called.

Initialize MAMA.

MAMA employs a reference count to track multiple calls to mama_open() and mama_close(). The count is incremented every time mama_open() is called and decremented when mama_close() is called. The resources are not actually released until the count reaches zero.

function mama_openWithProperties

MAMAExpDLL mama_status mama_openWithProperties(
    const char * path,
    const char * filename
)

Parameters:

  • path Fully qualified path to the directory containing the properties file
  • filename The name of the file containing MAMA properties.

Return: mama_status Whether the call was successful or not.

Initialize MAMA.

Allows users of the API to override the default behavior of mama_open() where a file mama.properties is required to be located in the directory specified by $WOMBAT_PATH.

The properties file must have the same structure as a standard mama.properties file.

If null is passed as the path the API will look for the properties file on the $WOMBAT_PATH.

If null is passed as the filename the API will look for the default filename of mama.properties.

MAMA employs a reference count to track multiple calls to mama_open() and mama_close(). The count is incremented every time mama_open() is called and decremented when mama_close() is called. The resources are not actually released until the count reaches zero.

function mama_openWithPropertiesCount

MAMAExpDLL mama_status mama_openWithPropertiesCount(
    const char * path,
    const char * filename,
    unsigned int * count
)

Parameters:

  • path Fully qualified path to the directory containing the properties file
  • filename The name of the file containing MAMA properties.
  • count The reference count for the MAMA library after opening once. This will be non-zero and will match the amount of times a mama_open() variant has been called.

Return: mama_status Whether the call was successful or not.

Initialize MAMA.

Allows users of the API to override the default behavior of mama_open() where a file mama.properties is required to be located in the directory specified by $WOMBAT_PATH.

The properties file must have the same structure as a standard mama.properties file.

If null is passed as the path the API will look for the properties file on the $WOMBAT_PATH.

If null is passed as the filename the API will look for the default filename of mama.properties.

MAMA employs a reference count to track multiple calls to mama_open() and mama_close(). The count is incremented every time mama_open() is called and decremented when mama_close() is called. The resources are not actually released until the count reaches zero.

function mama_setProperty

MAMAExpDLL mama_status mama_setProperty(
    const char * name,
    const char * value
)

Parameters:

  • name The name of the property being set.
  • value The value of the property being set.

Return: MAMA_STATUS_NULL_ARG is either name or value is null. MAMA_STATUS_OK if the function completed successfully.

Set a specific property for the API.

If the property being set has already been given a value from a properties file that value will be replaced.

See the example mama.properties provided with the distribution for examples of property formatting. The properties set via this function should be formatted in the same manner as those specified in mama.properties.

The strings passed to the function are copied.

function mama_setPropertiesFromFile

MAMAExpDLL mama_status mama_setPropertiesFromFile(
    const char * path,
    const char * filename
)

Parameters:

  • path Fully qualified path to the directory containing the properties file
  • filename The name of the file containing properties.

Return: MAMA_STATUS_NULL_ARG is either name or value is null. MAMA_STATUS_OK if the function completed successfully.

Load a set of properties through the API.

If the property being set has already been given a value from a properties file that value will be replaced.

The properties file must have the same structure as a standard mama.properties file.

If null is passed as the path the API will look for the properties file on the $WOMBAT_PATH.

function mama_getProperty

MAMAExpDLL const char * mama_getProperty(
    const char * name
)

Parameters:

  • name The name of the property to retrieve.

Return: the value of the property or NULL if unset.

Retrieve a specific property from the API.

If the property has not been set, a NULL value will be returned.

function mama_loadDefaultProperties

MAMAExpDLL void mama_loadDefaultProperties(
    void 
)

Load in default mama.properties from the default WOMBAT_PATH directory.

function mama_getPropertiesAsString

MAMAExpDLL const char * mama_getPropertiesAsString(
    void 
)

Return: String representing all the properties

Build a string containing all configuration properties in the format: key1=value key2=value key3=value

NB The caller is responsible for destroying memory allocated by this function

function mama_close

MAMAExpDLL mama_status mama_close(
    void 
)

Return: mama_status Whether the call was successful or not.

Close MAMA and free all associated resources if no more references exist (e.g.if open has been called 3 times then it will require 3 calls to close in order for all resources to be freed).

function mama_closeCount

MAMAExpDLL mama_status mama_closeCount(
    unsigned int * count
)

Parameters:

  • count The reference count for the MAMA library after closing once. If this is zero then MAMA and all resources will have been freed.

Return: mama_status Whether the call was successful or not.

Close MAMA and free all associated resources if no more references exist (e.g.if open has been called 3 times then it will require 3 calls to close in order for all resources to be freed).

function mama_getVersion

MAMAExpDLL const char * mama_getVersion(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The bridge specific structure.

Return the version information for the library. The version of the underlying transport follows in parens.

function mama_start

MAMAExpDLL mama_status mama_start(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The bridge specific structure.

Start processing messages on the internal queue. This starts Mama’s internal throttle, refresh logic, and other internal Mama processes as well as dispatching messages from the internal queue.

mama_start( ) blocks until an invocation of mama_stop() occurs.

function mama_startAll

MAMAExpDLL mama_status mama_startAll(
    mama_bool_t isBlocking
)

Parameters:

  • bridgeImpl The bridge specific structure.

Start processing messages on the internal queue for all currently loaded MAMA bridges. This starts Mama’s internal throttle, refresh logic, and other internal Mama processes as well as dispatching messages from the internal queue.

mama_startAll( ) blocks until all currently outstandin

function mama_startBackground

MAMAExpDLL mama_status mama_startBackground(
    mamaBridge bridgeImpl,
    mamaStartCB callback
)

Parameters:

  • bridgeImpl The bridge specific structure.
  • callback The callback for asynchronous status.

Return: MAMA_STATUS_OK if successful.

Start Mama in the background. This method invokes mama_start() in a separate thread.

This API uses the deprecated mamaStartCB callback type. mama_startBackgroundEx uses the replacement type mamaStopCBEx. To retain backward compatability mama_startBackground casts callback to mamaStopCB for further processing.

function mama_startBackgroundEx

MAMAExpDLL mama_status mama_startBackgroundEx(
    mamaBridge bridgeImpl,
    mamaStopCBEx callback,
    void * closure
)

Parameters:

  • bridgeImpl The bridge specific structure.
  • callback The extended callback for asynchronous status.

Return: MAMA_STATUS_OK if successful.

Start Mama in the background, with extended parameters.

This method performs the same functionality as mama_startBackground accept it provides the facility to pass in a closure. The C++ wrapper layer uses this version of the function, and stores the MamaStartCallback object in the closure.

function mama_stop

MAMAExpDLL mama_status mama_stop(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The bridge specific structure.

Stop dispatching on the default event queue for the specified bridge.

function mama_stopAll

MAMAExpDLL mama_status mama_stopAll(
    void 
)

Stop dispatching on the default event queue for all bridges.

function mama_setApplicationName

MAMAExpDLL mama_status mama_setApplicationName(
    const char * applicationName
)

Parameters:

  • applicationName

mama_setApplicationName - sets the mama application name This should be called before mama_open

function mama_setApplicationClassName

MAMAExpDLL mama_status mama_setApplicationClassName(
    const char * className
)

Parameters:

  • className

mama_setApplicationClass - sets the mama class name This should be called before mama_open

function mama_registerEntitlementCallbacks

MAMAExpDLL mama_status mama_registerEntitlementCallbacks(
    const mamaEntitlementCallbacks * entitlementCallbacks
)

Parameters:

  • entitlementCallbacks Structure containing functions to be invoked when disconnect request is received from the entitlement server or dynamic entitlement update has occurred

mama_registerEntitlementCallbacks - Registers the callback method to be called whenever the user is disconnected from the entitlement server

function mama_getApplicationName

MAMAExpDLL mama_status mama_getApplicationName(
    const char ** applicationName
)

Parameters:

  • applicationName address of where to put applicationName

mama_getApplicationName - gets the mama application name

function mama_getApplicationClassName

MAMAExpDLL mama_status mama_getApplicationClassName(
    const char ** className
)

Parameters:

  • className address of where to put className

mama_getApplicationClass - sets the mama class name

function mama_getUserName

MAMAExpDLL mama_status mama_getUserName(
    const char ** userName
)

Parameters:

  • userName address of where to put user name

mama_getUserName - gets the user name

function mama_getHostName

MAMAExpDLL mama_status mama_getHostName(
    const char ** hostName
)

Parameters:

  • hostName address of where to put host name

mama_getHostName - gets the host name

function mama_getIpAddress

MAMAExpDLL mama_status mama_getIpAddress(
    const char ** ipAddress
)

Parameters:

  • ipAddress address of where to put IP address

mama_getIpAddressName - gets the IP Address

function mama_getDefaultEventQueue

MAMAExpDLL mama_status mama_getDefaultEventQueue(
    mamaBridge bridgeImpl,
    mamaQueue * defaultQueue
)

Parameters:

  • bridgeImpl The middleware for which the default event queue is being obtained.
  • defaultQueue Address to which the defaultQueue is to be written.

Return: MAMA_STATUS_OK if the function returns successfully.

Get a reference to the internal default event queue in use for the specified middleware.

function mama_setLastError

MAMAExpDLL void mama_setLastError(
    mamaError error
)

Parameters:

  • error The code of the last error to have occured in this thread.

Set the last error to occur in Mama. Each thread will have its own last error.

This function is for internal usage only.

function mama_getLastErrorCode

MAMAExpDLL mamaError mama_getLastErrorCode(
    void 
)

Parameters:

  • error The code of the last error to have occured in this thread.

Get the code of the last error to have occurred in Mama. Each thread will have its own last error.

function mama_getLastErrorText

MAMAExpDLL const char * mama_getLastErrorText(
    void 
)

Parameters:

  • error The text of the last error to have occured in this thread.

Get the text of the last error to have occurred in Mama. Each thread will have its own last error.

function mama_setBridgeInfoCallback

MAMAExpDLL mama_status mama_setBridgeInfoCallback(
    mamaBridge bridgeImpl,
    bridgeInfoCallback callback
)

Sets a callback to be invoked whenever an information message is logged at the bridge level. Messages returned vary depending on the underlying middleware. Currently only implemented for LBM bridges.

function mama_addStatsCollector

MAMAExpDLL mama_status mama_addStatsCollector(
    mamaStatsCollector statsCollector
)

Add a user stats collector

function mama_removeStatsCollector

MAMAExpDLL mama_status mama_removeStatsCollector(
    mamaStatsCollector statsCollector
)

Remove a user stats collector

function mama_getGenerateTransportStats

MAMAExpDLL int mama_getGenerateTransportStats(
    void 
)

function mama_getMiddlewareBridge

MAMAExpDLL mama_status mama_getMiddlewareBridge(
    mamaBridge * bridge,
    const char * middlewareName
)

Parameters:

  • bridge Pointer to a mamaBridge object.
  • middlewareName String denoting the middleware to return

Return: mama_status MAMA_STATUS_OK if successful. MAMA_STATUS_NULL_ARG if one of the arguments is NULL. MAMA_STATUS_NOT_FOUND if no bridge available.

Get Middleware Bridge by middleware name

function mama_getPayloadBridge

MAMAExpDLL mama_status mama_getPayloadBridge(
    mamaPayloadBridge * payloadBridge,
    const char * payloadName
)

Parameters:

  • payloadBridge Pointer to the mamaPayloadBridge object.
  • payloadName String denoting the payload to return

Return: mama_status MAMA_STATUS_OK if successful MAMA_STATUS_NULL_ARG if one of the arguments is NULL. MAMA_STATUS_NOT_FOUND if no payload available.

Get Payload bridge by payload name

function mama_getAvailableTransportNames

MAMAExpDLL mama_status mama_getAvailableTransportNames(
    char transports[][MAMA_MAX_TRANSPORT_LEN],
    size_t maxCount,
    size_t * count
)

Parameters:

  • transports
  • count
  • maxCount

Return:

Macros Documentation

define MAMA_OPEN_MD

#define MAMA_OPEN_MD ((uint32_t)(0x00000001))

define MAMA_OPEN_PUB_SUB

#define MAMA_OPEN_PUB_SUB ((uint32_t)(0x00000002))

define MAMA_DEFAULT_THROTTLE_RATE

#define MAMA_DEFAULT_THROTTLE_RATE 500

define MAMA_DEFAULT_RECAP_THROTTLE_RATE

#define MAMA_DEFAULT_RECAP_THROTTLE_RATE 250

define MAMA_DEFAULT_RETRIES

#define MAMA_DEFAULT_RETRIES 2

define MAMA_DEFAULT_TIMEOUT

#define MAMA_DEFAULT_TIMEOUT 30.0f

define MAMA_MAX_SYMBOL_LEN

#define MAMA_MAX_SYMBOL_LEN 128

define MAMA_MAX_ROOT_LEN

#define MAMA_MAX_ROOT_LEN 5

define MAMA_MAX_SOURCE_LEN

#define MAMA_MAX_SOURCE_LEN 64

define MAMA_MAX_TRANSPORT_LEN

#define MAMA_MAX_TRANSPORT_LEN 64

define MAMA_MAX_BRIDGE_NAME_LEN

#define MAMA_MAX_BRIDGE_NAME_LEN 64

define MAMA_MAX_RESOURCE_POOL_LEN

#define MAMA_MAX_RESOURCE_POOL_LEN 128

define MAMA_MAX_TOTAL_SYMBOL_LEN

#define MAMA_MAX_TOTAL_SYMBOL_LEN                                     (MAMA_MAX_SYMBOL_LEN + MAMA_MAX_SOURCE_LEN + \
                                    MAMA_MAX_ROOT_LEN + 2)
#define MAMA_LINK_BRIDGE(
    implIdentifier,
    impl
)
    do                                                              \
    {                                                               \
        implIdentifier ## Bridge_createImpl (impl);                 \
    }                                                               \
    while(0)                                                        \

define MAMA_CREATE_BRIDGE

#define MAMA_CREATE_BRIDGE(
    implIdentifier,
    impl
)
    do                                                              \
    {                                                               \
        if (MAMA_LINK_##implIdentifier)                             \
        {                                                           \
            implIdentifier##Bridge_createImpl (impl);               \
        }                                                           \
        else                                                        \
        {                                                           \
            mama_loadBridge (impl, "##implIdentifier##");           \
        }                                                           \
    }                                                               \
    while(0)                                                        \

Source code

/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Technologies, 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 MamaH__
#define MamaH__

#include "mama/config.h"
#include <mama/log.h>
#include <mama/error.h>
#include <mama/types.h>
#include <mama/datetime.h>
#include <mama/servicelevel.h>
#include <mama/status.h>
#include <mama/msgstatus.h>
#include <mama/msgtype.h>
#include <mama/msgfield.h>
#include <mama/dictionary.h>
#include <mama/transport.h>
#include <mama/msg.h>
#include <mama/middleware.h>
#include <mama/price.h>
#include <mama/publisher.h>
#include <mama/reservedfields.h>
#include <mama/inbox.h>
#include <mama/timer.h>
#include <mama/queue.h>
#include <mama/senderId.h>
#include <mama/symbolmap.h>
#include <mama/symbolmapfile.h>
#include <mama/timezone.h>
#include <mama/source.h>
#include <mama/subscriptiontype.h>
#include <mama/quality.h>
#include <mama/ft.h>
#include <mama/entitlement.h>

#if defined(__cplusplus)
extern "C"
{
#endif

#define MAMA_OPEN_MD      ((uint32_t)(0x00000001))
#define MAMA_OPEN_PUB_SUB ((uint32_t)(0x00000002))

#define MAMA_DEFAULT_THROTTLE_RATE 500
#define MAMA_DEFAULT_RECAP_THROTTLE_RATE 250

#define MAMA_DEFAULT_RETRIES       2
#define MAMA_DEFAULT_TIMEOUT       30.0f
#define MAMA_MAX_SYMBOL_LEN        128
#define MAMA_MAX_ROOT_LEN          5 // e.g. _MDDD
#define MAMA_MAX_SOURCE_LEN        64
#define MAMA_MAX_TRANSPORT_LEN     64
#define MAMA_MAX_BRIDGE_NAME_LEN   64
#define MAMA_MAX_RESOURCE_POOL_LEN 128
// This is source + symbol + root + 2 delimiting periods
#define MAMA_MAX_TOTAL_SYMBOL_LEN  (MAMA_MAX_SYMBOL_LEN + MAMA_MAX_SOURCE_LEN + \
                                    MAMA_MAX_ROOT_LEN + 2)

    mama_status
    mama_setDefaultPayload (char id);

    MAMAExpDLL
    extern mama_status
    mama_loadBridge (mamaBridge* impl, const char*  middleware);

    MAMAExpDLL
    extern mama_status
    mama_loadPayloadBridge (mamaPayloadBridge*  bridge,  const char* payloadName);


    MAMAExpDLL
    extern mama_status
    mama_loadBridgeWithPath (mamaBridge* impl, const char*  middleware, const char* path);

    #define MAMA_LINK_BRIDGE(implIdentifier, impl)                  \
    do                                                              \
    {                                                               \
        implIdentifier ## Bridge_createImpl (impl);                 \
    }                                                               \
    while(0)                                                        \

    #define MAMA_CREATE_BRIDGE(implIdentifier, impl)                \
    do                                                              \
    {                                                               \
        if (MAMA_LINK_##implIdentifier)                             \
        {                                                           \
            implIdentifier##Bridge_createImpl (impl);               \
        }                                                           \
        else                                                        \
        {                                                           \
            mama_loadBridge (impl, "##implIdentifier##");           \
        }                                                           \
    }                                                               \
    while(0)                                                        \

    /******** End of multi-impl section   ********/

    /******************************************************************************
     * Global initialization and configuration.
     */

    MAMAExpDLL
    extern mama_status
    mama_open (void);

    MAMAExpDLL
    extern mama_status
    mama_openCount (unsigned int* count);

    MAMAExpDLL
    extern mama_status
    mama_openWithProperties (const char*    path,
                             const char*    filename);

    MAMAExpDLL
    extern mama_status
    mama_openWithPropertiesCount (const char*    path,
                                  const char*    filename,
                                  unsigned int*  count);

    MAMAExpDLL
    extern mama_status
    mama_setProperty (const char* name,
                      const char* value);

    MAMAExpDLL
    extern mama_status
    mama_setPropertiesFromFile (const char *path,
                                const char *filename);

    MAMAExpDLL
    extern const char *
    mama_getProperty (const char* name);

    MAMAExpDLL
    extern void
    mama_loadDefaultProperties (void);

    MAMAExpDLL
    extern const char * mama_getPropertiesAsString (void);

    MAMAExpDLL
    extern mama_status
    mama_close (void);

    MAMAExpDLL
    extern mama_status
    mama_closeCount (unsigned int* count);

    MAMAExpDLL
    extern const char*
    mama_getVersion (mamaBridge bridgeImpl);


    MAMAExpDLL
    extern mama_status
    mama_start (mamaBridge bridgeImpl);

    MAMAExpDLL
    extern mama_status
    mama_startAll (mama_bool_t isBlocking);

    typedef void (MAMACALLTYPE *mamaStartCB) (mama_status status);

    typedef void (MAMACALLTYPE *mamaStopCB) (mama_status);

    MAMAExpDLL
    extern mama_status
    mama_startBackground (mamaBridge    bridgeImpl,
                          mamaStartCB   callback);
    typedef void (MAMACALLTYPE *mamaStopCBEx) (mama_status, mamaBridge, void*);

    MAMAExpDLL
    extern mama_status mama_startBackgroundEx (mamaBridge   bridgeImpl,
                                               mamaStopCBEx callback,
                                               void*        closure);

    MAMAExpDLL
    extern mama_status
    mama_stop (mamaBridge bridgeImpl);

    MAMAExpDLL
    extern mama_status
    mama_stopAll (void);

    MAMAExpDLL
    mama_status
    mama_setApplicationName (const char* applicationName);

    MAMAExpDLL
    mama_status
    mama_setApplicationClassName (const char* className);

    typedef enum
    {
        /*Disconnection request sent by administrator via site server GUI*/
        SESSION_DISCONNECT_REASON_ADMIN               = 0,
        /*Disconnection request sent due to user reaching concurrent access limit*/
        SESSION_DISCONNECT_REASON_NEW_CONNECTION      = 1,
        /*Disconnection request sent due to an entitlements modification resulting in user now exceeding concurrent access limit*/
        SESSION_DISCONNECT_REASON_ENTITLEMENTS_UPDATE = 2,

        SESSION_DISCONNECT_REASON_INVALID             = 101
    } sessionDisconnectReason;

    typedef void (
    MAMACALLTYPE
    *onSessionDisconnectCB) (const sessionDisconnectReason reason,
                                           const char* userId,
                                           const char* host,
                                           const char* appName);

    typedef void (
    MAMACALLTYPE
    *onEntitlementUpdateCB) (void);

    typedef void (
    MAMACALLTYPE
    *onEntitlementCheckingSwitchCB) (const int isEntitlementCheckingDisabled);
    typedef struct mamaEntitlementCallbacks_
    {
        onSessionDisconnectCB       onSessionDisconnect;
        onEntitlementUpdateCB       onEntitlementUpdate;
        onEntitlementCheckingSwitchCB onEntitlementCheckingSwitch;
    } mamaEntitlementCallbacks;

    MAMAExpDLL
    mama_status
    mama_registerEntitlementCallbacks (const mamaEntitlementCallbacks* entitlementCallbacks);

    MAMAExpDLL
    mama_status
    mama_getApplicationName (const char** applicationName);

    MAMAExpDLL
    mama_status
    mama_getApplicationClassName (const char**  className);

    MAMAExpDLL
    mama_status
    mama_getUserName (const char** userName);

    MAMAExpDLL
    mama_status
    mama_getHostName (const char** hostName);

    MAMAExpDLL
    mama_status
    mama_getIpAddress (const char** ipAddress);

    MAMAExpDLL
    mama_status
    mama_getDefaultEventQueue (mamaBridge bridgeImpl,
                               mamaQueue* defaultQueue);

    MAMAExpDLL
    extern void
    mama_setLastError (mamaError error);

    MAMAExpDLL
    extern mamaError
    mama_getLastErrorCode (void);

    MAMAExpDLL
    extern const char*
    mama_getLastErrorText (void);

    typedef void (MAMACALLTYPE *bridgeInfoCallback) (mamaBridge bridgeImpl, const char* message);

    MAMAExpDLL
    extern mama_status
    mama_setBridgeInfoCallback (mamaBridge         bridgeImpl,
                                bridgeInfoCallback callback);
    MAMAExpDLL
    extern mama_status
    mama_addStatsCollector (mamaStatsCollector  statsCollector);

    MAMAExpDLL
    extern mama_status
    mama_removeStatsCollector (mamaStatsCollector  statsCollector);

    MAMAExpDLL int mama_getGenerateTransportStats(void);

    MAMAExpDLL
    extern mama_status
    mama_getMiddlewareBridge (mamaBridge *bridge, const char *middlewareName);

    MAMAExpDLL
    extern mama_status
    mama_getPayloadBridge (mamaPayloadBridge *payloadBridge,
                           const char        *payloadName);

    MAMAExpDLL
    extern mama_status
    mama_getAvailableTransportNames (char transports[][MAMA_MAX_TRANSPORT_LEN],
                                     size_t maxCount,
                                     size_t* count);

#if defined(__cplusplus)
}
#endif

#endif /* MamaH__ */

Updated on 2023-03-31 at 15:29:16 +0100