This commit is contained in:
Ren RenJuan 2014-01-15 16:44:02 +00:00
parent 65c5e984e7
commit 1019546b94
7 changed files with 55 additions and 28 deletions

Binary file not shown.

View File

@ -125,6 +125,7 @@ void mdCommander::driver() {
case '1': ; case '2': ; case '3': ; case '4': ; case '5': ; case '1': ; case '2': ; case '3': ; case '4': ; case '5': ;
case '6': ; case '7': ; case '8': ; case '9': case '6': ; case '7': ; case '8': ; case '9':
goto retarget ; goto retarget ;
case 'q': goto quit;
case '!': runCommand(false); case '!': runCommand(false);
break; break;
case '?': help(); case '?': help();
@ -232,7 +233,7 @@ void mdCommander::driver() {
if (!strcmp(rawString,"done")) { if (!strcmp(rawString,"done")) {
goto done; goto done;
} }
if (!strcmp(rawString,"quit")) { work[128]; if (!strcmp(rawString,"quit")) { quit:
thisConfig->terminateRequest = true; thisConfig->terminateRequest = true;
sprintf(work,"kill -9 %d",thisConfig->daemonProcess); sprintf(work,"kill -9 %d",thisConfig->daemonProcess);
system(work); system(work);
@ -254,12 +255,14 @@ void mdCommander::say(char *what)
void mdCommander::greet() { void mdCommander::greet() {
const char *title="AusReg Cliever Commander", const char *title="AusReg Cliever Commander",
*warn="NB: this program is meant to be powerful and fast, not safe or user friendly",
*prompt="Enter ? or command"; *prompt="Enter ? or command";
sprintf(theBanner,banner,thisConfig->shellProcess,thisConfig->daemonProcess); sprintf(theBanner,banner,thisConfig->shellProcess,thisConfig->daemonProcess);
getmaxyx(stdscr,row,col); getmaxyx(stdscr,row,col);
mvprintw(0,(col-strlen(banner))/2,"%s",theBanner); mvprintw(0,(col-strlen(banner))/2,"%s",theBanner);
mvprintw(row/2,(col-strlen(title))/2,"%s",title); mvprintw(row/2,(col-strlen(title))/2,"%s",title);
mvprintw((row/2)+2,(col-strlen(warn))/2,"%s",warn);
mvprintw(row-2,1,"%s",prompt); mvprintw(row-2,1,"%s",prompt);
refresh(); refresh();
acceptingInput = true; acceptingInput = true;
@ -284,7 +287,7 @@ void mdCommander::help() {
mvprintw(16,10," log - display this cliever's log"); mvprintw(16,10," log - display this cliever's log");
mvprintw(17,10," mlog - display the master daemon log"); mvprintw(17,10," mlog - display the master daemon log");
mvprintw(18,10," done - terminate commander but not process"); mvprintw(18,10," done - terminate commander but not process");
mvprintw(19,10," quit - terminate this process and its' children"); mvprintw(19,10," q/quit - terminate this process and its' children");
mvprintw(23,5,"<n> is an integer, above active everywhere outside data entry (>>)"); mvprintw(23,5,"<n> is an integer, above active everywhere outside data entry (>>)");
mvprintw(24,5,"no space before <n>, X0 to delete all commands."); mvprintw(24,5,"no space before <n>, X0 to delete all commands.");
@ -296,17 +299,21 @@ void mdCommander::eppMainMenu() {
doHeader(); doHeader();
mvprintw(5,10," Create a new EPP command"); mvprintw(5,10," Create a new EPP command");
mvprintw(10,10," Queries "); mvprintw(7,10,"Queries");
mvprintw(12,10," c - check"); mvprintw(8,10," c - check");
mvprintw(13,10," i - info"); mvprintw(9,10," i - info");
mvprintw(14,10," p - poll"); mvprintw(10,10," p - poll");
mvprintw(15,10," t - transfer query"); mvprintw(11,10," t - transfer query");
mvprintw(17,10," Transactions"); mvprintw(12,10,"Transactions");
mvprintw(19,10," C - create"); mvprintw(13,10," C - create");
mvprintw(20,10," R - renew"); mvprintw(14,10," R - renew");
mvprintw(21,10," U - update"); mvprintw(15,10," U - update");
mvprintw(22,10," D - delete"); mvprintw(16,10," D - delete");
mvprintw(23,10," T - transfer"); mvprintw(17,10," T - transfer");
mvprintw(18,10," D - delete");
mvprintw(19,10,"Meta");
mvprintw(20,10," x - load XML for 1 above from ./xml ");
mvprintw(21,10," A - load all named above from ./xml ");
say((char *)"Action letter or ? to exit"); say((char *)"Action letter or ? to exit");
} }

View File

@ -1,4 +1,5 @@
LOCATION=DEBIAN_7 LOCATION=DEBIAN_7
ARTKENABLED=0
#LOCATION=DEBIAN_6 #LOCATION=DEBIAN_6
#LOCATION=OSX_10_8 #LOCATION=OSX_10_8
# #
@ -14,9 +15,11 @@ Cc=gcc
CLIENT=drde CLIENT=drde
ifeq ($(LOCATION),DEBIAN_7) ifeq ($(LOCATION),DEBIAN_7)
ifneq ($(ARTKENABLED),0)
ARTKLIB=-L/home/jdaugherty/clients/reg.de/git/ACTK1_0/lib ARTKLIB=-L/home/jdaugherty/clients/reg.de/git/ACTK1_0/lib
ARTKINCL=-I/home/jdaugherty/clients/reg.de/git/ACTK1_0 ARTKINCL=-I/home/jdaugherty/clients/reg.de/git/ACTK1_0
endif endif
endif
ifeq ($(LOCATION),DEBIAN_6) ifeq ($(LOCATION),DEBIAN_6)
ARTKLIB=-L/home/jdaugherty/dnseppus/ACTK1_0/lib ARTKLIB=-L/home/jdaugherty/dnseppus/ACTK1_0/lib
ARTKINCL=-I/home/jdaugherty/dnseppus/ACTK1_0 ARTKINCL=-I/home/jdaugherty/dnseppus/ACTK1_0
@ -26,13 +29,9 @@ ifeq ($(LOCATION),OSX_10_8)
ARTKINCL=-I/Users/juand/dnseppus/ACTK1_0 ARTKINCL=-I/Users/juand/dnseppus/ACTK1_0
endif endif
SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp -l ACTK1_0
SINCL= -I include -I /usr/include/log4cpp $(BOSINCL)
CFLAGS= -DCURRENT_DEBUG=1000 -ggdb3
ifeq ($(LOCATION),DEBIAN_7) ifeq ($(LOCATION),DEBIAN_7)
#XALAN_LIB_DIR = /usr/lib/x86_64-linux-gnu/ ifneq ($(ARTKENABLED),0)
XALAN_LIB_DIR = /usr/local/lib XALAN_LIB_DIR = /usr/local/lib
XALAN_LIB = xalan-c XALAN_LIB = xalan-c
XALAN_INC_DIR = /usr/local/include/xalanc XALAN_INC_DIR = /usr/local/include/xalanc
@ -40,6 +39,7 @@ XERCES_LIB_DIR = /usr/local/lib/
XERCES_LIB = xerces-c XERCES_LIB = xerces-c
XERCES_INC_DIR = /usr/local/include/xercesc/ XERCES_INC_DIR = /usr/local/include/xercesc/
endif endif
endif
ifeq ($(LOCATION),DEBIAN_6) ifeq ($(LOCATION),DEBIAN_6)
XALAN_LIB_DIR = /usr/lib/ XALAN_LIB_DIR = /usr/lib/
XALAN_LIB = xalan-c XALAN_LIB = xalan-c
@ -57,6 +57,12 @@ XERCES_LIB = xerces-c
XERCES_INC_DIR = /opt/local/include/xercesc/ XERCES_INC_DIR = /opt/local/include/xercesc/
endif endif
SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp -l ACTK1_0
DLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp
SINCL= -I include -I /usr/include/log4cpp $(BOSINCL)
CFLAGS= -DCURRENT_DEBUG=1000 -ggdb3 -DARTKENABLED=$(ARTKENABLED)
# #
# ---------- Should not need to change below # ---------- Should not need to change below
# #
@ -70,6 +76,8 @@ CLFLAGS= -Wall -Wundef -Wpointer-arith -Wshadow \
ACOBJS= build/cliever.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \ ACOBJS= build/cliever.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \
build/mdHost.o build/mdState.o build/mdAusReg.o build/mdHost.o build/mdState.o build/mdAusReg.o
MDOBJS= build/md.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \
build/mdHost.o build/mdState.o
ARTKDEPS = -L$(ARTK_LIB_DIR) -lACTK1_0 \ ARTKDEPS = -L$(ARTK_LIB_DIR) -lACTK1_0 \
@ -93,6 +101,9 @@ build/mdLogger.o: server/mdLogger.cpp include/mdLogger.h
build/cliever.o: server/cliever-md.cpp include/*.h build/cliever.o: server/cliever-md.cpp include/*.h
$(CC) $(CFLAGS) server/cliever-md.cpp -c -o build/cliever.o $(SINCL) $(ARTKINCL) $(CC) $(CFLAGS) server/cliever-md.cpp -c -o build/cliever.o $(SINCL) $(ARTKINCL)
build/md.o: server/cliever-md.cpp include/*.h
$(CC) $(CFLAGS) server/cliever-md.cpp -c -o build/md.o $(SINCL)
build/masterDaemonConfig.o: server/masterDaemonConfig.cpp include/*.h build/masterDaemonConfig.o: server/masterDaemonConfig.cpp include/*.h
$(CC) $(CFLAGS) server/masterDaemonConfig.cpp -c -o build/masterDaemonConfig.o $(SINCL) $(ARTKINCL) $(CC) $(CFLAGS) server/masterDaemonConfig.cpp -c -o build/masterDaemonConfig.o $(SINCL) $(ARTKINCL)
@ -109,6 +120,9 @@ build/masterDaemon.o: server/masterDaemon.cpp include/*.h
build/mdAusReg.o: server/mdAusReg.cpp include/*.h build/mdAusReg.o: server/mdAusReg.cpp include/*.h
$(CC) $(CFLAGS) server/mdAusReg.cpp -c -o build/mdAusReg.o $(SINCL) $(ARTKINCL) $(CC) $(CFLAGS) server/mdAusReg.cpp -c -o build/mdAusReg.o $(SINCL) $(ARTKINCL)
build/ausreg-md: $(MDOBJS)
$(CC) $(CFLAGS) -o build/ausreg-md $(SINCL) $(LIBS) $(MDOBJS) $(DLIBS)
build/drde-cliever: $(ACOBJS) build/drde-cliever: $(ACOBJS)
$(CC) $(CFLAGS) -o build/drde-cliever $(SINCL) $(LIBS) $(ACOBJS) $(SLIBS) $(ARTKDEPS) $(CC) $(CFLAGS) -o build/drde-cliever $(SINCL) $(LIBS) $(ACOBJS) $(SLIBS) $(ARTKDEPS)
@ -128,6 +142,7 @@ clean:
find ./build -name "*.o" -print | perl -ne "print;chop;unlink" find ./build -name "*.o" -print | perl -ne "print;chop;unlink"
find ./build -name "*.rpo" -print | perl -ne "print;chop;unlink" find ./build -name "*.rpo" -print | perl -ne "print;chop;unlink"
rm build/$(CLIENT)-cliever rm build/$(CLIENT)-cliever
rm build/ausreg-md

View File

@ -38,7 +38,9 @@ namespace fsm = boost::statechart;
#include "mdState.h" #include "mdState.h"
#include "mdHost.h" #include "mdHost.h"
#if ARTKENABLED > 0
#include "ausRegTK.h" #include "ausRegTK.h"
#endif
#define MD_HAUSHALT 2000 // milliseconds between attention routine #define MD_HAUSHALT 2000 // milliseconds between attention routine
#define MD_LOCK_FILE "cliever-md.lock" #define MD_LOCK_FILE "cliever-md.lock"

View File

@ -43,7 +43,9 @@ public:
received, received,
sentCommands; sentCommands;
#if ARTKENABLED > 0
ausRegEPPTK *artk; ausRegEPPTK *artk;
#endif
masterDaemonConfig *cfg; masterDaemonConfig *cfg;
mdDGChannel *bg,*fg; mdDGChannel *bg,*fg;

View File

@ -76,7 +76,6 @@ void md() {
if (background.joinable()) { if (background.joinable()) {
theseLogs->logN(2,"%s %d","Accepting API Requests on Port",thisConfig->clientPort); theseLogs->logN(2,"%s %d","Accepting API Requests on Port",thisConfig->clientPort);
// myAusRegTk.init();
background.join(); // normally unreachable background.join(); // normally unreachable
} else } else
theseLogs->logN(0,"Fatal Error: couldn't start client service layer!"); theseLogs->logN(0,"Fatal Error: couldn't start client service layer!");
@ -109,7 +108,8 @@ main(int const argc,
thisConfig->shellProcess = getpid(); thisConfig->shellProcess = getpid();
mdOrAC = (strcspn(argv[0],"./") == strlen(argv[0])) ? argv[0] : strrchr(argv[0],'/') + 1; mdOrAC = (strcspn(argv[0],"./") == strlen(argv[0])) ? argv[0] : strrchr(argv[0],'/') + 1;
mdHasEPPTk = strstr(argv[0],"epp") ? true : false; mdHasEPPTk = strstr(argv[0],"noepp") ? false : true;
if (argc < 3 || argc > 6) usage(); if (argc < 3 || argc > 6) usage();

View File

@ -123,9 +123,8 @@ void masterDaemon::dispatch(const mdIncoming &what) {
} }
} }
int masterDaemon::initAusRegTK(void) { int masterDaemon::initAusRegTK(void) {
#if ARTKENABLED > 0
int rc=OK; int rc=OK;
const std::string nil("/home/drde/etc/toolkit2.conf"); const std::string nil("/home/drde/etc/toolkit2.conf");
@ -152,7 +151,7 @@ int masterDaemon::initAusRegTK(void) {
rc = NOT_OK; } rc = NOT_OK; }
return rc; return rc;
#endif
} }
void masterDaemon::listen() { void masterDaemon::listen() {
@ -222,7 +221,7 @@ void masterDaemon::processEvent( const mdAPIFrame &thisFrame )
assert(EventSender<mdAPIFrame>::isSending()); assert(EventSender<mdAPIFrame>::isSending());
} }
void oteA() { void oteA() {
#if ARTKENABLED > 0
int nthDay; int nthDay;
for (nthDay=0;nthDay<30;nthDay++) { for (nthDay=0;nthDay<30;nthDay++) {
@ -232,9 +231,9 @@ void oteA() {
thisService->artk->daysRunning = nthDay; thisService->artk->daysRunning = nthDay;
} }
#endif
}void oteB() { }void oteB() {
#if ARTKENABLED > 0
int nthDay; int nthDay;
for (nthDay=0;nthDay<30;nthDay++) { for (nthDay=0;nthDay<30;nthDay++) {
@ -244,13 +243,15 @@ void oteA() {
thisService->artk->daysRunning = nthDay; thisService->artk->daysRunning = nthDay;
} }
#endif
} }
void masterDaemon::run() { void masterDaemon::run() {
deviceFactory = new mdHostFabrik(); deviceFactory = new mdHostFabrik();
fg = new mdDGChannel( thisService->io_, 0 ); fg = new mdDGChannel( thisService->io_, 0 );
#if ARTKENABLED > 0
if (initAusRegTK()) return; if (initAusRegTK()) return;
if (artk->tkScenario == ACTK_OTEA) { if (artk->tkScenario == ACTK_OTEA) {
@ -265,7 +266,7 @@ void masterDaemon::run() {
oteBrun.join(); oteBrun.join();
theseLogs->logNdebug(MAX_DEBUG,0,"Pre-production Ops / OTEB EOJ."); theseLogs->logNdebug(MAX_DEBUG,0,"Pre-production Ops / OTEB EOJ.");
} }
#endif
listen(); listen();
boost::thread work(mdWQ); boost::thread work(mdWQ);
assert(work.joinable()); assert(work.joinable());