|
Leosac
0.8.0
Open Source Access Control
|
Go to the documentation of this file.
36 #include <boost/property_tree/ptree.hpp>
37 #include <zmqpp/context.hpp>
85 explicit Kernel(
const boost::property_tree::ptree &config,
86 bool strict_mode =
false);
118 static boost::property_tree::ptree
188 const std::chrono::steady_clock::time_point
start_time()
const;
240 void connect_to_db(
const boost::property_tree::ptree &db_cfg_node);
zmqpp::reactor reactor_
Watch for message on the control_ socket.
std::unique_ptr< NetworkConfig > network_config_
Object that handle networking configuration.
std::string factory_config_directory() const
Return the path to factory config directory Uses environment variable if available,...
MessageBus bus_
Application wide (inproc) message bus.
void restart_later()
Set the running_ and want_restart flag so that leosac will restart in the next main loop iteration.
RuntimeOptions class declaration.
~Kernel()
Implemented in .cpp for unique_ptr to work.
That class helps manage the configuration for the application and its module.
Tools::XmlNodeNameEnforcer xmlnne_
void set_netconfig(zmqpp::message *msg)
Handle SET_NETCONFIG command and update the configuration file directly.
ModuleManager module_manager_
Manages the different libraries (.so) we load, path to those libraries, modules instantiation.
bool autosave_
Autosave configuration on shutdown.
bool run()
Main loop of the main thread.
A second module manager that loads "ZMQ aware" module – modules that talks to the application through...
void connect_to_db(const boost::property_tree::ptree &db_cfg_node)
friend ServiceRegistry & get_service_registry()
A function to retrieve the ServiceRegistry from pretty much anywhere.
std::shared_ptr< odb::database > DBPtr
std::map< EnvironVar, std::string > environ_
ServiceRegistryUPtr service_registry_
DBPtr database_
A pointer to the database used by Leosac, if any.
void populate_default_db()
This is the header file for a generated source file, GitSHA1.cpp.
Kernel(const boost::property_tree::ptree &config, bool strict_mode=false)
Construct a Kernel object.
const std::chrono::steady_clock::time_point start_time() const
Return the time point at which Leosac started.
void unregister_core_services()
Unregister the service that were registered into register_core_services().
void factory_reset()
Reset Leosac configuration.
bool want_restart_
Should leosac restart ?
NetworkConfig class declaration.
void get_netconfig()
Handle GET_NETCONFIG command.
zmqpp::context ctx_
The application ZMQ context.
bool save_config()
Save the current configuration to its original file if autosave is enabled.
A class that manages services.
Kernel & operator=(const Kernel &)=delete
Disable assignment operator.
std::unique_ptr< ServiceRegistry > ServiceRegistryUPtr
bool send_sighup_
Should we broadcast "SIGHUP" in the next main loop iteration ?
bool is_running_
Controls core main loop.
zmqpp::context & zmqpp_context()
Returns a reference to the zmqpp context created for the application.
void module_manager_init()
Init the module manager by feeding it paths to library file, loading module, etc.
Implements a message bus (running in its own thread) that use 2 sockets.
void configure_signal_handler()
Setup signal handling for the process.
static boost::property_tree::ptree make_config(const Leosac::Tools::RuntimeOptions &opt)
Build a property tree from a runtime object object.
static Kernel * instance_
A global pointer to the Kernel instance.
ConfigManager config_manager_
std::string script_directory() const
Return the path to the scripts directory.
void create_update_schema()
Create and/or update the database schema.
void handle_control_request()
A request has arrived on the control_ socket.
std::unique_ptr< RemoteControl > remote_controller_
Object that expose leosac to the world.
void register_core_services()
Register some important services to the service registry.
std::string config_file_path() const
Return the path to the kernel configuration file.
zmqpp::socket control_
A REP socket to send request to the kernel.
ServiceRegistry & service_registry()
Retrieve a reference to the service registry.
void configure_database()
CoreUtilsPtr core_utils()
Returns a (smart) pointer to the core utils: some thread-safe utilities.
std::shared_ptr< CoreUtils > CoreUtilsPtr
const ModuleManager & module_manager() const
Returns a reference to the module manager object (const version).
ConfigManager & config_manager()
Retrieve a reference to the configuration manager object.
const std::chrono::steady_clock::time_point start_time_
Time-point when Leosac started to run.
zmqpp::socket bus_push_
A PUSH socket to write on the bus.
DBPtr database()
Retrieve a pointer to the database, if any.