diff --git a/APIG/Makefile b/APIG/Makefile new file mode 100644 index 0000000..e09be09 --- /dev/null +++ b/APIG/Makefile @@ -0,0 +1,75 @@ +LOCATION=authoring +# +# Add other locations and move target differences into the macros as needed +# +CC=g++ +Cc=gcc + + BOSTLIB=-L/usr/lib/boost + BOSINCL=-L/usr/include/boost + LOG4LIB=-L/usr/lib + +SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) -l boost_system -l boost_thread -l log4cpp + +ifeq ($(LOCATION),authoring) +SINCL= -I include -I /usr/include/log4cpp $(BOSINCL) +CFLAGS= -DCURRENT_DEBUG=1000 +endif + +CLIBS= -L$(USRLIB) + +CLFLAGS= -Wall -Wundef -Wpointer-arith -Wshadow \ + -Wcast-align -Winline -Wmissing-declarations -Wredundant-decls \ + -Wmissing-prototypes -Wnested-externs \ + -Wstrict-prototypes -Waggregate-return -Wno-implicit + +ACOBJS= build/cliever.o build/cdLogger.o build/clientDaemonConfig.o build/clientDaemon.o + +# --- targets +# + +ifeq ($(LOCATION),authoring) +all: cliever +endif + +cliever: build/cliever + +.c.o: + $(Cc) -c $(CLFLAGS) -o $< + +build/cdLogger.o: client/cdLogger.cpp include/cdLogger.h + $(CC) $(CFLAGS) client/cdLogger.cpp -c -o build/cdLogger.o $(SINCL) + +build/cliever.o: client/ausreg-cd.cpp include/*.h + $(CC) $(CFLAGS) client/ausreg-cd.cpp -c -o build/cliever.o $(SINCL) + +build/clientDaemonConfig.o: client/clientDaemonConfig.cpp include/*.h + $(CC) $(CFLAGS) client/clientDaemonConfig.cpp -c -o build/clientDaemonConfig.o $(SINCL) + +build/masterDaemon.o: client/clientDaemon.cpp include/*.h + $(CC) $(CFLAGS) client/clientDaemon.cpp -c -o build/clientDaemon.o $(SINCL) + +build/ausreg-cd: $(ACOBJS) + $(CC) $(CFLAGS) -o build/ausreg-cd $(SINCL) $(LIBS) $(ACOBJS) $(SLIBS) + +doxygen/index.html: etc/doxygen.config + doxygen etc/doxygen.config + +# --- rebuild on copy to a new host +distclean: + clrbak + rm -rf build + rm -rf doxygen + mkdir doxygen + mkdir build + touch etc/doxygen.config + +clean: + clrbak + find ./build -name "*.o" -print | perl -ne "print;chop;unlink" + find ./build -name "*.rpo" -print | perl -ne "print;chop;unlink" + rm build/drde-cliever + + + + diff --git a/APIG/client/apig-cli.cpp b/APIG/client/apig-cli.cpp new file mode 100644 index 0000000..120f061 --- /dev/null +++ b/APIG/client/apig-cli.cpp @@ -0,0 +1,108 @@ +/*! \brief mdclient + * Master Daemon standalone client + * + * This MD sample client driver has the same functionality as the + * xmlrpc-c xmlrpc command line utility program but additionally + * runs a test suite using the test harness reused from the + * xmlrpc-c cpp test. + * + * Client interfaces are automatically generated when the server + * is compiled from the current server API so this program should + * be run to verify and currently the coding of test cases is + * entirely manual. + * + * \todo DLL packaging supplying the client functionality used here. + * + */ + +#define MDCLIENTMAIN +#include "mdclient.h" + +using namespace std; + +main(int argc, char **argv) { + + char debug[10]; + int rc; + + cout << "mdclient compiled " __DATE__ " " __TIME__ " \n"; + + if (argc < 3 ) { + + cerr << "Usage: apig-cli \n\nwhere\n\n" + " = . defaults to '" MD_SERVER_URL "'\n" + " = . defaults to '" DEFAULT_DEVICE "'\n" + " = 'n' or 'N'\n\n" + + "The master daemon must be running at the specified .\n" + " = n causes non-repeatable testbucket(s) to be skipped.\n" + "Any other 3rd ooption causes a simple connectivity test and exit.\n" + "Otherwise performs the full MD core API test suite.\n\n"; + + // "If XMLRPC_TRACE_XML is defined will pause " << + // PAUSE_SECS << " at selected points in the tests.\n\n"; + exit(1); + + } + + phase = string("setup"); + if (argc > 3) { + if (*argv[3] == 'n' || *argv[3] == 'N') repeatableOnly = true; + else doSanityCheck = true; + } + defaultDevice = (*argv[1] == '.') ? DEFAULT_DEVICE : argv[1]; + serverURL = (*argv[2] == '.') ? MD_SERVER_URL : argv[2]; + + if (doSanityCheck) { + + cout << "Doing sanity check with simple client: get a handle for " << defaultDevice << " from " << serverURL << "\n"; + + string const serverUrl(serverURL); + string const methodName("device.registeR"); + + xmlrpc_c::clientSimple monClient; + xmlrpc_c::value result; + + monClient.call(serverUrl, methodName, "is", &result, 0, DEFAULT_DEVICE); + + int const handle((xmlrpc_c::value_int(result))); + + if ((mdServerHandle=handle) <= 0) + {cout << serverURL << " returned: " << handle << " instead of a valid handle.\n" + " Run terminates in error.\n"; + exit(1); + } + + cout << "Got " << defaultDevice << " handle: " << handle << "\n"; + cout << "Sanity check completed OK.\n"; + exit(0); + + } + + mdCoreAPITestSuite tests; + + try { + + xmlrpc_env_init(&env); + xmlrpc_client_setup_global_const(&env); + xmlrpc_client_init2(&env, 0, "mdclient", "1.0", NULL, 0); + + tests.run(0); + + } catch(exception const& e) { + cout << "During " << phase << " caught std exception: " << e.what() << "\n"; + cout << "Terminating in error.\n" ; + rc = 1; + } + catch(XmlRpcFault const& e) { + cout << "XmlRpcFault during " << phase << ": " << e.getFaultString() << "\n"; + cout << "Terminating in error.\n" ; + rc = 1; + } + + cout << tests.tests << " Variation(s).\n" + << tests.failures << " Failure(s).\n"; + + return rc; +} + diff --git a/APIG/client/ausreg-cd.cpp b/APIG/client/ausreg-cd.cpp new file mode 100644 index 0000000..d52fa77 --- /dev/null +++ b/APIG/client/ausreg-cd.cpp @@ -0,0 +1,232 @@ +#define CD_MAIN +#include "ausreg-cd.h" + +#include +#include +#include +#include + + bool cdHasKb; + char cdOrKbValue; +const char *cdOrKb=&cdOrKbValue; + +using namespace std; + +/* + * This is the shell for the Unix Client Server (Cliever) daemon. + * There is a different shell for the Windows Service. + * + */ + void runCommander(); + void setSignals(); + void signal_handler(int); + void usage(); + +using namespace boost::interprocess; +using namespace std; + +void aucClientServer() { // AKA "Cliever" + + int i,lfp; + char str[10]; + + thisConfig->daemonProcess = fork(); + if (thisConfig->daemonProcess < 0) { + puts("Can't initialize process!"); + exit(1); + } + if (thisConfig->runCommander && getpid() == thisConfig->shellProcess) + {setSignals(); runCommander();} + setsid(); /* obtain a new process group */ + i=open("/dev/null",O_RDWR); dup(i); dup(i); /* handle standard I/O */ + umask(027); /* set newly created file permissions */ + chdir(RUNNING_DIR); /* change running directory */ + lfp=open(CD_LOCK_FILE,O_RDWR|O_CREAT,0640); + if (lfp<0) {puts("Can't open lockfile!"); exit(1);} + if (lockf(lfp,F_TLOCK,0)<0) + {puts("Can't lock lockfile!"); exit(0);} + shared_memory_object shm(open_only, "auc-cd-global", read_write); + mapped_region aucCDglobal(shm, read_write); + gm = (auc_cd_global *)aucCDglobal.get_address(); + if (strcmp(gm->id,"auc-cd")) // Same deal + {theseLogs.logN(0,"Daemon couldn't identify global memory. Bye."); exit(1);} + gm->daemon_pid = getpid(); + sprintf(str,"%d",getpid()); + theseLogs.logN(1,"auc-cd running (%s)",str); + strcat(str,"\n"); + write(lfp,str,strlen(str)); /* record pid to lockfile */ + setSignals(); + + theseLogs.init("auc-cd"); + theseLogs.logN(0,CD_NAME " " CD_VERSION " compiled on " __DATE__ " @ " __TIME__); + theseLogs.logN(3,"Cliever processing(%d) begins for devices on port %s to MD at %s.",getpid(),thisConfig->telemetryPortStr.c_str(),thisConfig->mdAddress.c_str()); + + if (cdHasKb) { + thisConfig->clipsProcess = fork(); + if (thisConfig->clipsProcess < 0) { + puts("Can't initialize CLIPS--!"); + exit(1); + } + if (getpid() != gm->daemon_pid) { +#if defined(MD_MAND) + theseLogs.logN(0,"Creating CLIPS Environment."); + DACLIPS::init(); +#endif + } + } + + try { + + boost::thread cliever(runCliever); + boost::thread dataLayer(runDataLayer); + + if (!dataLayer.joinable() || !cliever.joinable()) { + if (!dataLayer.joinable()) + theseLogs.logN(0,"Failed to start data layer, auc-cd process will terminate."); + if (!cliever.joinable()) + theseLogs.logN(0,"Failed to start client-server, auc-cd process will terminate."); + } + else { + theseLogs.logN(0,"Cliever started OK."); + dataLayer.join(); + theseLogs.logN(0,"auc-cd EOJ."); + } + + } + catch (std::exception &e) + { + theseLogs.logN(1,"Exception: %s",e.what()); + } + catch (...) { + theseLogs.logN(0,"General fault."); + } + + exit(thisCliever->rc); + +} +int main(int const argc, const char ** const argv) +{ + const char *exeName,*banner = "\n" CD_NAME " " CD_VERSION " compiled on " __DATE__ " @ " __TIME__ " (%d)\n"; + int mthParm, rc = OK; + + thisCliever = NULL; + + cdHasKb = strstr(argv[0],"clips") ? true : false; + cdOrKbValue = cdHasKb ? 'd' : 'D'; // d == kb enabled, D = !d + + //RAII constructor/destructor + struct shm_remove + { + shm_remove() { shared_memory_object::remove("auc-cd-global"); } + ~shm_remove() { shared_memory_object::remove("auc-cd-global"); } + } remover; + + shared_memory_object shm(create_only, "auc-cd-global", read_write); + shm.truncate(CD_GLOBAL_SIZE); + mapped_region aucCDglobal(shm, read_write); + memset(aucCDglobal.get_address(), 0, aucCDglobal.get_size()); + gm = (auc_cd_global *)aucCDglobal.get_address(); + strcpy(gm->id,"auc-cd"); + strcmp(gm->id,"auc-cd"); // Will segfault if there is a problem so catches are are futile. + // But the signal trap will catch the fault. + + thisConfig = new clientDaemonConfig(); + thisConfig->shellProcess = getpid(); + strcpy(thisConfig->origCmd,argv[0]); + + if (argc < 2 || argc > 7) usage(); + + thisConfig->telemetryPort = atoi(argv[1]); + if (thisConfig->telemetryPort < 1000 || thisConfig->telemetryPort > 65535) + { + std::cerr << "The value is invalid.\n"; + exit(1); + } + thisConfig->telemetryPortStr = std::string(argv[1]); + for (mthParm=2;mthParm < argc;mthParm++) { + if (*argv[mthParm] == '*') { + thisConfig->runCommander = false; + } + else + if (!strncmp(argv[mthParm],"device=",7)) { + thisConfig->deviceName = std::string(argv[mthParm]+8); + } + else + if (!strncmp(argv[mthParm],"logs=",4)) { + strcpy(thisConfig->logPath,argv[mthParm]+5); + } + else + if (!strncmp(argv[mthParm],"mdIP=",4)) { + thisConfig->mdAddress = std::string(argv[mthParm]+5); + } + else usage(); + } + + if (thisConfig->runCommander) printf(banner,thisConfig->shellProcess); + aucClientServer(); + while(!gm->graceful) sleep(2); + +} +void runCommander() { + + char msg[128]; + int i; + mdCommander commander; + + theseLogs.init("auc-cd-ui"); + theseLogs.logN(0,"Interactive command processor started."); + commander.driver(); + if (thisConfig->terminateRequest) { + theseLogs.logN(0,"Interactive shutdown requested."); + puts("auc-cd operator issued terminate command."); + kill(gm->daemon_pid,SIGTERM); + } else { + theseLogs.logN(0,"Interactive command processor ended."); + sprintf(msg,"Commander terminated, auc-cd continues (%d).",gm->daemon_pid); + puts(msg); + } + + theseLogs.logN(1,"Closing out I/O for shell process (%d)",thisConfig->shellProcess); + for (i=getdtablesize();i>=0;--i) close(i); /* close all descriptors */ + + exit(0); + +} +void setSignals() { + + signal(SIGCHLD,SIG_IGN); /* ignore child */ + signal(SIGTSTP,SIG_IGN); /* ignore tty signals */ + signal(SIGTTOU,SIG_IGN); // both input + signal(SIGTTIN,SIG_IGN); // and output + signal(SIGSEGV,signal_handler); + signal(SIGUSR1,signal_handler); // commander log messages + signal(SIGHUP,signal_handler); /* catch hangup signal */ + signal(SIGTERM,signal_handler); /* catch kill signal */ + +} +void signal_handler(int sig) +{ + switch(sig) { + case SIGSEGV: + break; + case SIGUSR1: + break; + case SIGHUP: + theseLogs.logN(0,"hangup signal caught, currently auc-cd ignores this."); + break; + case SIGTERM: + theseLogs.logN(0,"terminate signal caught, auc-cd will shutdown."); + cdShutdown termEvent; + termEvent.send(); + break; + } + +} +void usage() { + + std::cerr << "Usage: " << cdOrKb << " ['*'] [device=TEST] [mdIP=" MD_DEFAULT_IP "] [logs=\\tmp]\n\n where \n\n" + "\t is required, must be the first parameter, and must be 1000 or greater. \n" + "\t The other parameters are optional and non-positional and take the shown defaults. \n" + "\t '*', if present, indicates skip the command loop (string quotes may be required). \n"; + exit(1); +} diff --git a/APIG/client/cdLogger.cpp b/APIG/client/cdLogger.cpp new file mode 100644 index 0000000..2becddc --- /dev/null +++ b/APIG/client/cdLogger.cpp @@ -0,0 +1,182 @@ +#include "auc-cd.h" + +#include "log4cpp/Category.hh" +#include "log4cpp/Appender.hh" +#include "log4cpp/FileAppender.hh" +#include "log4cpp/Layout.hh" +#include "log4cpp/BasicLayout.hh" +#include "log4cpp/Priority.hh" + +using namespace log4cpp; + + Appender *app; + char cdLogWork[256]; + Category &root = Category::getRoot(), + &cd_core = Category::getInstance(std::string("cd_core")), + &cd_dbug = Category::getInstance(std::string("cd_dbug")), + &cd_devl = Category::getInstance(std::string("cd_devl")); + PatternLayout *layout; + +void cdLogger::init(const char *baseName) { + + const char *defaultBasename = "auc-cd-99"; + char mainLogFileName[128]; + + if (!strlen(baseName)) strcpy(mainLogFileName,defaultBasename); + else strcpy(mainLogFileName,baseName); + strcat(mainLogFileName,".log"); + + strcpy(cdLogWork,thisConfig->logPath); + strcat(cdLogWork,"/"); + strcat(cdLogWork,mainLogFileName); + strcpy(thisConfig->logPath,cdLogWork); + logPath = cdLogWork; + + app = new FileAppender("default", std::string(logPath)); + layout = new PatternLayout(); + layout->setConversionPattern("%d %p %c %x: %m%n"); + app->setLayout(layout); + + root.addAppender(app); + root.setPriority(Priority::ERROR); + + cd_core.setPriority(Priority::INFO); + cd_core.setAdditivity(true); + + cd_dbug.setPriority(Priority::DEBUG); + cd_dbug.setAdditivity(true); + + cd_devl.setPriority(Priority::NOTSET); + cd_devl.setAdditivity(true); + +} +void cdLogger::logN(int n, const char *format, ...) { + char buff[1024]; + void *args[4]; + int nthArg = 0; + va_list lm; + + va_start(lm,format); + for (;nthArg thisConfig->debugThreshold) return; + + va_start(lm,format); + for (;nthArg + +using namespace std; +using boost::asio::ip::udp; + +void hbCallback(const boost::system::error_code&); +void stream(); +void trCallback(const boost::system::error_code& error); + +void mdCliever::processEvent( const cdIncoming &dgEvent ) +{ + assert(EventSender::isSending()); + + switch(dgEvent.dg.hdr.msgType) { + case MDDG_NEWBORN: + switch(dgEvent.dg.hdr.clientType) { + case MDDEV_MD: + if (dgEvent.dg.hdr.sinkHandle) { + myHandle = dgEvent.dg.hdr.sinkHandle; + theseLogs.logN(1,"Got handle (%d) from MD. End of natal sequence for this cliever.",myHandle); + } + else if (!myHandle) + theseLogs.logN(0,"MD rejected natal sequence. Please kill me and call tech. support."); + break; + case MACHINE: + break; + case MDDEV_INSTRUMENT: + break; + } + break; + } + +} +void mdCliever::processEvent( const cdHeartbeat &thisPulse ) +{ + assert(EventSender::isSending()); + + myPulse.dg.hdr.msgSN = sentMsgCount[MDDG_HEARTBEAT][0]++; + myPulse.dg.hdr.sourceHandle = myHandle; + strcpy(myPulse.dg.payLoad,thisConfig->telemetryPortStr.c_str()); + myPulse.dg.hdr.primeOffset = strlen(thisConfig->telemetryPortStr.c_str()) + 1; + strcpy((char *)(&myPulse.dg.payLoad[strlen(myPulse.dg.payLoad)+1]),"CLIEVER"); + myPulse.dg.hdr.payloadSize = myPulse.dg.hdr.primeOffset + strlen("CLIEVER") + 1; + fg->send_to(myPulse.dg, myStdDevIdx ); + theseLogs.logNdebug(MAX_DEBUG,1,"Heartbeat (%d)",sentMsgCount[MDDG_HEARTBEAT][0]); + +} +void mdCliever::processEvent( const cdInteractiveCommand &cmdEvent ) +{ + assert(EventSender::isSending()); + +} +void mdCliever::processEvent( const cdShutdown &bye ) +{ + assert(EventSender::isSending()); + shuttingDown = true; + theseLogs.logN(0,"Shutting down: draining work for immediate exit."); + +} +void mdCliever::processEvent( const cdTelemetryFrame &thisFrame ) +{ + assert(EventSender::isSending()); + +} +void mdCliever::processEvent( const cdResponse &thisReply ) +{ + const void *queued = &thisReply; + + assert(EventSender::isSending()); + queue(new mdWQitem( queued, MD_NEWBORN, 0 )); + +} +void mdDGChannel::handle_receive_from(const boost::system::error_code& error, + size_t bytes_recvd) +{ + if (!error && bytes_recvd > 0) + { + cdIncoming incoming( *(thisCliever->bg) ); + + if (incoming.dg.hdr.clientType >= 0 && incoming.dg.hdr.clientType < N_MDDEV_TYPES) + {theseLogs.logNdebug(MAX_DEBUG,2,"msgtype %d received from a '%s'.",incoming.dg.hdr.msgType,clientTypes[incoming.dg.hdr.clientType]); + incoming.ip = p_endpoint_; + incoming.send(); + + } else + theseLogs.logNdebug(1,1,"msgtype %d received from unknown MD client type, ignored.",incoming.dg.hdr.msgType); + + } + passive_.async_receive_from( + boost::asio::buffer(data_, MD_MAX_DATAGRAM), p_endpoint_, + boost::bind(&mdDGChannel::handle_receive_from, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); + +} +void mdCliever::dispatch(mdWQitem *next) { + + switch(next->kind) { + case MD_NEWBORN: + break; + } + delete next; + +} +void mdCDHeartbeat::nextBeat(const boost::system::error_code& error) { thisCliever->myPulse.send(); } +void mdCDHeartbeat::run() { + + while (!thisCliever->shuttingDown) + {t0->async_wait(hbCallback); + if (thisCliever->myHandle) + sleep(60*MD_HEARTBEAT); + else + sleep(10*MD_HEARTBEAT); + } + +} +void hbCallback(const boost::system::error_code& error) { if (thisCliever->alive) thisCliever->pulse->nextBeat(error); } +void pulse() { + if ((thisCliever->connected=thisCliever->fg->connect_to( thisConfig->mdAddress, thisConfig->telemetryPortStr ))) + theseLogs.logNdebug(NORMAL_DEBUG,2,"Cliever connection open on: MD @ %s port %s.", thisConfig->mdAddress.c_str(),thisConfig->telemetryPortStr.c_str()); + else + theseLogs.logNdebug(NORMAL_DEBUG*2,2,"Cliever UDP socket open on: MD @ %s port %s failed.", thisConfig->mdAddress.c_str(),thisConfig->telemetryPortStr.c_str()); + if (thisCliever->connected) + thisCliever->pulse->run(); +} +void runCliever() { + + try { cb[0] = new mdCB(); + + thisCliever = new mdCliever(thisConfig); + + EventSender::add(*thisCliever); + assert(EventSender::getNumListeners() == 1); + EventSender::add(*thisCliever); + assert(EventSender::getNumListeners() == 1); + EventSender::add(*thisCliever); + assert(EventSender::getNumListeners() == 1); + EventSender::add(*thisCliever); + assert(EventSender::getNumListeners() == 1); + EventSender::add(*thisCliever); + assert(EventSender::getNumListeners() == 1); + + thisCliever->fg = new mdDGChannel( io_fg, 0 ); + + } catch(...) { + theseLogs.logNdebug(-1,0,"Unknown error in Cliever initialization block."); + } + + theseLogs.logNdebug(NORMAL_DEBUG*2,0,"Cliever instantiated, starting heartbeat and telemetry stream."); + + thisCliever->alive = true; + io_fg.run(); + theseLogs.logNdebug(0,0,"runCliever asio ended"); + +} +void runDataLayer() { + + int assertCliever; + + theseLogs.logN(1,"Spin to attach MD datalayer background on port %d ...",thisConfig->telemetryPort); + + for(assertCliever=0;!thisCliever && assertCliever < MAX_DEBUG;assertCliever++); + for(assertCliever=0;!thisCliever->alive && assertCliever < MAX_DEBUG;assertCliever++); + + try { + + thisCliever->bg = new mdDGChannel(io_bg, thisConfig->telemetryPort ); + theseLogs.logN(0,"... main bus background running."); + thisCliever->pulse = new mdCDHeartbeat(); + thisCliever->pulse->init(); + boost::thread myPulse(pulse); + assert(myPulse.joinable()); + boost::thread telemetryStream(stream); + assert(telemetryStream.joinable()); + io_bg.run(); + myPulse.join(); + telemetryStream.join(); + + } + catch (std::exception& e) + { + theseLogs.logN(1,"Fatal error in data layer bg: %s .",e.what()); + } + catch (...) + { + theseLogs.logN(0,"Unknown failure in datalayer bg."); + } + + theseLogs.logNdebug(1,0,"asio background io service ended."); + +} +void shutdown() { + + cdShutdown bye = cdShutdown(); + bye.send(); + +} +void stream() { + + boost::asio::deadline_timer t1(io_bg, boost::posix_time::seconds(MD_REFRESH)); + while (!thisCliever->shuttingDown) + {t1.async_wait(trCallback); + sleep(2*MD_REFRESH); + } + +} +void trCallback(const boost::system::error_code& error) { + + cdTelemetryFrame thisFrame; + thisFrame.send(); + +} diff --git a/APIG/client/clientDaemonConfig.cpp b/APIG/client/clientDaemonConfig.cpp new file mode 100644 index 0000000..36d7294 --- /dev/null +++ b/APIG/client/clientDaemonConfig.cpp @@ -0,0 +1,15 @@ + +#include "auc-cd.h" + +int clientDaemonConfig::loadMachineConfiguration() { + + /*! \todo add processing for predefinition of local devices + * + */ + + int rc=OK; + + return rc; + +} + diff --git a/APIG/client/commander.cpp b/APIG/client/commander.cpp new file mode 100644 index 0000000..c95ef86 --- /dev/null +++ b/APIG/client/commander.cpp @@ -0,0 +1,149 @@ +#include "auc-cd.h" + +int is_numeric(const char *p) { int i = strlen(p),j=0; + if (*p) { + char c; + while ((c=*p++)) { j++; + if (!isdigit(c)) { + if (j == i) return 2; + else return 0; + } + } + return 1; + } + return 0; +} +void mdCommander::driver() { + + bool rc; + char instrinsic[16],next,rawString[256],work[256]; + const char *mdErrCode = ""; + int i,commandLength; + + greet(); + while(acceptingInput) { + putchar('>'); + next=0; + i=0; + memset(rawString,0,sizeof(rawString)); + while(next != '\012') { + next = getchar(); + rawString[i++] = next; + if (i > (sizeof(rawString) - 1)) { + puts("Max length exceeded!"); + continue; + } + } + if (!strlen(rawString)) continue; + if (rawString[0] == '?') { + help(); + continue; + } + if (is_numeric(rawString) == 2) { + rawString[strlen(rawString)] = 0; + mdStdDevIdx = atoi(rawString); + continue; + } + if (strlen(rawString) >= 4 && strlen(rawString) <= 6 ) + {if (!strcmp(rawString,"log\n")) { + system("less /tmp/auc-cd.log"); + continue; + } + if (!strcmp(rawString,"rlog\n")) { + system(PULL_MD_LOG); + system("less auc-md.log"); + continue; + } + if (!strcmp(rawString,"clips\n")) { +#ifdef MD_MAND + +#endif + continue; + } + if (!strcmp(rawString,"done\n")) { + return; + } + if (!strcmp(rawString,"mdapi\n")) { + system("mdclient "); + continue; + } + if (!strcmp(rawString,"quit\n")) { + thisConfig->terminateRequest = true; + return; + } + if (!strcmp(rawString,"mdapi\n")) { + continue; + } + if (strlen(rawString) < 3) { + puts("That SCPI command is too short!"); + continue; + } + rc = scpi(rawString); + if (!rc) puts("Command transmitted: OK."); + else printf("Command result: %s.",mdErrCode); + continue; + } + } + +} +void mdCommander::greet() { + + puts("auc-cd command processor"); + puts("Enter ? for help or a cliever low level command"); + acceptingInput = true; + SCPImode = true; + currentDevice = std::string("ALX"); + +} +void mdCommander::help() { + + const char *banner = "\n" CD_NAME " " CD_VERSION " compiled on " __DATE__ " @ " __TIME__ " (%d)\n"; + + system("clear"); + printf(banner,thisConfig->shellProcess); + printf("Target mdStdDevIdx: %d (0: Master Daemon(MD), 1: Cliever(CD))\n",mdStdDevIdx); + puts("LL (low level) Cliever commands: \n"); + puts(" ? - display this screen"); + puts(" - make (an integer) the target mdStdDevIdx"); + puts(" done - terminate the command loop but not ausreg-cd"); + puts(" log - display this cliever log"); + puts(" rlog - pull and display the MD log"); + puts(" mdapi - run mdclient here (xmlrpc-c must be installed)"); + printf(" quit - terminate %s (if in md shell CTL-C if finished)\n\n",thisConfig->origCmd); + puts("Anything else is a EPP cmd for the selected EPP Server."); + puts("If the device responds it should show in the log if debug level high enough.\n"); + if (*cdOrKb == 'd') { + puts("In the character mode UI:"); + puts(" Enter (help) in the rules system for more help."); + puts(" Enter (exit) in the rules system to return here.\n"); + } + puts("If in md shell, 'RST' and 'quit' resets the servers for this Cliever group"); + puts("(i.e. if the mdStdDevIdx is 0;used to get a fresh epoch with MD"); + puts(" and CD initialized and connected for device and data client testing).\n"); + puts("NB: USE LL SCPI COMMANDS FOR DEVICE DEV ONLY -\n"); + puts("Sending device commands at this level is potentially dangerous and is "); + puts("only for device development. Other users should issue commands using the"); + puts("data client XMLRPC API, e.g. thru mdclient which uses the current best"); + puts("proven rulebase (when MD is running as daclips-md)."); + +} +bool mdCommander::scpi(char *cmd) { + + char *command,work[256]; + bool isDirect=false,rc=true; + + if (!mdStdDevIdx && !strncmp(cmd,"RST",3)) { + + mdDG mdg; + + mdg.dg.hdr.sourceHandle = thisCliever->myHandle; + mdg.dg.hdr.payloadSize = 0; + mdg.dg.hdr.msgType = MDDG_CDRESET; + if (thisCliever->fg->send(mdg.dg)) rc = false; + + } + + return rc; + +} + diff --git a/APIG/client/tools.cpp b/APIG/client/tools.cpp new file mode 100644 index 0000000..386a940 --- /dev/null +++ b/APIG/client/tools.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include "xmlrpc-c/girerr.hpp" +using girerr::error; +using girerr::throwf; + +#include "tools.h" + +using namespace std; + +testSuite::~testSuite() { +} + + + +void +testSuite::run(unsigned int const indentation) { + try { + cout << string(indentation*2, ' ') + << "Running " << suiteName() << endl; + this->runtests(indentation); + } catch (error const& error) { + throwf("%s failed. %s", suiteName().c_str(), error.what()); + } catch (...) { failures++; + throw(error(suiteName() + string(" failed. ") + + string("It threw an unexpected type of object"))); + } + cout << string(indentation*2, ' ') + << suiteName() << " tests passed." << endl; +} + + + +// This is a good place to set a breakpoint. +void +logFailedTest(const char * const fileName, + unsigned int const lineNum, + const char * const statement) { + + ostringstream msg; + + msg << endl + << fileName << ":" << lineNum + << ": expected (" << statement << ")" << endl; + + throw(error(msg.str())); +} + + +error +fileLineError(string const filename, + unsigned int const lineNumber, + string const description) { + + ostringstream combined; + + combined << filename << ":" << lineNumber << " " << description; + + return error(combined.str()); +} + + + diff --git a/APIG/include/apiFrame.h b/APIG/include/apiFrame.h new file mode 100644 index 0000000..7040ba5 --- /dev/null +++ b/APIG/include/apiFrame.h @@ -0,0 +1,41 @@ +#ifndef MD_TELEMETRY +#define MD_TELEMETRY +#define MAX_FRAMESIZE 100 // Capacity if data elements of both kinds. +#define nameOffsetIdx (frame + (sizeof(unsigned short) * (1 + *nNames))) + +class mdAPIFrame { +public: + + char *frame,*frameData,*nameCursor; + int frameSize,i,nameOffset; + unsigned short *nameOffsets,*nNames; + std::string manifest[MAX_FRAMESIZE]; + + mdAPIFrame(const char *buffer,int size) : frameSize(size) + {frame = (char *)buffer; + frameData = frame + frameSize; + nNames = (unsigned short *)frame; + nameOffsets = ((unsigned short *)frame) + 1; + nameCursor = frame + ((MAX_FRAMESIZE + 1) * sizeof(unsigned short)); + nameOffsets[0] = nameCursor - frame; + nameOffset = 0; + } + + char *nameIdx(int j) {return frame + ((MAX_FRAMESIZE+1) * sizeof(unsigned short)) + nameOffsets[j];} + + void newOut() { memset(frame,0,frameSize); } + void newIn() { for (i=0;i< *nNames;i++) manifest[i] = std::string(nameIdx(i)); } + + + void pack(mdOperationalDataElement *ode, std::string &next) { + frameData -= ode->pack(frameData); + strcpy(nameCursor,next.c_str()); + *((unsigned short *)nameOffsetIdx) = nameOffset; + nameOffset += (unsigned short)next.length() + 1; + *nNames++; + } + +}; + + +#endif diff --git a/APIG/include/ausreg-cd.h b/APIG/include/ausreg-cd.h new file mode 100644 index 0000000..fda2168 --- /dev/null +++ b/APIG/include/ausreg-cd.h @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "Listener.h" +#include "EventSender.h" +#include "TimeStampedEvent.h" +#include "PolymorphEvent.h" + +#include +#include +#include +#include +#include + +#define CLIEVER + +#include "mdcommon.h" + +#ifdef MD_MAND +#include +#endif + +#include "cdEvents.h" +#include "mdCommander.h" + +#include "mdBehavior.h" +#include "mdObservable.h" +#include "mdState.h" + + +#define CD_EPOCH date() +#define CD_GLOBAL_SIZE 4096 +#define CD_LOCK_FILE "auc-cd.lock" +#define CD_NAME DACLIPS_APP " Cliever" +#define CD_VERSION "1.1" +#define CD_REFRESH MD_HEARTBEAT // default milliseconds between telemetry frame updates +#define CD_MAX_DEVICE 4 // including ourselves + + +#include "clientDaemonConfig.h" + +typedef std::map ObservablesOfInterest; +typedef std::map ODEsOfInterest; + +#include "cdLogger.h" + +class cdDataLayer; +class mdCliever; + + +#ifdef CD_MAIN + + auc_cd_global *gm; + boost::asio::io_service io_bg,io_fg; + cdLogger theseLogs; + clientDaemonConfig *thisConfig; + mdCliever *thisCliever; + +#ifdef MD_MAND + DACLIPS::Environment rules[2]; // 0: batch, 1: commander +#endif + + extern void runDataLayer(); + extern void runCliever(); + extern void shutdown(); + +#else + + extern auc_cd_global *gm; + extern boost::asio::io_service io_bg,io_fg; + extern const char *cdOrKb; + extern cdLogger theseLogs; + extern clientDaemonConfig *thisConfig; + extern mdCliever *thisCliever; + +#ifdef MD_MAND + extern DACLIPS::Environment *rules[2]; +#endif + +#endif + +#include "clientDaemon.h" + diff --git a/APIG/include/cdEvents.h b/APIG/include/cdEvents.h new file mode 100644 index 0000000..96a2ce6 --- /dev/null +++ b/APIG/include/cdEvents.h @@ -0,0 +1,55 @@ +class cdHeartbeat: public TimeStampedEvent<>, public PolymorphEvent { + + public: + mdDatagram dg; + mdReply dgr; + + cdHeartbeat() { + + memset((void *)&dg,0,sizeof(mdReply)); + dg.hdr.clientType = MDDEV_CD; + dg.hdr.msgType = MDDG_HEARTBEAT; + + }; + + ~cdHeartbeat() {}; + virtual void send() const { sendTypedEvent(*this); } + +}; +class cdIncoming: public TimeStampedEvent<>, public PolymorphEvent { + + public: + mdDatagram dg; + boost::asio::ip::udp::endpoint ip; + + cdIncoming(mdDGChannel &c) {dg = *(c.inProcess);} + + virtual void send() const { sendTypedEvent(*this); } + +}; +class cdResponse: public TimeStampedEvent<>, public PolymorphEvent { +public: + bool ackIsNak; + mdDatagram *incoming; + mdDatagram *reply; + boost::asio::ip::udp::endpoint ip; + + virtual void send() const { sendTypedEvent(*this); } + +}; +class cdShutdown: public TimeStampedEvent<>, public PolymorphEvent { + + public: + virtual void send() const { sendTypedEvent(*this); } +}; +class cdTelemetryFrame: public TimeStampedEvent<>, public PolymorphEvent { + + public: + virtual void send() const { sendTypedEvent(*this); } +}; +class cdInteractiveCommand: public TimeStampedEvent<>, public PolymorphEvent { + + public: + virtual void send() const { sendTypedEvent(*this); } + +}; diff --git a/APIG/include/cdLogger.h b/APIG/include/cdLogger.h new file mode 100644 index 0000000..0197662 --- /dev/null +++ b/APIG/include/cdLogger.h @@ -0,0 +1,29 @@ +#ifndef CLIEVER_LOGGER +#define CLIEVER_LOGGER + +#include "log4cpp/Category.hh" +#include "log4cpp/Appender.hh" +#include "log4cpp/FileAppender.hh" +#include "log4cpp/Layout.hh" +#include "log4cpp/BasicLayout.hh" +#include "log4cpp/Priority.hh" + +using namespace log4cpp; + +class cdLogger { +public: + char *logPath; + + cdLogger() {}; + + void init(const char * = ""); + void logN(int n, const char *format, ...); + void logNdebug(int n, const char *format, ...); + void logNdebug(int m, int n, const char *format, ...); + void logNdev(int n, const char *format, ...); + + ~cdLogger(){}; + +}; + +#endif diff --git a/APIG/include/clientDaemon.h b/APIG/include/clientDaemon.h new file mode 100644 index 0000000..06ac7d0 --- /dev/null +++ b/APIG/include/clientDaemon.h @@ -0,0 +1,87 @@ +#ifndef CLIEVER_CORE +#define CLIEVER_CORE + + +using boost::asio::ip::udp; +/*! \brief mdClieverTransaction + * Abstract category encapsulating MD-CD interactions. + */ +class mdClieverTransaction : public mdProcess {void run() {};}; +/*! \brief mdCDHearbeat + * Ensure vitality of the base MD-CD distributed process. + */ +void hbCallback(const boost::system::error_code& error); +class mdCDHeartbeat : public mdClieverTransaction { + + boost::asio::deadline_timer *t0; + +public: + + mdCDHeartbeat() {} + + void init() { + t0 = new boost::asio::deadline_timer(io_bg, boost::posix_time::seconds(MD_HEARTBEAT)); + } + void dispatch(mdWQitem*) {} // Heartbeats aren't dispatched. + void nextBeat(const boost::system::error_code& error); + void run(); + +}; +/*! \brief cdClieverTransaction + * Encapsulates CD-mdHost interactions. + * + * + */ +class cdClieverTransaction : public mdProcess {void run()=0;}; + +/*! \brief mdCliever + * Client-server middleware object. + * + * + */ +class mdCliever: public mdProcess, + public Listener, + public Listener, + public Listener, + public Listener, + public Listener, + public Listener +{ + public: + + bool alive,connected,shuttingDown,shutDown; + + int instrumentHandle[MAX_INSTRUMENTS], + myHandle,machineHandle, + rc, + sentMsgCount[N_MDDG_TYPES][CD_MAX_DEVICE]; + + cdHeartbeat myPulse; + clientDaemonConfig *cfg; + mdCDHeartbeat *pulse; + mdDGChannel *bg,*fg; + + + mdCliever() { alive = connected = false; + rc = OK; + pulse = NULL; + shuttingDown = shutDown = false; + memset(sentMsgCount,0,sizeof(sentMsgCount)); + memset(instrumentHandle,0,sizeof(instrumentHandle)); + myHandle = machineHandle = 0; + } + mdCliever(clientDaemonConfig *cmdCfg) + { this->cfg = cmdCfg; } + + void dispatch(mdWQitem *); + void run() {} + + virtual void processEvent(const cdHeartbeat &ev); + virtual void processEvent(const cdTelemetryFrame &ev); + virtual void processEvent(const cdInteractiveCommand &ev); + virtual void processEvent(const cdIncoming &ev); + virtual void processEvent(const cdResponse &ev); + virtual void processEvent(const cdShutdown &ev); + +}; +#endif diff --git a/APIG/include/clientDaemonConfig.h b/APIG/include/clientDaemonConfig.h new file mode 100644 index 0000000..20a6e54 --- /dev/null +++ b/APIG/include/clientDaemonConfig.h @@ -0,0 +1,60 @@ +#ifndef CLIEVER_CONFIG +#define CLIEVER_CONFIG + +using namespace boost::gregorian; +using namespace boost::posix_time; + +class mdDataSource { + + bool enabled; + std::string fullName; + int port; + int ip; + +}; + +typedef std::map localSourcesByClaimedName; + +class clientDaemonConfig { +public: + + bool runCommander; + bool terminateRequest; + char configPath[256],logPath[256],origCmd[32]; + pid_t clipsProcess; + pid_t daemonProcess; + pid_t shellProcess; + std::string mdAddress; + std::string deviceName; + std::string telemetryPortStr; + int cluster, + debugThreshold, + instruments[MAX_INSTRUMENTS]; + int telemetryPort; // talks to central server with this + date epoch(CD_EPOCH); + localSourcesByClaimedName localDevices; + + clientDaemonConfig() { terminateRequest = false; + mdAddress = std::string(MD_DEFAULT_IP); + strcpy(configPath,"./"); + deviceName = std::string("TEST"); + debugThreshold = MAX_DEBUG; + strcpy(logPath,"/tmp"); + runCommander = true; + memset(instruments,0,sizeof(instruments)); + } + + int loadMachineConfiguration(); + +}; + +typedef +struct CD_GLOBAL { + char id[7]; + pid_t daemon_pid; + bool cmdrShutdown; + bool graceful; +} + auc_cd_global; + +#endif diff --git a/APIG/include/mdCommander.h b/APIG/include/mdCommander.h new file mode 100644 index 0000000..cacfc5d --- /dev/null +++ b/APIG/include/mdCommander.h @@ -0,0 +1,23 @@ +#ifndef MD_CHARGUI +#define MD_CHARGUI + +class mdCommander { + + bool acceptingInput; + bool SCPImode; // false implies CLIPS mode + int mdStdDevIdx; + std::string currentDevice; + + public: + + mdCommander() {mdStdDevIdx=0;} + ~mdCommander() {} + + void driver(); + void greet(); + void help(); + bool scpi(char *command); + +}; + +#endif diff --git a/APIG/include/mdclient.h b/APIG/include/mdclient.h new file mode 100644 index 0000000..27540f4 --- /dev/null +++ b/APIG/include/mdclient.h @@ -0,0 +1,104 @@ + +#include +#include +#include +#include +#define XMLRPC_C +#include "tools.h" +#include "mdClientBehavior.h" +#include "mdClientDevice.h" +#include "mdClientState.h" + +#define MD_SERVER_URL "http://localhost:4243/RPC2" +#define DEFAULT_DEVICE "ALX" +#define EXPECTED_MACHINE_HANDLE 1 +#define PAUSE_SECS 3 + +#ifdef MDCLIENTMAIN + + bool doSanityCheck = false, repeatableOnly = false; + + xmlrpc_env env; + xmlrpc_c::clientXmlTransport_libwww myTransport; + xmlrpc_c::client_xml myClient(&myTransport); + XmlRpcValue::int32 mdServerHandle = 0; + + int pauseSecs=0; + const char *defaultDevice,*serverURL; + std::string phase; + +#else + + extern bool doSanityCheck, repeatableOnly; + + extern xmlrpc_env env; + extern xmlrpc_c::clientXmlTransport_libwww myTransport; + extern xmlrpc_c::client_xml myClient; + extern XmlRpcValue::int32 mdServerHandle; + extern const char *defaultDevice,*serverURL; + extern int pauseSecs; + extern std::string phase; + +#endif + +class mdCoreAPITestSuite : public testSuite { + +/*---------------------------------------------------------------------------- + The object of this class tests the MD core API. + + Some day, we would like to automate its generate + with that of the client objects it tests. + + Unlike the "new" xmlrpc-c test style, we do count + successes and failures and attempt to execute the + entire suite. +-----------------------------------------------------------------------------*/ +public: + + mdClientState *testState; + mdClientDevice *thisClient; + mdClientBehavior *testBehavior; + + virtual std::string suiteName() { + return "Phase I UAT Suite"; + } + void bucket00(char const *title) { + + std::cout << "\nTest Bucket: " << title << std::endl; + TEST(mdServerHandle = thisClient->registeR( 0, defaultDevice)); + + } + void bucket01(char const *title); + void bucket02(char const *title); + void bucket03(char const *title); + void bucket04(char const *title); + void bucket05(char const *title); + void bucket06(char const *title); + + virtual void runtests(unsigned int const) { + + char testContext[256]; + mdClientState mdState(serverURL); + mdClientDevice mdClient(serverURL); + mdClientBehavior mdBehavior(serverURL); + + testState = &mdState; + thisClient = &mdClient; + testBehavior = &mdBehavior; + + tests = failures = 0; + + sprintf(testContext,"Get handle for device: %s to test against: %s\n",defaultDevice,serverURL); + if (!mdServerHandle) + bucket00(testContext); + bucket01("Check predefined observables access.\n"); + bucket02("Check for required SCPI subsystems for the selected device.\n"); + if (!repeatableOnly) + bucket03("Check dynamic definition of remaining specified observables.\n"); + bucket04("Check event/rule mechanism.\n"); + bucket05("Check SCPI execution.\n"); + bucket06("Check datagram layer operations.\n"); + + } +}; + diff --git a/APIG/include/mdcommon.h b/APIG/include/mdcommon.h new file mode 100644 index 0000000..15239ba --- /dev/null +++ b/APIG/include/mdcommon.h @@ -0,0 +1,537 @@ + /** + * \mainpage AusReg Cliever + * + *

