Jazz 1.25.+
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions | Variables
jazz_main Namespace Reference

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 CHANNELSLOGGER
 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.
 

Detailed Description

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 Documentation

◆ pSignalHandler

typedef void(* jazz_main::pSignalHandler) (int signum)

Callback function used to handle a POSIX signal.

◆ pMHD_Daemon

typedef MHD_Daemon* jazz_main::pMHD_Daemon

The server's MHD_Daemon created by MHD_start_daemon() and needed for MHD_stop_daemon()

Function Documentation

◆ http_request_callback()

MHD_Result jazz_main::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 
)
extern

Callback function for MHD. See: https://www.gnu.org/software/libmicrohttpd/tutorial.html

Parameters
clsA pointer to a state variable.
connectionA pointer to a MHD_Connection.
urlThe url requested.
methodThe http method requested.
versionThe http version requested.
upload_dataThe data uploaded.
upload_data_sizeThe size of the data uploaded.
con_clsThe state of the connection.
Returns
MHD_YES if the connection is still open, MHD_NO if the connection is closed.

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.

◆ start_service()

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.

Parameters
serviceThe address of the Service being started.
Returns
True if the service started ok.

◆ stop_service()

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.

Parameters
serviceThe address of the Service being stopped.
Returns
True if the service stopped ok.

◆ signalHandler_SIGTERM()

void jazz_main::signalHandler_SIGTERM ( int  signum)

Capture SIGTERM. This callback procedure stops a running server.

Parameters
signumThe signal number. (SIGTERM = 15)

See main_server_start() for details on the server's start/stop.

Variable Documentation

◆ LOGGER

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.