|
|
ClickSocket class opens a Click socket and forwards data arriving on the socket to ClickSocketObservers. The ClickSocket hooks itself into the EventLoop and activity usually happens asynchronously.
ClickSocket (EventLoop& eventloop)
| ClickSocket |
~ClickSocket ()
| ~ClickSocket |
void enable_click (bool v)
| enable_click |
Enable/disable Click support.
Note that this operation does not start the Click operations.
Parameters:
v | if true, then enable Click support, otherwise disable it. |
bool is_enabled ()
| is_enabled |
[const]
Test if the Click support is enabled.
Returns: true if the Click support is enabled, otherwise false.
bool is_duplicate_routes_to_kernel_enabled ()
| is_duplicate_routes_to_kernel_enabled |
[const]
Test if duplicating the Click routes to the system kernel is enabled.
Returns: true if duplicating the Click routes to the system kernel is enabled, otherwise false.
void enable_duplicate_routes_to_kernel (bool v)
| enable_duplicate_routes_to_kernel |
Enable/disable duplicating the Click routes to the system kernel.
Parameters:
enable | if true, then enable duplicating the Click routes to the system kernel, otherwise disable it. |
void enable_kernel_click (bool v)
| enable_kernel_click |
Enable/disable kernel-level Click.
Note that this operation does not start the kernel-level Click operations.
Parameters:
v | if true, enable kernel-level Click, otherwise disable it. |
void enable_kernel_click_install_on_startup (bool v)
| enable_kernel_click_install_on_startup |
Enable/disable installing kernel-level Click on startup.
Parameters:
v | if true, then install kernel-level Click on startup. |
void set_kernel_click_modules (const list<string>& v)
| set_kernel_click_modules |
Specify the list of kernel Click modules to load on startup if installing kernel-level Click on startup is enabled.
Parameters:
v | the list of kernel Click modules to load. |
void set_kernel_click_mount_directory (const string& v)
| set_kernel_click_mount_directory |
Specify the kernel-level Click mount directory.
Parameters:
v | the kernel-level Click mount directory. |
void enable_user_click (bool v)
| enable_user_click |
Enable/disable user-level Click.
Note that this operation does not start the user-level Click operations.
Parameters:
v | if true, enable user-level Click, otherwise disable it. |
bool is_kernel_click ()
| is_kernel_click |
[const]
Test if we are running kernel-level Click operations.
Returns: true if kernel-level Click is enabled, otherwise false.
bool is_user_click ()
| is_user_click |
[const]
Test if we are running user-level Click operations.
Returns: true if user-level Click is enabled, otherwise false.
int start (string& error_msg)
| start |
Start the Click socket operation.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int stop (string& error_msg)
| stop |
Stop the Click socket operation.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
const string& kernel_click_config_generator_file ()
| kernel_click_config_generator_file |
[const]
Get the name of the external program to generate the kernel-level Click configuration.
Returns: the name of the external program to generate the kernel-level Click configuration.
void set_kernel_click_config_generator_file (const string& v)
| set_kernel_click_config_generator_file |
Specify the external program to generate the kernel-level Click configuration.
Parameters:
v | the name of the external program to generate the kernel-level Click configuration. |
void set_user_click_command_file (const string& v)
| set_user_click_command_file |
Specify the user-level Click command file.
Parameters:
v | the name of the user-level Click command file. |
void set_user_click_command_extra_arguments (const string& v)
| set_user_click_command_extra_arguments |
Specify the extra arguments to the user-level Click command.
Parameters:
v | the extra arguments to the user-level Click command. |
void set_user_click_command_execute_on_startup (bool v)
| set_user_click_command_execute_on_startup |
Specify whether to execute on startup the user-level Click command.
Parameters:
v | if true, then execute the user-level Click command on startup. |
void set_user_click_startup_config_file (const string& v)
| set_user_click_startup_config_file |
Specify the configuration file to be used by user-level Click on startup.
Parameters:
v | the name of the configuration file to be used by user-level Click on startup. |
void set_user_click_control_address (const IPv4& v)
| set_user_click_control_address |
Specify the address to use for control access to the user-level Click.
Parameters:
v | the address to use for control access to the user-level Click. |
void set_user_click_control_socket_port (uint16_t v)
| set_user_click_control_socket_port |
Specify the socket port to use for control access to the user-level Click.
Parameters:
v | the socket port to use for control access to the user-level Click. |
const string& user_click_config_generator_file ()
| user_click_config_generator_file |
[const]
Get the name of the external program to generate the user-level Click configuration.
Returns: the name of the external program to generate the user-level Click configuration.
void set_user_click_config_generator_file (const string& v)
| set_user_click_config_generator_file |
Specify the external program to generate the user-level Click configuration.
Parameters:
v | the name of the external program to generate the user-level Click configuration. |
int write_config (const string& element, const string& handler,
bool has_kernel_config, const string& kernel_config,
bool has_user_config, const string& user_config,
string& error_msg)
| write_config |
Write Click configuration.
Parameters:
element | the Click element to write the configuration to. If it is an empty string, then we use only the handler to write the configuration. |
handler | the Click handler to write the configuration to. |
has_kernel_config | true if we wish to write the kernel-level Click configuration (if kernel-level Click is enabled). |
kernel_config | the kernel-level Click configuration to write. |
has_user_config | true if we wish to write the user-level Click configuration (if user-level Click is enabled). |
user_config | the user-level Click configuration to write. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
ssize_t write (XorpFd fd, const void* data, size_t nbytes)
| write |
Write data to Click socket.
This method also updates the sequence number associated with this Click socket.
Returns: the number of bytes which were written, or -1 if error.
int check_user_command_status (bool& is_warning, string& command_warning,
bool& is_error, string& command_error,
string& error_msg)
| check_user_command_status |
Check the status of a previous command.
Parameters:
is_warning | if true, the previous command generated a warning. |
command_warning | if is_warning is true, then it contains the generated warning message. |
is_error | if true, the previous command generated an error. |
command_error | if is_error is true, then it contains the generated error message. |
error_msg | if the command status cannot be checked, then it contains the error message with the reason. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
inline uint32_t seqno ()
| seqno |
[const]
Get the sequence number for next message written into Click.
The sequence number is derived from the instance number of this Click socket and a 16-bit counter.
Returns: the sequence number for the next message written into Click.
inline pid_t pid ()
| pid |
[const]
Get the cached process identifier value.
Returns: the cached process identifier value.
int force_kernel_click_read (string& error_msg)
| force_kernel_click_read |
Force socket to read data from kernel-level Click.
This usually is performed after writing a request that Click will answer (e.g., after writing a configuration change). Use sparingly, with caution, and at your own risk.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int force_user_click_read (string& error_msg)
| force_user_click_read |
Force socket to read data from user-level Click.
This usually is performed after writing a request that Click will answer (e.g., after writing a configuration change). Use sparingly, with caution, and at your own risk.
Parameters:
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.