+ * + * \par About + * \par + * The Delivery Document Subsite + * + * \htmlonly + * \endhtmlonly + * + *

+ * + * \par AusReg Cliever requirements + * + * This program suite was originally developed on Debian Wheezy 64 but + * should compile on any Unix where all of the requirements are present. + * + *

+ * + * \par Access source code + * + * Developers Repository + * + * - To pull from my git repo: + * - \verbatim git clone drde@git.meansofproduction.biz:/git/DRDE \endverbatim + * + * + *

+ * + * \par Top Level External Dependencies... and version currently used + *
+ * \b boost: 1.49
+ * \b log4cpp: 1.0
+ * \b sigc++: 2.0
+ *
+ * The above is a covering set of dependencies, everything else required for unix builds should be in the git repo or with AusReg EPP TK. + * + *

+ * + * accommon.h - Core Daemon Level definitions. + * + * \par Authors Support Site + * + * \htmlonly DNS EPP Upgrade Service \endhtmlonly + * + * \par License + * See the licenses section of the Latex2HTML document + * + */ + +#ifndef MD_COMMON +#define MD_COMMON + +#include + +using namespace std; +using boost::asio::ip::udp; + +#define MAX_CLIENTS 1000 +#define MAX_CLIEVER 10 +#define MAX_DATACLIENTS 200 +#define MAX_EPP_SERVERS 3 . +#define MAX_DEBUG 1000 // Set the config parm higher than this to inhibit logNdebug(m...) where m < this +#define MAX_HOST (((MAX_CLIEVER + 1) * MAX_EPP_SERVERS) + MAX_CLIENTS) +#ifndef MD_STAGE +#define CD_DEFAULT_IP "192.168.0.9" +#define MD_DEFAULT_IP "192.168.0.5" +#define PULL_MD_LOG "cp /somejuan/tmp/-md.log ." +#else +#define CD_DEFAULT_IP "184.168.64.86" +#define MD_DEFAULT_IP "178.79.142.228" +#define PULL_MD_LOG ("scp drde@" MD_DEFAULT_IP "/tmp/-md.log .") +#endif +#define MD_EPOCH date() +#define MD_HEARTBEAT 1 // Network peer heartbeat in seconds. +#define MD_MAX_DATAGRAM (32*1024) // half of the IPV4 max +#define AC_APP "Generic" +#define AC_COMPONENT "Master Daemon" // AC Component +#define AC_NAME AC_APP " " AC_COMPONENT +#define MD_VERSION " 1.1 " // DACLIPS Version +#define MD_REFRESH 10 // default milliseconds between APIG frame updates +#define MD_TYPE "EPPREGISTRAR" +#define NORMAL_DEBUG 10 +#ifndef CURRENT_DEBUG +#define CURRENT_DEBUG NORMAL_DEBUG +#endif +#define NOT_OK -1 +#define OK 0 +#define RUNNING_DIR "/tmp" + +#define theMachine thisConfig->machine[thisConfig->thisMachineContext] + +enum md_mand { + MD_NAM, // Not a Mand. + MD_USER_MAND, // User defined mand type + MD_SCPI, + MD_RULE_ACTION, + MD_CLIEVER_CMD, // From CD command loop or other UI + MD_CLIENT_CMD, // From XMLRPC + MD_NMANDS +}; + +enum mdErrorCode { // In auc-md/kb index to masterDaemonConfig.err + MDERR_OK, + MDERR_MISSING, + MDERR_EXISTS, + MDERR_CONFLICT, + MDERR_NOTREADY, + MDERR_SYNTAX, + N_MDSTDERR +}; + +enum md_dispatch_category { + MD_NEWBORN = 0, // inbound this isn't dispatched + CD_FRAME, + MD_FRAME, + CD_MDQUERY, + MD_SHUTDOWN +}; + +enum md_host { + MDDEV_MD = 0, + MDDEV_CD, + MDDEV_PEER, + MACHINE, + N_MDDEV_TYPES +}; + +enum md_reserved { + MD_RESERVED_UNDEFINED = 0, + N_MD_RESERVED +}; + +enum mdDGtype { + MDDG_HEARTBEAT = 0, + MDDG_DEVICEHB, + MDDG_NEWBORN, + MDDG_MDQUERY, + MDDG_REGSCPI, + MDDG_REGOBS, + MDDG_REGODE, + MDDG_TELEMETRY, + MDDG_CDRESET, + N_MDDG_TYPES +}; + +typedef +struct MD_DG_TYPE { +unsigned inBandOnly : 1; +unsigned requiresAck : 1; +unsigned isAckNak : 1; +unsigned value : 1; // i.e. boolean for ack/nak etc. where true = ack. +unsigned reserved : 4; +unsigned clieverGroup : 8; // masterDaemonConfig.thisMachineContext +unsigned reserved2 : 16; +} + mdDGflags; + +typedef +struct MD_DG_HEADER { +mdDGtype msgType; +mdDGflags dgType; +mdDGtype dgSubType; +int msgSN; // Ordinal in a dialog +md_device clientType; +int sourceHandle; +int sinkHandle; +int handle; // for example if query about a device other than source or sink. +mdErrorCode ec; +int payloadSize; +int primeOffset; // for example to the name associated with the data +} + mdDGHeader; + +typedef +struct MD_DATAGRAM { + mdDGHeader hdr; + char payLoad[MD_MAX_DATAGRAM - (sizeof(mdDGHeader))]; +} + mdDatagram; + +typedef +struct MD_REPLY { + mdDGHeader hdr; + char payLoad[512 - sizeof(mdDGHeader)]; +} + mdDGReply; + +class mdReply { +public: + + mdDGReply dg; + + mdReply() {memset((void *)&dg,0,sizeof(mdDGReply)); + dg.hdr.dgType.isAckNak = true; + } +}; + +#if (defined(MD_MAIN) || defined(CD_MAIN) ) +const char *hostTypes[N_MDDEV_TYPES ] = { "Master Daemon", "Cliever", "Machine" }; +#else +extern const char *clientTypes[N_MDDEV_TYPES]; +#endif + +/* \brief mdProcess + * Abstract base class of various subprocesses + * + * AC is a distributed system with various subprocesses + * spanning the central server, the 'Cliever' middleware components and clients. + * Root class for these. + * + */ + +class mdWQitem { +public: + md_dispatch_category kind; + const void *what; + int user; // User defined + mdWQitem (const void *work,md_dispatch_category priority,int x) + : what(work), kind(priority), user(x) {} + + bool operator< (const mdWQitem & right) const { + return kind < right.kind; + } + +}; + +typedef std::priority_queue < mdWQitem* > MDWQ; + +class mdProcess { +public: MDWQ q; + mdProcess() {} + ~mdProcess() {} + + void queue(mdWQitem *w) {q.push(w);} +virtual void dispatch(mdWQitem *w)=0; +virtual void run() = 0; + +}; +#define MD_DEFAULT_DEVICE_PROTOCOL 0 +#define MD_DEFAULT_RULE 0 + +typedef +struct { + unsigned open:1; + unsigned looped:1; // back channel established from passive connection. + unsigned reserved:30; + } mdCnctBool; + +typedef +struct MD_CONTROL_BLOCK +{int handle; // debug mark + mdCnctBool connection; + boost::asio::ip::udp::endpoint ep; + boost::asio::ip::udp::resolver::iterator it; + boost::asio::ip::udp::socket *udp; + MD_CONTROL_BLOCK() { + handle = 0; + memset((void *)&connection,0,sizeof(connection)); + udp = NULL; + } +} + mdCB; + +typedef std::map mdStdDevicePODMap; // MD Standard Device Map - +/* + *\brief stdDev: collection with MD at: 0, CDs in: 1 - MAX_CLIEVER, + * EPPSERVERS in: MAX_CLIEVER+2 - MAX_CLIEVER+2+MAX_EPPSERVER + * + * The mdStdDevIdx of a host is its index above. + * Within intervals clients are assigned compactly in the same order as thier handles are created and assigned. + */ + +#if (defined(MD_MAIN) || defined(CD_MAIN) || defined(TK_DLL_MAIN)) + mdStdDevicePODMap cb; + int myStdDevIdx=MAX_CLIENTS+1; // global default to localhost +#else + extern mdStdDevicePODMap cb; + extern int myStdDevIdx; +#endif + +class mdDGChannel +{public: + + boost::asio::io_service& io_service_; + boost::asio::ip::udp::endpoint p_endpoint_; + boost::asio::ip::udp::endpoint a_endpoint_; + boost::asio::ip::udp::endpoint *ep_; + boost::asio::ip::udp::resolver *r; + boost::asio::ip::udp::resolver::query *q; + boost::asio::ip::udp::socket passive_; + boost::asio::ip::udp::socket *active_; + boost::asio::ip::udp::socket *s_; + + char ack_[sizeof(mdDGReply)]; + char data_[MD_MAX_DATAGRAM]; + + int mdStdDevIdx; + + mdDatagram *inProcess; + mdReply *reply; + + short port; + + mdDGChannel(boost::asio::io_service& io_service, + short inport, int stdDevIdx=myStdDevIdx) + : io_service_(io_service), mdStdDevIdx(stdDevIdx), + passive_(io_service, udp::endpoint(udp::v4(), inport)) + { + inProcess = (mdDatagram *)data_; + ep_ = &p_endpoint_; + port = inport; + reply = (mdReply *)ack_; + q = NULL; + r = NULL; + s_ = &passive_; + + passive_.async_receive_from( + boost::asio::buffer(data_, MD_MAX_DATAGRAM), p_endpoint_, + boost::bind(&mdDGChannel::handle_receive_from, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); + } + + void async_send(mdDatagram &dg) { + + size_t dgSize = sizeof(mdDGHeader) + dg.hdr.payloadSize; + + *inProcess = dg; + //std::memcpy(this->data_,(char *)&dg,dgSize); + + active_->async_send_to( + boost::asio::buffer(data_, dgSize), *ep_, + boost::bind(&mdDGChannel::handle_send_to, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); + } + + bool connect_to (std::string &host, std::string &port, int stdDevIdx=-1) { + + bool value = false; + int rport = atoi(port.c_str()); + boost::system::error_code ec; + boost::asio::ip::udp::endpoint remote ( boost::asio::ip::address::from_string(host.c_str()), rport); + + stdDevIdx = (stdDevIdx == -1) ? mdStdDevIdx : stdDevIdx; + map::iterator iter = cb.find(stdDevIdx); + if( iter == cb.end() ) cb[stdDevIdx] = new mdCB(); + + try { + if (!r) r = new udp::resolver(io_service_); + if ( q) delete q; + q = new udp::resolver::query(udp::v4(), host.c_str(), port.c_str()); + cb[stdDevIdx]->it = r->resolve(*q); + if (!cb[mdStdDevIdx]->udp) + cb[mdStdDevIdx]->udp = new udp::socket(io_service_, udp::endpoint(udp::v4(), 0)); + active_ = cb[mdStdDevIdx]->udp; + if (active_->is_open()) + active_->connect(remote,ec); + + if (!ec) value = true; + + } + catch(...) {} + + return (cb[stdDevIdx]->connection.open=value); + + } + + bool connect_to (boost::asio::ip::udp::endpoint &ep,boost::system::error_code &ec,int &step,int stdDevIdx=-1) + { + + bool value = false; + + stdDevIdx = stdDevIdx == -1 ? mdStdDevIdx : stdDevIdx; + map::iterator iter = cb.find(stdDevIdx); + if( iter == cb.end() ) cb[stdDevIdx] = new mdCB(); + + try { if (cb[stdDevIdx]->udp) {if (cb[stdDevIdx]->udp->is_open()) + cb[stdDevIdx]->udp->close(); + delete cb[stdDevIdx]->udp;} + + cb[stdDevIdx]->ep = ep; + active_ = cb[stdDevIdx]->udp = new boost::asio::ip::udp::socket( io_service_ , udp::endpoint(udp::v4(), 0) ); + ec.clear(); + active_->connect( cb[stdDevIdx]->ep, ec ); + if (active_->is_open()) { value = true; cb[stdDevIdx]->connection.open=1; } + else { + step++; + active_->open( udp::v4(), ec ); + if (active_->is_open()) {value = true; cb[stdDevIdx]->connection.open=1; } + } + + } + catch(boost::system::system_error &be) {boost::system::system_error warning = be;} + catch(...) {} + + return (value); + + } + + void handle_receive_from(const boost::system::error_code& error, size_t bytes_recvd); + + void handle_send_to(const boost::system::error_code& asioEC, size_t sentByes) + { + size_t dgSize = inProcess->hdr.dgType.requiresAck + ? sizeof(mdReply) : sizeof(mdDatagram); + + // std::string debugMsg = asioEC.message(); + + if (inProcess->hdr.dgType.requiresAck) + active_->async_receive_from( + boost::asio::buffer(ack_, dgSize), *ep_, + boost::bind(&mdDGChannel::handle_receive_from, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); + else + active_->async_receive_from( + boost::asio::buffer(data_, dgSize), *ep_, + boost::bind(&mdDGChannel::handle_receive_from, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); + } + + bool send(mdDatagram &dg) { + + size_t dgSize = sizeof(mdDGHeader) + dg.hdr.payloadSize; + + return (dgSize == + active_->send(boost::asio::buffer((void *)&dg, dgSize))); + + } + + bool send_to(mdDatagram &dg, int mdStdDevIdx) { + + size_t dgSize = sizeof(mdDGHeader) + dg.hdr.payloadSize; + + return (dgSize == + active_->send_to(boost::asio::buffer((void *)&dg, dgSize), *cb[mdStdDevIdx]->it)); + + } + + size_t send(mdReply &dg, boost::system::error_code &ec) { + + size_t dgSize = sizeof(mdDGReply); + boost::asio::socket_base::message_flags flags=0; + + return (active_->send(boost::asio::buffer((void *)&dg, dgSize), flags, ec)); + + } + + size_t send_back(mdReply &dg, boost::system::error_code &ec, int &step) { + + size_t dgSize = sizeof(mdDGReply); + boost::asio::socket_base::message_flags flags=0; + step = 1; + + a_endpoint_ = passive_.remote_endpoint(ec); + + if (ec) return 0; + + return (passive_.send_to(boost::asio::buffer((void *)&dg, dgSize), a_endpoint_, flags, ec)); + + } + + bool send_to(mdReply &dg,int mdStdDevIdx) { + + size_t dgSize = sizeof(mdDGReply); + + return (dgSize == + active_->send_to(boost::asio::buffer((void *)&dg, dgSize), *cb[mdStdDevIdx]->it)); + + } + +}; + + +#if defined(_WIN32_WINNT) && !defined(DllExport) && defined(DV_DLL) +#pragma warning( disable: 4251 ) +#define DllExport __declspec(dllexport) +#else +#define DllExport +#endif + +typedef std::map mdErrMsgMap; + +class DllExport mdError { + + int instance; + mdErrMsgMap text; + +public: + mdError() { text[0] = std::string("OK"); + instance = 0; + } + + ~mdError() {} + + // The below populate the additional messages; + // Instances below 1000 are reserved for system errors, negative + // integers not used. + // Users derive from this class and implement additionalUsrMsgs. + + void additionalUserMsg(int instCode,const char *msgText) + {if (instCode >= 1000) text[instCode] = std::string(msgText);} + void additionalSystemMsg(int instCode,const char *msgText) + {if (instCode < 1000 && instCode >0) text[instCode] = std::string(msgText);} + + int get() {return instance;} + void get(mdError **parentPtr) + {*parentPtr = this;} + void set(int i) {instance = i;} + + const char *what(char *buffer=NULL) { + if (text.find(get()) == text.end()) { + {if (!buffer) return NULL; + sprintf(buffer,"Unknown error code: %d",get()); + return buffer; + } + return text[get()].c_str(); + } + return "unknown"; + } + +}; + +class mdDG { +public: + mdDatagram dg; + + mdDG() {memset(&dg,0,sizeof(mdDatagram));} + +}; + +#endif diff --git a/AusRegCliever/Makefile b/AusRegCliever/Makefile index 8f8146c..5e21dfb 100644 --- a/AusRegCliever/Makefile +++ b/AusRegCliever/Makefile @@ -1,32 +1,46 @@ LOCATION=authoring # -# Add other locations as needed. +# Add other locations and move target differences into the macros as needed # CC=g++ Cc=gcc -#ifeq ($(LOCATION),authoring) BOSTLIB=-L/usr/lib/boost BOSINCL=-L/usr/include/boost - ARTKLIB= - ARTKINCL= + LOG4LIB=-L/usr/lib + +#ifeq ($(LOCATION),authoring) + ARTKLIB=-L/home/jdaugherty/clients/reg.de/git/AusRegEPPTk/build + ARTKINCL=I/home/jdaugherty/clients/reg.de/git/AusRegEPPTk/common #endif -SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) -l boost_system -l boost_thread +#ifeq ($(LOCATION),testing) + ARTKLIB=-L/home/drdejdaugherty/clients/reg.de/git/AusRegEPPTk/build + ARTKINCL=I/home/jdaugherty/clients/reg.de/git/AusRegEPPTk/common +#endif -ARTKFLAGS=-shared -fPIC -Wl,-soname,libAusRegEPPTK.so +SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) -l boost_system -l boost_thread -l log4cpp ifeq ($(LOCATION),authoring) SINCL= -I include -I /usr/include/log4cpp $(BOSINCL) -CFLAGS= -DCURRENT_DEBUG=1000 +CFLAGS= -DCURRENT_DEBUG=1000 -DPRODUCTION=0 endif +ifeq ($(LOCATION),production) +SINCL= -I include -I /usr/include/log4cpp $(BOSINCL) +CFLAGS= -DPRODUCTION=1 +endif + + CLIBS= -L$(USRLIB) CLFLAGS= -Wall -Wundef -Wpointer-arith -Wshadow \ -Wcast-align -Winline -Wmissing-declarations -Wredundant-decls \ -Wmissing-prototypes -Wnested-externs \ - -Wstrict-prototypes -Waggregate-return -Wno-implicit + -Wstrict-prototypes -Waggregate-return -Wno-implicit + +ACOBJS= build/cliever.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \ + build/mdHost.o # --- targets # @@ -46,8 +60,17 @@ build/mdLogger.o: server/mdLogger.cpp include/mdLogger.h build/cliever.o: server/cliever-md.cpp include/*.h $(CC) $(CFLAGS) server/cliever-md.cpp -c -o build/cliever.o $(SINCL) -build/drde-cliever: build/cliever.o build/mdLogger.o - $(CC) $(CFLAGS) -o build/cliever $(SINCL) $(LIBS) build/mdLogger.o $(SLIBS) +build/masterDaemonConfig.o: server/masterDaemonConfig.cpp include/*.h + $(CC) $(CFLAGS) server/masterDaemonConfig.cpp -c -o build/masterDaemonConfig.o $(SINCL) + +build/mdHost.o: server/mdHost.cpp include/*.h + $(CC) $(CFLAGS) server/mdHost.cpp -c -o build/mdHost.o $(SINCL) + +build/masterDaemon.o: server/masterDaemon.cpp include/*.h + $(CC) $(CFLAGS) server/masterDaemon.cpp -c -o build/masterDaemon.o $(SINCL) + +build/drde-cliever: $(ACOBJS) + $(CC) $(CFLAGS) -o build/drde-cliever $(SINCL) $(LIBS) $(ACOBJS) $(SLIBS) doxygen/index.html: etc/doxygen.config doxygen etc/doxygen.config diff --git a/AusRegCliever/include/Listener.h b/AusRegCliever/include/Listener.h index d3ea689..01f1100 100644 --- a/AusRegCliever/include/Listener.h +++ b/AusRegCliever/include/Listener.h @@ -1,63 +1,118 @@ - -/** - \class Listener +#ifndef LISTENER_H +#define LISTENER_H - Derive your class from a Listener, to give it the - ability to hear (i.e. receive, listen to) events of type - EvType. EvType is a fundamental type (bool, int, float, - etc), a struct or a class of your choice. You must define - Listener::processEvent() in your Listener - subclass. You call listenForEvents() on your listener - instance (at least once) for it to be able to hear (i.e. - receive) any EvType event, and you call ignoreEvents() on - the instance so it will no longer receive events of type - EvType. - - \note - - Do not assume that the Listeners will receive the generated event in - the same order as they registered. - - A class can listen to more than one type of event by inheriting - from more than one type of listener. Calling listenForEvents() - then is done by specifying which listenForEvents() to call, e.g. - \code - class YourListener: - public Listener, public Listener - { - public: - YourListener() { - Listener::listenForEvents(); - Listener::listenForEvents(); - } - protected: - virtual void processEvent(const TicEvent& event) {...} - virtual void processEvent(const TacEvent& event) {...} - }; - \endcode - - If a subclass of your class must also process an event, remember - that because its processEvent is virtual, it will be the first - one called. Therefore it should call its base class method: - \code - struct TicEvent {...}; - class YourListener: public Listener {...}; - class DerivedListener: public YourListener - { - public: - // ... - protected: - virtual void processEvent(const TicEvent& event) - { - // give parent class a chance to process event - YourListener::processEvent(event); - // do our stuff ... - } - }; - \endcode - - ignoreThisEvent(): You can call it (from inside - processEvent()) to tell EventSender that you will be ignoring - the event received. This can be a useful way to signify an error in - the data sent by the event generator. Just keep in mind that the - generator of the event may not actually check whether any listener - ignored the event (it may not care). +/** \file + Class template definition file. - + \copyright + Copyright (C) 2002, 2003 Oliver Schoenborn + + This software is provided 'as-is', without + any express or implied warranty. In no event + will the authors be held liable for any + damages arising from the use of this + software. + + You can redistribute it and/or modify it + under the terms found in the LICENSE file that + is included in the library distribution. + \endcopyright */ + +template +class Listener +{ + public: + /// By default, listener not registered + Listener(): _registered(false), _ignoringHeardEvent(false), + _processingEvent(false) {} + + /// Automatically deregister ourselves + virtual ~Listener() { ignoreEvents(); } + + void ignoreEvents(); + void listenForEvents(); + void ignoreThisEvent(); + inline void processEventPublic(const EvType&); + + /** Is this instance of listener registered? + If not, it will not receive events of type EvType, + processEvent() will not be called. To register + it, call listenForEvents(). + \return true if *this is registered + */ + bool isRegistered() const {return _registered;} + + protected: + /** Classes that inherit from Listener must override this + method. This is where you react to the \a event heard. + \param event the event heard. + */ + virtual void processEvent(const EvType& event) = 0; + + private: // methods + inline void preProcessEvent(); + inline void postProcessEvent(); + + private: // data + /** True if our listenForEvents() method has been called, + and false otherwise or if ignoreEvents() is called. + */ + bool _registered; + /// are we ignoring this event? + bool _ignoringHeardEvent; + /// are we ignoring this event? + bool _processingEvent; +}; + +/// Pre-processing for the event. +template +inline void +Listener::preProcessEvent() +{ + _ignoringHeardEvent = false; + _processingEvent = true; +} + +/// Undo any pre-processing, as required. +template +inline void +Listener::postProcessEvent() +{ + _processingEvent = false; + // ignoringHeardEvent doesn't need touching +} + +/** Process this event. This public method can be called directly + with an event to simulate an event having been generated and heard by + this listener. It is also called by EventSender::send(). This + public method is a "template pattern" method, in that it calls + several private methods but most importantly calls the protected, + virtual processEvent(). Since the latter is virtual it is the definition + in the most derived class of this Listener that will get + called. The event is passed as const, so listeners can't + change the data carried by the event. + + \param event event to process + */ +template +inline void +Listener::processEventPublic(const EvType& event) +{ + preProcessEvent(); + try { + processEvent(event); + } + catch (...) { + postProcessEvent(); + throw; + } + postProcessEvent(); +} + +//#ifdef __GNUG__ + // because gcc doesn't handle separate template definition + //#include "Listener.cc" +//#endif + +#endif // LISTENER_H diff --git a/AusRegCliever/include/cliever-md.h b/AusRegCliever/include/cliever-md.h index 4212ccc..33fe054 100644 --- a/AusRegCliever/include/cliever-md.h +++ b/AusRegCliever/include/cliever-md.h @@ -29,26 +29,28 @@ namespace fsm = boost::statechart; #include "mdcommon.h" #include "mdevents.h" #include "mdLogger.h" +#include "mdBehavior.h" +#include "mdHost.h" -#define MD_HAUSHALT 1200000 // milliseconds between attention routine +#define MD_HAUSHALT 2000 // milliseconds between attention routine #define MD_LOCK_FILE "cliever-md.lock" #include "masterDaemonConfig.h" #ifdef MD_MAIN - mdDeviceFabrik *engineFactory; - mdLogger *theseLogs; + mdHostFabrik *deviceFactory; + mdLogger *theseLogs; masterDaemonConfig *thisConfig; extern void runMasterDaemon(); - extern void runClientServiceLayer(); + extern void runAPILayer(); #else - extern mdDeviceFabrik *engineFactory; - extern mdLogger *theseLogs; - extern masterDaemonConfig *thisConfig; + extern mdHostFabrik *deviceFactory; + extern mdLogger *theseLogs; + extern masterDaemonConfig *thisConfig; #endif diff --git a/AusRegCliever/include/coreapi.h b/AusRegCliever/include/coreapi.h new file mode 100644 index 0000000..5e68f43 --- /dev/null +++ b/AusRegCliever/include/coreapi.h @@ -0,0 +1,239 @@ +/*! \brief registerDevice + * core API. + * + * Singleton: All Devices must begin their interation with the MD + * with this and use the supplied handle sin subsequent + * API. + */ +class registerDevice : public xmlrpc_c::method { +private: + masterDaemonConfig *_cfg; +public: + registerDevice(masterDaemonConfig *cfg) { + _cfg = cfg; + _signature = "i:is"; + _help = "Register a client with the auc-md. The first parameter is the client type " + "which should be the integer value of MDDEV_DATACLIENT (currently 4) " + "or other md_dev type value. The string, specifies a signature identifying " + "client. Normally the first call to the MD after connecting, the response " + "if positive definite is a handle to use in further interaction referring " + "to the registered client. This API is primarily intended for data integrators not " + "device integrators but device integrators can also use if for diagnostic " + "purposes. Execute this API with signature 'release' to remove a MD client " + "in which case the first parameter should be the handle for the client to drop. " + "Obviously this API can cause havoc with a production MD, so use with care."; + } + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const handleOrType(paramList.getInt(0)); + std::string stringField(paramList.getString(1)); + + paramList.verifyEnd(2); + + if (stringField == "release") + *retvalP = xmlrpc_c::value_int(thisService->releaseDevice(handleOrType)); + else + *retvalP = xmlrpc_c::value_int(thisService->getDeviceHandle(handleOrType,stringField)); + + } + +}; +/*! \brief getter + * core API. + * + * Common getter. + */ +class getter : public xmlrpc_c::method, mdState { +public: + getter() { + _signature = "S:is"; + _help = "Send handle, dataname, get structure answer. The the first " + "character of the dataname determines its type: ODEs " + "(Operational Data Elements) start with an underscore, otherwise " + "the dataname is that of an expermental Observable. The first " + "entry in the structure is always the state of the call which " + "will either the supplied dataname indicating success or error text. " + "The remainder of the structure is specific to the datatype."; + } + + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const deviceHandle(paramList.getInt(0)); + std::string dataName(paramList.getString(1)); + paramList.verifyEnd(2); + + *retvalP = *mdState::get(deviceHandle,dataName); + } + +}; +/*! \brief setter + * core API. + * + * Common setter. + */ +class setter : public xmlrpc_c::method, mdState { +public: + setter() { + + _signature = "s:iS"; + _help = "Process a gotten structure with changes. " + "Answers 'OK' or error text"; + } + + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const deviceHandle(paramList.getInt(0)); + xmlrpc_c::cstruct returnee(paramList.getStruct(1)); + paramList.verifyEnd(2); + + *retvalP = xmlrpc_c::value_string(mdState::set(deviceHandle,returnee)); + } +}; +/*! \brief create + * create a ndw data element. + * + * Dynamically create a MD data item. + */ +class create : public xmlrpc_c::method, mdState { +public: + create() { + + _signature = "s:iss"; + _help = "Given a device handle, focus type, and dataname create the element. " + "The type string uses the standard xmplrpc-c single character " + "type signatures and the name is an MD dataname whose first character " + "determines whether an Observable or and ODEe. Any text " + "following the type signature is preserved as a comment. " + "Answers 'OK' or error text"; + } + + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const deviceHandle(paramList.getInt(0)); + std::string typeSpec(paramList.getString(1)); + std::string newName(paramList.getString(2)); + paramList.verifyEnd(3); + + *retvalP = xmlrpc_c::value_string(mdState::create(deviceHandle,typeSpec,newName)); + } + +}; +/*! \brief cmdListFetch + * core API. + * + * Fetch currently defined SCPI for device. + */ + + +class cmdListFetch : public xmlrpc_c::method, mdCommand { +public: + cmdListFetch() { + + _signature = "A:is"; + _help = "Send handle, md_dev type, and the SCPI subsystem or subcommand. " + "Use empty string to get the full subsystem list. Reply will be " + "an array of the available command/subsystems. Only MD clients " + "of type MACHINE or MDDEV_INSTRUMENT can have SCPI commands defined " + "so it is an error to specify any other type of MD client"; + } + + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const deviceHandle(paramList.getInt(0)); + int const deviceType(paramList.getInt(0)); + std::string commandSetSpecified(paramList.getString(2)); + paramList.verifyEnd(3); + + if (deviceType != MACHINE && deviceType != MDDEV_INSTRUMENT) + *retvalP = xmlrpc_c::value_string(std::string("Invalid MD client type.")); + else + {if (thisService->validateHandleForCmds(deviceHandle)) + *retvalP = *thisService->fetchCommands(commandSetSpecified); + else *retvalP = xmlrpc_c::value_string(std::string("Error: Device not in state where this API can execute.")); + + } + } +}; +/*! \brief cmd + * core API. + * + * Common commander. + */ +class cmd : public xmlrpc_c::method, mdCommand { +public: + cmd() { + + _signature = "s:iS"; + _help = "Given, a handle, device type, the full text of a SCPI " + "sends the command to the MD and if accepted to the device. " + "If the command is valid for the configured MD, MD answers OK " + "and sends it, otherwise answers error text. Whether " + "or not the OK indicates anything other than a valid command " + "depends on the configured behavior of the device."; + } + + std::string head(std::string in) { return in; } + std::string tail(std::string in) { return in; } + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + mdCommand *thisCommand; + mdCommand local; + + int deviceHandle(paramList.getInt(0)); + std::string commandText(paramList.getString(1)); + paramList.verifyEnd(2); + std::string tails=tail(commandText); + +// if (thisService->validateHandleForCmds(deviceHandle)) { +// if (thisCommand = thisDevice->commands[head(commandText)]) +// *retvalP = xmlrpc_c::value_string(thisCommand->dO(thisDevice,&tails)) ; +// else { +// *retvalP = xmlrpc_c::value_string(std::string("Error: Can't construct SCPI Command '" + commandText + "'")); +// } +// } +// else { +// *retvalP = xmlrpc_c::value_string(std::string("Error: Unknown Device")); +// } + } +}; + +/*! \brief getMDversion + * core API. + * + * Report the configuration of the MD. This API can be called at + * any time and does not require a device handle. + */ +class getMDversion : public xmlrpc_c::method { +public: + getMDversion() { + + _signature = "i:s"; + _help = "Accepts a device handle and returns the version identification " + "of the MD. "; + + } + + void + execute(xmlrpc_c::paramList const& paramList, + xmlrpc_c::value * const retvalP) { + + int const addend(paramList.getInt(0)); + + paramList.verifyEnd(1); + *retvalP = xmlrpc_c::value_string("OpenAUC v 0.5"); + } + +}; + diff --git a/AusRegCliever/include/masterDaemon.h b/AusRegCliever/include/masterDaemon.h index 7a18d99..ccec876 100644 --- a/AusRegCliever/include/masterDaemon.h +++ b/AusRegCliever/include/masterDaemon.h @@ -1,12 +1,11 @@ #ifndef MASTER_DAEMON #define MASTER_DAEMON -#include /*! \brief masterDaemon * server core. * - * Contains the data layer and the XMLRPC API. + * Two Process Layers: one to n EPP Servers and one to n EPP Clients. */ #ifdef MD_CORE @@ -29,8 +28,8 @@ class masterDaemon : public mdProcess, public Listener, public Listener, public Listener, - public Listener, - public Listener { + public Listener, + public Listener { public: bool shuttingDown; @@ -38,9 +37,10 @@ public: boost::asio::io_service io_; int arCycles, - dataClients[MAX_DATACLIENTS], - instruments[MAX_INSTRUMENTS], - nClievers, + apiClients[MAX_CLIENTS], + eppServers[MAX_PEER], + nClievers, + received, sentCommands; masterDaemonConfig *cfg; @@ -56,8 +56,8 @@ public: cfg = cmdCfg; nClievers = 0; shuttingDown = false; - memset(dataClients,0,sizeof(dataClients)); - memset(instruments,0,sizeof(instruments)); + memset(apiClients,0,sizeof(apiClients)); + memset(eppServers,0,sizeof(eppServers)); } int getDeviceHandle(int deviceMajor,std::string &deviceMinor) {}; @@ -68,7 +68,8 @@ public: void dispatch(mdWQitem*); void dispatch(const mdIncoming&); void listen(); - xmlrpc_c::value* fetchCommands(std::string subSystem) {}; +//rrj xmlrpc_c::value* fetchCommands(std::string subSystem) {}; + void * fetchCommands(std::string subSystem) {}; virtual void processEvent(const mdAttention &ev); virtual void processEvent(const mdCDPulse &ev); @@ -76,8 +77,8 @@ public: virtual void processEvent(const mdClientDeath &ev); virtual void processEvent(const mdIncoming &ev); virtual void processEvent(const mdResponse &ev); - virtual void processEvent(const mdTelemetryFrame &ev); - virtual void processEvent(const mdDeviceCommand &ev); + virtual void processEvent(const mdAPIFrame &ev); + virtual void processEvent(const mdHostCommand &ev); void run(); diff --git a/AusRegCliever/include/masterDaemonConfig.h b/AusRegCliever/include/masterDaemonConfig.h index 52a992b..42cdae8 100644 --- a/AusRegCliever/include/masterDaemonConfig.h +++ b/AusRegCliever/include/masterDaemonConfig.h @@ -26,7 +26,7 @@ public: ClientsByHandle allClients; - date epoch(MD_EPOCH); +// date epoch(MD_EPOCH); int debugThreshold,nClients,nClievers, servicePort,thisMachineContext, clientPort; diff --git a/AusRegCliever/include/mdBehavior.h b/AusRegCliever/include/mdBehavior.h new file mode 100644 index 0000000..897cdb3 --- /dev/null +++ b/AusRegCliever/include/mdBehavior.h @@ -0,0 +1,92 @@ +#ifndef MD_BEHAVIOR +#define MD_BEHAVIOR + +#include "Listener.h" +#include "EventSender.h" +#include "PolymorphEvent.h" + +/*! \brief mdMand + * The former mdBehavior + * + * The overall object category and files are still using the original name. + * Wanted to make d0 pure virtual but too many problems with current gcc template instantiation + * ( http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html ) + * + * The CLIPS integration with the low level system in mostly restricted to this interface. + */ + +class mdMand; + +typedef std::map MandLayer; + +class mdMand { +public: + + md_mand kind; + std::string fullname; + MandLayer subsystem; // children + MandLayer parent; + void *handler; + + // Subtypes must implement these. + std::string *dO(std::string *text); + +}; + +class mdMandSpace { + MandLayer catalog; + + bool add(std::string name,md_mand typ) + {if (catalog.find(name) == catalog.end()) { + mdMand *newMand = new mdMand(); + catalog[name] = *newMand; + newMand->fullname = name; + newMand->kind = typ; + newMand->handler = NULL; + } + + } + mdMand *find(std::string fn); + mdMand *parseAndCreatePath(std::string fn); + bool setFullName(void); +}; + +typedef struct { + bool requiresResponse; + bool hasArguments; + unsigned short nArgs; + char sVal; +} + mdCmdPOD; + +class mdCommand : mdMand { +public: + mdCmdPOD parms; + std::string signature; + + mdCommand(md_mand typ=MD_USER_MAND,std::string name=std::string("")) + {mdMand::handler = NULL; + mdMand::fullname = name; + mdMand::kind = typ; + } + ~mdCommand() {} + + mdCommand *mand(int deviceHandle, std::string& text); + std::string dO(void *target,std::string *text); + void *getHandler() {return mdMand::handler;} + void setHandler(void *to) {mdMand::handler = to;} + +}; +class mdResponse; /*rrj +class mdSCPI : mdCommand { +public: + + mdSCPI(std::string name) : mdCommand(MD_SCPI, name) {} + mdSCPI *setHandler(mdResponse *mdr); + std::string dO(void *target,std::string *text); + +}; */ + +typedef std::map InstructionSet; // The EPP commands by cannonical name. + +#endif diff --git a/AusRegCliever/include/mdDevice.h b/AusRegCliever/include/mdHost.h similarity index 55% rename from AusRegCliever/include/mdDevice.h rename to AusRegCliever/include/mdHost.h index 6fd6312..9611e2f 100644 --- a/AusRegCliever/include/mdDevice.h +++ b/AusRegCliever/include/mdHost.h @@ -1,7 +1,7 @@ #include -/*! \brief mdDevice +/*! \brief mdHost * General abstraction of all MD clients * * For historical reasons all clients are considered to be @@ -15,75 +15,68 @@ using namespace std; using boost::asio::ip::udp; template -class mdDevice { +class mdHost { public: bool isSingleton; int clieverGroup, // masterDaemonConfig.thisMachineContext handle,mdStdDevIdx; md_device type; - mdState state; udp::endpoint ip; - // Only Machine and Instrument use below - InstructionSet cmds; + // Only Machine and Instrument use below + InstructionSet cmds; // Some parameters initially here are now all uniformly ODEs // defined in the COOL scripts. - ~mdDevice() {} - mdDevice(md_device t) : type(t) {clieverGroup = handle = mdStdDevIdx = -1;} + ~mdHost() {} + mdHost(md_device t) : type(t) {clieverGroup = handle = mdStdDevIdx = -1;} - void lxi_control(T* device,std::string scpiText); T* registeR(md_device t); - xmlrpc_c::value* fetchCommands(std::string subSystem); void registerCmd(const char *cmdName,const mdIncoming &mdI); }; class mdClientServer; -class mdClientServer : public mdDevice { +class mdClientServer : public mdHost { public: - mdClientServer() : mdDevice( MDDEV_CD ) {}; + mdClientServer() : mdHost( MDDEV_CD ) {}; mdClientServer *validateClient(int handle, mdResponse &r); }; class mdMachine; -class mdMachine : public mdDevice { +class mdMachine : public mdHost { public: - mdMachine() : mdDevice( MACHINE ) - { cmds["RST"] = new mdCommand(MD_SCPI,std::string("RST")); } + mdMachine() : mdHost( MACHINE ) {} + mdMachine *validateClient(int handle, const mdClientBirth &c, mdResponse &r); void registerCmd(const char *cmdName,const mdIncoming &mdI); }; + class mdInstrument; -class mdInstrument : public mdDevice { +class mdInstrument : public mdHost { public: - mdInstrument() : mdDevice( MDDEV_INSTRUMENT ) - { cmds["RST"] = new mdCommand(MD_SCPI,std::string("RST")); } + mdInstrument() : mdHost( MDDEV_PEER ) + { +//rrj cmds["RST"] = new mdCommand(MD_SCPI,std::string("RST")); + cmds["RST"] = new mdCommand((md_mand)0,std::string("RST")); + } mdInstrument *validateClient(int handle, const mdClientBirth &c, mdResponse &r); void registerCmd(const char *cmdName,const mdIncoming &mdI); }; -class mdDataClient; -class mdDataClient : public mdDevice { -public: - - mdDataClient() : mdDevice( MDDEV_DATACLIENT ) {}; - mdDataClient *validateClient(int handle); -}; - class masterDaemon; -class mdDeviceFabrik : public mdDevice +class mdHostFabrik : public mdHost {public: - mdDeviceFabrik() : mdDevice( MDDEV_MD ) {} + mdHostFabrik() : mdHost( MDDEV_MD ) {} void newFromHeartbeat(const mdClientBirth &itsAWhat); std::string newFromAPI(md_device type,std::string signature); diff --git a/AusRegCliever/include/mdcommon.h b/AusRegCliever/include/mdcommon.h index 3c77424..3eb26c5 100644 --- a/AusRegCliever/include/mdcommon.h +++ b/AusRegCliever/include/mdcommon.h @@ -35,10 +35,9 @@ *
* \b boost: 1.49
* \b log4cpp: 1.0
- * \b sigc++: 2.0
* \b AusRegTk: 1.3.2
*
- * See the Tk for it's dependencies, besides that and above everything should be in the git tree. + * See the Tk for its' dependencies, besides that and above everything should be in the git tree. * *

