Leosac  0.8.0
Open Source Access Control
Leosac::Module::Doorman::DoormanModule Class Reference

Main class for the module, it create handlers and run them to, well, handle events and send command. More...

#include <DoormanModule.hpp>

+ Inheritance diagram for Leosac::Module::Doorman::DoormanModule:
+ Collaboration diagram for Leosac::Module::Doorman::DoormanModule:

Public Member Functions

 DoormanModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 
 DoormanModule (const DoormanModule &)=delete
 
DoormanModuleoperator= (const DoormanModule &)=delete
 
 ~DoormanModule ()=default
 
virtual void run () override
 This is the main loop of the module. More...
 
const std::vector< Auth::AuthTargetPtr > & doors () const
 
- Public Member Functions inherited from Leosac::Module::BaseModule
 BaseModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 Constructor of BaseModule. More...
 
virtual ~BaseModule ()=default
 

Private Member Functions

void update ()
 
void process_config ()
 Processing the configuration tree, spawning AuthFileInstance object as described in the configuration file. More...
 
void process_doors_config (const boost::property_tree::ptree &t)
 

Private Attributes

std::vector< std::shared_ptr< DoormanInstance > > doormen_
 Authenticator instances. More...
 
std::vector< Auth::AuthTargetPtrdoors_
 Doors, to manage the always-on or always off stuff. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Leosac::Module::BaseModule
virtual void handle_pipe ()
 The base class register the pipe_ socket to its reactor_ so that this function is called when the pipe_ is available from reading. More...
 
virtual void handle_control ()
 Handle called when a message on the module's control socket arrives. More...
 
virtual void dump_additional_config (zmqpp::message *out) const
 Dump additional configuration (for example module specific config file). More...
 
void dump_config (ConfigManager::ConfigFormat fmt, zmqpp::message *out_msg) const
 Fills a message with the module's configuration information. More...
 
void config_check (const std::string &obj_name, Leosac::Hardware::DeviceClass type)
 An helper that checks configuration the existence of some objects. More...
 
void config_check (const std::string &obj_name)
 An helper that checks configuration the existence of some objects. More...
 
- Protected Attributes inherited from Leosac::Module::BaseModule
zmqpp::context & ctx_
 A reference to the ZeroMQ context in case you need it to create additional socket. More...
 
zmqpp::socket & pipe_
 A reference to the pair socket that link back to the module manager. More...
 
boost::property_tree::ptree config_
 The configuration tree passed to the start_module function. More...
 
CoreUtilsPtr utils_
 Pointer to the core utils, which gives access to scheduler and others. More...
 
bool is_running_
 Boolean indicating whether the main loop should run or not. More...
 
zmqpp::socket control_
 Control REP socket. More...
 
zmqpp::reactor reactor_
 The reactor object we poll() on in the main loop. More...
 
std::string name_
 

Detailed Description

Main class for the module, it create handlers and run them to, well, handle events and send command.

See also
Configuration Options for configuration information.

Definition at line 52 of file DoormanModule.hpp.

Constructor & Destructor Documentation

◆ DoormanModule() [1/2]

DoormanModule::DoormanModule ( zmqpp::context &  ctx,
zmqpp::socket *  pipe,
const boost::property_tree::ptree &  cfg,
CoreUtilsPtr  utils 
)

Definition at line 30 of file DoormanModule.cpp.

◆ DoormanModule() [2/2]

Leosac::Module::Doorman::DoormanModule::DoormanModule ( const DoormanModule )
delete

◆ ~DoormanModule()

Leosac::Module::Doorman::DoormanModule::~DoormanModule ( )
default

Member Function Documentation

◆ doors()

const std::vector< AuthTargetPtr > & DoormanModule::doors ( ) const

Definition at line 189 of file DoormanModule.cpp.

◆ operator=()

DoormanModule& Leosac::Module::Doorman::DoormanModule::operator= ( const DoormanModule )
delete

◆ process_config()

void DoormanModule::process_config ( )
private

Processing the configuration tree, spawning AuthFileInstance object as described in the configuration file.

Definition at line 58 of file DoormanModule.cpp.

◆ process_doors_config()

void DoormanModule::process_doors_config ( const boost::property_tree::ptree &  t)
private

Definition at line 120 of file DoormanModule.cpp.

◆ run()

void DoormanModule::run ( )
overridevirtual

This is the main loop of the module.

It should only exit when receiving signal::stop on its pipe_ socket. This is completely handled by this base class. In case you override this, make sure you watch the pipe_ socket.

Reimplemented from Leosac::Module::BaseModule.

Definition at line 111 of file DoormanModule.cpp.

◆ update()

void DoormanModule::update ( )
private

Definition at line 179 of file DoormanModule.cpp.

Member Data Documentation

◆ doormen_

std::vector<std::shared_ptr<DoormanInstance> > Leosac::Module::Doorman::DoormanModule::doormen_
private

Authenticator instances.

Definition at line 83 of file DoormanModule.hpp.

◆ doors_

std::vector<Auth::AuthTargetPtr> Leosac::Module::Doorman::DoormanModule::doors_
private

Doors, to manage the always-on or always off stuff.

Definition at line 88 of file DoormanModule.hpp.


The documentation for this class was generated from the following files: