fgms 0.11.8
The
FlightGear MultiPlayer Server
project
FG_CLI Class Reference

cisco like command line interface More...

#include <fg_cli.hxx>

Inheritance diagram for FG_CLI:
LIBCLI::CLI

Public Types

typedef int(* c_auth_func) (const string &, const string &)
 
typedef int(* c_enable_func) (const string &)
 
typedef int(CLI::* cpp_auth_func) (const string &, const string &)
 
typedef int(CLI::* cpp_enable_func) (const string &)
 
typedef std::map< string, string > unp
 
typedef std::map< string, string >::iterator unp_it
 

Public Member Functions

 FG_CLI (FG_SERVER *fgms, int fd)
 
void allow_enable (const string &password)
 
void allow_user (const string &username, const string &password)
 
void deny_user (const string &username)
 
void destroy ()
 
int file (FILE *fh, int privilege, int mode)
 
void free_history ()
 
int loop ()
 
int print (const char *format,...)
 
void register_command (Command< CLI > *command, Command< CLI > *parent=0)
 
void regular (int(*callback)())
 
int run_command (char *command)
 
void set_auth_callback (c_auth_func callback)
 
void set_auth_callback (cpp_auth_func callback)
 
void set_banner (const string &banner)
 
int set_configmode (int mode, const string &config_desc)
 
void set_enable_callback (c_enable_func callback)
 
void set_enable_callback (cpp_enable_func callback)
 
void set_hostname (const string &hostname)
 
void set_modestring (const string &modestring)
 
int set_privilege (int privilege)
 
void set_prompt (const string &prompt)
 
int unregister_command (char *command)
 

Public Attributes

c_auth_func auth_callback
 
string banner
 
Client client
 
Command< CLI > * commands
 
int completion_callback
 
cpp_auth_func cpp_auth_callback
 
cpp_enable_func cpp_enable_callback
 
c_enable_func enable_callback
 
string enable_password
 
char * history [MAX_HISTORY]
 
string hostname
 
int mode
 
string modestring
 
int privilege
 
string prompt
 
int(* regular_callback )()
 
bool showprompt
 
int state
 
unp users
 

Protected Member Functions

int _print (int print_mode, const char *format, va_list ap)
 
int add_history (char *cmd)
 
bool append (const unsigned char &c)
 
int build_shortest (Command< CLI > *commands)
 
void check_enable (const char *pass)
 
bool check_pager ()
 
void check_user_auth (const string &username, const string &password)
 
void clear_line (char *cmd, int l, int cursor)
 
void clear_line ()
 
void clear_to_eol ()
 
void cursor_left ()
 
void cursor_right ()
 
void delete_backwards (const unsigned char c)
 
void do_history (const unsigned char &c)
 
int find_command (Command< CLI > *commands, int num_words, char *words[], int start_word, int filters[])
 
void free_command (Command< CLI > *cmd)
 
int get_completions (char *command, char **completions, int max_completions)
 
int get_input (unsigned char &c)
 
void handle_telnet_option ()
 
void insert (const unsigned char &c)
 
