|
|
There is one CLI client per CLI user (e.g., telnet connection).
CliClient (CliNode& init_cli_node, XorpFd input_fd, XorpFd output_fd,
const string& startup_cli_prompt)
| CliClient |
Constructor for a given CLI node and file descriptor.
Parameters:
init_cli_node | the CliNode CLI node this client belongs to. |
input_fd | the file descriptor for the CLI client to read data from. |
output_fd | the file descriptor for the CLI client to write data to. |
startup_cli_prompt | the startup CLI prompt. |
~CliClient ()
| ~CliClient |
[virtual]
bool done ()
| done |
[const]
Test if the processing of any pending commands or pending data has complated.
Returns: true if processing of any pending commands or pending data has completed, otherwise false.
int start_connection (string& error_msg)
| start_connection |
Start the connection.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int stop_connection (string& error_msg)
| stop_connection |
Stop the connection.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int cli_print (const string& msg)
| cli_print |
Print a message to the CLI user.
Parameters:
msg | C++ string with the message to display. |
Returns: the number of characters printed (not including the trailing '\0').
int cli_flush ()
| cli_flush |
Flush the CLI output.
Returns: XORP_OK on success, otherwise XORP_ERROR.
int set_log_output (bool v)
| set_log_output |
Add/remove this client for displaying log messages.
Parameters:
v | if true, add this client for displaying messages, otherwise remove it. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
bool is_log_output ()
| is_log_output |
[const]
Test if this client has been added for displaying log messages.
Returns: true if this client has been added for displaying log messages, otherwise false.
XorpFd input_fd ()
| input_fd |
Get the file descriptor for reading the input from the user.
Returns: the file descriptor for reading the input from the user.
XorpFd output_fd ()
| output_fd |
Get the file descriptor for writing the output to the user.
Returns: the file descriptor for writing the output to the user.
bool is_input_tty ()
| is_input_tty |
[const]
Test if this client is associated with a terminal type input device.
Returns: true if this client is associated with a terminal type input device, otherwise false.
bool is_output_tty ()
| is_output_tty |
[const]
Test if this client is associated with a terminal type output device.
Returns: true if this client is associated with a terminal type output device, otherwise false.
bool is_network ()
| is_network |
[const]
Test if this client is associated with a network connection.
Returns: true if this client is associated with a network connection, otherwise false.
void set_network_client (bool v)
| set_network_client |
Set the flag that associates the client with a network connection.
Parameters:
v | true if this client is associated with a network connection. |
bool is_telnet ()
| is_telnet |
[const]
Test if this client is associated with a telnet connection.
Returns: true if this client is associated with a telnet connection, otherwise false.
bool is_interactive ()
| is_interactive |
[const]
Test if this client is running in interactive mode.
Returns: true if this client is running in interactive mode, otherwise false.
const string& cli_session_user_name ()
| cli_session_user_name |
[const]
Get the user name.
Returns: the user name.
const string& cli_session_term_name ()
| cli_session_term_name |
[const]
Get the terminal name.
Returns: the terminal name.
const IPvX& cli_session_from_address ()
| cli_session_from_address |
[const]
const TimeVal& cli_session_start_time ()
| cli_session_start_time |
[const]
Get the start time for this connection.
Returns: a reference to TimeVal with the starting time for this connection.
const TimeVal& cli_session_stop_time ()
| cli_session_stop_time |
[const]
Get the stop time for this connection.
Returns: a reference to TimeVal with the end time for this connection.
bool is_cli_session_active ()
| is_cli_session_active |
[const]
Test if the CLI session is active (i.e., it has been setup and ready to use).
Returns: true if the CLI session is active, otherwise false.
uint32_t cli_session_session_id ()
| cli_session_session_id |
[const]
Get the session ID.
Returns: the session ID for this client.
void set_cli_session_user_name (const string& v)
| set_cli_session_user_name |
Set the user name.
Parameters:
v | the user name to set. |
void set_cli_session_term_name (const string& v)
| set_cli_session_term_name |
Set the terminal name.
Parameters:
v | the terminal name to set. |
void set_cli_session_from_address (const IPvX& v)
| set_cli_session_from_address |
Set the user network address.
Parameters:
v | the user network address to set. |
void set_cli_session_start_time (const TimeVal& v)
| set_cli_session_start_time |
Set the start time for this connection.
Parameters:
v | the start time for this connection. |
void set_cli_session_stop_time (const TimeVal& v)
| set_cli_session_stop_time |
Set the stop time for this connection.
Parameters:
v | the stop time for this connection. |
void set_is_cli_session_active (bool v)
| set_is_cli_session_active |
Set if this session is active.
Parameters:
v | if true, the session is set as active, otherwise is set as non-active. |
void set_cli_session_session_id (uint32_t v)
| set_cli_session_session_id |
Set the session ID.
Parameters:
v | the session ID value to set. |
void post_process_command ()
| post_process_command |
Perform final processing of a command.
void flush_process_command_output ()
| flush_process_command_output |
Flush the output of a command while it is still running
bool is_waiting_for_data ()
| is_waiting_for_data |
[const]
Test if waiting for data from command processor.
Returns: true if waiting for data from command processor, otherwise false.
void set_is_waiting_for_data (bool v)
| set_is_waiting_for_data |
Set a flag whether is waiting for data from command processor.
Parameters:
v | if true, the session is set as waiting for data, otherwise is set as non-waiting. |
const string& current_cli_prompt ()
| current_cli_prompt |
[const]
Get the current CLI prompt.
Returns: the current CLI prompt.
void set_current_cli_prompt (const string& cli_prompt)
| set_current_cli_prompt |
Set the current CLI prompt.
Parameters:
cli_prompt | the current CLI prompt to set. |
void terminal_resized ()
| terminal_resized |
Update the terminal-related information after it has been resized.