There should one node per CLI instance. There should be one CLI instance per router.
CliNode (int init_family, xorp_module_id init_module_id,
EventLoop& init_eventloop)
| CliNode |
Constructor for a given address family, module ID, and event loop.
Parameters:
init_family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). Note that this argument may disappear in the future, and a single Cli node would provide access for both IPv4 and IPv6. |
init_module_id | the module ID (xorp_module_id). Should be equal to XORP_MODULE_CLI. |
init_eventloop | the event loop to use. |
~CliNode ()
| ~CliNode |
[virtual]
int start ()
| start |
Start the node operation.
Returns: XORP_OK on success, otherwise XORP_ERROR.
int stop ()
| stop |
Stop the node operation.
Returns: XORP_OK on success, otherwise XORP_ERROR.
void enable ()
| enable |
Enable node operation.
If an unit is not enabled, it cannot be start, or pending-start.
void disable ()
| disable |
Disable node operation.
If an unit is disabled, it cannot be start or pending-start. If the unit was runnning, it will be stop first.
void set_cli_port (unsigned short v)
| set_cli_port |
Set the CLI access port.
The access port is the TCP port the CLI node listens to for network access (e.g., telnet xorp_host <port_number>).
Parameters:
v | the access port number (in host order). |
void add_enable_cli_access_from_subnet (const IPvXNet& subnet_addr)
| add_enable_cli_access_from_subnet |
Add a subnet address to the list of subnet addresses enabled for CLI access.
This method can be called more than once to add a number of subnet addresses.
Parameters:
subnet_addr | the subnet address to add. |
int delete_enable_cli_access_from_subnet (const IPvXNet& subnet_addr)
| delete_enable_cli_access_from_subnet |
Delete a subnet address from the list of subnet addresses enabled for CLI access.
Parameters:
subnet_addr | the subnet address to delete. |
Returns: XORP_OK on success, otherwise XORP_ERROR (e.g., if the subnet address was not added before).
void add_disable_cli_access_from_subnet (const IPvXNet& subnet_addr)
| add_disable_cli_access_from_subnet |
Add a subnet address to the list of subnet addresses disabled for CLI access.
This method can be called more than once to add a number of subnet addresses.
Parameters:
subnet_addr | the subnet address to add. |
int delete_disable_cli_access_from_subnet (const IPvXNet& subnet_addr)
| delete_disable_cli_access_from_subnet |
Delete a subnet address from the list of subnet addresses disabled for CLI access.
Parameters:
subnet_addr | the subnet address to delete. |
Returns: XORP_OK on success, otherwise XORP_ERROR (e.g., if the subnet address was not added before).
CliCommand * cli_command_root ()
| cli_command_root |
Get the CliCommand entry for the CLI root command.
Returns: a pointer to the CliCommand entry for the CLI root command.
int xlog_output (void *obj, const char *msg)
| xlog_output |
[static]
Output a log message to a CliClient object.
Parameters:
obj | the CliClient object to apply this method to. |
msg | a C-style string with the message to output. |
Returns: on success, the number of characters printed, otherwise %XORP_ERROR.
CliClient * find_cli_by_term_name (const string& term_name)
| find_cli_by_term_name |
[const]
Find a CLI client CliClient for a given terminal name.
Parameters:
term_name | the CLI terminal name to search for. |
Returns: the CLI client CliClient with name of term_name on success, otherwise NULL.
CliClient * find_cli_by_session_id (uint32_t session_id)
| find_cli_by_session_id |
[const]
Find a CLI client CliClient for a given session ID.
Parameters:
session_id | the CLI session ID to search for. |
Returns: the CLI client CliClient with session ID of session_id on success, otherwise NULL.
list<CliClient *>& client_list ()
| client_list |
Get the list of CLI clients (see CliClient).
Returns: a reference to the list of pointers to CLI clients (see CliClient).
int add_cli_command (
const string& processor_name,
const string& command_name,
const string& command_help,
const bool& is_command_cd,
const string& command_cd_prompt,
const bool& is_command_processor,
string& error_msg)
| add_cli_command |
Add a CLI command to the CLI manager.
Parameters:
processor_name | the name of the module that will process that command. |
command_name | the name of the command to add. |
command_help | the help for the command to add. |
is_command_cd | if true, this is a command that allows "change directory" inside the CLI command-tree. |
command_cd_prompt | if is_command_cd is true, the string that will replace the CLI prompt after we "cd" to that level of the CLI command-tree. |
is_command_processor | if true, this is a processing command that would be performed by @processor_name. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int delete_cli_command (
const string& processor_name,
const string& command_name,
string& error_msg)
| delete_cli_command |
Delete a CLI command from the CLI manager.
Parameters:
processor_name | the name of the module that is processing that command. |
command_name | the name of the command to delete. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
void recv_process_command_output (const string *processor_name,
const string *cli_term_name,
const uint32_t *cli_session_id,
const string *command_output)
| recv_process_command_output |
Process the response of a command processed by a remote node.
Parameters:
processor_name | the name of the module that has processed that command. |
cli_term_name | the terminal name the command was entered from. |
cli_session_id | the CLI session ID the command was entered from. |
command_output | the command output to process. |
int proto_recv (const string& ,
xorp_module_id ,
uint32_t ,
const IPvX& ,
const IPvX& ,
int ,
int ,
bool ,
const uint8_t * ,
size_t ,
string&
)
| proto_recv |
UNUSED
Reimplemented from ProtoNode.
int proto_send (const string& ,
xorp_module_id ,
uint32_t ,
const IPvX& ,
const IPvX& ,
int ,
int ,
bool ,
const uint8_t * ,
size_t ,
string&
)
| proto_send |
UNUSED
Reimplemented from ProtoNode.
int signal_message_recv (const string& ,
xorp_module_id ,
int ,
uint32_t ,
const IPvX& ,
const IPvX& ,
const uint8_t * ,
size_t
)
| signal_message_recv |
UNUSED
Reimplemented from ProtoNode.
int signal_message_send (const string& ,
xorp_module_id ,
int ,
uint32_t ,
const IPvX& ,
const IPvX& ,
const uint8_t * ,
size_t
)
| signal_message_send |
UNUSED
Reimplemented from ProtoNode.
typedef XorpCallback6<void, const string&, const string&, const string&, uint32_t, const vector<string>&, const vector<string>& >::RefPtr SenderProcessCallback | SenderProcessCallback |
void set_send_process_command_callback (const SenderProcessCallback& v)
| set_send_process_command_callback |
Set a callback to send a CLI command to a processing module.
Parameters:
v | the SenderProcessCallback callback to set. |
CliClient * add_client (XorpFd input_fd, XorpFd output_fd, bool is_network,
const string& startup_cli_prompt, string& error_msg)
| add_client |
Add a CLI client (CliClient) to the CLI with enabled access from a file descriptor.
Parameters:
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. |
is_network | if true, this client is associated with a network connection. |
startup_cli_prompt | the startup CLI prompt. |
error_msg | the error message (if error). |
Returns: a pointer to the CLI client (CliClient) with enabled CLI access on success, otherwise NULL.
int delete_client (CliClient *cli_client, string& error_msg)
| delete_client |
Delete a CLI client (CliClient) from the CLI.
Parameters:
cli_client | the CLI client (CliClient) to delete. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
typedef XorpCallback1<void, CliClient* >::RefPtr CliClientDeleteCallback | CliClientDeleteCallback |
void set_cli_client_delete_callback (const CliClientDeleteCallback& v)
| set_cli_client_delete_callback |
Set the callback method that is invoked whenever a CliClient is deleted
Parameters:
v | the CliClientDeleteCallback callback to set. |
bool is_log_trace ()
| is_log_trace |
[const]
Test if trace log is enabled.
This method is used to test whether to output trace log debug messges.
Returns: true if trace log is enabled, otherwise false.
void set_log_trace (bool is_enabled)
| set_log_trace |
Enable/disable trace log.
This method is used to enable/disable trace log debug messages output.
Parameters:
is_enabled | if true, trace log is enabled, otherwise is disabled. |