int int_configure_terminal (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_disable (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_dump (char *command, char *argv[], int argc)
 
int internal_enable (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_exit (char *command, char *argv[], int argc)
 
int internal_help (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_history (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_quit (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int internal_whoami (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
void jump_end_of_line ()
 
void jump_start_of_line ()
 
void leave_config_mode ()
 
void list_completions ()
 
unsigned char map_esc ()
 
int pager ()
 
int parse_line (char *line, char *words[], int max_words)
 
int pass_matches (string pass, string tried_pass)
 
void prompt_user ()
 
void redraw_line ()
 
void show_prompt ()
 
bool try_logout ()
 
void unregister_all (Command< CLI > *command)
 

Protected Attributes

char * cmd
 
int cursor
 
bool from_socket
 
int in_history
 
int length
 
int my_sock
 
struct termios OldModes
 
string username
 

Private Member Functions

int cmd_blacklist_add (char *command, char *argv[], int argc)
 Add Blacklist entry. More...
 
int cmd_blacklist_delete (char *command, char *argv[], int argc)
 Delete Blacklist entry. More...
 
int cmd_blacklist_show (char *command, char *argv[], int argc)
 Show Blacklist. More...
 
int cmd_crossfeed_add (char *command, char *argv[], int argc)
 Add Crossfeed entry. More...
 
int cmd_crossfeed_delete (char *command, char *argv[], int argc)
 Delete Crossfeed entry. More...
 
int cmd_crossfeed_show (char *command, char *argv[], int argc)
 Show Crossfeed. More...
 
int cmd_fgms_die (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int cmd_NOT_IMPLEMENTED (char *command, char *argv[], int argc)
 
int cmd_relay_add (char *command, char *argv[], int argc)
 Add Relay entry. More...
 
int cmd_relay_delete (char *command, char *argv[], int argc)
 Delete Relay entry. More...
 
int cmd_relay_show (char *command, char *argv[], int argc)
 Show Relays. More...
 
int cmd_show_stats (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int cmd_show_uptime (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int cmd_show_version (UNUSED(char *command), UNUSED(char *argv[]), UNUSED(int argc))
 
int cmd_tracker_show (char *command, char *argv[], int argc)
 Show status of tracker server. More...
 
int cmd_user_show (char *command, char *argv[], int argc)
 Show Players. More...
 
bool need_help (char *argv)
 
void setup ()
 

Private Attributes

FG_SERVERfgms
 

Detailed Description

cisco like command line interface

Definition at line 44 of file fg_cli.hxx.

Member Typedef Documentation

typedef int(* LIBCLI::CLI::c_auth_func) (const string &, const string &)
inherited

Definition at line 41 of file libcli.hxx.

typedef int(* LIBCLI::CLI::c_enable_func) (const string &)
inherited

Definition at line 43 of file libcli.hxx.

typedef int(CLI::* LIBCLI::CLI::cpp_auth_func) (const string &, const string &)
inherited

Definition at line 42 of file libcli.hxx.

typedef int(CLI::* LIBCLI::CLI::cpp_enable_func) (const string &)
inherited

Definition at line 44 of file libcli.hxx.

typedef std::map<string,string> LIBCLI::CLI::unp
inherited

Definition at line 39 of file libcli.hxx.

typedef std::map<string,string>::iterator LIBCLI::CLI::unp_it
inherited

Definition at line 40 of file libcli.hxx.

Constructor & Destructor Documentation

FG_CLI::FG_CLI ( FG_SERVER fgms,
int  fd 
)

Definition at line 34 of file fg_cli.cxx.

Member Function Documentation

int LIBCLI::CLI::_print ( int  print_mode,
const char *  format,
va_list  ap 
)
protectedinherited
int LIBCLI::CLI::add_history ( char *  cmd)
protectedinherited

Definition at line 710 of file libcli.cxx.

void LIBCLI::CLI::allow_enable ( const string &  password)
inherited

Definition at line 130 of file libcli.cxx.

void LIBCLI::CLI::allow_user ( const string &  username,
const string &  password 
)
inherited

Definition at line 113 of file libcli.cxx.

bool LIBCLI::CLI::append ( const unsigned char &  c)
protectedinherited

Definition at line 1841 of file libcli.cxx.

int LIBCLI::CLI::build_shortest ( Command< CLI > *  commands)
protectedinherited

Definition at line 185 of file libcli.cxx.

void LIBCLI::CLI::check_enable ( const char *  pass)
protectedinherited

Definition at line 1404 of file libcli.cxx.

bool LIBCLI::CLI::check_pager ( )
protectedinherited

Definition at line 2171 of file libcli.cxx.

void LIBCLI::CLI::check_user_auth ( const string &  username,
const string &  password 
)
protectedinherited

Definition at line 1447 of file libcli.cxx.

void LIBCLI::CLI::clear_line ( char *  cmd,
int  l,
int  cursor 
)
protectedinherited

Definition at line 1239 of file libcli.cxx.

void LIBCLI::CLI::clear_line ( )
protectedinherited

Definition at line 1605 of file libcli.cxx.

void LIBCLI::CLI::clear_to_eol ( )
protectedinherited

Definition at line 1620 of file libcli.cxx.

int FG_CLI::cmd_blacklist_add ( char *  command,
char *  argv[],
int  argc 
)
private

Add Blacklist entry.

ONLY in config mode

possible arguments: blacklist add ? blacklist add TTL IP-Address [reason] blacklist add [...] <cr>

Definition at line 735 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_blacklist_delete ( char *  command,
char *  argv[],
int  argc 
)
private

Delete Blacklist entry.

ONLY in config mode

possible arguments: blacklist delete ? blacklist delete ID blacklist delete IP-Address blacklist delete [...] <cr>

Definition at line 641 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_blacklist_show ( char *  command,
char *  argv[],
int  argc 
)
private

Show Blacklist.

possible arguments: show blacklist ? show blacklist <cr> show blacklist ID show blacklist IP-Address show blacklist [...] brief

Definition at line 495 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_crossfeed_add ( char *  command,
char *  argv[],
int  argc 
)
private

Add Crossfeed entry.

ONLY in config mode

possible arguments: crossfeed add ? crossfeed add IP-Address Port Name crossfeed add [...] <cr>

Definition at line 924 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_crossfeed_delete ( char *  command,
char *  argv[],
int  argc 
)
private

Delete Crossfeed entry.

ONLY in config mode

possible arguments: crossfeed delete ? crossfeed delete ID crossfeed delete IP-Address crossfeed delete [...] <cr>

Definition at line 830 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_crossfeed_show ( char *  command,
char *  argv[],
int  argc 
)
private

Show Crossfeed.

possible arguments: show blacklist ? show blacklist <cr> show blacklist ID show blacklist IP-Address show blacklist [...] brief

Definition at line 1019 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_fgms_die ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
private

Definition at line 410 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_NOT_IMPLEMENTED ( char *  command,
char *  argv[],
int  argc 
)
private

Definition at line 1819 of file fg_cli.cxx.

int FG_CLI::cmd_relay_add ( char *  command,
char *  argv[],
int  argc 
)
private

Add Relay entry.

ONLY in config mode

possible arguments: relay add ? relay add IP-Address Port [Name] relay add [...] <cr>

Definition at line 1507 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_relay_delete ( char *  command,
char *  argv[],
int  argc 
)
private

Delete Relay entry.

ONLY in config mode

possible arguments: relay delete ? relay delete ID relay delete IP-Address relay delete [...] <cr>

Definition at line 1413 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_relay_show ( char *  command,
char *  argv[],
int  argc 
)
private

Show Relays.

possible arguments: show relay ? show relay <cr> show relay ID show relay IP-Address show relay [...] brief

Definition at line 1159 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_show_stats ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
private

Definition at line 270 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_show_uptime ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
private

Definition at line 430 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_show_version ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
private

Definition at line 451 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_tracker_show ( char *  command,
char *  argv[],
int  argc 
)
private

Show status of tracker server.

possible arguments: show tracker ? show tracker <cr>

Definition at line 1317 of file fg_cli.cxx.

Referenced by setup().

int FG_CLI::cmd_user_show ( char *  command,
char *  argv[],
int  argc 
)
private

Show Players.

possible arguments: show user ? show user <cr> show user ID <cr> show user IP-Address <cr> show user Name <cr> show user local <cr> show user remote <cr> show user [...] brief <cr>

Definition at line 1601 of file fg_cli.cxx.

Referenced by setup().

void LIBCLI::CLI::cursor_left ( )
protectedinherited

Definition at line 1782 of file libcli.cxx.

void LIBCLI::CLI::cursor_right ( )
protectedinherited

Definition at line 1797 of file libcli.cxx.

void LIBCLI::CLI::delete_backwards ( const unsigned char  c)
protectedinherited

Definition at line 1493 of file libcli.cxx.

void LIBCLI::CLI::deny_user ( const string &  username)
inherited

Definition at line 140 of file libcli.cxx.

void LIBCLI::CLI::destroy ( )
inherited

Definition at line 667 of file libcli.cxx.

void LIBCLI::CLI::do_history ( const unsigned char &  c)
protectedinherited

Definition at line 1714 of file libcli.cxx.

int LIBCLI::CLI::file ( FILE *  fh,
int  privilege,
int  mode 
)
inherited

Definition at line 2079 of file libcli.cxx.

int LIBCLI::CLI::find_command ( Command< CLI > *  commands,
int  num_words,
char *  words[],
int  start_word,
int  filters[] 
)
protectedinherited

Definition at line 835 of file libcli.cxx.

void LIBCLI::CLI::free_command ( Command< CLI > *  cmd)
protectedinherited

Definition at line 352 of file libcli.cxx.

void LIBCLI::CLI::free_history ( )
inherited

Definition at line 748 of file libcli.cxx.

int LIBCLI::CLI::get_completions ( char *  command,
char **  completions,
int  max_completions 
)
protectedinherited

Definition at line 1113 of file libcli.cxx.

int LIBCLI::CLI::get_input ( unsigned char &  c)
protectedinherited

Definition at line 1370 of file libcli.cxx.

void LIBCLI::CLI::handle_telnet_option ( )
protectedinherited

Definition at line 1353 of file libcli.cxx.

void LIBCLI::CLI::insert ( const unsigned char &  c)
protectedinherited

Definition at line 1859 of file libcli.cxx.

int LIBCLI::CLI::int_configure_terminal ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 549 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_disable ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 437 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_dump ( char *  command,
char *  argv[],
int  argc 
)
protectedinherited
int LIBCLI::CLI::internal_enable ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 410 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_exit ( char *  command,
char *  argv[],
int  argc 
)
protectedinherited

Definition at line 525 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_help ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 451 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_history ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 490 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_quit ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 511 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

int LIBCLI::CLI::internal_whoami ( UNUSED(char *command)  ,
UNUSED(char *argv[])  ,
UNUSED(int argc)   
)
protectedinherited

Definition at line 477 of file libcli.cxx.

Referenced by LIBCLI::CLI::CLI().

void LIBCLI::CLI::jump_end_of_line ( )
protectedinherited

Definition at line 1827 of file libcli.cxx.

void LIBCLI::CLI::jump_start_of_line ( )
protectedinherited

Definition at line 1812 of file libcli.cxx.

void LIBCLI::CLI::leave_config_mode ( )
protectedinherited

Definition at line 1658 of file libcli.cxx.

void LIBCLI::CLI::list_completions ( )
protectedinherited

Definition at line 1675 of file libcli.cxx.

int LIBCLI::CLI::loop ( )
inherited

Definition at line 1896 of file libcli.cxx.

Referenced by FG_SERVER::HandleAdmin(), and main().

unsigned char LIBCLI::CLI::map_esc ( )
protectedinherited

Definition at line 1326 of file libcli.cxx.

bool FG_CLI::need_help ( char *  argv)
private

Definition at line 256 of file fg_cli.cxx.

int LIBCLI::CLI::pager ( )
protectedinherited

Definition at line 2135 of file libcli.cxx.

int LIBCLI::CLI::parse_line ( char *  line,
char *  words[],
int  max_words 
)
protectedinherited

Definition at line 763 of file libcli.cxx.

int LIBCLI::CLI::pass_matches ( string  pass,
string  tried_pass 
)
protectedinherited

Definition at line 1284 of file libcli.cxx.

int LIBCLI::CLI::print ( const char *  format,
  ... 
)
inherited

Definition at line 2187 of file libcli.cxx.

void LIBCLI::CLI::prompt_user ( )
protectedinherited

Definition at line 1556 of file libcli.cxx.

void LIBCLI::CLI::redraw_line ( )
protectedinherited

Definition at line 1588 of file libcli.cxx.

void LIBCLI::CLI::register_command ( Command< CLI > *  command,
Command< CLI > *  parent = 0 
)
inherited

Definition at line 293 of file libcli.cxx.

void LIBCLI::CLI::regular ( int(*)()  callback)
inherited

Definition at line 1271 of file libcli.cxx.

int LIBCLI::CLI::run_command ( char *  command)
inherited

Definition at line 1062 of file libcli.cxx.

void LIBCLI::CLI::set_auth_callback ( c_auth_func  callback)
inherited

Definition at line 69 of file libcli.cxx.

void LIBCLI::CLI::set_auth_callback ( cpp_auth_func  callback)
inherited

Definition at line 80 of file libcli.cxx.

void LIBCLI::CLI::set_banner ( const string &  banner)
inherited

Definition at line 155 of file libcli.cxx.

Referenced by main().

int LIBCLI::CLI::set_configmode ( int  mode,
const string &  config_desc 
)
inherited

Definition at line 262 of file libcli.cxx.

void LIBCLI::CLI::set_enable_callback ( c_enable_func  callback)
inherited

Definition at line 91 of file libcli.cxx.

void LIBCLI::CLI::set_enable_callback ( cpp_enable_func  callback)
inherited

Definition at line 102 of file libcli.cxx.

void LIBCLI::CLI::set_hostname ( const string &  hostname)
inherited

Definition at line 165 of file libcli.cxx.

Referenced by main().

void LIBCLI::CLI::set_modestring ( const string &  modestring)
inherited

Definition at line 252 of file libcli.cxx.

int LIBCLI::CLI::set_privilege ( int  privilege)
inherited

Definition at line 235 of file libcli.cxx.

void LIBCLI::CLI::set_prompt ( const string &  prompt)
inherited

Definition at line 175 of file libcli.cxx.

void FG_CLI::setup ( )
private

Definition at line 45 of file fg_cli.cxx.

void LIBCLI::CLI::show_prompt ( )
protectedinherited

Definition at line 1306 of file libcli.cxx.

bool LIBCLI::CLI::try_logout ( )
protectedinherited

Definition at line 1644 of file libcli.cxx.

void LIBCLI::CLI::unregister_all ( Command< CLI > *  command)
protectedinherited

Definition at line 673 of file libcli.cxx.

int LIBCLI::CLI::unregister_command ( char *  command)
inherited

Definition at line 374 of file libcli.cxx.

Member Data Documentation

c_auth_func LIBCLI::CLI::auth_callback
inherited

Definition at line 63 of file libcli.hxx.

string LIBCLI::CLI::banner
inherited

Definition at line 47 of file libcli.hxx.

Client LIBCLI::CLI::client
inherited

Definition at line 57 of file libcli.hxx.

char* LIBCLI::CLI::cmd
protectedinherited

Definition at line 142 of file libcli.hxx.

Command<CLI>* LIBCLI::CLI::commands
inherited

Definition at line 59 of file libcli.hxx.

int LIBCLI::CLI::completion_callback
inherited

Definition at line 46 of file libcli.hxx.

cpp_auth_func LIBCLI::CLI::cpp_auth_callback
inherited

Definition at line 64 of file libcli.hxx.

cpp_enable_func LIBCLI::CLI::cpp_enable_callback
inherited

Definition at line 66 of file libcli.hxx.

int LIBCLI::CLI::cursor
protectedinherited

Definition at line 141 of file libcli.hxx.

c_enable_func LIBCLI::CLI::enable_callback
inherited

Definition at line 65 of file libcli.hxx.

string LIBCLI::CLI::enable_password
inherited

Definition at line 48 of file libcli.hxx.

FG_SERVER* FG_CLI::fgms
private

Definition at line 84 of file fg_cli.hxx.

bool LIBCLI::CLI::from_socket
protectedinherited

Definition at line 138 of file libcli.hxx.

char* LIBCLI::CLI::history[MAX_HISTORY]
inherited

Definition at line 49 of file libcli.hxx.

string LIBCLI::CLI::hostname
inherited

Definition at line 52 of file libcli.hxx.

int LIBCLI::CLI::in_history
protectedinherited

Definition at line 144 of file libcli.hxx.

int LIBCLI::CLI::length
protectedinherited

Definition at line 140 of file libcli.hxx.

int LIBCLI::CLI::mode
inherited

Definition at line 55 of file libcli.hxx.

string LIBCLI::CLI::modestring
inherited

Definition at line 53 of file libcli.hxx.

int LIBCLI::CLI::my_sock
protectedinherited

Definition at line 139 of file libcli.hxx.

struct termios LIBCLI::CLI::OldModes
protectedinherited

Definition at line 146 of file libcli.hxx.

int LIBCLI::CLI::privilege
inherited

Definition at line 54 of file libcli.hxx.

string LIBCLI::CLI::prompt
inherited

Definition at line 51 of file libcli.hxx.

int(* LIBCLI::CLI::regular_callback) ()
inherited

Definition at line 62 of file libcli.hxx.

bool LIBCLI::CLI::showprompt
inherited

Definition at line 50 of file libcli.hxx.

int LIBCLI::CLI::state
inherited

Definition at line 56 of file libcli.hxx.

string LIBCLI::CLI::username
protectedinherited

Definition at line 143 of file libcli.hxx.

unp LIBCLI::CLI::users
inherited

Definition at line 58 of file libcli.hxx.


The documentation for this class was generated from the following files: