![]() |
Jazz 1.25.+
|
The http API, instancing and building the server. More...
Data Structures | |
class | API |
API: A Service to manage the REST API. More... | |
class | HttpServer |
HttpServer: The http server is also a Service. More... | |
Typedefs | |
typedef struct MHD_Response * | pMHD_Response |
Pointer to a MHD_Response. | |
typedef struct MHD_Connection * | pMHD_Connection |
Pointer to a MHD_Connection. | |
typedef void(* | pSignalHandler) (int signum) |
typedef MHD_Daemon * | pMHD_Daemon |
Functions | |
MHD_Result | http_request_callback (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) |
void | init_http_callback () |
The initialization of the global variables for http_request_callback(). | |
bool | start_service (pService service) |
A little utility to start services writing output to the console. | |
bool | stop_service (pService service) |
A little utility to stop services writing output to the console. | |
void | signalHandler_SIGTERM (int signum) |
Variables | |
Channels CHANNELS & | LOGGER |
The container channeling blocks. | |
pMHD_Daemon | Jazz_MHD_Daemon |
The MHD_Daemon created by MHD_start_daemon() | |
int | callback_state [3] |
The state of the callback function for each of STATE_NEW_CALL .. STATE_BAD_REQUEST. | |
char | response_put_ok [] = "0" |
The response for a successful PUT call. | |
char | response_put_fail [] = "1" |
The response for a failed PUT call. | |
TenBitIntLUT | http_methods |
A LUT to convert argument const char *method int an integer code. | |
Channels | CHANNELS |
The container channeling blocks. | |
Volatile | VOLATILE |
The container allocating volatile blocks. | |
Persisted | PERSISTED |
The container allocating persisted blocks. | |
Core | CORE |
The container running Bop code. | |
HttpServer | HTTP |
The server. | |
The http API, instancing and building the server.
This small namespace is about the server running and putting everything together. Unlike jazz_elements, jazz_bebop and jazz_models it is not intended to build other applications than the server.
typedef void(* jazz_main::pSignalHandler) (int signum) |
Callback function used to handle a POSIX signal.
typedef MHD_Daemon* jazz_main::pMHD_Daemon |
The server's MHD_Daemon created by MHD_start_daemon() and needed for MHD_stop_daemon()
|
extern |
Callback function for MHD. See: https://www.gnu.org/software/libmicrohttpd/tutorial.html
cls | A pointer to a state variable. |
connection | A pointer to a MHD_Connection. |
url | The url requested. |
method | The http method requested. |
version | The http version requested. |
upload_data | The data uploaded. |
upload_data_size | The size of the data uploaded. |
con_cls | The state of the connection. |
Jazz does not use post processor callbacks linked with MHD_create_post_processor(). Jazz does not use request completed callbacks linked with MHD_start_daemon().
The only callback functions are:
1. This (http_request_callback): The full operational blocks and instrumental API. 2. http_apc_callback(): An IP based (firewall like) that can filter based on called IPs.
This function is multithreaded with the default configuration settings. (Other settings are untested for the moment.)
The internal operation of the callback function is subject to change and the remarks in the source code are the description of it.
bool jazz_main::start_service | ( | pService | service | ) |
A little utility to start services writing output to the console.
It also logs errors directly to the LOGGER instance.
service | The address of the Service being started. |
bool jazz_main::stop_service | ( | pService | service | ) |
A little utility to stop services writing output to the console.
It also logs errors directly to the LOGGER instance.
service | The address of the Service being stopped. |
void jazz_main::signalHandler_SIGTERM | ( | int | signum | ) |
Capture SIGTERM. This callback procedure stops a running server.
signum | The signal number. (SIGTERM = 15) |
See main_server_start() for details on the server's start/stop.
HttpServer HTTP & jazz_main::LOGGER |
The container channeling blocks.
The http server.
The core execution engine.
The container allocating persisted blocks.
The container allocating volatile blocks.