diff --git a/.cproject b/.cproject index a4e1608..7403924 100644 --- a/.cproject +++ b/.cproject @@ -55,31 +55,8 @@ - - make - clean - true - true - true - - - make - all - true - true - true - - - make - - tests - true - true - true - make - libACTK1_0.so true true @@ -87,6 +64,7 @@ make + clean true true @@ -94,7 +72,6 @@ make - tests true true @@ -102,7 +79,6 @@ make - dirs true true @@ -110,13 +86,27 @@ make - dclean true true true + make + all + true + true + true + + + make + + clean + true + true + true + + make all @@ -124,8 +114,16 @@ true true + + make + tests + true + true + true + make + clean true true @@ -133,7 +131,6 @@ make - dirs true true @@ -141,7 +138,6 @@ make - ausreg_cd true true @@ -149,38 +145,21 @@ make - apig-cli true true true - - make - cliever - true - true - true - - + make - clean - true - true - true - - - make - - distclean + build/commander.o true true true make - all true true @@ -188,7 +167,6 @@ make - tests true true @@ -196,12 +174,33 @@ make - clean true true true + + make + + cliever + true + true + true + + + make + clean + true + true + true + + + make + distclean + true + true + true + diff --git a/APIG/Makefile b/APIG/Makefile index 645d981..686a98d 100644 --- a/APIG/Makefile +++ b/APIG/Makefile @@ -88,7 +88,7 @@ build/cdLogger.o: client/cdLogger.cpp include/cdLogger.h build/cliever.o: client/ausreg-cd.cpp include/*.h $(CC) $(CFLAGS) client/ausreg-cd.cpp -c -o build/cliever.o $(SINCL) $(DEF_XML_RPC) $(XMLRPC_INCL) -build/clientDaemonConfig.o: client/clientDaemonConfig.cpp include/*.h +build/clientDaemonConfig.o: client/clientDaemonConfig.cpp include/clientDaemonConfig.h $(CC) $(CFLAGS) client/clientDaemonConfig.cpp -c -o build/clientDaemonConfig.o $(SINCL) build/clientDaemon.o: client/clientDaemon.cpp include/*.h @@ -97,7 +97,7 @@ build/clientDaemon.o: client/clientDaemon.cpp include/*.h build/mdBehavior.o: client/mdBehavior.cpp include/mdBehavior.h $(CC) $(CFLAGS) client/mdBehavior.cpp $(SINCL) -c -o build/mdBehavior.o -build/commander.o: client/commander.cpp include/mdCommander.h +build/commander.o: client/commander.cpp include/mdCommander.h include/eppargs.h $(CC) $(CFLAGS) client/commander.cpp $(SINCL) -c -o build/commander.o build/$(CLIENT)-cd: $(ACOBJS) diff --git a/APIG/build/drde-cd b/APIG/build/drde-cd index e09c175..41f89a1 100755 Binary files a/APIG/build/drde-cd and b/APIG/build/drde-cd differ diff --git a/APIG/client/commander.cpp b/APIG/client/commander.cpp index 5ba58b4..4cae29f 100644 --- a/APIG/client/commander.cpp +++ b/APIG/client/commander.cpp @@ -1,13 +1,12 @@ #include #include "ausreg-cd.h" +#include "eppargs.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" }; char theBanner[256]; int targetHost = 0; @@ -37,18 +36,41 @@ void mdCommander::doHeader() { mvprintw(1,(col-strlen(wwork))/2,"%s",wwork); } -void mdCommander::digestibleLines() { +int mdCommander::selectArg() { - char buffer[256],*sp; - int nLines=0, wrow=5; + char legend1[80]="Arg types: ",selection[10]; + int i, wrow=5; + + for (i=0;i < eppArgs[commandsNow[cmdNow]].n;i++) { + sprintf(wwork," %d %s ",i+1,eppArgs[commandsNow[cmdNow]].names[i]); + strcat(legend1,wwork); + } + + mvprintw(wrow,2,(char *)legend1); + + say((char *)"Select arg string type"); + prompt(true); + mvgetstr(row-1,2,selection); + thisArg = atoi(selection); + +} +void mdCommander::getArgStringsByType() { + + eppArgDef *sp1; + char buffer[256],*sp; + int i, nLines=0, wrow=7; nocbreak(); + 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; + sp1 = (eppArgDef *)malloc(sizeof(eppArgDef)); + sp = (char *) malloc(strlen(buffer)+1); + sp1->name = commandsNow[cmdNow]; + sp1->s = sp; + commandArgs[cmdNow][argsNow[cmdNow]++] = sp1; strcpy(sp,buffer); } else break; @@ -75,6 +97,7 @@ void mdCommander::driver() { activeCommands = 0; cmdNow = 0; cmdsNow = 0; + initEPPArgs(); memset(commandsNow,0,sizeof(commandsNow)); memset(argsNow,0,sizeof(argsNow)); initscr(); @@ -316,8 +339,10 @@ void mdCommander::flushCommand(int which,bool allOfEm){ if (!allOfEm) { if (argsNow[which]) { - for (i=0;is); free(commandArgs[which][i]); + } } argsNow[which] = 0; deleted[which] = true; @@ -325,8 +350,10 @@ void mdCommander::flushCommand(int which,bool allOfEm){ } else for (i=0;is); free(commandArgs[i][j]); + } } else deleted[i] = false; // back to start state. } @@ -356,8 +383,10 @@ void mdCommander::showCommand(bool allOfEm){ sprintf(wwork,"EPP directive: %s",befehlJetzt); mvprintw(5,2,wwork); for (nthItem=0;nthItem < argsNow[cmdNow];nthItem++) { - ASSERT(commandArgs[cmdNow][nthItem]); - sprintf(wwork,"%d %s",nthItem+1,(commandArgs[cmdNow][nthItem])); + ASSERT(commandArgs[cmdNow][nthItem]->s); + sprintf(wwork,"%d %s %s",nthItem+1, + eppArgs[commandsNow[cmdNow]].names[commandArgs[cmdNow][nthItem]->name], + (commandArgs[cmdNow][nthItem]->s)); mvprintw(7+nthItem,2,wwork); } @@ -368,7 +397,7 @@ void mdCommander::showCommand(bool allOfEm){ for ( i=0, nthItem=0; nthItem < cmdsNow;nthItem++ ) { if (!deleted[nthItem]) { - sprintf(wwork,"%d %s %s",nthItem+1,cmdNames[commandsNow[nthItem]],commandArgs[nthItem][0]); + sprintf(wwork,"%d %s %s",nthItem+1,cmdNames[commandsNow[nthItem]],commandArgs[nthItem][0]->s); mvprintw(7+(i++),2,wwork); } @@ -386,15 +415,16 @@ bool mdCommander::editingCommand(bool run){ const char *befehlJetzt = cmdNames[commandsNow[cmdNow]]; char sp[256],*spp; + eppArgDef *arg; int editLine,length; doHeader(); mvprintw(3,(col-strlen(befehlJetzt))/2,befehlJetzt); if (!run) { if (!argsNow[cmdNow]) { - say((char *)"Enter command arg strings, just enter to end data entry, ? to main menu"); - prompt(true); - digestibleLines(); + selectArg(); + say((char *)"Enter arg string(s), just enter to end"); + getArgStringsByType(); } else { nocbreak(); while(true) { @@ -404,10 +434,13 @@ const char *befehlJetzt = cmdNames[commandsNow[cmdNow]]; mvgetstr(row-1,2,sp); if (!strlen(sp)) goto done; if (*sp == 'A' || *sp == 'a') { + selectArg(); prompt(true); mvgetstr(row-1,2,sp); if (length=strlen(sp)) { - spp = commandArgs[cmdNow][argsNow[cmdNow]++] = (char *) malloc(length+1); + arg = (eppArgDef *)malloc(sizeof(eppArgDef)); + commandArgs[cmdNow][argsNow[cmdNow]++] = arg; + spp = commandArgs[cmdNow][argsNow[cmdNow]++]->s = (char *) malloc(length+1); strcpy(spp,sp); } } @@ -417,8 +450,8 @@ const char *befehlJetzt = cmdNames[commandsNow[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); + free (commandArgs[cmdNow][editLine-1]->s); + spp = commandArgs[cmdNow][editLine-1]->s = (char *) malloc(strlen(sp)+1); strcpy(spp,sp); } } diff --git a/APIG/include/mdCommander.h b/APIG/include/mdCommander.h index a44d444..8c1d776 100644 --- a/APIG/include/mdCommander.h +++ b/APIG/include/mdCommander.h @@ -3,14 +3,21 @@ #define MAX_CMDS 20 + typedef + struct { + int name; + char *s; + } + eppArgDef; + class mdCommander { bool acceptingInput,deleted[MAX_CMDS]; bool EPPmode; // RFC 9 int activeCommands, argsNow[MAX_CMDS], cmdNow, cmdsNow, mdStdDevIdx; - int row,col; + int row,col, thisArg; int commandsNow[MAX_CMDS]; // type index into cmdNames - char *commandArgs[MAX_CMDS][MAX_CMD_ARGS]; + eppArgDef *commandArgs[MAX_CMDS][MAX_CMD_ARGS]; char wwork[1024]; public: @@ -27,7 +34,7 @@ class mdCommander { void create(bool run); void doHeader(); void driver(); - void digestibleLines(); + void getArgStringsByType(); void eppMainMenu(); void flushCommand(int which,bool allowsZero); void greet(); @@ -44,6 +51,7 @@ class mdCommander { void prompt(bool forStrings); void queryTransfer(bool run); void renew(bool run); + int selectArg(); void sendCommand(int which); void showCommand(bool all); void trash(bool run);