xorp

ProtoNodeCli Class Reference

Base class for Protocol node CLI access. More...

#include <proto_node_cli.hh>

Inheritance diagram for ProtoNodeCli:
ProtoUnit ProtoState ServiceBase BugCatcher MfeaNodeCli Mld6igmpNodeCli Mld6igmpNodeCli PimNodeCli XrlMfeaNode XrlMld6igmpNode XrlMld6igmpNode XrlMld6igmpNode XrlMld6igmpNode XrlPimNode

List of all members.

Public Member Functions

 ProtoNodeCli (int init_family, xorp_module_id init_module_id)
 Constructor for a given address family and module ID.
virtual ~ProtoNodeCli ()
 Destructor.
int add_cli_dir_command (const char *dir_command_name, const char *dir_command_help)
 Add a CLI directory level that does not allow user to move to it.
int add_cli_dir_command (const char *dir_command_name, const char *dir_command_help, bool is_allow_cd, const char *dir_cd_prompt)
 Add a CLI directory level that may allow user to move to it.
int add_cli_command (const char *command_name, const char *command_help, const CLIProcessCallback &cli_process_callback)
 Add a CLI command.
int delete_cli_command (const char *command_name)
 Delete a CLI command.
int delete_all_cli_commands ()
 Delete all CLI commands that were added by this node.
int cli_process_command (const string &processor_name, const string &cli_term_name, const uint32_t &cli_session_id, const string &command_name, const string &command_args, string &ret_processor_name, string &ret_cli_term_name, uint32_t &ret_cli_session_id, string &ret_command_output)
 Process a CLI command.
int cli_print (const string &msg)
 Print a message to the CLI interface.
virtual int add_cli_command_to_cli_manager (const char *command_name, const char *command_help, bool is_command_cd, const char *command_cd_prompt, bool is_command_processor)=0
 Add a CLI command to the CLI manager.
virtual int delete_cli_command_from_cli_manager (const char *command_name)=0
 Delete a CLI command from the CLI manager.

Private Member Functions

int add_cli_command_entry (const char *command_name, const char *command_help, bool is_command_cd, const char *command_cd_prompt, bool is_command_processor, const CLIProcessCallback &cli_process_callback)
int cli_process_dummy (const vector< string > &)

Private Attributes

string _cli_result_string
map< string, CLIProcessCallback > _cli_callback_map
vector< string > _cli_callback_vector

Detailed Description

Base class for Protocol node CLI access.


Constructor & Destructor Documentation

ProtoNodeCli::ProtoNodeCli ( int  init_family,
xorp_module_id  init_module_id 
)

Constructor for a given address family and module ID.

ProtoNodeCli::ProtoNodeCli: : The address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively).

Parameters:
init_familythe address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively).
init_module_idthe module ID XORP_MODULE_* (xorp_module_id).

: The module ID (XORP_MODULE_*).

ProtoNodeCli node constructor.


Member Function Documentation

int ProtoNodeCli::add_cli_command ( const char *  command_name,
const char *  command_help,
const CLIProcessCallback &  cli_process_callback 
)

Add a CLI command.

Parameters:
command_namethe command name to add.
command_helpthe command help.
cli_process_callbackthe callback function that will be called when this command is executed.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
virtual int ProtoNodeCli::add_cli_command_to_cli_manager ( const char *  command_name,
const char *  command_help,
bool  is_command_cd,
const char *  command_cd_prompt,
bool  is_command_processor 
) [pure virtual]

Add a CLI command to the CLI manager.

This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.

Parameters:
command_namethe command name to add.
command_helpthe help message for the command.
is_command_cdif true, this is a directory level that allows user to "cd" to that directory.
command_cd_promptif this is a directory user can "cd" to it, the prompt to appear after the "cd".
is_command_processorif true, this is an oridinary command that can be invoked for processing rather than a directory level.
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implemented in XrlMld6igmpNode, XrlMfeaNode, XrlMld6igmpNode, and XrlPimNode.

int ProtoNodeCli::add_cli_dir_command ( const char *  dir_command_name,
const char *  dir_command_help,
bool  is_allow_cd,
const char *  dir_cd_prompt 
)

Add a CLI directory level that may allow user to move to it.

The added directory level may allow an user to move to it (i.e., user can type the directory name to "cd" to that directory level).

Parameters:
dir_command_namethe directory name to add.
dir_command_helpthe help message for the directory.
is_allow_cdif true, allow user to "cd" to that directory.
dir_cd_promptif user can "cd" to that directory, the prompt to appear after the "cd".
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoNodeCli::add_cli_dir_command ( const char *  dir_command_name,
const char *  dir_command_help 
)

Add a CLI directory level that does not allow user to move to it.

The added directory level does not allow an user to move to it (i.e., user cannot "cd" to that directory level).

Parameters:
dir_command_namethe directory name to add.
dir_command_helpthe help message for the directory.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoNodeCli::cli_print ( const string &  msg)

Print a message to the CLI interface.

ProtoNodeCli::cli_print: : the message string to display.

Parameters:
msgthe message string to display.
Returns:
the number of characters printed (not including the trailing '\0').

Print a message to the CLI interface.

Return value: The number of characters printed (not including the trailing `\0').

int ProtoNodeCli::cli_process_command ( const string &  processor_name,
const string &  cli_term_name,
const uint32_t &  cli_session_id,
const string &  command_name,
const string &  command_args,
string &  ret_processor_name,
string &  ret_cli_term_name,
uint32_t &  ret_cli_session_id,
string &  ret_command_output 
)

Process a CLI command.

This method is invoked when the CLI has detected a valid command has been entered, and that command has been installed by this node.

Parameters:
processor_namethe processor name for this command.
cli_term_namethe terminal name the command was entered from.
cli_session_idthe CLI session ID the command was entered from.
command_namethe command name to process.
command_argsthe command arguments to process.
ret_processor_namethe processor name to return back to the CLI.
ret_cli_term_namethe terminal name to return back.
ret_cli_session_idthe CLI session ID to return back.
ret_command_outputthe command output to return back.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoNodeCli::delete_all_cli_commands ( )

Delete all CLI commands that were added by this node.

Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoNodeCli::delete_cli_command ( const char *  command_name)

Delete a CLI command.

Parameters:
command_namethe command name to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
virtual int ProtoNodeCli::delete_cli_command_from_cli_manager ( const char *  command_name) [pure virtual]

Delete a CLI command from the CLI manager.

This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.

Parameters:
command_namethe command name to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implemented in XrlMld6igmpNode, XrlMfeaNode, XrlMld6igmpNode, and XrlPimNode.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations