fgms 0.11.8
The
FlightGear MultiPlayer Server
project
LIBCLI::CLI Class Reference

#include <libcli.hxx>

Inheritance diagram for LIBCLI::CLI:
FG_CLI my_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

 CLI (int fd)
 
 ~CLI ()
 
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
 

Detailed Description

Definition at line 36 of file libcli.hxx.

Member Typedef Documentation

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

Definition at line 41 of file libcli.hxx.

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

Definition at line 43 of file libcli.hxx.

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

Definition at line 42 of file libcli.hxx.

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

Definition at line 44 of file libcli.hxx.

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

Definition at line 39 of file libcli.hxx.

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

Definition at line 40 of file libcli.hxx.

Constructor & Destructor Documentation

LIBCLI::CLI::CLI ( int  fd)

Definition at line 567 of file libcli.cxx.

LIBCLI::CLI::~CLI ( )

Definition at line 658 of file libcli.cxx.

Member Function Documentation

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

Definition at line 710 of file libcli.cxx.

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

Definition at line 130 of file libcli.cxx.

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

Definition at line 113 of file libcli.cxx.

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

Definition at line 1841 of file libcli.cxx.

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

Definition at line 185 of file libcli.cxx.

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

Definition at line 1404 of file libcli.cxx.

bool LIBCLI::CLI::check_pager ( )
protected

Definition at line 2171 of file libcli.cxx.

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

Definition at line 1447 of file libcli.cxx.

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

Definition at line 1239 of file libcli.cxx.

void LIBCLI::CLI::clear_line ( )
protected

Definition at line 1605 of file libcli.cxx.

void LIBCLI::CLI::clear_to_eol ( )
protected

Definition at line 1620 of file libcli.cxx.

void LIBCLI::CLI::cursor_left ( )
protected

Definition at line 1782 of file libcli.cxx.

void LIBCLI::CLI::cursor_right ( )
protected

Definition at line 1797 of file libcli.cxx.

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

Definition at line 1493 of file libcli.cxx.

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

Definition at line 140 of file libcli.cxx.

void LIBCLI::CLI::destroy ( )

Definition at line 667 of file libcli.cxx.

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

Definition at line 1714 of file libcli.cxx.

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

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[] 
)
protected

Definition at line 835 of file libcli.cxx.

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

Definition at line 352 of file libcli.cxx.

void LIBCLI::CLI::free_history ( )

Definition at line 748 of file libcli.cxx.

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

Definition at line 1113 of file libcli.cxx.

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

Definition at line 1370 of file libcli.cxx.

void LIBCLI::CLI::handle_telnet_option ( )
protected

Definition at line 1353 of file libcli.cxx.

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

Definition at line 1859 of file libcli.cxx.

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

Definition at line 549 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 437 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 410 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 525 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 451 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 490 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 511 of file libcli.cxx.

Referenced by CLI().

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

Definition at line 477 of file libcli.cxx.

Referenced by CLI().

void LIBCLI::CLI::jump_end_of_line ( )
protected

Definition at line 1827 of file libcli.cxx.

void LIBCLI::CLI::jump_start_of_line ( )
protected

Definition at line 1812 of file libcli.cxx.

void LIBCLI::CLI::leave_config_mode ( )
protected

Definition at line 1658 of file libcli.cxx.

void LIBCLI::CLI::list_completions ( )
protected

Definition at line 1675 of file libcli.cxx.

int LIBCLI::CLI::loop ( )

Definition at line 1896 of file libcli.cxx.

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

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

Definition at line 1326 of file libcli.cxx.

int LIBCLI::CLI::pager ( )
protected

Definition at line 2135 of file libcli.cxx.

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

Definition at line 763 of file libcli.cxx.

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

Definition at line 1284 of file libcli.cxx.

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

Definition at line 2187 of file libcli.cxx.

void LIBCLI::CLI::prompt_user ( )
protected

Definition at line 1556 of file libcli.cxx.

void LIBCLI::CLI::redraw_line ( )
protected

Definition at line 1588 of file libcli.cxx.

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

Definition at line 293 of file libcli.cxx.

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

Definition at line 1271 of file libcli.cxx.

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

Definition at line 1062 of file libcli.cxx.

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

Definition at line 69 of file libcli.cxx.

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

Definition at line 80 of file libcli.cxx.

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

Definition at line 155 of file libcli.cxx.

Referenced by main().

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

Definition at line 262 of file libcli.cxx.

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

Definition at line 91 of file libcli.cxx.

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

Definition at line 102 of file libcli.cxx.

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

Definition at line 165 of file libcli.cxx.

Referenced by main().

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

Definition at line 252 of file libcli.cxx.

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

Definition at line 235 of file libcli.cxx.

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

Definition at line 175 of file libcli.cxx.

void LIBCLI::CLI::show_prompt ( )
protected

Definition at line 1306 of file libcli.cxx.

bool LIBCLI::CLI::try_logout ( )
protected

Definition at line 1644 of file libcli.cxx.

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

Definition at line 673 of file libcli.cxx.

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

Definition at line 374 of file libcli.cxx.

Member Data Documentation

c_auth_func LIBCLI::CLI::auth_callback

Definition at line 63 of file libcli.hxx.

string LIBCLI::CLI::banner

Definition at line 47 of file libcli.hxx.

Client LIBCLI::CLI::client

Definition at line 57 of file libcli.hxx.

char* LIBCLI::CLI::cmd
protected

Definition at line 142 of file libcli.hxx.

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

Definition at line 59 of file libcli.hxx.

int LIBCLI::CLI::completion_callback

Definition at line 46 of file libcli.hxx.

cpp_auth_func LIBCLI::CLI::cpp_auth_callback

Definition at line 64 of file libcli.hxx.

cpp_enable_func LIBCLI::CLI::cpp_enable_callback

Definition at line 66 of file libcli.hxx.

int LIBCLI::CLI::cursor
protected

Definition at line 141 of file libcli.hxx.

c_enable_func LIBCLI::CLI::enable_callback

Definition at line 65 of file libcli.hxx.

string LIBCLI::CLI::enable_password

Definition at line 48 of file libcli.hxx.

bool LIBCLI::CLI::from_socket
protected

Definition at line 138 of file libcli.hxx.

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

Definition at line 49 of file libcli.hxx.

string LIBCLI::CLI::hostname

Definition at line 52 of file libcli.hxx.

int LIBCLI::CLI::in_history
protected

Definition at line 144 of file libcli.hxx.

int LIBCLI::CLI::length
protected

Definition at line 140 of file libcli.hxx.

int LIBCLI::CLI::mode

Definition at line 55 of file libcli.hxx.

string LIBCLI::CLI::modestring

Definition at line 53 of file libcli.hxx.

int LIBCLI::CLI::my_sock
protected

Definition at line 139 of file libcli.hxx.

struct termios LIBCLI::CLI::OldModes
protected

Definition at line 146 of file libcli.hxx.

int LIBCLI::CLI::privilege

Definition at line 54 of file libcli.hxx.

string LIBCLI::CLI::prompt

Definition at line 51 of file libcli.hxx.

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

Definition at line 62 of file libcli.hxx.

bool LIBCLI::CLI::showprompt

Definition at line 50 of file libcli.hxx.

int LIBCLI::CLI::state

Definition at line 56 of file libcli.hxx.

string LIBCLI::CLI::username
protected

Definition at line 143 of file libcli.hxx.

unp LIBCLI::CLI::users

Definition at line 58 of file libcli.hxx.


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