class CliNode

The class for the CLI node. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods

Public Static Methods


Detailed Description

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_familythe 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_idthe module ID (xorp_module_id). Should be equal to XORP_MODULE_CLI.
init_eventloopthe event loop to use.
 ~CliNode ()

~CliNode

[virtual]

Destructor

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:

vthe 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_addrthe 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_addrthe 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_addrthe 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_addrthe subnet address to delete.

Returns: XORP_OK on success, otherwise XORP_ERROR (e.g., if the subnet address was not added before).

CliCommandcli_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, xlog_level_t level, const char *msg)

xlog_output

[static]

Output a log message to a CliClient object.

Parameters:

objthe CliClient object to apply this method to.
levelthe XLOG level.
msga C-style string with the message to output.

Returns: on success, the number of characters printed, otherwise %XORP_ERROR.

CliClientfind_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_namethe CLI terminal name to search for.

Returns: the CLI client CliClient with name of term_name on success, otherwise NULL.

CliClientfind_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_idthe 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_namethe name of the module that will process that command.
command_namethe name of the command to add.
command_helpthe help for the command to add.
is_command_cdif true, this is a command that allows "change directory" inside the CLI command-tree.
command_cd_promptif 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_processorif true, this is a processing command that would be performed by @processor_name.
error_msgthe 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_namethe name of the module that is processing that command.
command_namethe name of the command to delete.
error_msgthe 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_namethe name of the module that has processed that command.
cli_term_namethe terminal name the command was entered from.
cli_session_idthe CLI session ID the command was entered from.
command_outputthe command output to process.
int  proto_recv (const string& , const string& , const IPvX& , const IPvX& , uint8_t , int32_t , int32_t , bool , bool , const vector<uint8_t>& , string& )

proto_recv

UNUSED

Reimplemented from ProtoNode.

int  proto_send (const string& , const string& , const IPvX& , const IPvX& , uint8_t , int32_t , int32_t , bool , bool , const uint8_t* , size_t , string& )

proto_send

UNUSED

Reimplemented from ProtoNode.

int  signal_message_recv (const string& , 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& , 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:

vthe SenderProcessCallback callback to set.
CliClientadd_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_fdthe file descriptor for the CLI client to read data from.
output_fdthe file descriptor for the CLI client to write data to.
is_networkif true, this client is associated with a network connection.
startup_cli_promptthe startup CLI prompt.
error_msgthe error message (if error).

Returns: a pointer to the CLI client (CliClient) with enabled CLI access on success, otherwise NULL.

int  remove_client (CliClient *cli_client, string& error_msg)

remove_client

Remove a CLI client (CliClient) from the CLI.

Note that the CLI client object itself is not deleted.

Parameters:

cli_clientthe CLI client (CliClient) to remove.
error_msgthe 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:

vthe 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_enabledif true, trace log is enabled, otherwise is disabled.

Generated by: bms on anglepoise.lon.incunabulum.net on Wed Jul 23 10:05:47 2008, using kdoc 2.0a54+XORP.