Leosac
0.8.0
Open Source Access Control
|
This class handle the remote control of leosac. More...
#include <RemoteControl.hpp>
Public Member Functions | |
RemoteControl (zmqpp::context &ctx, Kernel &kernel, const boost::property_tree::ptree &cfg) | |
void | update () |
Private Types | |
using | CommandHandlerMap = std::map< std::string, std::function< bool(zmqpp::message *msg_in, zmqpp::message *msg_out)> > |
Private Member Functions | |
bool | handle_module_config (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Extract and verify content from user-message and call implementation. More... | |
bool | handle_module_list (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Extract and verify content from message and call implementation. More... | |
bool | handle_sync_from (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Extract and verify content from message and call sync_from() More... | |
bool | handle_save (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Save the current configuration to disk. More... | |
bool | handle_general_config (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Command handler for GENERAL_CONFIG. More... | |
bool | handle_config_version (zmqpp::message *msg_in, zmqpp::message *msg_out) |
Command handler for CONFIG_VERSION command. More... | |
void | module_list (zmqpp::message *message_out) |
Implements the module list command. More... | |
void | module_config (const std::string &module, ConfigManager::ConfigFormat cfg_format, zmqpp::message *message_out) |
Implements the MODULE_CONFIG command. More... | |
void | general_config (ConfigManager::ConfigFormat cfg_format, zmqpp::message *msg_out) |
Implements GLOBAL_CONFIG API call. More... | |
void | handle_msg () |
Register by core and called when message arrives. More... | |
void | process_config (const boost::property_tree::ptree &cfg) |
bool | gather_remote_module_list (zmqpp::socket &s, std::list< std::string > &remote_modules) |
Build the list of modules (their name) running on the remote host. More... | |
bool | receive_remote_config (zmqpp::socket &s, std::map< std::string, bool > &cfg) |
After sending a bunch of MODULE_CONFIG command, wait for reply. More... | |
bool | gather_remote_config (zmqpp::socket &s, std::list< std::string > &start_list, std::list< std::string > &stop_list) |
Will retrieve the config for a remote leosac unit. More... | |
Private Attributes | |
Kernel & | kernel_ |
zmqpp::socket | socket_ |
Public ROUTER. More... | |
std::string | public_key_ |
z85 encoded public curve key More... | |
std::string | secret_key_ |
z85 encoded private curve key More... | |
zmqpp::auth | auth_ |
zmqpp::context & | context_ |
CommandHandlerMap | command_handlers_ |
RemoteControlSecurity | security_ |
Object to check remote user permission before processing their request. More... | |
std::string | current_client_idt_ |
Friends | |
class | Kernel |
This class handle the remote control of leosac.
It's responsibility is to expose a secure socket on the network and filter request from the world, passing legit message to the rest of the application.
Definition at line 40 of file RemoteControl.hpp.
|
private |
Definition at line 174 of file RemoteControl.hpp.
RemoteControl::RemoteControl | ( | zmqpp::context & | ctx, |
Kernel & | kernel, | ||
const boost::property_tree::ptree & | cfg | ||
) |
Definition at line 39 of file RemoteControl.cpp.
|
private |
Will retrieve the config for a remote leosac unit.
The socket shall be already connected to the remote endpoint.
It will populate the stop_list and start_list with a list of to respectively stop and start.
|
private |
Build the list of modules (their name) running on the remote host.
We issue the MODULE_LIST command in order to do that.
|
private |
Implements GLOBAL_CONFIG API call.
This returns configuration information unrelated to modules.
Definition at line 207 of file RemoteControl.cpp.
|
private |
Command handler for CONFIG_VERSION command.
It shall return the current version of the configuration. This is used for synchronization purpose.
Definition at line 361 of file RemoteControl.cpp.
|
private |
Command handler for GENERAL_CONFIG.
Returning false means the source message was malformed.
Definition at line 345 of file RemoteControl.cpp.
|
private |
Extract and verify content from user-message and call implementation.
Returning false means the source message was malformed.
Definition at line 229 of file RemoteControl.cpp.
|
private |
Extract and verify content from message and call implementation.
Returning false means the source message was malformed.
Definition at line 246 of file RemoteControl.cpp.
|
private |
Register by core and called when message arrives.
Definition at line 94 of file RemoteControl.cpp.
|
private |
Save the current configuration to disk.
Returning false means the source message was malformed.
Definition at line 327 of file RemoteControl.cpp.
|
private |
Extract and verify content from message and call sync_from()
Returning false means the source message was malformed.
Definition at line 260 of file RemoteControl.cpp.
|
private |
Implements the MODULE_CONFIG command.
Definition at line 163 of file RemoteControl.cpp.
|
private |
Implements the module list command.
It fetch the list of module from the module manager object.
Definition at line 154 of file RemoteControl.cpp.
|
private |
Definition at line 51 of file RemoteControl.cpp.
|
private |
After sending a bunch of MODULE_CONFIG command, wait for reply.
Update the configuration manager object with the newly received configuration. Also update additional configuration if needed.
If receiving command timeout (>3s) return false;
void RemoteControl::update | ( | ) |
Definition at line 375 of file RemoteControl.cpp.
|
friend |
Definition at line 186 of file RemoteControl.hpp.
|
private |
Definition at line 168 of file RemoteControl.hpp.
|
private |
Definition at line 176 of file RemoteControl.hpp.
|
private |
Definition at line 169 of file RemoteControl.hpp.
|
private |
Definition at line 183 of file RemoteControl.hpp.
|
private |
Definition at line 151 of file RemoteControl.hpp.
|
private |
z85 encoded public curve key
Definition at line 161 of file RemoteControl.hpp.
|
private |
z85 encoded private curve key
Definition at line 166 of file RemoteControl.hpp.
|
private |
Object to check remote user permission before processing their request.
Definition at line 181 of file RemoteControl.hpp.
|
private |
Public ROUTER.
Definition at line 156 of file RemoteControl.hpp.