#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 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
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 );
void *user_p, struct commonOptions *commonOpts );
void
void
void
void
void
common_initCommandOptions ( struct commonOptions *commonOpt,
int requiredParams,
int optionals);
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