Jazz 1.25.+
Loading...
Searching...
No Matches
server.h
1/* Jazz (c) 2018-2025 kaalam.ai (The Authors of Jazz), using (under the same license):
2
3 1. Biomodelling - The AATBlockQueue class (c) Jacques BasaldĂșa, 2009-2012 licensed
4 exclusively for the use in the Jazz server software.
5
6 Copyright 2009-2012 Jacques BasaldĂșa
7
8 2. BBVA - Jazz: A lightweight analytical web server for data-driven applications.
9
10 Copyright 2016-2017 Banco Bilbao Vizcaya Argentaria, S.A.
11
12 This product includes software developed at
13
14 BBVA (https://www.bbva.com/)
15
16 3. LMDB, Copyright 2011-2017 Howard Chu, Symas Corp. All rights reserved.
17
18 Licensed under http://www.OpenLDAP.org/license.html
19
20
21 Licensed under the Apache License, Version 2.0 (the "License");
22 you may not use this file except in compliance with the License.
23 You may obtain a copy of the License at
24
25 http://www.apache.org/licenses/LICENSE-2.0
26
27 Unless required by applicable law or agreed to in writing, software
28 distributed under the License is distributed on an "AS IS" BASIS,
29 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 See the License for the specific language governing permissions and
31 limitations under the License.
32*/
33
34
35#include "src/jazz_main/api.h"
36
37#ifdef CATCH_TEST
38#ifndef INCLUDED_JAZZ_CATCH2
39#define INCLUDED_JAZZ_CATCH2
40
41#include "src/catch2/catch.hpp"
42
43#endif
44#endif
45
46
47#ifndef INCLUDED_JAZZ_MAIN_SERVER
48#define INCLUDED_JAZZ_MAIN_SERVER
49
50namespace jazz_main
51{
52
53using namespace jazz_elements;
54
57typedef void (*pSignalHandler)(int signum);
58
59
62typedef MHD_Daemon * pMHD_Daemon;
63
64
68class HttpServer : public Service {
69
70 public:
71
72 HttpServer(pLogger a_logger,
73 pConfigFile a_config);
74
75 virtual pChar const id();
76
77 StatusCode start(pSignalHandler p_sig_handler,
78 pMHD_Daemon &p_daemon,
79 MHD_AccessHandlerCallback dh,
80 Channels &channels);
81
83
84 private:
85
86 int http_port = 0;
87 MHD_OptionItem server_options[9];
88};
89
90} // namespace jazz_main
91
92#endif // ifndef INCLUDED_JAZZ_MAIN_SERVER
Channels: A Container doing block transactions across media (files, folders, shell,...
Definition channel.h:227
A configuration file as a key/value store.
Definition utils.h:217
A simple logger.
Definition utils.h:245
A Jazz Service is a globally instanced configurable object that may allocate RAM.
Definition utils.h:285
virtual StatusCode start()
A simple start()/shut_down() interface (Restart is: shut_down(TRUE):start())
Definition utils.cpp:683
HttpServer: The http server is also a Service.
Definition server.h:68
MHD_OptionItem server_options[9]
Variadic parameter MHD_OPTION_ARRAY, server_options, MHD_OPTION_END in MHD_start_daemon()
Definition server.h:87
StatusCode shut_down()
Definition server.cpp:215
virtual pChar const id()
Definition server.cpp:200
int http_port
The port the server is listening to.
Definition server.h:86
The namespace for Jazz Utils, Blocks, Kinds, Tuples, Containers, etc.
Definition block.cpp:39
char * pChar
A pointer to a char buffer.
Definition types.h:185
int StatusCode
Type returned by the Service API.
Definition utils.h:141
The http API, instancing and building the server.
Definition api.cpp:42
void(* pSignalHandler)(int signum)
Definition server.h:57
MHD_Daemon * pMHD_Daemon
Definition server.h:62