update domo

This commit is contained in:
NADAL Jean-Baptiste
2019-11-14 15:15:31 +01:00
parent ab4a18f685
commit e5bd19f12d
14 changed files with 298 additions and 134 deletions

View File

@@ -23,17 +23,25 @@
*
*/
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
/*------------------------------- INCLUDES ----------------------------------*/
#include "CivetServer.h"
#include "web/handler/exit-handler.h"
#include "web-server.h"
#define EXIT_URI "/exit"
/*! ----------------------------------------------------------------------------
* @fn WebServer
*
* @brief Constructor of the Web Server Object.
*/
WebServer::WebServer(void)
WebServer::WebServer(void) : m_server(NULL)
{
}
@@ -45,4 +53,26 @@ WebServer::WebServer(void)
WebServer::~WebServer(void)
{
delete m_server;
}
/*! ----------------------------------------------------------------------------
* @fn setup
*
* @brief Setup the Web server
*/
int WebServer::setup(const char *a_document_root, const char *a_port, struct event_base *an_evt_loop)
{
std::vector<std::string> the_options;
the_options.push_back("document_root");
the_options.push_back(a_document_root);
the_options.push_back("listening_ports");
the_options.push_back(a_port);
m_server = new CivetServer(the_options);
m_server->addHandler(EXIT_URI, new ExitHandler(an_evt_loop));
return 0;
}