OpenMAMA
mama.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MamaH__
23 #define MamaH__
24 
25 #include "mama/config.h"
26 #include <mama/log.h>
27 #include <mama/error.h>
28 #include <mama/types.h>
29 #include <mama/datetime.h>
30 #include <mama/servicelevel.h>
31 #include <mama/status.h>
32 #include <mama/msgstatus.h>
33 #include <mama/msgtype.h>
34 #include <mama/msgfield.h>
35 #include <mama/dictionary.h>
36 #include <mama/transport.h>
37 #include <mama/msg.h>
38 #include <mama/middleware.h>
39 #include <mama/price.h>
40 #include <mama/publisher.h>
41 #include <mama/reservedfields.h>
42 #include <mama/inbox.h>
43 #include <mama/timer.h>
44 #include <mama/queue.h>
45 #include <mama/senderId.h>
46 #include <mama/symbolmap.h>
47 #include <mama/symbolmapfile.h>
48 #include <mama/timezone.h>
49 #include <mama/source.h>
50 #include <mama/subscriptiontype.h>
51 #include <mama/quality.h>
52 #include <mama/ft.h>
53 
54 #if defined(__cplusplus)
55 extern "C"
56 {
57 #endif
58 
59 #define MAMA_OPEN_MD ((uint32_t)(0x00000001))
60 #define MAMA_OPEN_PUB_SUB ((uint32_t)(0x00000002))
61 
62 #define MAMA_DEFAULT_THROTTLE_RATE 500
63 #define MAMA_DEFAULT_RECAP_THROTTLE_RATE 250
64 
65 #define MAMA_DEFAULT_RETRIES 2
66 #define MAMA_DEFAULT_TIMEOUT 30.0f
67 #define MAMA_MAX_SYMBOL_LEN 128
68 #define MAMA_MAX_SOURCE_LEN 64
69 #define MAMA_MAX_TRANSPORT_LEN 64
70 
124  mama_setDefaultPayload (char id);
125 
134  MAMAExpDLL
135  extern mama_status
136  mama_loadBridge (mamaBridge* impl, const char* middleware);
137 
138  MAMAExpDLL
139  extern mama_status
140  mama_loadPayloadBridge (mamaPayloadBridge* bridge, const char* payloadName);
141 
151  MAMAExpDLL
152  extern mama_status
153  mama_loadBridgeWithPath (mamaBridge* impl, const char* middleware, const char* path);
154 
155  #define MAMA_LINK_BRIDGE(implIdentifier, impl) \
156  do \
157  { \
158  implIdentifier ## Bridge_createImpl (impl); \
159  } \
160  while(0) \
161 
162  #define MAMA_CREATE_BRIDGE(implIdentifier, impl) \
163  do \
164  { \
165  if (MAMA_LINK_##implIdentifier) \
166  { \
167  implIdentifier##Bridge_createImpl (impl); \
168  } \
169  else \
170  { \
171  mama_loadBridge (impl, "##implIdentifier##"); \
172  } \
173  } \
174  while(0) \
175 
176  /******** End of multi-impl section ********/
177 
178  /******************************************************************************
179  * Global initialization and configuration.
180  */
181 
193  MAMAExpDLL
194  extern mama_status
195  mama_open (void);
196 
219  MAMAExpDLL
220  extern mama_status
221  mama_openWithProperties (const char* path,
222  const char* filename);
223 
242  MAMAExpDLL
243  extern mama_status
244  mama_setProperty (const char* name,
245  const char* value);
246 
269  MAMAExpDLL
270  extern mama_status
271  mama_setPropertiesFromFile (const char *path,
272  const char *filename);
273 
283  MAMAExpDLL
284  extern const char *
285  mama_getProperty (const char* name);
286 
291  MAMAExpDLL
292  extern mama_status
293  mama_close (void);
294 
301  MAMAExpDLL
302  extern const char*
303  mama_getVersion (mamaBridge bridgeImpl);
304 
305 
315  MAMAExpDLL
316  extern mama_status
317  mama_start (mamaBridge bridgeImpl);
318 
324  typedef void (MAMACALLTYPE *mamaStartCB) (mama_status status);
325 
329  typedef void (MAMACALLTYPE *mamaStopCB) (mama_status);
330 
343  MAMAExpDLL
344  extern mama_status
345  mama_startBackground (mamaBridge bridgeImpl,
346  mamaStartCB callback);
351  typedef void (MAMACALLTYPE *mamaStopCBEx) (mama_status, mamaBridge, void*);
352 
364  MAMAExpDLL
365  extern mama_status mama_startBackgroundEx (mamaBridge bridgeImpl,
366  mamaStopCBEx callback,
367  void* closure);
368 
374  MAMAExpDLL
375  extern mama_status
376  mama_stop (mamaBridge bridgeImpl);
377 
381  MAMAExpDLL
382  extern mama_status
383  mama_stopAll (void);
384 
390  MAMAExpDLL
391  mama_status
392  mama_setApplicationName (const char* applicationName);
393 
399  MAMAExpDLL
400  mama_status
401  mama_setApplicationClassName (const char* className);
402 
403 #ifdef WITH_ENTITLEMENTS
404 
407  typedef enum
408  {
409  /*Disconnection request sent by administrator via site server GUI*/
410  SESSION_DISCONNECT_REASON_ADMIN = 0,
411  /*Disconnection request sent due to user reaching concurrent access limit*/
412  SESSION_DISCONNECT_REASON_NEW_CONNECTION = 1,
413  /*Disconnection request sent due to an entitlements modification resulting in user now exceeding concurrent access limit*/
414  SESSION_DISCONNECT_REASON_ENTITLEMENTS_UPDATE = 2,
415 
416  SESSION_DISCONNECT_REASON_INVALID = 101
417  } sessionDisconnectReason;
418 
428  typedef void (
429  MAMACALLTYPE
430  *onSessionDisconnectCB) (const sessionDisconnectReason reason,
431  const char* userId,
432  const char* host,
433  const char* appName);
434 
438  typedef void (
439  MAMACALLTYPE
440  *onEntitlementUpdateCB) (void);
441 
448  typedef void (
449  MAMACALLTYPE
450  *onEntitlementCheckingSwitchCB) (const int isEntitlementCheckingDisabled);
454  typedef struct mamaEntitlementCallbacks_
455  {
456  onSessionDisconnectCB onSessionDisconnect;
457  onEntitlementUpdateCB onEntitlementUpdate;
458  onEntitlementCheckingSwitchCB onEntitlementCheckingSwitch;
459  } mamaEntitlementCallbacks;
460 
470  MAMAExpDLL
471  mama_status
472  mama_registerEntitlementCallbacks (const mamaEntitlementCallbacks* entitlementCallbacks);
473 #endif /*WITH_ENTITLEMENTS*/
474 
479  MAMAExpDLL
480  mama_status
481  mama_getApplicationName (const char** applicationName);
482 
487  MAMAExpDLL
488  mama_status
489  mama_getApplicationClassName (const char** className);
490 
495  MAMAExpDLL
496  mama_status
497  mama_getUserName (const char** userName);
498 
503  MAMAExpDLL
504  mama_status
505  mama_getHostName (const char** hostName);
506 
511  MAMAExpDLL
512  mama_status
513  mama_getIpAddress (const char** ipAddress);
514 
525  MAMAExpDLL
526  mama_status
527  mama_getDefaultEventQueue (mamaBridge bridgeImpl,
528  mamaQueue* defaultQueue);
529 
538  MAMAExpDLL
539  extern void
541 
548  MAMAExpDLL
549  extern mamaError
550  mama_getLastErrorCode (void);
551 
558  MAMAExpDLL
559  extern const char*
560  mama_getLastErrorText (void);
561 
566  typedef void (MAMACALLTYPE *bridgeInfoCallback) (mamaBridge bridgeImpl, const char* message);
567 
573  MAMAExpDLL
574  extern mama_status
575  mama_setBridgeInfoCallback (mamaBridge bridgeImpl,
576  bridgeInfoCallback callback);
580  MAMAExpDLL
581  extern mama_status
583 
587  MAMAExpDLL
588  extern mama_status
590 
591 #if defined(__cplusplus)
592 }
593 #endif
594 
595 #endif /* MamaH__ */
596 
MAMAExpDLL mama_status mama_removeStatsCollector(mamaStatsCollector statsCollector)
Remove a user stats collector.
MAMAExpDLL mama_status mama_getHostName(const char **hostName)
mama_getHostName - gets the host name
MAMAExpDLL mama_status mama_close(void)
Close MAMA and free all associated resource.
void(MAMACALLTYPE * bridgeInfoCallback)(mamaBridge bridgeImpl, const char *message)
Callback passed to mama_setBridgeInfoCallback ().
Definition: mama.h:566
void(MAMACALLTYPE * mamaStopCBEx)(mama_status, mamaBridge, void *)
Extended stop callback that improves on mamaStopCB by including a bridge impl pointer and closure in ...
Definition: mama.h:351
MAMAExpDLL void mama_setLastError(mamaError error)
Set the last error to occur in Mama.
MAMAExpDLL mama_status mama_setPropertiesFromFile(const char *path, const char *filename)
Load a set of properties through the API.
MAMAExpDLL mama_status mama_loadBridgeWithPath(mamaBridge *impl, const char *middleware, const char *path)
Load the bridge specified by middleware string using the path specified by the user.
MAMAExpDLL mama_status mama_stop(mamaBridge bridgeImpl)
Stop dispatching on the default event queue for the specified bridge.
mama_status mama_setDefaultPayload(char id)
The Mama data type provides methods global initialization and manipulating global options...
MAMAExpDLL mama_status mama_getUserName(const char **userName)
mama_getUserName - gets the user name
struct mamaPayloadBridgeImpl_ * mamaPayloadBridge
Definition: types.h:74
void(MAMACALLTYPE * mamaStartCB)(mama_status status)
The callback invoked if an error occurs calling mama_startBackground() or when mama_startBackground()...
Definition: mama.h:324
MAMAExpDLL mama_status mama_start(mamaBridge bridgeImpl)
Start processing messages on the internal queue.
MAMAExpDLL mama_status mama_addStatsCollector(mamaStatsCollector statsCollector)
Add a user stats collector.
struct mamaBridgeImpl_ * mamaBridge
Definition: types.h:69
MAMAExpDLL const char * mama_getProperty(const char *name)
Retrieve a specific property from the API.
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...
MAMAExpDLL const char * mama_getVersion(mamaBridge bridgeImpl)
Return the version information for the library.
MAMAExpDLL mama_status mama_getIpAddress(const char **ipAddress)
mama_getIpAddressName - gets the IP Address
MAMAExpDLL mama_status mama_open(void)
mama_status mama_open (void)
MAMAExpDLL mama_status mama_startBackground(mamaBridge bridgeImpl, mamaStartCB callback)
Start Mama in the background.
struct mamaQueueImpl_ * mamaQueue
Definition: types.h:107
struct mamaStatsCollectorImpl_ * mamaStatsCollector
Definition: types.h:125
MAMAExpDLL const char * mama_getLastErrorText(void)
Get the text of the last error to have occurred in Mama.
MAMAExpDLL mama_status mama_loadPayloadBridge(mamaPayloadBridge *bridge, const char *payloadName)
MAMAExpDLL mama_status mama_getApplicationName(const char **applicationName)
mama_getApplicationName - gets the mama application name
MAMAExpDLL mama_status mama_stopAll(void)
Stop dispatching on the default event queue for all bridges.
MAMAExpDLL mama_status mama_setApplicationClassName(const char *className)
mama_setApplicationClass - sets the mama class name This should be called before mama_open ...
void(MAMACALLTYPE * mamaStopCB)(mama_status)
Callback invoked when default thread for middleware has finished processing.
Definition: mama.h:329
MAMAExpDLL mama_status mama_getDefaultEventQueue(mamaBridge bridgeImpl, mamaQueue *defaultQueue)
Get a reference to the internal default event queue in use for the specified middleware.
mama_status
Definition: status.h:37
MAMAExpDLL mama_status mama_loadBridge(mamaBridge *impl, const char *middleware)
Load the bridge specified by middleware string.
MAMAExpDLL mamaError mama_getLastErrorCode(void)
Get the code of the last error to have occurred in Mama.
MAMAExpDLL mama_status mama_getApplicationClassName(const char **className)
mama_getApplicationClass - sets the mama class name
MAMAExpDLL mama_status mama_setProperty(const char *name, const char *value)
Set a specific property for the API.
MAMAExpDLL mama_status mama_openWithProperties(const char *path, const char *filename)
Initialize MAMA.
MAMAExpDLL mama_status mama_setApplicationName(const char *applicationName)
mama_setApplicationName - sets the mama application name This should be called before mama_open ...
MAMAExpDLL mama_status mama_startBackgroundEx(mamaBridge bridgeImpl, mamaStopCBEx callback, void *closure)
Start Mama in the background, with extended parameters.
enum mamaError_ mamaError


© 2012 Linux Foundation