Leosac  0.8.0
Open Source Access Control
WebSockAPI.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 "WSServer.hpp"
23 #include "core/auth/AuthFwd.hpp"
24 #include "modules/BaseModule.hpp"
25 #include "tools/db/db_fwd.hpp"
26 
27 namespace Leosac
28 {
29 namespace Module
30 {
31 namespace WebSockAPI
32 {
47 {
48  public:
49  WebSockAPIModule(zmqpp::context &ctx, zmqpp::socket *pipe,
50  const boost::property_tree::ptree &cfg, CoreUtilsPtr utils);
51 
52  ~WebSockAPIModule() = default;
53 
54  virtual void run() override;
55 
61 
62  private:
66  uint16_t port_;
67 
71  std::string interface_;
72 
76  std::unique_ptr<WSServer> wssrv_;
77 };
78 }
79 }
80 }
Leosac::Module::WebSockAPI::WebSockAPIModule::WebSockAPIModule
WebSockAPIModule(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
Definition: WebSockAPI.cpp:32
Leosac::Module::BaseModule
Base class for module implementation.
Definition: BaseModule.hpp:110
Leosac::Module::WebSockAPI::WebSockAPIModule::run
virtual void run() override
This is the main loop of the module.
Definition: WebSockAPI.cpp:46
AuthFwd.hpp
BaseModule.hpp
Leosac::Module::WebSockAPI::WebSockAPIModule::core_utils
CoreUtilsPtr core_utils()
This module explicitly expose CoreUtils to other object in the module.
Definition: WebSockAPI.cpp:60
Leosac::Module::WebSockAPI::WebSockAPIModule
A module that provide a websocket interface to Leosac.
Definition: WebSockAPI.hpp:46
Leosac::Module::WebSockAPI::WebSockAPIModule::port_
uint16_t port_
Port to bind the websocket endpoint.
Definition: WebSockAPI.hpp:66
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::WebSockAPI::WebSockAPIModule::~WebSockAPIModule
~WebSockAPIModule()=default
WSServer.hpp
db_fwd.hpp
Leosac::Module::WebSockAPI::WebSockAPIModule::interface_
std::string interface_
IP address of the interface to listen on.
Definition: WebSockAPI.hpp:71
Leosac::Module::WebSockAPI::WebSockAPIModule::wssrv_
std::unique_ptr< WSServer > wssrv_
Our websocket server object.
Definition: WebSockAPI.hpp:76
Leosac::CoreUtilsPtr
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35