Apama Capital Markets Foundation  10.11.0.0
SM_SessionInterface.h
Go to the documentation of this file.
1 
11 #ifndef _AP_SESSION_MANAGERINTERFACE_H
12 #define _AP_SESSION_MANAGERINTERFACE_H
13 
14 /* The timestamp tags are tempararily allocated
15  These corresponding space should be allocated in the AP_TimestampSet.h
16 
17  AP_TIMESTAMP_UPSTREAM_SESSION_ENTRY 19851
18  AP_TIMESTAMP_UPSTREAM_SESSION_EXIT 19800
19 
20  AP_TIMESTAMP_DOWNSTREAM_SESSION_ENTRY 1151
21  AP_TIMESTAMP_DOWNSTREAM_SESSION_EXIT 1200
22 */
23 
24 //Apama includes
25 #include <CHashMap.h>
26 #include <EventTransport.h>
27 #include <limits.h>
28 #if defined(_APBUILD_WIN32_ALL__) || defined(__WIN32__) || defined(WIN32)
29 /*
30  * DLL import/export symbols for Win32 builds. Everything will work correctly
31  * as long as the following symbols are *not* defined when this file is
32  * included (These symbols are for Apama internal use only):
33  * AP_SESSION_BACKEND
34  *
35  */
36 
37 #ifndef _APBUILD_WIN32_ALL__
38 #define _APBUILD_WIN32_ALL__
39 #endif
40 
41 #ifdef AP_SESSION_BACKEND
42 #define AP_SESSION_API __declspec(dllexport)
43 #define AP_SESSION_CALL __stdcall
44 #else
45 #define AP_SESSION_API __declspec(dllimport)
46 #define AP_SESSION_CALL __stdcall
47 #endif
48 
49 #elif defined(_APBUILD_UNIX_ALL__) || defined(__unix__)
50 
51 #define AP_SESSION_API
52 #define AP_SESSION_CALL
53 #else
54 #error "Can't determine platform: try #define _APBUILD_WIN32_ALL__ or _APBUILD_UNIX_ALL__"
55 
56 #endif
57 
63 #define STREAMTYPE_BBA ("com.apama.md.BBA")
64 #define STREAMTYPE_TRADE ("com.apama.md.T")
65 #define STREAMTYPE_MBP ("com.apama.md.D")
66 #define STREAMTYPE_MBO ("com.apama.md.O")
67 #define STREAMTYPE_EP ("com.apama.md.EP")
68 #define STREAMTYPE_QUOTEBOOK ("com.apama.md.QB")
69 #define STREAMTYPE_NEWS ("com.apama.md.N") // end of session_capabilities
71 
80 typedef struct
81 {
94  void (*onCorrelatorWatchDogTimedOut)(void* transportInternals);
95 
111  void (*onSessionRegistrationSuccess)(void* transportInternals, const char* sessionName, AP_int64 sourceId, AP_TimestampSet *tss);
112 
127  void (*onSessionRegistrationError)(void* transportInternals, const char* sessionName, AP_TimestampSet *tss);
128 
149  void (*onSessionStart)(void* transportInternals, AP_int64 sourceId, HashMap* configParams, AP_TimestampSet *tss);
150 
173  void (*onSessionStop) (void* transportInternals, AP_int64 sourceId, AP_TimestampSet *tss);
174 
190  void (*onSessionReconfigure)(void* transportInternals, AP_int64 sourceId, HashMap* configParams, AP_TimestampSet *tss);
191 
206  void (*onSessionReset)(void* transportInternals, const char* transportName, AP_TimestampSet* tss);
207 }
209 
218 typedef struct
219 {
222  void *reserved;
223 }
225 
229 typedef enum
230 {
231  /* Maintain sequence */
239 }
241 
242 #if defined( __cplusplus )
243 extern "C"{
244 #endif
245 
262  AP_SESSION_API void AP_SESSION_Init(AP_SESSION_AdapterInterface* adapterInterface, void* transportInternals, AP_SESSION_Interface** smi);
263 
272  AP_SESSION_API void AP_SESSION_DeInit(AP_SESSION_Interface* smi);
273  // end of session_init_api
275 
296  AP_SESSION_API void AP_SESSION_AddSession(
298  const char* transportName,
299  const char* sessionName,
300  const char* channelName,
301  const char* description);
302 
321  AP_SESSION_API void AP_SESSION_AddSessionParams(
322  AP_SESSION_Interface * smi,
323  const char* sessionName,
324  const char* paramName,
325  const char* type,
326  const char* defaultValue,
327  const char *const allowValues[],
328  size_t allowsize,
329  const char* description,
330  AP_bool required,
331  AP_bool referenceOnly); // end of session_add_api
333 
352  AP_SESSION_API void AP_SESSION_AddCapabilities(AP_SESSION_Interface* smi, const char* sessionName, const char *const capabilities[], size_t capsSize);
353 
372  AP_SESSION_API void AP_SESSION_AddCapabilityParams(
373  AP_SESSION_Interface * smi,
374  const char* sessionName,
375  const char* streamName,
376  const char* key,
377  const char* type,
378  const char* defaultValue,
379  const char* const allowedValues[],
380  size_t allowsize,
381  const char* description,
382  AP_bool required);
383 
396  AP_SESSION_API void AP_SESSION_AddCapabilitiesById(AP_SESSION_Interface* smi, AP_int64 sourceId, const char *const capabilities[], size_t capsSize);
397 
416  AP_SESSION_API void AP_SESSION_AddCapabilityParamsById(
417  AP_SESSION_Interface * smi,
418  AP_int64 sourceId,
419  const char* streamName,
420  const char* key,
421  const char* type,
422  const char* defaultValue,
423  const char* const allowedValues[],
424  size_t allowsize,
425  const char* description,
426  AP_bool required);
427 
437  AP_SESSION_API AP_bool AP_SESSION_HasCapability(AP_SESSION_Interface* smi, const AP_int64 sourceId, const char* capability); // end of session_register_api
439 
453  AP_SESSION_API void AP_SESSION_RegisterSessions(AP_SESSION_Interface* smi);
454 
464  AP_SESSION_API void AP_SESSION_RegisterSession(AP_SESSION_Interface* smi, const char* sessionName); // end of session_register_api
466 
478  AP_SESSION_API void AP_SESSION_DeleteSessionByName(AP_SESSION_Interface* smi, const char* sessionName);
479 
486  AP_SESSION_API void AP_SESSION_DeleteSessionById(AP_SESSION_Interface* smi, AP_int64 sourceId);
487 
493  AP_SESSION_API void AP_SESSION_Clear(AP_SESSION_Interface* smi); // end of session_delete_api
495 
496  /* Manipulate the session states */
497 
512  AP_SESSION_API void AP_SESSION_SetSessionStateByName(AP_SESSION_Interface* smi, const char* sessionName, AP_SESSION_State state, bool generateNewId = false);
513 
522  AP_SESSION_API void AP_SESSION_SetSessionStateById(AP_SESSION_Interface* smi, AP_int64 sourceId, AP_SESSION_State state, bool generateNewId = false);
523 
532  AP_SESSION_API AP_SESSION_State AP_SESSION_GetSessionStateByName(AP_SESSION_Interface* smi, const char* sessionName);
533 
542  AP_SESSION_API AP_SESSION_State AP_SESSION_GetSessionStateById(AP_SESSION_Interface* smi, AP_int64 sourceId);
543 
551  AP_SESSION_API HashMap * AP_SESSION_GetAllSessionStates(AP_SESSION_Interface* smi); // end of session_state_api
553 
562  AP_SESSION_API void AP_SESSION_SetCorrelatorHBTimeout(AP_SESSION_Interface* smi, int timeoutInterval);
563 
574  AP_SESSION_API void AP_SESSION_GenerateIAFStatus(AP_SESSION_Interface* smi, AP_NormalisedEvent *nevent);
575 
585  AP_SESSION_API int AP_SESSION_ProcessEvent(AP_SESSION_Interface* smi, AP_TransportEvent event, AP_TimestampSet* tss);
586 
595  AP_SESSION_API void AP_SESSION_SetDecoder(AP_SESSION_Interface* smi, AP_EventDecoder* decoder);
596 
611  AP_SESSION_API void AP_SESSION_SessionStartSuccess(AP_SESSION_Interface* smi, AP_int64 sourceId, AP_TimestampSet* tss);
612 
623  AP_SESSION_API void AP_SESSION_SessionStartError(AP_SESSION_Interface* smi, AP_int64 sourceId, const char* errMsg, AP_TimestampSet* tss);
624 
634  AP_SESSION_API void AP_SESSION_SessionStopSuccess(AP_SESSION_Interface* smi, AP_int64 sourceId, AP_TimestampSet* tss);
635 
646  AP_SESSION_API void AP_SESSION_SessionStopError(AP_SESSION_Interface* smi, AP_int64 sourceId, const char* errMsg, AP_TimestampSet* tss);
647 
657  AP_SESSION_API void AP_SESSION_SessionReconfigureSuccess(AP_SESSION_Interface* smi, AP_int64 sourceId, AP_TimestampSet* tss);
658 
669  AP_SESSION_API void AP_SESSION_SessionReconfigureError(AP_SESSION_Interface* smi, AP_int64 sourceId, const char* errMsg, AP_TimestampSet* tss); // end of session_callbacks_api
671 
680  AP_SESSION_API const char* AP_SESSION_GetSessionName(AP_SESSION_Interface* smi, AP_int64 sourceId);
681 
690  AP_SESSION_API AP_int64 AP_SESSION_GetSessionId(AP_SESSION_Interface* smi, const char* sessionName);
691 
698  AP_SESSION_API void AP_SESSION_LogLatency(AP_SESSION_Interface* smi, IAF_TimestampConfig* config);
699 
707  AP_SESSION_API void AP_SESSION_Stop(AP_SESSION_Interface* smi);
708 
716  AP_SESSION_API void AP_SESSION_Start(AP_SESSION_Interface* smi);
717 
718 #if defined( __cplusplus )
719 } // extern "C"
720 #endif
721 
722 
723 #endif //_AP_SESSION_MANAGERINTERFACE_H
AP_SESSION_API AP_bool AP_SESSION_HasCapability(AP_SESSION_Interface *smi, const AP_int64 sourceId, const char *capability)
AP_SESSION_API void AP_SESSION_AddCapabilityParams(AP_SESSION_Interface *smi, const char *sessionName, const char *streamName, const char *key, const char *type, const char *defaultValue, const char *const allowedValues[], size_t allowsize, const char *description, AP_bool required)
AP_SESSION_API const char * AP_SESSION_GetSessionName(AP_SESSION_Interface *smi, AP_int64 sourceId)
AP_SESSION_AdapterInterface * adapterInterface
Definition: SM_SessionInterface.h:220
AP_SESSION_API void AP_SESSION_Init(AP_SESSION_AdapterInterface *adapterInterface, void *transportInternals, AP_SESSION_Interface **smi)
AP_SESSION_API AP_SESSION_State AP_SESSION_GetSessionStateByName(AP_SESSION_Interface *smi, const char *sessionName)
AP_SESSION_API void AP_SESSION_DeleteSessionByName(AP_SESSION_Interface *smi, const char *sessionName)
AP_SESSION_API void AP_SESSION_DeleteSessionById(AP_SESSION_Interface *smi, AP_int64 sourceId)
AP_SESSION_API void AP_SESSION_SessionStartError(AP_SESSION_Interface *smi, AP_int64 sourceId, const char *errMsg, AP_TimestampSet *tss)
AP_SESSION_State
Definition: Connectivity_SessionDefs.h:31
AP_SESSION_API void AP_SESSION_SetDecoder(AP_SESSION_Interface *smi, AP_EventDecoder *decoder)
AP_SESSION_API void AP_SESSION_SetSessionStateById(AP_SESSION_Interface *smi, AP_int64 sourceId, AP_SESSION_State state, bool generateNewId=false)
Definition: SM_SessionInterface.h:233
AP_SESSION_API int AP_SESSION_ProcessEvent(AP_SESSION_Interface *smi, AP_TransportEvent event, AP_TimestampSet *tss)
Definition: SM_SessionInterface.h:218
AP_SESSION_API void AP_SESSION_Stop(AP_SESSION_Interface *smi)
AP_SESSION_API void AP_SESSION_SessionStartSuccess(AP_SESSION_Interface *smi, AP_int64 sourceId, AP_TimestampSet *tss)
AP_SESSION_API void AP_SESSION_Start(AP_SESSION_Interface *smi)
AP_SESSION_API void AP_SESSION_SetSessionStateByName(AP_SESSION_Interface *smi, const char *sessionName, AP_SESSION_State state, bool generateNewId=false)
Definition: SM_SessionInterface.h:235
AP_SESSION_API void AP_SESSION_SessionStopSuccess(AP_SESSION_Interface *smi, AP_int64 sourceId, AP_TimestampSet *tss)
AP_SESSION_API void AP_SESSION_AddSession(AP_SESSION_Interface *smi, const char *transportName, const char *sessionName, const char *channelName, const char *description)
AP_SESSION_State
Definition: SM_SessionInterface.h:229
AP_SESSION_API void AP_SESSION_LogLatency(AP_SESSION_Interface *smi, IAF_TimestampConfig *config)
AP_SESSION_API void AP_SESSION_RegisterSession(AP_SESSION_Interface *smi, const char *sessionName)
Definition: SM_SessionInterface.h:80
Definition: SM_SessionInterface.h:237
AP_SESSION_API void AP_SESSION_SetCorrelatorHBTimeout(AP_SESSION_Interface *smi, int timeoutInterval)
AP_SESSION_API void AP_SESSION_RegisterSessions(AP_SESSION_Interface *smi)
Definition: SM_SessionInterface.h:234
AP_SESSION_API void AP_SESSION_DeInit(AP_SESSION_Interface *smi)
Definition: SM_SessionInterface.h:232
AP_SESSION_API AP_SESSION_State AP_SESSION_GetSessionStateById(AP_SESSION_Interface *smi, AP_int64 sourceId)
AP_SESSION_API void AP_SESSION_Clear(AP_SESSION_Interface *smi)
Definition: SM_SessionInterface.h:236
AP_SESSION_API void AP_SESSION_SessionStopError(AP_SESSION_Interface *smi, AP_int64 sourceId, const char *errMsg, AP_TimestampSet *tss)
void * transportInternals
Definition: SM_SessionInterface.h:221
AP_SESSION_API void AP_SESSION_GenerateIAFStatus(AP_SESSION_Interface *smi, AP_NormalisedEvent *nevent)
AP_SESSION_API AP_int64 AP_SESSION_GetSessionId(AP_SESSION_Interface *smi, const char *sessionName)
AP_SESSION_API void AP_SESSION_SessionReconfigureSuccess(AP_SESSION_Interface *smi, AP_int64 sourceId, AP_TimestampSet *tss)
AP_SESSION_API void AP_SESSION_AddCapabilityParamsById(AP_SESSION_Interface *smi, AP_int64 sourceId, const char *streamName, const char *key, const char *type, const char *defaultValue, const char *const allowedValues[], size_t allowsize, const char *description, AP_bool required)
Definition: SM_SessionInterface.h:238
AP_SESSION_API void AP_SESSION_AddSessionParams(AP_SESSION_Interface *smi, const char *sessionName, const char *paramName, const char *type, const char *defaultValue, const char *const allowValues[], size_t allowsize, const char *description, AP_bool required, AP_bool referenceOnly)
AP_SESSION_API void AP_SESSION_AddCapabilitiesById(AP_SESSION_Interface *smi, AP_int64 sourceId, const char *const capabilities[], size_t capsSize)
AP_SESSION_API void AP_SESSION_AddCapabilities(AP_SESSION_Interface *smi, const char *sessionName, const char *const capabilities[], size_t capsSize)
AP_SESSION_API void AP_SESSION_SessionReconfigureError(AP_SESSION_Interface *smi, AP_int64 sourceId, const char *errMsg, AP_TimestampSet *tss)
AP_SESSION_API HashMap * AP_SESSION_GetAllSessionStates(AP_SESSION_Interface *smi)