2014-01-05 22:58:00 +00:00
|
|
|
#ifndef MD_CHARGUI
|
|
|
|
#define MD_CHARGUI
|
|
|
|
|
2014-01-13 01:29:22 +00:00
|
|
|
#define MAX_CMDS 20
|
|
|
|
|
2014-01-14 03:00:23 +00:00
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
int name;
|
|
|
|
char *s;
|
|
|
|
}
|
|
|
|
eppArgDef;
|
|
|
|
|
2014-01-18 23:09:39 +00:00
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *schema;
|
|
|
|
char *xml; // For the ad-hoc write, the internals store uses a convention
|
|
|
|
}
|
|
|
|
eppXML;
|
|
|
|
|
|
|
|
|
2014-01-05 22:58:00 +00:00
|
|
|
class mdCommander {
|
|
|
|
|
2014-01-13 01:29:22 +00:00
|
|
|
bool acceptingInput,deleted[MAX_CMDS];
|
|
|
|
int activeCommands, argsNow[MAX_CMDS], cmdNow, cmdsNow, mdStdDevIdx;
|
2014-01-14 03:00:23 +00:00
|
|
|
int row,col, thisArg;
|
2014-01-13 01:29:22 +00:00
|
|
|
int commandsNow[MAX_CMDS]; // type index into cmdNames
|
2014-01-14 03:00:23 +00:00
|
|
|
eppArgDef *commandArgs[MAX_CMDS][MAX_CMD_ARGS];
|
2014-01-18 23:09:39 +00:00
|
|
|
eppXML xmlIO[9];
|
2014-01-13 01:29:22 +00:00
|
|
|
char wwork[1024];
|
2014-01-18 23:14:30 +00:00
|
|
|
char* schemaFileName;
|
2014-01-05 22:58:00 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-01-13 23:19:10 +00:00
|
|
|
mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0;
|
2014-01-18 23:09:39 +00:00
|
|
|
xmlIO[0].xml = "check.xml" ;
|
|
|
|
xmlIO[1].xml = "info.xml" ;
|
|
|
|
xmlIO[2].xml = "tranq.xml" ;
|
|
|
|
xmlIO[3].xml = "poll.xml" ;
|
|
|
|
xmlIO[4].xml = "create.xml";
|
|
|
|
xmlIO[5].xml = "renew.xml" ;
|
|
|
|
xmlIO[6].xml = "update.xml";
|
|
|
|
xmlIO[7].xml = "delete.xml";
|
|
|
|
xmlIO[8].xml = "transf.xml";
|
|
|
|
|
2014-01-18 23:14:30 +00:00
|
|
|
schemaFilename="epp-1.0.xsd;"
|
2014-01-18 23:09:39 +00:00
|
|
|
|
2014-01-13 23:19:10 +00:00
|
|
|
memset(commandArgs,0,sizeof(commandArgs));
|
|
|
|
}
|
2014-01-05 22:58:00 +00:00
|
|
|
~mdCommander() {}
|
|
|
|
|
2014-01-13 01:29:22 +00:00
|
|
|
void say(char *what) ;
|
|
|
|
|
2014-01-11 19:34:15 +00:00
|
|
|
void acMainMenu();
|
2014-01-13 01:29:22 +00:00
|
|
|
void check(bool run);
|
|
|
|
void create(bool run);
|
|
|
|
void doHeader();
|
2014-01-05 22:58:00 +00:00
|
|
|
void driver();
|
2014-01-14 03:00:23 +00:00
|
|
|
void getArgStringsByType();
|
2014-01-11 19:34:15 +00:00
|
|
|
void eppMainMenu();
|
2014-01-13 01:29:22 +00:00
|
|
|
void flushCommand(int which,bool allowsZero);
|
2014-01-05 22:58:00 +00:00
|
|
|
void greet();
|
|
|
|
void help();
|
2014-01-13 01:29:22 +00:00
|
|
|
void info(bool run);
|
|
|
|
bool isValidCmd(int which,bool isX)
|
|
|
|
{ if (which == 0 && !isX) return false;
|
|
|
|
if (which > cmdsNow) return false;
|
|
|
|
if (!isX && which < 1) return false;
|
|
|
|
if (which && deleted[which-1]) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
void poll(bool run);
|
|
|
|
void prompt(bool forStrings);
|
|
|
|
void queryTransfer(bool run);
|
|
|
|
void renew(bool run);
|
2014-01-14 03:00:23 +00:00
|
|
|
int selectArg();
|
2014-01-13 01:29:22 +00:00
|
|
|
void sendCommand(int which);
|
|
|
|
void showCommand(bool all);
|
|
|
|
void trash(bool run);
|
|
|
|
void transfer(bool run);
|
|
|
|
void update(bool run);
|
|
|
|
|
|
|
|
bool editingCommand(bool run);
|
|
|
|
bool runCommand(bool all);
|
2014-01-05 22:58:00 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|