Leosac  0.8.0
Open Source Access Control
Service.cpp
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 
22 
23 namespace Leosac
24 {
25 namespace Module
26 {
27 namespace WebSockAPI
28 {
29 
31  const std::string &type)
32 {
33  return server_.register_asio_handler(handler, type);
34 }
35 
36 void Service::unregister_handler(const std::string &name)
37 {
39 }
40 
41 void Service::register_crud_handler(const std::string &resource_name,
43 {
44  server_.register_crud_handler_external(resource_name, factory);
45 }
46 }
47 }
48 }
Leosac::Module::WebSockAPI::Service::register_typed_handler
bool register_typed_handler(const WSHandler &handler, const std::string &type)
Register an handler that is ready to be invoked in the websocket thread.
Definition: Service.cpp:30
Leosac::Module::WebSockAPI::Service::server_
WSServer & server_
Definition: Service.hpp:143
Leosac::Module::WebSockAPI::WSServer::register_crud_handler_external
void register_crud_handler_external(const std::string &resource_name, CRUDResourceHandler::Factory factory)
Register a CRUD handler from an external thread.
Definition: WSServer.cpp:526
Leosac::Module::WebSockAPI::WSServer::unregister_handler
void unregister_handler(const std::string &name)
Remove an Asio based handler.
Definition: WSServer.cpp:510
Leosac::Module::WebSockAPI::Service::register_crud_handler
void register_crud_handler(const std::string &resource_name, CRUDResourceHandler::Factory factory)
Definition: Service.cpp:41
Leosac::Module::WebSockAPI::CRUDResourceHandler::Factory
CRUDResourceHandlerUPtr(*)(RequestContext) Factory
Definition: CRUDResourceHandler.hpp:90
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::WebSockAPI::WSServer::register_asio_handler
bool register_asio_handler(const Service::WSHandler &handler, const std::string &name)
This function block the calling thread until the WebSocket thread has processed the handler registrat...
Definition: WSServer.cpp:492
Leosac::Module::WebSockAPI::Service::WSHandler
std::function< boost::optional< json >(const RequestContext &)> WSHandler
Definition: Service.hpp:53
Service.hpp
WSServer.hpp
Leosac::Module::WebSockAPI::Service::unregister_handler
void unregister_handler(const std::string &name)
Remove an handler by name.
Definition: Service.cpp:36