Leosac  0.7.0
OpenSourceAccessControl
DoormanModule.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "core/auth/AuthTarget.hpp"
24 #include "modules/BaseModule.hpp"
26 #include <boost/property_tree/ptree.hpp>
27 #include <memory>
28 #include <vector>
29 #include <zmqpp/zmqpp.hpp>
30 
31 namespace Leosac
32 {
33 namespace Module
34 {
41 namespace Doorman
42 {
43 
44 class DoormanInstance;
45 
52 class DoormanModule : public BaseModule
53 {
54  public:
55  DoormanModule(zmqpp::context &ctx, zmqpp::socket *pipe,
56  const boost::property_tree::ptree &cfg, CoreUtilsPtr utils);
57 
58  DoormanModule(const DoormanModule &) = delete;
59 
60  DoormanModule &operator=(const DoormanModule &) = delete;
61 
62  ~DoormanModule() = default;
63 
64  virtual void run() override;
65 
66  const std::vector<Auth::AuthTargetPtr> &doors() const;
67 
68  private:
69  void update();
70 
76  void process_config();
77 
78  void process_doors_config(const boost::property_tree::ptree &t);
79 
83  std::vector<std::shared_ptr<DoormanInstance>> doormen_;
84 
88  std::vector<Auth::AuthTargetPtr> doors_;
89 };
90 }
91 }
92 }
std::vector< std::shared_ptr< DoormanInstance > > doormen_
Authenticator instances.
This is the header file for a generated source file, GitSHA1.cpp.
DoormanModule(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
void process_config()
Processing the configuration tree, spawning AuthFileInstance object as described in the configuration...
virtual void run() override
This is the main loop of the module.
void process_doors_config(const boost::property_tree::ptree &t)
const std::vector< Auth::AuthTargetPtr > & doors() const
Base class for module implementation.
Definition: BaseModule.hpp:110
DoormanModule & operator=(const DoormanModule &)=delete
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35
std::vector< Auth::AuthTargetPtr > doors_
Doors, to manage the always-on or always off stuff.
Main class for the module, it create handlers and run them to, well, handle events and send command...