PubSub+ Messaging API For C  7.29.0.6
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ex/common.h
#ifndef COMMON_H_
#define COMMON_H_
#include "os.h"
#define COMMON_MY_SAMPLE_TOPIC "my/sample/topic"
#define COMMON_SEMP_TOPIC_FORMAT "#SEMP/%s/SHOW"
#define COMMON_TESTQ "my_sample_queue"
#define COMMON_TESTDTE "my_sample_topicendpoint"
#define COMMON_DMQ_NAME "#DEAD_MSG_QUEUE"
#define COMMON_ATTACHMENT_TEXT "my attached data"
enum flowMode
{
SUBSCRIBER = 0,
QUEUE = 1,
TE = 2,
DIRECT = 3
};
#define HOST_PARAM_MASK 0x0001
#define USER_PARAM_MASK 0x0002
#define DEST_PARAM_MASK 0x0004
#define PASS_PARAM_MASK 0x0008
#define CACHE_PARAM_MASK 0x0010
#define DURABLE_MASK 0x0020
#define NUM_MSGS_MASK 0x0040
#define MSG_RATE_MASK 0x0080
#define WINDOW_SIZE_MASK 0x0100
#define LOG_LEVEL_MASK 0x0200
#define USE_GSS_MASK 0x0400
#define ZIP_LEVEL_MASK 0x0800
#define REPLAY_START_MASK 0x1000
#define HOST_PARAM_STRING "\t-c, --cip=[Protocol:]Host[:Port] Protocol, host and port of the messaging appliance (e.g. --cip=tcp:192.168.160.101).\n"
#define USER_PARAM_STRING "\t-u, --cu=user[@vpn] Client username and Mesage VPN name. The VPN name is optional and\n"\
"\t only used in a Solace messaging appliance running SolOS-TR. \n"
#define DEST_PARAM_STRING "\t-t, --topic=Topic Topic or Destination String. \n"
#define PASS_PARAM_STRING "\t-p, --cp=password Client password. \n"
#define CACHE_PARAM_STRING "\t-a, --cache Distributed Cache Name.\n"
#define DURABLE_STRING "\t-d, --durable Use durable endpoint (default: temporary)\n"
#define NUM_MSGS_STRING "\t-n, --mn Number of Messages.\n"
#define MSG_RATE_STRING "\t-r, --mr Message Rate.\n"
#define WINDOW_SIZE_STRING "\t-w, --win Window Size.\n"
#define LOG_LEVEL_STRING "\t-l, --log=loglevel API and application logging level (debug, info, notice, warn, error, critical).\n"
#define USE_GSS_STRING "\t-g, --gss Use GSS (Kerberos) authentication. When specified the '--cu' option is ignored.\n"
#define ZIP_LEVEL_STRING "\t-z, --zip Enable compression (set compress level=9 for SolOS-TR appliances only).\n"
#define REPLAY_START_STRING "\t-R, --replay=replay Replay Start Location String (BEGINNING or RFC3339 time stamp).\n"
struct commonOptions
{
char targetHost[256];
char destinationName[SOLCLIENT_BUFINFO_MAX_TOPIC_SIZE + 1];
char replayStartLocation[250];
BOOL usingTopic;
BOOL usingAD;
int numMsgsToSend;
int msgRate;
int gdWindow;
int requiredFields;
int optionalFields;
BOOL usingDurable;
BOOL enableCompression;
BOOL useGSS;
};
void
common_printCCSMPversion ( );
void
common_handleError ( solClient_returnCode_t rc, const char *errorStr );
void
common_parseUsernameAndVpn ( const char *inName, char *outUsername, size_t usernameLen, char *outVpn, size_t vpnLen );
int
common_parseCommandOptions ( int argc, charPtr32 *argv, struct commonOptions *copt, const char *positionalDesc );
common_createAndConnectSession ( solClient_opaqueContext_pt context_p,
void *user_p, struct commonOptions *commonOpts );
/*****************************************************************************
* common_createQueue
*****************************************************************************/
common_createQueue ( solClient_opaqueSession_pt session_p, const char *queueName_p );
/*****************************************************************************
* common_deleteQueue
*****************************************************************************/
common_deleteQueue ( solClient_opaqueSession_pt session_p, const char *queueName_p );
common_publishMessage ( solClient_opaqueSession_pt session_p, char *topic_p, solClient_uint32_t deliveryMode );
void
common_cacheEventCallback ( solClient_opaqueSession_pt opaqueSession_p, solCache_eventCallbackInfo_pt eventInfo_p, void *user_p );
void
common_eventCallback ( solClient_opaqueSession_pt opaqueSession_p,
solClient_session_eventCallbackInfo_pt eventInfo_p, void *user_p );
void
common_eventPerfCallback ( solClient_opaqueSession_pt opaqueSession_p,
solClient_session_eventCallbackInfo_pt eventInfo_p, void *user_p );
void
common_flowEventCallback ( solClient_opaqueFlow_pt opaqueFlow_p, solClient_flow_eventCallbackInfo_pt eventInfo_p, void *user_p );
common_flowMessageReceiveCallback ( solClient_opaqueFlow_pt opaqueFlow_p, solClient_opaqueMsg_pt msg_p, void *user_p );
common_flowMessageReceiveAckCallback ( solClient_opaqueFlow_pt opaqueFlow_p, solClient_opaqueMsg_pt msg_p, void *user_p );
void
common_initCommandOptions ( struct commonOptions *commonOpt,
int requiredParams,
int optionals);
common_flowMessageReceivePrintMsgCallback ( solClient_opaqueFlow_pt opaqueFlow_p, solClient_opaqueMsg_pt msg_p, void *user_p );
common_flowMessageReceivePrintMsgAndAckCallback ( solClient_opaqueFlow_pt opaqueFlow_p, solClient_opaqueMsg_pt msg_p, void *user_p );
common_messageReceiveCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
common_messageReceivePrintMsgCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
common_messageReceivePerfCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
typedef struct contextThreadInfo
{
volatile int contextThreadStarted;
volatile int stopContextThread;
int rc;
THREAD_HANDLE_T handle;
} contextThreadInfo_t;
typedef struct threadInfo
{
volatile int threadStarted;
volatile int stopThread;
int rc;
THREAD_HANDLE_T handle;
void *user_p;
} threadInfo_t;
int common_startContextThread ( contextThreadInfo_t * info_p );
int common_startThread ( threadFn_pt threadFunction, void *user_p, threadInfo_t * info_p );
void common_stopContextThread ( contextThreadInfo_t * info_p );
void common_stopThread ( threadInfo_t * info_p );
#endif /* COMMON_H_ */