diff --git a/APIG/build/drde-cd b/APIG/build/drde-cd index d11cdd2..e09c175 100755 Binary files a/APIG/build/drde-cd and b/APIG/build/drde-cd differ diff --git a/APIG/client/ausreg-cd.cpp b/APIG/client/ausreg-cd.cpp index 47413ee..c37680d 100644 --- a/APIG/client/ausreg-cd.cpp +++ b/APIG/client/ausreg-cd.cpp @@ -211,9 +211,12 @@ void setSignals() { } void signal_handler(int sig) -{ +{ int debug=0; + switch(sig) { case SIGSEGV: + debug=1; // for breakpoint + theseLogs.logN(0,"Segfault great that you can see this."); break; case SIGUSR1: break; diff --git a/APIG/client/commander.cpp b/APIG/client/commander.cpp index f5ff55c..5ba58b4 100644 --- a/APIG/client/commander.cpp +++ b/APIG/client/commander.cpp @@ -1,6 +1,10 @@ #include #include "ausreg-cd.h" +#define ASSERT(expr) \ + if (!(expr)) { \ + std::cerr << __FILE__ << ":" << __LINE__ << ":" << #expr << std::endl;} + const char *banner = CD_NAME " " CD_VERSION " compiled on " __DATE__ " @ " __TIME__ " (%d)"; const char *cmdNames[9] = { "check", "info", "poll", "transfer query", "create", "renew", "update", "delete", "transfer" }; @@ -35,14 +39,19 @@ void mdCommander::doHeader() { } void mdCommander::digestibleLines() { - char *sp; + char buffer[256],*sp; int nLines=0, wrow=5; nocbreak(); - for (;argsNow[cmdNow] < MAX_CMD_ARGS;argsNow[cmdNow]++) - {sp = commandArgs[cmdNow][argsNow[cmdNow]++] = (char *) malloc(256); - mvgetstr(wrow++,2,sp); - if (!strlen(sp)) break; + for (;argsNow[cmdNow] < MAX_CMD_ARGS;) + {memset(buffer,0,sizeof(buffer)); + mvgetstr(wrow++,2,buffer); + if (strlen(buffer)) { + sp = (char *) malloc(strlen(buffer)+1); + commandArgs[cmdNow][argsNow[cmdNow]++] = sp; + strcpy(sp,buffer); + } + else break; } cbreak(); prompt(false); @@ -53,7 +62,7 @@ void mdCommander::prompt(bool forStrings) { if (forStrings) mvprintw(row-1,1,">>"); else - mvprintw(row-1,1,"> "); + mvprintw(row-1,1,">"); } void mdCommander::driver() { @@ -160,6 +169,7 @@ void mdCommander::driver() { cmdNow = --targetCmd; editingCommand(false); doHeader();} + help(); break; case 'S': if (isValidCmd(targetCmd,false)) { @@ -318,6 +328,7 @@ void mdCommander::flushCommand(int which,bool allOfEm){ for (j=0;j of arg to replace, A to add, - to erase, just enter to finish"); - prompt(true); + nocbreak(); + while(true) { + showCommand(false); + say((char *)"line no to replace, A to add, enter to return"); + prompt(false); mvgetstr(row-1,2,sp); - if (!strlen(sp)) editing = false; - else { - if (*sp == 'A' || *sp == 'a') { - if (strlen(sp)) { - sp = commandArgs[cmdNow][argsNow[cmdNow]++] = (char *) malloc(256); - mvgetstr(row-1,2,sp); - } - continue; - } + if (!strlen(sp)) goto done; + if (*sp == 'A' || *sp == 'a') { + prompt(true); + mvgetstr(row-1,2,sp); + if (length=strlen(sp)) { + spp = commandArgs[cmdNow][argsNow[cmdNow]++] = (char *) malloc(length+1); + strcpy(spp,sp); + } + } + if (is_numeric(sp) >= 1) { editLine = atoi(sp); - if (editLine>0) { - mvgetstr(row-1,2,sp); - if (strlen(sp)) { - free (commandArgs[cmdNow][editLine]); - commandArgs[cmdNow][editLine] = (char *) malloc(strlen(sp)+1); - strcpy(commandArgs[cmdNow][editLine],sp); - } + if (editLine > 1 && editLine < argsNow[cmdNow]) { + prompt(true); + mvgetstr(row-1,2,sp); + if (length=strlen(sp)) { + free (commandArgs[cmdNow][editLine-1]); + spp = commandArgs[cmdNow][editLine-1] = (char *) malloc(strlen(sp)+1); + strcpy(spp,sp); + } + } } - else { editLine = editLine * -1 ; - memset(commandArgs[cmdNow][editLine],0,strlen(commandArgs[cmdNow][editLine])); - } - } // editing body } // editing loop - } // new / existing + done: cbreak(); + } // editing block } // run / execute else { say((char *)"Press 'Y' to confirm"); @@ -423,62 +437,62 @@ void mdCommander::check(bool run) { if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 0; if (!editingCommand(run)) { - } + } else help(); } void mdCommander::create(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 4; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::info(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 1; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::renew(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 5; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::queryTransfer(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 3; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::trash(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 7; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::transfer(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 8; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::poll(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 2; if (!editingCommand(run)) { - } + } else help(); }; void mdCommander::update(bool run){ if (!commandsNow[cmdNow]) commandsNow[cmdNow] = 6; if (!editingCommand(run)) { - } + } else help(); }; diff --git a/APIG/include/mdCommander.h b/APIG/include/mdCommander.h index b4fa779..a44d444 100644 --- a/APIG/include/mdCommander.h +++ b/APIG/include/mdCommander.h @@ -8,7 +8,6 @@ class mdCommander { bool acceptingInput,deleted[MAX_CMDS]; bool EPPmode; // RFC 9 int activeCommands, argsNow[MAX_CMDS], cmdNow, cmdsNow, mdStdDevIdx; - std::string currentDevice; int row,col; int commandsNow[MAX_CMDS]; // type index into cmdNames char *commandArgs[MAX_CMDS][MAX_CMD_ARGS]; @@ -16,7 +15,9 @@ class mdCommander { public: - mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0;} + mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0; + memset(commandArgs,0,sizeof(commandArgs)); + } ~mdCommander() {} void say(char *what) ; diff --git a/AusRegCliever/include/ausRegTK.h b/AusRegCliever/include/ausRegTK.h index be8e8c9..a1568f5 100644 --- a/AusRegCliever/include/ausRegTK.h +++ b/AusRegCliever/include/ausRegTK.h @@ -32,5 +32,6 @@ class ausRegEPPTK { } bool didInit(const std::string propertiesFilePath); void doOTEA(); + void doOTEB(); }; diff --git a/AusRegCliever/include/mdcommon.h b/AusRegCliever/include/mdcommon.h index 91982d2..7266a0f 100644 --- a/AusRegCliever/include/mdcommon.h +++ b/AusRegCliever/include/mdcommon.h @@ -144,6 +144,9 @@ enum acTKScenario { ACTK_ALONE = 0, ACTK_INSECURE, ACTK_OTEA, + ACTK_OTEB, + ACTK_OTEC, + ACTK_PROD, N_ACTK_SCENARIOS }; diff --git a/AusRegCliever/server/masterDaemon.cpp b/AusRegCliever/server/masterDaemon.cpp index db27921..6b059a6 100644 --- a/AusRegCliever/server/masterDaemon.cpp +++ b/AusRegCliever/server/masterDaemon.cpp @@ -231,20 +231,36 @@ void oteA() { } -} +}void oteB() { + + int nthDay; + for (nthDay=0;nthDay<30;nthDay++) { + + theseLogs->logNdebug(MAX_DEBUG,1,"PreProd / OTEB day %d",nthDay); + thisService->artk->doOTEB(); + theseLogs->logNdebug(MAX_DEBUG,1,"Preprod/ OTEB day %d",nthDay); + thisService->artk->daysRunning = nthDay; + + } + + } void masterDaemon::run() { deviceFactory = new mdHostFabrik(); fg = new mdDGChannel( thisService->io_, 0 ); if (initAusRegTK()) return; - else switch(artk->tkScenario) { - case ACTK_OTEA: + if (artk->tkScenario == ACTK_OTEA) { boost::thread oteArun(oteA); assert(oteArun.joinable()); oteArun.join(); theseLogs->logNdebug(MAX_DEBUG,0,"OTE Connectivity Test EOJ."); - break; + } + if (artk->tkScenario == ACTK_OTEB) { + boost::thread oteBrun(oteB); + assert(oteBrun.joinable()); + oteBrun.join(); + theseLogs->logNdebug(MAX_DEBUG,0,"Pre-production Ops / OTEB EOJ."); } listen(); boost::thread work(mdWQ); diff --git a/AusRegCliever/server/mdAusReg.cpp b/AusRegCliever/server/mdAusReg.cpp index b24810d..62b108d 100644 --- a/AusRegCliever/server/mdAusReg.cpp +++ b/AusRegCliever/server/mdAusReg.cpp @@ -31,7 +31,7 @@ bool ausRegEPPTK::didInit(const std::string propertiesFilePath) { } void ausRegEPPTK::doOTEA() { - int hours; + int hours,hoops; string op("newInstance"); if (!daysRunning) @@ -45,14 +45,17 @@ void ausRegEPPTK::doOTEA() manager->startup(); op = "run (keep-alive)"; manager->run(); + sess->open(); - sess->open(); - for (hours=0;hours < 24;hours++) { + for (hours=0;hours < 24;hours++) { // Spawn the keep alive thread. - theseLogs->logN(1,"Send Test SE at start of OTE Test Hour %d.",hours); - sess->writeXML(TEST_SE); - sess->read(); - sleep(3630); + theseLogs->logN(1,"Send Test SEs on or about start OTE Test Hour %d.",hours); + + for (hoops=0;hoops<7;hoops++) { + sess->writeXML(TEST_SE); + sess->read(); + sleep(857); + } } sess->close(); @@ -69,5 +72,46 @@ void ausRegEPPTK::doOTEA() { theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str()); } +} + void ausRegEPPTK::doOTEB() + { + int hours; + string op("newInstance"); + + if (!daysRunning) + scenario(tkScenario); + + try { + Timer::setTime("20070101.010101"); + auto_ptr manager(SessionManagerFactory::newInstance(&props)); + auto_ptr sess(SessionFactory::newInstance(&props)); + op = "startup"; + manager->startup(); + op = "run (keep-alive)"; + manager->run(); + + sess->open(); + for (hours=0;hours < 24;hours++) { + // Spawn the keep alive thread. + theseLogs->logN(1,"Send Test SE at start of OTE Test Hour %d.",hours); + sess->writeXML(TEST_SE); + // sess->read(); + sleep(3630); + + } + sess->close(); + manager->shutdown(); + + } + catch (EPPException& e) + { const char *eMsg = e.getMessage().c_str(); + const char *opNow = op.c_str(); + theseLogs->logN(2,"EPP Exception during OTE A (%s): %s .",opNow,eMsg); + throw e; + } + catch (...) + { + theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str()); + } }