DRDE/APIG/include/mdCommander.h

127 lines
3.7 KiB
C
Raw Normal View History

#ifndef MD_CHARGUI
#define MD_CHARGUI
2014-01-13 01:29:22 +00:00
#define MAX_CMDS 20
2014-01-28 18:16:48 +00:00
#define MAX_FSM 20
2014-01-13 01:29:22 +00:00
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 {
2014-01-28 18:16:48 +00:00
void *schema[9];
char *xml; // For the ad-hoc write, the internals store uses a convention
2014-01-18 23:09:39 +00:00
}
eppXML;
2014-01-19 07:45:43 +00:00
typedef
struct {
2014-01-28 18:16:48 +00:00
bool hasXML:1;
bool reserved:7;
void bre[MAX_FSM];
char *fsm[MAX_FSM]; // by which known at MD
2014-01-19 07:45:43 +00:00
}
eppState;
2014-01-18 23:09:39 +00:00
class mdCommander {
2014-01-19 07:45:43 +00:00
bool acceptingInput,deleted[MAX_CMDS],schemaLoaded[6];
2014-01-13 01:29:22 +00:00
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-19 07:45:43 +00:00
eppState state[MAX_CMDS];
2014-01-13 01:29:22 +00:00
char wwork[1024];
2014-01-28 18:16:48 +00:00
char* schemaFileNames[9];
public:
2014-01-13 23:19:10 +00:00
mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0;
2014-01-19 07:45:43 +00:00
memset(commandArgs,0,sizeof(commandArgs));
memset(state,0,sizeof(state));
memset(schemaLoaded,0,sizeof(schemaLoaded));
memset(xmlIO,0,sizeof(xmlIO));
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-19 07:45:43 +00:00
schemaFileNames[0]="epp-1.0.xsd";
schemaFileNames[1]="domain-1.0.xsd";
schemaFileNames[2]="contact-1.0.xsd";
schemaFileNames[3]="registrant-1.0.xsd";
schemaFileNames[4]="host-1.0.xsd";
schemaFileNames[5]="kv-1.0.xsd";
2014-01-28 18:16:48 +00:00
schemaFileNames[6]="launch-1.0.xsd";
schemaFileNames[7]="mark-1.0.xsd";
schemaFileNames[8]="signedMark-1.0.xsd";
state[0].fsm[0] = "Check" ;
state[0].fsm[1] = "Check (LPE claims)" ;
state[1].fsm[0] = "Info" ;
state[2].fsm[0] = "Transfer Query" ;
state[3].fsm[0] = "Poll" ;
state[4].fsm[0] = "Create ";
state[4].fsm[1] = "Create (LPE) ";
state[5].fsm[0] = "Renew" ;
state[6].fsm[0] = "Update";
state[7].fsm[0] = "Delete";
state[8].fsm[0] = "Transfer";
2014-01-18 23:09:39 +00:00
2014-01-13 23:19:10 +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();
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);
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;
}
2014-01-19 07:45:43 +00:00
bool loadSchema(int which);
2014-01-13 01:29:22 +00:00
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);
2014-01-19 07:45:43 +00:00
void viSchema(int which);
void viBlankForm(char which);
2014-01-13 01:29:22 +00:00
void update(bool run);
2014-01-19 07:45:43 +00:00
void writeCommand(char which);
2014-01-13 01:29:22 +00:00
bool editingCommand(bool run);
bool runCommand(bool all);
};
#endif