Changeset 3691
- Timestamp:
- 05/30/2012 07:05:26 PM (13 months ago)
- Location:
- openbts/trunk/CLI
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
openbts/trunk/CLI/CLI.cpp
r3688 r3691 78 78 79 79 80 int Parser::execute(char* line, ostream& os , istream& is) const80 int Parser::execute(char* line, ostream& os) const 81 81 { 82 82 // escape to the shell? … … 105 105 return NOT_FOUND; 106 106 } 107 int (*func)(int,char**,ostream& ,istream&);107 int (*func)(int,char**,ostream&); 108 108 func = cfp->second; 109 109 // Do it. 110 int retVal = (*func)(argc,argv,os ,is);110 int retVal = (*func)(argc,argv,os); 111 111 // Give hint on bad # args. 112 112 if (retVal==BAD_NUM_ARGS) os << help(argv[0]) << endl; … … 115 115 116 116 117 int Parser::process(const char* line, ostream& os , istream& is) const117 int Parser::process(const char* line, ostream& os) const 118 118 { 119 119 char *newLine = strdup(line); 120 int retVal = execute(newLine,os ,is);120 int retVal = execute(newLine,os); 121 121 free(newLine); 122 122 if (retVal>0) os << standardResponses[retVal] << endl; … … 138 138 139 139 // forward refs 140 int printStats(int argc, char** argv, ostream& os , istream& is);140 int printStats(int argc, char** argv, ostream& os); 141 141 142 142 /* … … 146 146 147 147 /** Display system uptime and current GSM frame number. */ 148 int uptime(int argc, char** argv, ostream& os , istream& is)148 int uptime(int argc, char** argv, ostream& os) 149 149 { 150 150 if (argc!=1) return BAD_NUM_ARGS; … … 173 173 174 174 /** Give a list of available commands or describe a specific command. */ 175 int showHelp(int argc, char** argv, ostream& os , istream& is)175 int showHelp(int argc, char** argv, ostream& os) 176 176 { 177 177 if (argc==2) { … … 201 201 202 202 /** A function to return -1, the exit code for the caller. */ 203 int exit_function(int argc, char** argv, ostream& os , istream& is)203 int exit_function(int argc, char** argv, ostream& os) 204 204 { 205 205 unsigned wait =0; … … 231 231 if (loads) { 232 232 os << endl << "exiting with loads:" << endl; 233 printStats(1,NULL,os ,is);233 printStats(1,NULL,os); 234 234 } 235 235 os << endl << "exiting..." << endl; … … 240 240 241 241 // Forward ref. 242 int tmsis(int argc, char** argv, ostream& os , istream& is);242 int tmsis(int argc, char** argv, ostream& os); 243 243 244 244 /** Dump TMSI table to a text file. */ 245 int dumpTMSIs(const char* filename , istream& is)245 int dumpTMSIs(const char* filename) 246 246 { 247 247 ofstream fileout; … … 251 251 char* subargv[] = {"tmsis", NULL}; 252 252 int subargc = 1; 253 return tmsis(subargc, subargv, fileout , is);253 return tmsis(subargc, subargv, fileout); 254 254 } 255 255 … … 258 258 259 259 /** Print or clear the TMSI table. */ 260 int tmsis(int argc, char** argv, ostream& os , istream& is)260 int tmsis(int argc, char** argv, ostream& os) 261 261 { 262 262 if (argc>=2) { … … 272 272 if (argc!=3) return BAD_NUM_ARGS; 273 273 os << "dumping TMSI table to " << argv[2] << endl; 274 return dumpTMSIs(argv[2] ,is);274 return dumpTMSIs(argv[2]); 275 275 } 276 276 return BAD_VALUE; … … 285 285 286 286 /** Submit an SMS for delivery to an IMSI. */ 287 int sendsimple(int argc, char** argv, ostream& os , istream& is)287 int sendsimple(int argc, char** argv, ostream& os) 288 288 { 289 289 if (argc!=3) return BAD_NUM_ARGS; … … 328 328 329 329 /** Submit an SMS for delivery to an IMSI. */ 330 int sendsms(int argc, char** argv, ostream& os , istream& is)330 int sendsms(int argc, char** argv, ostream& os) 331 331 { 332 332 if (argc!=3) return BAD_NUM_ARGS; … … 353 353 354 354 /** DEBUGGING: Sends a special sms that triggers a RRLP message to an IMSI. */ 355 int sendrrlp(int argc, char** argv, ostream& os , istream& is)355 int sendrrlp(int argc, char** argv, ostream& os) 356 356 { 357 357 if (argc!=3) return BAD_NUM_ARGS; … … 382 382 383 383 /** Print current usage loads. */ 384 int printStats(int argc, char** argv, ostream& os , istream& is)384 int printStats(int argc, char** argv, ostream& os) 385 385 { 386 386 if (argc!=1) return BAD_NUM_ARGS; … … 399 399 400 400 /** Get/Set MCC, MNC, LAC, CI. */ 401 int cellID(int argc, char** argv, ostream& os , istream& is)401 int cellID(int argc, char** argv, ostream& os) 402 402 { 403 403 if (argc==1) { … … 436 436 437 437 /** Print table of current transactions. */ 438 int calls(int argc, char** argv, ostream& os , istream& is)438 int calls(int argc, char** argv, ostream& os) 439 439 { 440 440 if (argc!=1) return BAD_NUM_ARGS; … … 447 447 448 448 /** Print or modify the global configuration table. */ 449 int config(int argc, char** argv, ostream& os , istream& is)449 int config(int argc, char** argv, ostream& os) 450 450 { 451 451 // no args, just print … … 486 486 487 487 /** Remove a configiuration value. */ 488 int unconfig(int argc, char** argv, ostream& os , istream& is)488 int unconfig(int argc, char** argv, ostream& os) 489 489 { 490 490 if (argc!=2) return BAD_NUM_ARGS; … … 504 504 505 505 /** Dump current configuration to a file. */ 506 int configsave(int argc, char** argv, ostream& os , istream& is)506 int configsave(int argc, char** argv, ostream& os) 507 507 { 508 508 os << "obsolete" << endl; … … 513 513 514 514 /** Change the registration timers. */ 515 int regperiod(int argc, char** argv, ostream& os , istream& is)515 int regperiod(int argc, char** argv, ostream& os) 516 516 { 517 517 if (argc==1) { … … 544 544 545 545 /** Print the list of alarms kept by the logger, i.e. the last LOG(ALARM) << <text> */ 546 int alarms(int argc, char** argv, ostream& os , istream& is)546 int alarms(int argc, char** argv, ostream& os) 547 547 { 548 548 std::ostream_iterator<std::string> output( os, "\n" ); … … 554 554 555 555 /** Version string. */ 556 int version(int argc, char **argv, ostream& os , istream& is)556 int version(int argc, char **argv, ostream& os) 557 557 { 558 558 if (argc!=1) return BAD_NUM_ARGS; … … 562 562 563 563 /** Show start-up notices. */ 564 int notices(int argc, char **argv, ostream& os , istream& is)564 int notices(int argc, char **argv, ostream& os) 565 565 { 566 566 if (argc!=1) return BAD_NUM_ARGS; … … 569 569 } 570 570 571 int page(int argc, char **argv, ostream& os , istream& is)571 int page(int argc, char **argv, ostream& os) 572 572 { 573 573 if (argc==1) { … … 594 594 595 595 596 int endcall(int argc, char **argv, ostream& os , istream& is)596 int endcall(int argc, char **argv, ostream& os) 597 597 { 598 598 if (argc!=2) return BAD_NUM_ARGS; … … 634 634 635 635 636 int chans(int argc, char **argv, ostream& os , istream& is)636 int chans(int argc, char **argv, ostream& os) 637 637 { 638 638 if (argc!=1) return BAD_NUM_ARGS; … … 676 676 677 677 678 int power(int argc, char **argv, ostream& os , istream& is)678 int power(int argc, char **argv, ostream& os) 679 679 { 680 680 os << "current downlink power " << gBTS.powerManager().power() << " dB wrt full scale" << endl; … … 705 705 706 706 707 int rxgain(int argc, char** argv, ostream& os , istream& is)707 int rxgain(int argc, char** argv, ostream& os) 708 708 { 709 709 os << "current RX gain is " << gConfig.getNum("GSM.Radio.RxGain") << " dB" << endl; … … 719 719 } 720 720 721 int noise(int argc, char** argv, ostream& os , istream& is)721 int noise(int argc, char** argv, ostream& os) 722 722 { 723 723 if (argc!=1) return BAD_NUM_ARGS; -
openbts/trunk/CLI/CLI.h
r3165 r3691 37 37 38 38 /** A table for matching strings to actions. */ 39 typedef std::map<std::string,int (*)(int,char**,std::ostream& ,std::istream&)> ParseTable;39 typedef std::map<std::string,int (*)(int,char**,std::ostream&)> ParseTable; 40 40 41 41 /** The help table. */ … … 58 58 @return 0 on sucess, -1 on exit request, error codes otherwise 59 59 */ 60 int process(const char* line, std::ostream& os , std::istream& is) const;60 int process(const char* line, std::ostream& os) const; 61 61 62 62 /** Add a command to the parsing table. */ 63 void addCommand(const char* name, int (*func)(int,char**,std::ostream& ,std::istream&), const char* helpString)63 void addCommand(const char* name, int (*func)(int,char**,std::ostream&), const char* helpString) 64 64 { mParseTable[name] = func; mHelpTable[name]=helpString; } 65 65 … … 73 73 74 74 /** Parse and execute a command string. */ 75 int execute(char* line, std::ostream& os , std::istream& is) const;75 int execute(char* line, std::ostream& os) const; 76 76 77 77 };
![(please configure the [header_logo] section in trac.ini)](http://wush.net/trac/rangepublic/raw-attachment/wiki/WikiStart/PublicReleaseLogo.png)
