Leosac  0.7.0
OpenSourceAccessControl
WebServiceNotifier.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/AuthFwd.hpp"
23 #include "modules/BaseModule.hpp"
25 
26 namespace Leosac
27 {
28 namespace Module
29 {
30 namespace WSNotifier
31 {
33 {
34  public:
35  WebServiceNotifier(zmqpp::context &ctx, zmqpp::socket *pipe,
36  const boost::property_tree::ptree &cfg, CoreUtilsPtr utils);
37 
39 
40  private:
44  void handle_msg_bus();
45 
49  void process_config();
50 
55  void send_card_info_to_remote(const std::string &auth_source,
56  const std::string &card, int nb_bits);
57 
58 
62  zmqpp::socket bus_sub_;
63 
67  struct TargetInfo
68  {
69  std::string url_;
83  std::string CA_info_file_;
84  };
85 
86  std::vector<TargetInfo> targets_;
87 
88  void send_to_target(void *curl, const std::string &auth_source,
89  const Cred::RFIDCard &card,
90  const TargetInfo &target) noexcept;
91 };
92 }
93 }
94 }
void send_to_target(void *curl, const std::string &auth_source, const Cred::RFIDCard &card, const TargetInfo &target) noexcept
This is the header file for a generated source file, GitSHA1.cpp.
void process_config()
Process the configuration file.
void send_card_info_to_remote(const std::string &auth_source, const std::string &card, int nb_bits)
Send an HTTP request to the remote webservice to let it know a card was read.
bool verify_peer_
If SSL is enabled, do we perform certificate validation ?
Base class for module implementation.
Definition: BaseModule.hpp:110
void handle_msg_bus()
Process a message that was read on the bus.
WebServiceNotifier(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35
Some information for each webservice target.
An RFID card credential.
Definition: RFIDCard.hpp:33
bool verify_host_
If SSL is enabled, do we perform certificate hostname validation ?
zmqpp::socket bus_sub_
Read internal message bus.