Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
sol-http-server.h File Reference

HTTP server. More...

#include <sol-common-buildopts.h>
#include <sol-certificate.h>
#include <sol-http.h>
#include <sol-network.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  sol_http_server_config
 It's created with sol_http_server_new() and should be later deleted with sol_http_server_del() More...
 
struct  sol_http_server_progressive_config
 Progressive server response configuration. More...
 

Macros

#define SOL_HTTP_SERVER_CONFIG_API_VERSION   (1)
 compile time API version to be checked during runtime More...
 
#define SOL_HTTP_SERVER_PROGRESSIVE_CONFIG_API_VERSION   (1)
 

Typedefs

typedef struct
sol_http_progressive_response 
sol_http_progressive_response
 Opaque handler used for send data progressively. More...
 
typedef struct sol_http_request sol_http_request
 Opaque handler for a request made to an HTTP server. More...
 
typedef struct sol_http_server sol_http_server
 Opaque handler for an HTTP server instance. More...
 
typedef struct
sol_http_server_config 
sol_http_server_config
 It's created with sol_http_server_new() and should be later deleted with sol_http_server_del() More...
 
typedef struct
sol_http_server_progressive_config 
sol_http_server_progressive_config
 Progressive server response configuration. More...
 

Functions

void sol_http_progressive_response_del (struct sol_http_progressive_response *progressive, bool graceful_del)
 Delete the progressive response. More...
 
int sol_http_progressive_response_feed (struct sol_http_progressive_response *progressive, struct sol_blob *blob)
 Send data for the progressive response. More...
 
int sol_http_progressive_response_sse_feed (struct sol_http_progressive_response *progressive, struct sol_blob *blob)
 Send sse data for the progressive response. More...
 
int sol_http_request_get_client_address (const struct sol_http_request *request, struct sol_network_link_addr *address)
 Gets the client address that made the request. More...
 
int sol_http_request_get_interface_address (const struct sol_http_request *request, struct sol_network_link_addr *address)
 Gets the address of the interface that request comes. More...
 
enum sol_http_method sol_http_request_get_method (const struct sol_http_request *request)
 Gets the method (GET, POST, ...) from a given request. More...
 
const struct sol_http_paramssol_http_request_get_params (const struct sol_http_request *request)
 Gets the parameters from a given request. More...
 
const char * sol_http_request_get_url (const struct sol_http_request *request)
 Gets the URL from a given request. More...
 
static int sol_http_response_set_sse_headers (struct sol_http_response *response)
 Set the necessary headers to allow server sent events. More...
 
int sol_http_server_add_dir (struct sol_http_server *server, const char *basename, const char *rootdir)
 Add a root dir where the server will look for static files to serve. More...
 
void sol_http_server_del (struct sol_http_server *server)
 Destroy the server instance. More...
 
int sol_http_server_get_buffer_size (struct sol_http_server *server, size_t *buf_size)
 Get the request buffer's size. More...
 
struct sol_http_serversol_http_server_new (const struct sol_http_server_config *config)
 Creates an HTTP server, binding on all interfaces in the specified port. More...
 
int sol_http_server_register_handler (struct sol_http_server *server, const char *path, int(*request_cb)(void *data, struct sol_http_request *request), const void *data)
 Register a handler for a specific path. More...
 
int sol_http_server_remove_dir (struct sol_http_server *server, const char *basename, const char *rootdir)
 Removes a dir registered with sol_http_server_add_dir() More...
 
struct
sol_http_progressive_response
sol_http_server_send_progressive_response (struct sol_http_request *request, const struct sol_http_response *response, const struct sol_http_server_progressive_config *config)
 Send the response and keep connection alive to request given in the callback registered on sol_http_server_register_handler(). More...
 
int sol_http_server_send_response (struct sol_http_request *request, struct sol_http_response *response)
 Send the response to request given in the callback registered on sol_http_server_register_handler(). More...
 
int sol_http_server_set_buffer_size (struct sol_http_server *server, size_t buf_size)
 Set the buffer size for a request. More...
 
int sol_http_server_set_last_modified (struct sol_http_server *server, const char *path, time_t modified)
 Set the last time the specified path had its value modified. More...
 
int sol_http_server_unregister_handler (struct sol_http_server *server, const char *path)
 Removes a handler registered with sol_http_server_register_handler() More...
 

Detailed Description

HTTP server.

API to make it possible to run an HTTP server to deliver and set values from other components.

Macro Definition Documentation

#define SOL_HTTP_SERVER_CONFIG_API_VERSION   (1)

compile time API version to be checked during runtime

Examples:
/src/samples/http/server-https.c, /src/samples/http/server-sse.c, /src/samples/http/server.c, and /src/samples/http/static-files.c.

Referenced by startup_server().

#define SOL_HTTP_SERVER_PROGRESSIVE_CONFIG_API_VERSION   (1)