* @@ -61,12 +60,12 @@ using namespace std; using boost::asio::ip::udp; -#define MAX_CLIENTS 10 -#define MAX_CLIEVER 1 -#define MAX_SERVERS 3 // Per Cliever cluster. +#define MAX_AC 1 +#define MAX_CLIENTS 1 +#define MAX_CLIEVER 10 +#define MAX_PEER 10 #define MAX_DEBUG 1000 // Set the config parm higher than this to inhibit logNdebug(m...) where m < this -#define MAX_DEVICE (((MAX_CLIEVER + 1) * MAX_INSTRUMENTS) + MAX_DATACLIENTS) - +#define MAX_DEVICE MAX_PEER + MAX_CLIEVER + MAX_CLIENTS + 1 #define MD_EPOCH date() #define MD_HEARTBEAT 1 // Network peer heartbeat in seconds. #define MD_MAX_DATAGRAM (32*1024) // half of the IPV4 max @@ -74,8 +73,8 @@ using boost::asio::ip::udp; #define MD_COMPONENT "Master Daemon" // Cliever Component #define MD_NAME CLIEVER_APP " " MD_COMPONENT #define MD_VERSION " 1.0 " // Version -#define MD_REFRESH 10 // default milliseconds between telemetry frame updates -#define MD_TYPE "AUSREGCLIEVER" // i.e. what a MACHINE is, Change per your Cliever derivation +#define MD_REFRESH 10 // default milliseconds between API frame updates +#define MD_TYPE "EPPCLIENT" #define NORMAL_DEBUG 10 #ifndef CURRENT_DEBUG #define CURRENT_DEBUG NORMAL_DEBUG @@ -117,8 +116,9 @@ enum md_dispatch_category { enum md_device { MDDEV_MD = 0, MDDEV_CD, - MACHINE, MDDEV_DATACLIENT, + MDDEV_PEER, + MACHINE, N_MDDEV_TYPES }; @@ -132,8 +132,11 @@ enum mdDGtype { MDDG_DEVICEHB, MDDG_NEWBORN, MDDG_MDQUERY, - MDDG_MDDATA, - MDDG_MDMAND, + MDDG_REGSCPI, + MDDG_REGOBS, + MDDG_REGODE, + MDDG_TELEMETRY, + MDDG_CDRESET, N_MDDG_TYPES }; diff --git a/AusRegCliever/include/mdevents.h b/AusRegCliever/include/mdevents.h index ad95e0c..45a268f 100644 --- a/AusRegCliever/include/mdevents.h +++ b/AusRegCliever/include/mdevents.h @@ -34,7 +34,7 @@ class mdClientDeath: public TimeStampedEvent<>, public PolymorphEvent { virtual void send() const { sendTypedEvent(*this); } }; -class mdDeviceCommand: public TimeStampedEvent<>, public PolymorphEvent { +class mdHostCommand: public TimeStampedEvent<>, public PolymorphEvent { public: virtual void send() const { sendTypedEvent(*this); } @@ -72,11 +72,11 @@ public: virtual void send() const { sendTypedEvent(*this); } }; -class mdTelemetryFrame: public TimeStampedEvent<>, public PolymorphEvent { +class mdAPIFrame: public TimeStampedEvent<>, public PolymorphEvent { public: int mdStdDevIdx; - mdTelemetryFrame() {mdStdDevIdx = -1;} + mdAPIFrame() {mdStdDevIdx = -1;} virtual void send() const { sendTypedEvent(*this); } }; diff --git a/AusRegCliever/server/Listener.cpp b/AusRegCliever/server/Listener.cpp index 7aefd0d..422099e 100644 --- a/AusRegCliever/server/Listener.cpp +++ b/AusRegCliever/server/Listener.cpp @@ -24,8 +24,6 @@ \endcopyright */ -#include "Listener.h" -#include "EventSender.h" /** Tell EventSender that this listener is ignoring the event received. This will increment a counter in EventSender, such that a call to diff --git a/AusRegCliever/server/cliever-md.cpp b/AusRegCliever/server/cliever-md.cpp index b885c35..ee68405 100644 --- a/AusRegCliever/server/cliever-md.cpp +++ b/AusRegCliever/server/cliever-md.cpp @@ -66,8 +66,8 @@ void md() { theseLogs->logN(0,"AusReg Cliever <- MasterDaemon."); } - boost::thread foreground(runMasterDaemon);` - boost::thread background(runClientLayer); + boost::thread foreground(runMasterDaemon); + boost::thread background(runAPILayer); if (!foreground.joinable()) { theseLogs->logN(0,"Fatal Error: couldn't start master daemon!"); @@ -76,7 +76,7 @@ void md() { if (background.joinable()) { theseLogs->logN(2,"%s %d","Accepting API Requests on Port",thisConfig->clientPort); - myAusRegProcess.run(); +// myAusRegTk.init(); background.join(); // normally unreachable } else theseLogs->logN(0,"Fatal Error: couldn't start client service layer!"); diff --git a/AusRegCliever/server/masterDaemon.cpp b/AusRegCliever/server/masterDaemon.cpp index 97cf429..06169d5 100644 --- a/AusRegCliever/server/masterDaemon.cpp +++ b/AusRegCliever/server/masterDaemon.cpp @@ -1,9 +1,9 @@ #define MD_CORE -#include "auc-md.h" +#include "cliever-md.h" #include "masterDaemon.h" -#include "coreapi.h" -#include "../server/Listener.cpp" -#include "../server/EventSender2.cpp" +//#include "coreapi.h" +#include "Listener.cpp" +#include "EventSender2.cpp" void attention(); void arCallback(const boost::system::error_code& error); @@ -82,8 +82,8 @@ void masterDaemon::dispatch(const mdIncoming &what) { switch(what.dg.hdr.dgSubType) { case MDDG_REGSCPI: theseLogs->logNdebug(NORMAL_DEBUG,4,"Src SCPI: '%s' from type: %d ('%s'), handle %d.", name, what.dg.hdr.clientType,xStr,about); - if (thisKind == MACHINE) theMachine->registerCmd(name,what); - else thisConfig->instruments[about]->registerCmd(name,what); + //rrj if (thisKind == MACHINE) theMachine->registerCmd(name,what); + //rrj else thisConfig->eppServers[about]->registerCmd(name,what); break; case MDDG_REGODE: theseLogs->logNdebug(NORMAL_DEBUG,4,"Src ODE: '%s' from type: %d ('%s'), handle %d.", name, what.dg.hdr.clientType,xStr,about); @@ -91,8 +91,8 @@ void masterDaemon::dispatch(const mdIncoming &what) { case MDDG_REGOBS: theseLogs->logNdebug(NORMAL_DEBUG,4,"Src Obs: '%s' from type: %d ('%s'), handle %d.", name, what.dg.hdr.clientType,xStr,about); regName: - if (thisKind == MACHINE) theMachine->state.registerData(name,what); - else thisConfig->instruments[about]->state.registerData(name,what); + //rrj if (thisKind == MACHINE) theMachine->state.registerData(name,what); + //rrj else thisConfig->instruments[about]->state.registerData(name,what); break; }} break; @@ -132,21 +132,6 @@ int masterDaemon::initBaseAPI(void) { theseLogs->logN(0,"Create Generic Core API"); - xmlrpc_c::methodPtr const registerDeviceP(new registerDevice(thisService->cfg)); - xmlrpc_c::methodPtr const getMDversionP(new getMDversion); - xmlrpc_c::methodPtr const getP(new getter); - xmlrpc_c::methodPtr const setP(new setter); - xmlrpc_c::methodPtr const getCmdListP(new cmdListFetch); - xmlrpc_c::methodPtr const getCmdP(new cmd); - xmlrpc_c::methodPtr const createP(new create); - - thisConfig->api_registry.addMethod("device.registeR", registerDeviceP ); - thisConfig->api_registry.addMethod("state.getMDversion", getMDversionP ); - thisConfig->api_registry.addMethod("state.create", createP); - thisConfig->api_registry.addMethod("state.get", getP ); - thisConfig->api_registry.addMethod("state.set", setP ); - thisConfig->api_registry.addMethod("behavior.getCommandList", getCmdListP ); - thisConfig->api_registry.addMethod("behavior.command", getCmdP ); } catch(...) @@ -165,14 +150,14 @@ void masterDaemon::listen() { assert(EventSender::getNumListeners() == 1); EventSender::add(*this); assert(EventSender::getNumListeners() == 1); - EventSender::add(*this); - assert(EventSender::getNumListeners() == 1); + EventSender::add(*this); + assert(EventSender::getNumListeners() == 1); EventSender::add(*this); assert(EventSender::getNumListeners() == 1); EventSender::add(*this); assert(EventSender::getNumListeners() == 1); - EventSender::add(*this); - assert(EventSender::getNumListeners() == 1); + EventSender::add(*this); + assert(EventSender::getNumListeners() == 1); boost::thread mdAr(attention); @@ -200,9 +185,9 @@ void masterDaemon::processEvent( const mdClientDeath &thisWas ) { assert(EventSender::isSending()); } -void masterDaemon::processEvent( const mdDeviceCommand &thisCmd ) +void masterDaemon::processEvent( const mdHostCommand &thisCmd ) { - assert(EventSender::isSending()); + assert(EventSender::isSending()); } void masterDaemon::processEvent( const mdIncoming &thisDatagram ) { @@ -217,13 +202,13 @@ void masterDaemon::processEvent( const mdResponse &thisReply ) queue(new mdWQitem( queued, thisReply.dCat, 0 )); } -void masterDaemon::processEvent( const mdTelemetryFrame &thisFrame ) +void masterDaemon::processEvent( const mdAPIFrame &thisFrame ) { - assert(EventSender::isSending()); + assert(EventSender::isSending()); } void masterDaemon::run() { - deviceFactory = new mdDeviceFabrik(); + deviceFactory = new mdHostFabrik(); fg = new mdDGChannel( thisService->io_, 0 ); if (initBaseAPI()) return; @@ -301,15 +286,15 @@ void mdWQ() { } } -void runDataLayer() { +void runAPILayer() { boost::asio::io_service io_; - theseLogs->logN(1,"Background dgram service thread starting on port %d.",thisConfig->telemetryPort); + theseLogs->logN(1,"Background dgram service thread starting on port %d.",thisConfig->clientPort); try { - thisService->bg = new mdDGChannel(io_, thisConfig->telemetryPort); + thisService->bg = new mdDGChannel(io_, thisConfig->clientPort); io_.run(); } @@ -319,7 +304,7 @@ void runDataLayer() { } catch (...) { - theseLogs->logN(0,"Unknown failure in background datalayer."); + theseLogs->logN(0,"Unknown failure in background service layer."); } theseLogs->logNdebug(1,0,"mainbus background thread exited."); diff --git a/AusRegCliever/server/masterDaemonConfig.cpp b/AusRegCliever/server/masterDaemonConfig.cpp new file mode 100644 index 0000000..1188af4 --- /dev/null +++ b/AusRegCliever/server/masterDaemonConfig.cpp @@ -0,0 +1,33 @@ +#include "cliever-md.h" + +const char *mdStdErrs[] = { "No error detected.", "Required state/element missing.", "Already exists.", + "Conflict detected.", "Not ready.", "Syntax error." }; + +masterDaemonConfig::masterDaemonConfig() { + + nClievers = 0; + configPath = "./"; + logPath = "/tmp"; + daemonized = true; +// used in the logNdebug by increasing power of 10. + debugThreshold = CURRENT_DEBUG; + halt = false; + shuttingDown = false; + shutdown = false; + thisMachineContext = -1; // in v 1.0. there's only 1 but the +// basis for more than one is pre-established. + err = mdStdErrs; +} +int masterDaemonConfig::loadMachineConfiguration(int deviceType) { + + int rc=OK; + + if (!deviceType) { + + } + + /* \todo Add configuration process for non-MD_TYPE devices */ + + return rc; + +} diff --git a/AusRegCliever/server/mdBehavior.cpp b/AusRegCliever/server/mdBehavior.cpp new file mode 100644 index 0000000..c5d5463 --- /dev/null +++ b/AusRegCliever/server/mdBehavior.cpp @@ -0,0 +1,34 @@ +#include "cliever-md.h" +#ifdef MD_MAND +#include +#endif +using namespace std; + + extern xmlrpc_c::registry aucMDregistry; + extern "C" int lxi_control(int,char **); + +std::string mdCommand::dO(void *targeT,std::string *text) { + + return std::string("OK"); + +} +mdSCPI *mdSCPI::setHandler(mdResponse *mdr) { + + mdSCPI *value = this; + mdCmdPOD *flat = (mdCmdPOD *)(&mdr->reply.dg.payLoad[0]); + + memcpy(flat,&this->parms,sizeof(mdCmdPOD)); + strcpy(&flat->sVal,this->signature.c_str()); + flat->nArgs = this->signature.length(); + + mdr->reply.dg.hdr.primeOffset = mdr->reply.dg.hdr.payloadSize = sizeof(mdCmdPOD) + flat->nArgs; + + done: return value; + +} +bool mdMandSpace::setFullName() { + + bool value=true; + + return value; +} diff --git a/AusRegCliever/server/mdDevice.cpp b/AusRegCliever/server/mdHost.cpp similarity index 91% rename from AusRegCliever/server/mdDevice.cpp rename to AusRegCliever/server/mdHost.cpp index b52e588..6561838 100644 --- a/AusRegCliever/server/mdDevice.cpp +++ b/AusRegCliever/server/mdHost.cpp @@ -1,7 +1,7 @@ #include "cliever-md.h" #include "masterDaemon.h" -#include "../server/Listener.cpp" -#include "../server/EventSender2.cpp" +#include "Listener.cpp" +#include "EventSender2.cpp" using namespace std; /*! \brief Client object implementatios @@ -28,12 +28,13 @@ int getHandle() { return value; } -template T* mdDevice::registeR(md_device t) { +template T* mdHost::registeR(md_device t) { T *value=NULL; int h = getHandle(); - if (value=mdDevice::validateClient(h)) { +//rrj if (value=mdHost::validateClient(h)) { + if (0) { theseLogs->logN(2,"Handle %d assigned to new client of type: %s",clientTypes[t]); } else { theseLogs->logN(2,"Validation failed for client type: %s",clientTypes[t]); @@ -45,9 +46,9 @@ template T* mdDevice::registeR(md_device t) { thisConfig->allClients[h] = value; // validateClient has already added to group return value ; -} +}/* template - void mdDevice::lxi_control(T *device, std::string fullText) { + void mdHost::lxi_control(T *device, std::string fullText) { T *target = device; char *ip,*port,*command,*timeout,*argv[5]; @@ -69,7 +70,7 @@ template free(timeout); free(command); -} +}*/ mdClientServer* mdClientServer::validateClient(int handle, mdResponse &r) { bool isNew=true; @@ -121,7 +122,7 @@ mdMachine* mdMachine::validateClient(int handle, const mdClientBirth &c, mdRespo done: return value; -} +}/* mdInstrument* mdInstrument::validateClient(int handle, const mdClientBirth &c, mdResponse &r) { mdInstrument *value=NULL; @@ -146,11 +147,11 @@ mdDataClient* mdDataClient::validateClient(int handle) { return value; -} -std::string mdDeviceFabrik::newFromAPI(md_device type,std::string thisSpecialOne) { +}*/ +std::string mdHostFabrik::newFromAPI(md_device type,std::string thisSpecialOne) { } -void mdDeviceFabrik::newFromHeartbeat(const mdClientBirth &thisOne) { +void mdHostFabrik::newFromHeartbeat(const mdClientBirth &thisOne) { const char *kind,*outcome; void *resultat; @@ -176,8 +177,8 @@ void mdDeviceFabrik::newFromHeartbeat(const mdClientBirth &thisOne) { case MDDEV_CD: thisKind = MDDEV_CD; kind = "cliever"; - newCliever = new mdClientServer(); - if (resultat = newCliever = newCliever->validateClient( maybe, *result )) { + newCliever = new mdClientServer(); if (0) { +//rrj if (resultat = newCliever = newCliever->validateClient( maybe, *result )) { newCliever->ip = thisOne.ip; mdStdDevIdx = newCliever->mdStdDevIdx; } @@ -187,22 +188,24 @@ void mdDeviceFabrik::newFromHeartbeat(const mdClientBirth &thisOne) { thisKind = MACHINE; kind = "machine"; newMachine = new mdMachine(); - if (resultat = newMachine = newMachine->validateClient( maybe, thisOne, *result )) { +// if (resultat = newMachine = newMachine->validateClient( maybe, thisOne, *result )) { + if (0) { theMachine = newMachine; newMachine->ip = thisOne.ip; mdStdDevIdx = MAX_CLIEVER + thisOne.dg.hdr.dgType.clieverGroup; } else delete newMachine; break; - case MDDEV_INSTRUMENT: - thisKind = MDDEV_INSTRUMENT; - kind = "instrument"; + case MDDEV_PEER: + thisKind = MDDEV_PEER; + kind = "EPP Server"; newInstrument = new mdInstrument(); - if (!(resultat = newInstrument = newInstrument->validateClient( maybe, thisOne, *result ))) +// if (!(resultat = newInstrument = newInstrument->validateClient( maybe, thisOne, *result ))) + if (0) delete newInstrument; else {newInstrument->ip = thisOne.ip; - for (i=0;iinstruments[i];i++); - thisService->instruments[i] = maybe; + for (i=0;ieppServers[i];i++); + thisService->eppServers[i] = maybe; mdStdDevIdx = 2+i; } break; diff --git a/AusRegEPPTK/build/AddRemType.o b/AusRegEPPTK/build/AddRemType.o deleted file mode 100644 index 8c7e565..0000000 Binary files a/AusRegEPPTK/build/AddRemType.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainCreateCommand.o b/AusRegEPPTK/build/AeDomainCreateCommand.o deleted file mode 100644 index 319f5da..0000000 Binary files a/AusRegEPPTK/build/AeDomainCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainCreateCommandTest b/AusRegEPPTK/build/AeDomainCreateCommandTest deleted file mode 100755 index fbcc601..0000000 Binary files a/AusRegEPPTK/build/AeDomainCreateCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainInfoResponse.o b/AusRegEPPTK/build/AeDomainInfoResponse.o deleted file mode 100644 index 17bd5ed..0000000 Binary files a/AusRegEPPTK/build/AeDomainInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainModifyRegistrantCommand.o b/AusRegEPPTK/build/AeDomainModifyRegistrantCommand.o deleted file mode 100644 index f975f7d..0000000 Binary files a/AusRegEPPTK/build/AeDomainModifyRegistrantCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainObjectType.o b/AusRegEPPTK/build/AeDomainObjectType.o deleted file mode 100644 index a13e210..0000000 Binary files a/AusRegEPPTK/build/AeDomainObjectType.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainTransferRegistrantCommand.o b/AusRegEPPTK/build/AeDomainTransferRegistrantCommand.o deleted file mode 100644 index 4781c30..0000000 Binary files a/AusRegEPPTK/build/AeDomainTransferRegistrantCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeDomainTransferRegistrantResponse.o b/AusRegEPPTK/build/AeDomainTransferRegistrantResponse.o deleted file mode 100644 index ccda8d6..0000000 Binary files a/AusRegEPPTK/build/AeDomainTransferRegistrantResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/AeExtension.o b/AusRegEPPTK/build/AeExtension.o deleted file mode 100644 index ade12ef..0000000 Binary files a/AusRegEPPTK/build/AeExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainObjectType.o b/AusRegEPPTK/build/ArDomainObjectType.o deleted file mode 100644 index 112ffc8..0000000 Binary files a/AusRegEPPTK/build/ArDomainObjectType.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainPolicyDeleteCommand.o b/AusRegEPPTK/build/ArDomainPolicyDeleteCommand.o deleted file mode 100644 index deabda4..0000000 Binary files a/AusRegEPPTK/build/ArDomainPolicyDeleteCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainPolicyDeleteCommandTest b/AusRegEPPTK/build/ArDomainPolicyDeleteCommandTest deleted file mode 100755 index f94ea15..0000000 Binary files a/AusRegEPPTK/build/ArDomainPolicyDeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainPolicyUndeleteCommand.o b/AusRegEPPTK/build/ArDomainPolicyUndeleteCommand.o deleted file mode 100644 index dcec598..0000000 Binary files a/AusRegEPPTK/build/ArDomainPolicyUndeleteCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainPolicyUndeleteCommandTest b/AusRegEPPTK/build/ArDomainPolicyUndeleteCommandTest deleted file mode 100755 index 5d170ec..0000000 Binary files a/AusRegEPPTK/build/ArDomainPolicyUndeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUndeleteCommand.o b/AusRegEPPTK/build/ArDomainUndeleteCommand.o deleted file mode 100644 index 6c14fba..0000000 Binary files a/AusRegEPPTK/build/ArDomainUndeleteCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUndeleteCommandTest b/AusRegEPPTK/build/ArDomainUndeleteCommandTest deleted file mode 100755 index 9c80fa4..0000000 Binary files a/AusRegEPPTK/build/ArDomainUndeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUnrenewCommand.o b/AusRegEPPTK/build/ArDomainUnrenewCommand.o deleted file mode 100644 index c01b8ae..0000000 Binary files a/AusRegEPPTK/build/ArDomainUnrenewCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUnrenewCommandTest b/AusRegEPPTK/build/ArDomainUnrenewCommandTest deleted file mode 100755 index 85d4344..0000000 Binary files a/AusRegEPPTK/build/ArDomainUnrenewCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUnrenewResponse.o b/AusRegEPPTK/build/ArDomainUnrenewResponse.o deleted file mode 100644 index 45bb23c..0000000 Binary files a/AusRegEPPTK/build/ArDomainUnrenewResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArDomainUnrenewResponseTest b/AusRegEPPTK/build/ArDomainUnrenewResponseTest deleted file mode 100755 index 72032fa..0000000 Binary files a/AusRegEPPTK/build/ArDomainUnrenewResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/ArExtension.o b/AusRegEPPTK/build/ArExtension.o deleted file mode 100644 index 3841286..0000000 Binary files a/AusRegEPPTK/build/ArExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/ArUnrenewCommandType.o b/AusRegEPPTK/build/ArUnrenewCommandType.o deleted file mode 100644 index 46f4878..0000000 Binary files a/AusRegEPPTK/build/ArUnrenewCommandType.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainCreateCommand.o b/AusRegEPPTK/build/AuDomainCreateCommand.o deleted file mode 100644 index b12fb53..0000000 Binary files a/AusRegEPPTK/build/AuDomainCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainCreateCommandTest b/AusRegEPPTK/build/AuDomainCreateCommandTest deleted file mode 100755 index fd087d7..0000000 Binary files a/AusRegEPPTK/build/AuDomainCreateCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainCreateCommandV1.o b/AusRegEPPTK/build/AuDomainCreateCommandV1.o deleted file mode 100644 index 00bdcdb..0000000 Binary files a/AusRegEPPTK/build/AuDomainCreateCommandV1.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainInfoResponse.o b/AusRegEPPTK/build/AuDomainInfoResponse.o deleted file mode 100644 index 2b4c6b8..0000000 Binary files a/AusRegEPPTK/build/AuDomainInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainInfoResponseTest b/AusRegEPPTK/build/AuDomainInfoResponseTest deleted file mode 100755 index 0561d4c..0000000 Binary files a/AusRegEPPTK/build/AuDomainInfoResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainInfoResponseV1.o b/AusRegEPPTK/build/AuDomainInfoResponseV1.o deleted file mode 100644 index 56a8ffd..0000000 Binary files a/AusRegEPPTK/build/AuDomainInfoResponseV1.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainInfoResponsev1Test b/AusRegEPPTK/build/AuDomainInfoResponsev1Test deleted file mode 100755 index aa44a8d..0000000 Binary files a/AusRegEPPTK/build/AuDomainInfoResponsev1Test and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainModifyRegistrantCommand.o b/AusRegEPPTK/build/AuDomainModifyRegistrantCommand.o deleted file mode 100644 index 55f0a82..0000000 Binary files a/AusRegEPPTK/build/AuDomainModifyRegistrantCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainModifyRegistrantCommandTest b/AusRegEPPTK/build/AuDomainModifyRegistrantCommandTest deleted file mode 100755 index 0506a80..0000000 Binary files a/AusRegEPPTK/build/AuDomainModifyRegistrantCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainObjectType.o b/AusRegEPPTK/build/AuDomainObjectType.o deleted file mode 100644 index a2b9a5c..0000000 Binary files a/AusRegEPPTK/build/AuDomainObjectType.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainTransferRegistrantCommand.o b/AusRegEPPTK/build/AuDomainTransferRegistrantCommand.o deleted file mode 100644 index 3b1f3b9..0000000 Binary files a/AusRegEPPTK/build/AuDomainTransferRegistrantCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainTransferRegistrantCommandTest b/AusRegEPPTK/build/AuDomainTransferRegistrantCommandTest deleted file mode 100755 index 61a87b4..0000000 Binary files a/AusRegEPPTK/build/AuDomainTransferRegistrantCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainTransferRegistrantResponse.o b/AusRegEPPTK/build/AuDomainTransferRegistrantResponse.o deleted file mode 100644 index 271ab90..0000000 Binary files a/AusRegEPPTK/build/AuDomainTransferRegistrantResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuDomainTransferRegistrantResponseTest b/AusRegEPPTK/build/AuDomainTransferRegistrantResponseTest deleted file mode 100755 index 5e16df3..0000000 Binary files a/AusRegEPPTK/build/AuDomainTransferRegistrantResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/AuExtension.o b/AusRegEPPTK/build/AuExtension.o deleted file mode 100644 index fd86d16..0000000 Binary files a/AusRegEPPTK/build/AuExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/AuExtensionV1.o b/AusRegEPPTK/build/AuExtensionV1.o deleted file mode 100644 index e269158..0000000 Binary files a/AusRegEPPTK/build/AuExtensionV1.o and /dev/null differ diff --git a/AusRegEPPTK/build/CLTRID.o b/AusRegEPPTK/build/CLTRID.o deleted file mode 100644 index 007cb8c..0000000 Binary files a/AusRegEPPTK/build/CLTRID.o and /dev/null differ diff --git a/AusRegEPPTK/build/CertificateUserMismatchException.o b/AusRegEPPTK/build/CertificateUserMismatchException.o deleted file mode 100644 index f2088c0..0000000 Binary files a/AusRegEPPTK/build/CertificateUserMismatchException.o and /dev/null differ diff --git a/AusRegEPPTK/build/CheckResponse.o b/AusRegEPPTK/build/CheckResponse.o deleted file mode 100644 index 3c4db4e..0000000 Binary files a/AusRegEPPTK/build/CheckResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/Command.o b/AusRegEPPTK/build/Command.o deleted file mode 100644 index 1a7dad4..0000000 Binary files a/AusRegEPPTK/build/Command.o and /dev/null differ diff --git a/AusRegEPPTK/build/CommandCounter.o b/AusRegEPPTK/build/CommandCounter.o deleted file mode 100644 index e5e7342..0000000 Binary files a/AusRegEPPTK/build/CommandCounter.o and /dev/null differ diff --git a/AusRegEPPTK/build/CommandCounterTest b/AusRegEPPTK/build/CommandCounterTest deleted file mode 100755 index 20e6241..0000000 Binary files a/AusRegEPPTK/build/CommandCounterTest and /dev/null differ diff --git a/AusRegEPPTK/build/Constants.o b/AusRegEPPTK/build/Constants.o deleted file mode 100644 index 8a38f12..0000000 Binary files a/AusRegEPPTK/build/Constants.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactCheckCommandTest b/AusRegEPPTK/build/ContactCheckCommandTest deleted file mode 100755 index 0527949..0000000 Binary files a/AusRegEPPTK/build/ContactCheckCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactCheckResponse.o b/AusRegEPPTK/build/ContactCheckResponse.o deleted file mode 100644 index 9ed87fc..0000000 Binary files a/AusRegEPPTK/build/ContactCheckResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactCheckResponseTest b/AusRegEPPTK/build/ContactCheckResponseTest deleted file mode 100755 index dc54ae9..0000000 Binary files a/AusRegEPPTK/build/ContactCheckResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactCreateCommand.o b/AusRegEPPTK/build/ContactCreateCommand.o deleted file mode 100644 index 44e1970..0000000 Binary files a/AusRegEPPTK/build/ContactCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactCreateResponse.o b/AusRegEPPTK/build/ContactCreateResponse.o deleted file mode 100644 index d13fc56..0000000 Binary files a/AusRegEPPTK/build/ContactCreateResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactDeleteCommandTest b/AusRegEPPTK/build/ContactDeleteCommandTest deleted file mode 100755 index f768325..0000000 Binary files a/AusRegEPPTK/build/ContactDeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactInfoCommandTest b/AusRegEPPTK/build/ContactInfoCommandTest deleted file mode 100755 index 53f838d..0000000 Binary files a/AusRegEPPTK/build/ContactInfoCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactInfoResponse.o b/AusRegEPPTK/build/ContactInfoResponse.o deleted file mode 100644 index f57dc83..0000000 Binary files a/AusRegEPPTK/build/ContactInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactInfoResponseTest b/AusRegEPPTK/build/ContactInfoResponseTest deleted file mode 100755 index 7889e58..0000000 Binary files a/AusRegEPPTK/build/ContactInfoResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactNotificationResponse.o b/AusRegEPPTK/build/ContactNotificationResponse.o deleted file mode 100644 index c3d4334..0000000 Binary files a/AusRegEPPTK/build/ContactNotificationResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactTransferRequestCommandTest b/AusRegEPPTK/build/ContactTransferRequestCommandTest deleted file mode 100755 index 32f0f14..0000000 Binary files a/AusRegEPPTK/build/ContactTransferRequestCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/ContactTransferResponse.o b/AusRegEPPTK/build/ContactTransferResponse.o deleted file mode 100644 index 69af6fd..0000000 Binary files a/AusRegEPPTK/build/ContactTransferResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ContactUpdateCommand.o b/AusRegEPPTK/build/ContactUpdateCommand.o deleted file mode 100644 index 45dda07..0000000 Binary files a/AusRegEPPTK/build/ContactUpdateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/CreateResponse.o b/AusRegEPPTK/build/CreateResponse.o deleted file mode 100644 index 6ccb4fe..0000000 Binary files a/AusRegEPPTK/build/CreateResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DataResponse.o b/AusRegEPPTK/build/DataResponse.o deleted file mode 100644 index ffb601e..0000000 Binary files a/AusRegEPPTK/build/DataResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/Disclose.o b/AusRegEPPTK/build/Disclose.o deleted file mode 100644 index 58fd8d4..0000000 Binary files a/AusRegEPPTK/build/Disclose.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainAddRem.o b/AusRegEPPTK/build/DomainAddRem.o deleted file mode 100644 index 74f5d7e..0000000 Binary files a/AusRegEPPTK/build/DomainAddRem.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainCheckCommandTest b/AusRegEPPTK/build/DomainCheckCommandTest deleted file mode 100755 index 5155be1..0000000 Binary files a/AusRegEPPTK/build/DomainCheckCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainCheckResponse.o b/AusRegEPPTK/build/DomainCheckResponse.o deleted file mode 100644 index 0697503..0000000 Binary files a/AusRegEPPTK/build/DomainCheckResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainCheckResponseTest b/AusRegEPPTK/build/DomainCheckResponseTest deleted file mode 100755 index c3a5fa9..0000000 Binary files a/AusRegEPPTK/build/DomainCheckResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainCreateCommand.o b/AusRegEPPTK/build/DomainCreateCommand.o deleted file mode 100644 index c1ac7d2..0000000 Binary files a/AusRegEPPTK/build/DomainCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainCreateResponse.o b/AusRegEPPTK/build/DomainCreateResponse.o deleted file mode 100644 index 893fdc4..0000000 Binary files a/AusRegEPPTK/build/DomainCreateResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainDeleteCommandTest b/AusRegEPPTK/build/DomainDeleteCommandTest deleted file mode 100755 index 2f35956..0000000 Binary files a/AusRegEPPTK/build/DomainDeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainInfoCommandTest b/AusRegEPPTK/build/DomainInfoCommandTest deleted file mode 100755 index 07aee5a..0000000 Binary files a/AusRegEPPTK/build/DomainInfoCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainInfoKVResponseExtension.o b/AusRegEPPTK/build/DomainInfoKVResponseExtension.o deleted file mode 100644 index 682806e..0000000 Binary files a/AusRegEPPTK/build/DomainInfoKVResponseExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainInfoKVResponseExtensionTest b/AusRegEPPTK/build/DomainInfoKVResponseExtensionTest deleted file mode 100755 index fea049f..0000000 Binary files a/AusRegEPPTK/build/DomainInfoKVResponseExtensionTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainInfoResponse.o b/AusRegEPPTK/build/DomainInfoResponse.o deleted file mode 100644 index 2b08789..0000000 Binary files a/AusRegEPPTK/build/DomainInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainKVCommandExtension.o b/AusRegEPPTK/build/DomainKVCommandExtension.o deleted file mode 100644 index 802f0bd..0000000 Binary files a/AusRegEPPTK/build/DomainKVCommandExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainKVCommandExtensionTest b/AusRegEPPTK/build/DomainKVCommandExtensionTest deleted file mode 100755 index 09f08c4..0000000 Binary files a/AusRegEPPTK/build/DomainKVCommandExtensionTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainNotificationResponse.o b/AusRegEPPTK/build/DomainNotificationResponse.o deleted file mode 100644 index 724e5e8..0000000 Binary files a/AusRegEPPTK/build/DomainNotificationResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRegistrantTransferCommand.o b/AusRegEPPTK/build/DomainRegistrantTransferCommand.o deleted file mode 100644 index 180c8c6..0000000 Binary files a/AusRegEPPTK/build/DomainRegistrantTransferCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRegistrantTransferCommandTest b/AusRegEPPTK/build/DomainRegistrantTransferCommandTest deleted file mode 100755 index 9712aff..0000000 Binary files a/AusRegEPPTK/build/DomainRegistrantTransferCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRegistrantTransferResponse.o b/AusRegEPPTK/build/DomainRegistrantTransferResponse.o deleted file mode 100644 index 47a2c80..0000000 Binary files a/AusRegEPPTK/build/DomainRegistrantTransferResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRegistrantTransferResponseTest b/AusRegEPPTK/build/DomainRegistrantTransferResponseTest deleted file mode 100755 index cc4bf68..0000000 Binary files a/AusRegEPPTK/build/DomainRegistrantTransferResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRenewCommand.o b/AusRegEPPTK/build/DomainRenewCommand.o deleted file mode 100644 index 4b93301..0000000 Binary files a/AusRegEPPTK/build/DomainRenewCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainRenewResponse.o b/AusRegEPPTK/build/DomainRenewResponse.o deleted file mode 100644 index 18e147f..0000000 Binary files a/AusRegEPPTK/build/DomainRenewResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSCreateCommandExtension.o b/AusRegEPPTK/build/DomainSecDNSCreateCommandExtension.o deleted file mode 100644 index e5a345a..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSCreateCommandExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSCreateCommandExtensionTest b/AusRegEPPTK/build/DomainSecDNSCreateCommandExtensionTest deleted file mode 100755 index b8cdb38..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSCreateCommandExtensionTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSInfoResponseExtension.o b/AusRegEPPTK/build/DomainSecDNSInfoResponseExtension.o deleted file mode 100644 index c795546..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSInfoResponseExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSInfoResponseExtensionTest b/AusRegEPPTK/build/DomainSecDNSInfoResponseExtensionTest deleted file mode 100755 index 7403809..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSInfoResponseExtensionTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtension.o b/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtension.o deleted file mode 100644 index aad57ed..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtensionTest b/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtensionTest deleted file mode 100755 index 686f621..0000000 Binary files a/AusRegEPPTK/build/DomainSecDNSUpdateCommandExtensionTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainTransferQueryCommandTest b/AusRegEPPTK/build/DomainTransferQueryCommandTest deleted file mode 100755 index f3eff7f..0000000 Binary files a/AusRegEPPTK/build/DomainTransferQueryCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainTransferResponse.o b/AusRegEPPTK/build/DomainTransferResponse.o deleted file mode 100644 index 11afb09..0000000 Binary files a/AusRegEPPTK/build/DomainTransferResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainUpdateCommand.o b/AusRegEPPTK/build/DomainUpdateCommand.o deleted file mode 100644 index 1425f0a..0000000 Binary files a/AusRegEPPTK/build/DomainUpdateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/DomainUpdateCommandTest b/AusRegEPPTK/build/DomainUpdateCommandTest deleted file mode 100755 index 8cd7588..0000000 Binary files a/AusRegEPPTK/build/DomainUpdateCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/DomainUpdateSyncCommandExtension.o b/AusRegEPPTK/build/DomainUpdateSyncCommandExtension.o deleted file mode 100644 index ce334ed..0000000 Binary files a/AusRegEPPTK/build/DomainUpdateSyncCommandExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/E164Extension.o b/AusRegEPPTK/build/E164Extension.o deleted file mode 100644 index 56477f6..0000000 Binary files a/AusRegEPPTK/build/E164Extension.o and /dev/null differ diff --git a/AusRegEPPTK/build/EPPDateFormatter.o b/AusRegEPPTK/build/EPPDateFormatter.o deleted file mode 100644 index b631d5d..0000000 Binary files a/AusRegEPPTK/build/EPPDateFormatter.o and /dev/null differ diff --git a/AusRegEPPTK/build/EPPDateFormatterTest b/AusRegEPPTK/build/EPPDateFormatterTest deleted file mode 100755 index b2d184f..0000000 Binary files a/AusRegEPPTK/build/EPPDateFormatterTest and /dev/null differ diff --git a/AusRegEPPTK/build/EPPExceptionTest b/AusRegEPPTK/build/EPPExceptionTest deleted file mode 100755 index e77fe79..0000000 Binary files a/AusRegEPPTK/build/EPPExceptionTest and /dev/null differ diff --git a/AusRegEPPTK/build/EPPWriter.o b/AusRegEPPTK/build/EPPWriter.o deleted file mode 100644 index fa19e71..0000000 Binary files a/AusRegEPPTK/build/EPPWriter.o and /dev/null differ diff --git a/AusRegEPPTK/build/EnumDomainCreateCommand.o b/AusRegEPPTK/build/EnumDomainCreateCommand.o deleted file mode 100644 index 644ccd4..0000000 Binary files a/AusRegEPPTK/build/EnumDomainCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/EnumDomainInfoResponse.o b/AusRegEPPTK/build/EnumDomainInfoResponse.o deleted file mode 100644 index 0c67752..0000000 Binary files a/AusRegEPPTK/build/EnumDomainInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/EnumDomainInfoResponseTest b/AusRegEPPTK/build/EnumDomainInfoResponseTest deleted file mode 100755 index 008b5f5..0000000 Binary files a/AusRegEPPTK/build/EnumDomainInfoResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/EnumDomainUpdateCommand.o b/AusRegEPPTK/build/EnumDomainUpdateCommand.o deleted file mode 100644 index ab3e95e..0000000 Binary files a/AusRegEPPTK/build/EnumDomainUpdateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/EnumType.o b/AusRegEPPTK/build/EnumType.o deleted file mode 100644 index 3dcd41e..0000000 Binary files a/AusRegEPPTK/build/EnumType.o and /dev/null differ diff --git a/AusRegEPPTK/build/ErrorPkg.o b/AusRegEPPTK/build/ErrorPkg.o deleted file mode 100644 index d48a776..0000000 Binary files a/AusRegEPPTK/build/ErrorPkg.o and /dev/null differ diff --git a/AusRegEPPTK/build/Greeting.o b/AusRegEPPTK/build/Greeting.o deleted file mode 100644 index 24ab7f7..0000000 Binary files a/AusRegEPPTK/build/Greeting.o and /dev/null differ diff --git a/AusRegEPPTK/build/HelloTest b/AusRegEPPTK/build/HelloTest deleted file mode 100755 index b0f198c..0000000 Binary files a/AusRegEPPTK/build/HelloTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostAddRem.o b/AusRegEPPTK/build/HostAddRem.o deleted file mode 100644 index a2ee006..0000000 Binary files a/AusRegEPPTK/build/HostAddRem.o and /dev/null differ diff --git a/AusRegEPPTK/build/HostCheckCommandTest b/AusRegEPPTK/build/HostCheckCommandTest deleted file mode 100755 index e08ae4c..0000000 Binary files a/AusRegEPPTK/build/HostCheckCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostCheckResponse.o b/AusRegEPPTK/build/HostCheckResponse.o deleted file mode 100644 index d4fe390..0000000 Binary files a/AusRegEPPTK/build/HostCheckResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/HostCreateCommand.o b/AusRegEPPTK/build/HostCreateCommand.o deleted file mode 100644 index a9bb011..0000000 Binary files a/AusRegEPPTK/build/HostCreateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/HostCreateCommandTest b/AusRegEPPTK/build/HostCreateCommandTest deleted file mode 100755 index 1278b7c..0000000 Binary files a/AusRegEPPTK/build/HostCreateCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostCreateResponse.o b/AusRegEPPTK/build/HostCreateResponse.o deleted file mode 100644 index 8eb98cd..0000000 Binary files a/AusRegEPPTK/build/HostCreateResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/HostDeleteCommandTest b/AusRegEPPTK/build/HostDeleteCommandTest deleted file mode 100755 index 2c8d6ad..0000000 Binary files a/AusRegEPPTK/build/HostDeleteCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostInfoCommandTest b/AusRegEPPTK/build/HostInfoCommandTest deleted file mode 100755 index aced1e2..0000000 Binary files a/AusRegEPPTK/build/HostInfoCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostInfoResponse.o b/AusRegEPPTK/build/HostInfoResponse.o deleted file mode 100644 index 650266b..0000000 Binary files a/AusRegEPPTK/build/HostInfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/HostInfoResponseTest b/AusRegEPPTK/build/HostInfoResponseTest deleted file mode 100755 index fde355e..0000000 Binary files a/AusRegEPPTK/build/HostInfoResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/HostUpdateCommand.o b/AusRegEPPTK/build/HostUpdateCommand.o deleted file mode 100644 index 6aaf221..0000000 Binary files a/AusRegEPPTK/build/HostUpdateCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/IPVersion.o b/AusRegEPPTK/build/IPVersion.o deleted file mode 100644 index e0be7e2..0000000 Binary files a/AusRegEPPTK/build/IPVersion.o and /dev/null differ diff --git a/AusRegEPPTK/build/IPVersionTest b/AusRegEPPTK/build/IPVersionTest deleted file mode 100755 index 8908533..0000000 Binary files a/AusRegEPPTK/build/IPVersionTest and /dev/null differ diff --git a/AusRegEPPTK/build/InetAddress.o b/AusRegEPPTK/build/InetAddress.o deleted file mode 100644 index 954a18d..0000000 Binary files a/AusRegEPPTK/build/InetAddress.o and /dev/null differ diff --git a/AusRegEPPTK/build/InfoResponse.o b/AusRegEPPTK/build/InfoResponse.o deleted file mode 100644 index a982f63..0000000 Binary files a/AusRegEPPTK/build/InfoResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/KVExtension.o b/AusRegEPPTK/build/KVExtension.o deleted file mode 100644 index 4743547..0000000 Binary files a/AusRegEPPTK/build/KVExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/Logger.o b/AusRegEPPTK/build/Logger.o deleted file mode 100644 index c9fe430..0000000 Binary files a/AusRegEPPTK/build/Logger.o and /dev/null differ diff --git a/AusRegEPPTK/build/LoginCommand.o b/AusRegEPPTK/build/LoginCommand.o deleted file mode 100644 index ab7e18f..0000000 Binary files a/AusRegEPPTK/build/LoginCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/LoginCommandTest b/AusRegEPPTK/build/LoginCommandTest deleted file mode 100755 index 0f24327..0000000 Binary files a/AusRegEPPTK/build/LoginCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/LogoutCommandTest b/AusRegEPPTK/build/LogoutCommandTest deleted file mode 100755 index ff96bb6..0000000 Binary files a/AusRegEPPTK/build/LogoutCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/NAPTR.o b/AusRegEPPTK/build/NAPTR.o deleted file mode 100644 index 11588d0..0000000 Binary files a/AusRegEPPTK/build/NAPTR.o and /dev/null differ diff --git a/AusRegEPPTK/build/NamespaceResolver.o b/AusRegEPPTK/build/NamespaceResolver.o deleted file mode 100644 index d2b3f76..0000000 Binary files a/AusRegEPPTK/build/NamespaceResolver.o and /dev/null differ diff --git a/AusRegEPPTK/build/NotificationResponse.o b/AusRegEPPTK/build/NotificationResponse.o deleted file mode 100644 index 01b7830..0000000 Binary files a/AusRegEPPTK/build/NotificationResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/ObjectCommand.o b/AusRegEPPTK/build/ObjectCommand.o deleted file mode 100644 index 40eaf2c..0000000 Binary files a/AusRegEPPTK/build/ObjectCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/Period.o b/AusRegEPPTK/build/Period.o deleted file mode 100644 index ec54e69..0000000 Binary files a/AusRegEPPTK/build/Period.o and /dev/null differ diff --git a/AusRegEPPTK/build/PeriodUnit.o b/AusRegEPPTK/build/PeriodUnit.o deleted file mode 100644 index 64f4b8c..0000000 Binary files a/AusRegEPPTK/build/PeriodUnit.o and /dev/null differ diff --git a/AusRegEPPTK/build/PollAckCommandTest b/AusRegEPPTK/build/PollAckCommandTest deleted file mode 100755 index fa35bcf..0000000 Binary files a/AusRegEPPTK/build/PollAckCommandTest and /dev/null differ diff --git a/AusRegEPPTK/build/PollOperation.o b/AusRegEPPTK/build/PollOperation.o deleted file mode 100644 index 3d8a969..0000000 Binary files a/AusRegEPPTK/build/PollOperation.o and /dev/null differ diff --git a/AusRegEPPTK/build/PollResponse.o b/AusRegEPPTK/build/PollResponse.o deleted file mode 100644 index 525de0c..0000000 Binary files a/AusRegEPPTK/build/PollResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/PollResponseTest b/AusRegEPPTK/build/PollResponseTest deleted file mode 100755 index 650dda4..0000000 Binary files a/AusRegEPPTK/build/PollResponseTest and /dev/null differ diff --git a/AusRegEPPTK/build/PostalInfo.o b/AusRegEPPTK/build/PostalInfo.o deleted file mode 100644 index a54582a..0000000 Binary files a/AusRegEPPTK/build/PostalInfo.o and /dev/null differ diff --git a/AusRegEPPTK/build/PostalInfoType.o b/AusRegEPPTK/build/PostalInfoType.o deleted file mode 100644 index c9006c0..0000000 Binary files a/AusRegEPPTK/build/PostalInfoType.o and /dev/null differ diff --git a/AusRegEPPTK/build/Properties.o b/AusRegEPPTK/build/Properties.o deleted file mode 100644 index 8d08f91..0000000 Binary files a/AusRegEPPTK/build/Properties.o and /dev/null differ diff --git a/AusRegEPPTK/build/ProtocolExtensionCommand.o b/AusRegEPPTK/build/ProtocolExtensionCommand.o deleted file mode 100644 index 48d2925..0000000 Binary files a/AusRegEPPTK/build/ProtocolExtensionCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/ReceiveSE.o b/AusRegEPPTK/build/ReceiveSE.o deleted file mode 100644 index b6fc819..0000000 Binary files a/AusRegEPPTK/build/ReceiveSE.o and /dev/null differ diff --git a/AusRegEPPTK/build/RegistrantObjectType.o b/AusRegEPPTK/build/RegistrantObjectType.o deleted file mode 100644 index 942c93a..0000000 Binary files a/AusRegEPPTK/build/RegistrantObjectType.o and /dev/null differ diff --git a/AusRegEPPTK/build/RegistrantTransferCommandType.o b/AusRegEPPTK/build/RegistrantTransferCommandType.o deleted file mode 100644 index d657a63..0000000 Binary files a/AusRegEPPTK/build/RegistrantTransferCommandType.o and /dev/null differ diff --git a/AusRegEPPTK/build/Response.o b/AusRegEPPTK/build/Response.o deleted file mode 100644 index 85ac2fd..0000000 Binary files a/AusRegEPPTK/build/Response.o and /dev/null differ diff --git a/AusRegEPPTK/build/ResponseExtension.o b/AusRegEPPTK/build/ResponseExtension.o deleted file mode 100644 index 26ac8e6..0000000 Binary files a/AusRegEPPTK/build/ResponseExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/Result.o b/AusRegEPPTK/build/Result.o deleted file mode 100644 index 0cf6d42..0000000 Binary files a/AusRegEPPTK/build/Result.o and /dev/null differ diff --git a/AusRegEPPTK/build/ResultCounter.o b/AusRegEPPTK/build/ResultCounter.o deleted file mode 100644 index b17bee8..0000000 Binary files a/AusRegEPPTK/build/ResultCounter.o and /dev/null differ diff --git a/AusRegEPPTK/build/SSLException.o b/AusRegEPPTK/build/SSLException.o deleted file mode 100644 index 8da7b86..0000000 Binary files a/AusRegEPPTK/build/SSLException.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSChgType.o b/AusRegEPPTK/build/SecDNSChgType.o deleted file mode 100644 index 6ab5068..0000000 Binary files a/AusRegEPPTK/build/SecDNSChgType.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSDSData.o b/AusRegEPPTK/build/SecDNSDSData.o deleted file mode 100644 index 169e632..0000000 Binary files a/AusRegEPPTK/build/SecDNSDSData.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSDSOrKeyType.o b/AusRegEPPTK/build/SecDNSDSOrKeyType.o deleted file mode 100644 index 18425a6..0000000 Binary files a/AusRegEPPTK/build/SecDNSDSOrKeyType.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSExtension.o b/AusRegEPPTK/build/SecDNSExtension.o deleted file mode 100644 index 0e69ecc..0000000 Binary files a/AusRegEPPTK/build/SecDNSExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSKeyData.o b/AusRegEPPTK/build/SecDNSKeyData.o deleted file mode 100644 index 3fdbe9d..0000000 Binary files a/AusRegEPPTK/build/SecDNSKeyData.o and /dev/null differ diff --git a/AusRegEPPTK/build/SecDNSRemType.o b/AusRegEPPTK/build/SecDNSRemType.o deleted file mode 100644 index 727ff97..0000000 Binary files a/AusRegEPPTK/build/SecDNSRemType.o and /dev/null differ diff --git a/AusRegEPPTK/build/SendSE.o b/AusRegEPPTK/build/SendSE.o deleted file mode 100644 index 8ae085e..0000000 Binary files a/AusRegEPPTK/build/SendSE.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionFactory.o b/AusRegEPPTK/build/SessionFactory.o deleted file mode 100644 index eec224e..0000000 Binary files a/AusRegEPPTK/build/SessionFactory.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionManagerFactory.o b/AusRegEPPTK/build/SessionManagerFactory.o deleted file mode 100644 index cf39425..0000000 Binary files a/AusRegEPPTK/build/SessionManagerFactory.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionManagerImpl.o b/AusRegEPPTK/build/SessionManagerImpl.o deleted file mode 100644 index 8ccd6da..0000000 Binary files a/AusRegEPPTK/build/SessionManagerImpl.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionManagerPropertiesImpl.o b/AusRegEPPTK/build/SessionManagerPropertiesImpl.o deleted file mode 100644 index e6116f0..0000000 Binary files a/AusRegEPPTK/build/SessionManagerPropertiesImpl.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionManagerTest b/AusRegEPPTK/build/SessionManagerTest deleted file mode 100755 index 06360db..0000000 Binary files a/AusRegEPPTK/build/SessionManagerTest and /dev/null differ diff --git a/AusRegEPPTK/build/SessionPoolImpl.o b/AusRegEPPTK/build/SessionPoolImpl.o deleted file mode 100644 index b6ad94a..0000000 Binary files a/AusRegEPPTK/build/SessionPoolImpl.o and /dev/null differ diff --git a/AusRegEPPTK/build/SessionTest b/AusRegEPPTK/build/SessionTest deleted file mode 100755 index 78c183e..0000000 Binary files a/AusRegEPPTK/build/SessionTest and /dev/null differ diff --git a/AusRegEPPTK/build/StandardCommandType.o b/AusRegEPPTK/build/StandardCommandType.o deleted file mode 100644 index 2b06fd5..0000000 Binary files a/AusRegEPPTK/build/StandardCommandType.o and /dev/null differ diff --git a/AusRegEPPTK/build/StandardObjectType.o b/AusRegEPPTK/build/StandardObjectType.o deleted file mode 100644 index 7b19fa3..0000000 Binary files a/AusRegEPPTK/build/StandardObjectType.o and /dev/null differ diff --git a/AusRegEPPTK/build/StringUtils.o b/AusRegEPPTK/build/StringUtils.o deleted file mode 100644 index 281d5a2..0000000 Binary files a/AusRegEPPTK/build/StringUtils.o and /dev/null differ diff --git a/AusRegEPPTK/build/SyncExtension.o b/AusRegEPPTK/build/SyncExtension.o deleted file mode 100644 index 91e85c7..0000000 Binary files a/AusRegEPPTK/build/SyncExtension.o and /dev/null differ diff --git a/AusRegEPPTK/build/SystemProperties.o b/AusRegEPPTK/build/SystemProperties.o deleted file mode 100644 index 9790edc..0000000 Binary files a/AusRegEPPTK/build/SystemProperties.o and /dev/null differ diff --git a/AusRegEPPTK/build/TLSContext.o b/AusRegEPPTK/build/TLSContext.o deleted file mode 100644 index 834551c..0000000 Binary files a/AusRegEPPTK/build/TLSContext.o and /dev/null differ diff --git a/AusRegEPPTK/build/TLSSession.o b/AusRegEPPTK/build/TLSSession.o deleted file mode 100644 index f4e5df1..0000000 Binary files a/AusRegEPPTK/build/TLSSession.o and /dev/null differ diff --git a/AusRegEPPTK/build/TLSSocket.o b/AusRegEPPTK/build/TLSSocket.o deleted file mode 100644 index 64e888a..0000000 Binary files a/AusRegEPPTK/build/TLSSocket.o and /dev/null differ diff --git a/AusRegEPPTK/build/Timer.o b/AusRegEPPTK/build/Timer.o deleted file mode 100644 index aaf8f4d..0000000 Binary files a/AusRegEPPTK/build/Timer.o and /dev/null differ diff --git a/AusRegEPPTK/build/TimerTest b/AusRegEPPTK/build/TimerTest deleted file mode 100755 index 66317eb..0000000 Binary files a/AusRegEPPTK/build/TimerTest and /dev/null differ diff --git a/AusRegEPPTK/build/TransferCommand.o b/AusRegEPPTK/build/TransferCommand.o deleted file mode 100644 index 7a57946..0000000 Binary files a/AusRegEPPTK/build/TransferCommand.o and /dev/null differ diff --git a/AusRegEPPTK/build/TransferOp.o b/AusRegEPPTK/build/TransferOp.o deleted file mode 100644 index f90d665..0000000 Binary files a/AusRegEPPTK/build/TransferOp.o and /dev/null differ diff --git a/AusRegEPPTK/build/TransferResponse.o b/AusRegEPPTK/build/TransferResponse.o deleted file mode 100644 index 92fb594..0000000 Binary files a/AusRegEPPTK/build/TransferResponse.o and /dev/null differ diff --git a/AusRegEPPTK/build/UserPassMismatchException.o b/AusRegEPPTK/build/UserPassMismatchException.o deleted file mode 100644 index 8fb1757..0000000 Binary files a/AusRegEPPTK/build/UserPassMismatchException.o and /dev/null differ diff --git a/AusRegEPPTK/build/XMLDocument.o b/AusRegEPPTK/build/XMLDocument.o deleted file mode 100644 index e6621d5..0000000 Binary files a/AusRegEPPTK/build/XMLDocument.o and /dev/null differ diff --git a/AusRegEPPTK/build/XMLGregorianCalendar.o b/AusRegEPPTK/build/XMLGregorianCalendar.o deleted file mode 100644 index e8e2ecd..0000000 Binary files a/AusRegEPPTK/build/XMLGregorianCalendar.o and /dev/null differ diff --git a/AusRegEPPTK/build/XMLGregorianCalendarTest b/AusRegEPPTK/build/XMLGregorianCalendarTest deleted file mode 100755 index 4af1d2d..0000000 Binary files a/AusRegEPPTK/build/XMLGregorianCalendarTest and /dev/null differ diff --git a/AusRegEPPTK/build/XMLParser.o b/AusRegEPPTK/build/XMLParser.o deleted file mode 100644 index a8a7844..0000000 Binary files a/AusRegEPPTK/build/XMLParser.o and /dev/null differ diff --git a/AusRegEPPTK/build/XMLWriter.o b/AusRegEPPTK/build/XMLWriter.o deleted file mode 100644 index fed2fc9..0000000 Binary files a/AusRegEPPTK/build/XMLWriter.o and /dev/null differ diff --git a/AusRegEPPTK/build/boolean.o b/AusRegEPPTK/build/boolean.o deleted file mode 100644 index 296d2bc..0000000 Binary files a/AusRegEPPTK/build/boolean.o and /dev/null differ diff --git a/AusRegEPPTK/build/config.o b/AusRegEPPTK/build/config.o deleted file mode 100644 index c3bd4c5..0000000 Binary files a/AusRegEPPTK/build/config.o and /dev/null differ diff --git a/AusRegEPPTK/build/init.o b/AusRegEPPTK/build/init.o deleted file mode 100644 index 1acaf40..0000000 Binary files a/AusRegEPPTK/build/init.o and /dev/null differ diff --git a/AusRegEPPTK/build/log.o b/AusRegEPPTK/build/log.o deleted file mode 100644 index 1fe4278..0000000 Binary files a/AusRegEPPTK/build/log.o and /dev/null differ diff --git a/AusRegEPPTK/lib/libAusRegEPPTK.so b/AusRegEPPTK/lib/libAusRegEPPTK.so deleted file mode 100755 index 21bfa95..0000000 Binary files a/AusRegEPPTK/lib/libAusRegEPPTK.so and /dev/null differ diff --git a/AusRegEPPTK/session/TLSContext.cpp b/AusRegEPPTK/session/TLSContext.cpp index a0aa1c8..517c4d6 100644 --- a/AusRegEPPTK/session/TLSContext.cpp +++ b/AusRegEPPTK/session/TLSContext.cpp @@ -8,6 +8,14 @@ #include #include +#if (PRODUCTION==1) +#define sslCast +#define sslUncast +#else +#define sslCast const +#define sslUncast (SSL_CTX *) +#endif + using namespace std; namespace { @@ -32,36 +40,37 @@ TLSContext::TLSContext(const string& private_key_file, { SSL_load_error_strings(); SSL_library_init(); - const SSL_METHOD *meth = TLSv1_client_method(); + + sslCast SSL_METHOD *meth = TLSv1_client_method(); if (meth == NULL) throw SSLException("Error initialising SSL method"); // SSL Context - const SSL_CTX *local_ctx = SSL_CTX_new(meth); + sslCast SSL_CTX *local_ctx = SSL_CTX_new(meth); if (local_ctx == NULL) { throw SSLException ("Error initialising SSL context"); } // SSL Ciphers - int i = SSL_CTX_set_cipher_list((SSL_CTX*)local_ctx, "TLSv1"); + int i = SSL_CTX_set_cipher_list( sslUncast local_ctx, "TLSv1"); if (i == -1) { - SSL_CTX_free((SSL_CTX *)local_ctx); + SSL_CTX_free( sslUncast local_ctx); throw SSLException( "There was a problem initialising the SSL cipher list"); } - SSL_CTX_set_default_passwd_cb_userdata((SSL_CTX *)local_ctx, + SSL_CTX_set_default_passwd_cb_userdata( sslUncast local_ctx, static_cast(const_cast(password.c_str()))); - SSL_CTX_set_default_passwd_cb((SSL_CTX *)local_ctx, getPassword); + SSL_CTX_set_default_passwd_cb( sslUncast local_ctx, getPassword); - i = SSL_CTX_use_PrivateKey_file((SSL_CTX *)local_ctx, + i = SSL_CTX_use_PrivateKey_file( sslUncast local_ctx, private_key_file.c_str(), SSL_FILETYPE_PEM); if (i == -1) { - SSL_CTX_free((SSL_CTX *)local_ctx); + SSL_CTX_free( sslUncast local_ctx); throw SSLException( "There was a problem initialising SSL the private key '" + private_key_file + "'"); @@ -69,23 +78,23 @@ TLSContext::TLSContext(const string& private_key_file, // Load the public certificate for our key. // Replace with - i = SSL_CTX_use_certificate_chain_file((SSL_CTX *)local_ctx, cert_file.c_str()); + i = SSL_CTX_use_certificate_chain_file( sslUncast local_ctx, cert_file.c_str()); if (i == -1) { - SSL_CTX_free((SSL_CTX *)local_ctx); + SSL_CTX_free( sslUncast local_ctx); throw SSLException("Error loading cert_file '" + cert_file + "'"); } // Load the CA certificate(s) - i = SSL_CTX_load_verify_locations ((SSL_CTX *)local_ctx, ca_file.c_str(), NULL); + i = SSL_CTX_load_verify_locations ( sslUncast local_ctx, ca_file.c_str(), NULL); if (i == -1) { - SSL_CTX_free((SSL_CTX *)local_ctx); + SSL_CTX_free( sslUncast local_ctx); throw EPPException ("Could not load CA file '" + ca_file +"'"); } - ctx = (SSL_CTX *)local_ctx; + ctx = sslUncast local_ctx; }