ulfius.h
Go to the documentation of this file.
#ifndef __ULFIUS_H__
#define __ULFIUS_H__
#ifdef __cplusplus
extern "C"
{
#endif
#include "ulfius-cfg.h"
#ifndef U_DISABLE_GNUTLS
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#endif
#ifndef U_DISABLE_JANSSON
#include <jansson.h>
#endif
#ifndef U_DISABLE_WEBSOCKET
#include <poll.h>
#include <zlib.h>
#include <pthread.h>
#ifndef POLLRDHUP
#define POLLRDHUP 0x2000
#endif
#endif
#include <microhttpd.h>
#if defined(_WIN32) && !defined(U_DISABLE_WEBSOCKET)
#define U_DISABLE_WEBSOCKET
#endif
#if (MHD_VERSION < 0x00095300) && !defined(U_DISABLE_WEBSOCKET)
#define U_DISABLE_WEBSOCKET
#endif
#include <orcania.h>
#ifndef U_DISABLE_YDER
#include <yder.h>
#else
#define Y_LOG_MODE_NONE 0
#define Y_LOG_MODE_CONSOLE 0
#define Y_LOG_MODE_SYSLOG 0
#define Y_LOG_MODE_FILE 0
#define Y_LOG_MODE_JOURNALD 0
#define Y_LOG_MODE_CALLBACK 0
#define Y_LOG_MODE_CURRENT 0
#define Y_LOG_LEVEL_NONE 0
#define Y_LOG_LEVEL_DEBUG 0
#define Y_LOG_LEVEL_INFO 0
#define Y_LOG_LEVEL_WARNING 0
#define Y_LOG_LEVEL_ERROR 0
#define Y_LOG_LEVEL_CURRENT 0
int y_init_logs(const char * app, const unsigned long init_mode, const unsigned long init_level, const char * init_log_file, const char * message);
int y_set_logs_callback(void (* y_callback_log_message) (void * cls, const char * app_name, const time_t date, const unsigned long level, const char * message), void * cls, const char * message);
void y_log_message(const unsigned long type, const char * message, ...);
int y_close_logs();
#endif
#define ULFIUS_STREAM_BLOCK_SIZE_DEFAULT 1024
#define U_STREAM_END MHD_CONTENT_READER_END_OF_STREAM
#define U_STREAM_ERROR MHD_CONTENT_READER_END_WITH_ERROR
#define U_STREAM_SIZE_UNKNOWN MHD_SIZE_UNKNOWN
#define U_STREAM_SIZE_UNKOWN U_STREAM_SIZE_UNKNOWN // Backward compatibility
#define U_OK 0
#define U_ERROR 1
#define U_ERROR_MEMORY 2
#define U_ERROR_PARAMS 3
#define U_ERROR_LIBMHD 4
#define U_ERROR_LIBCURL 5
#define U_ERROR_NOT_FOUND 6
#define U_ERROR_DISCONNECTED 7
#define U_CALLBACK_CONTINUE 0
#define U_CALLBACK_IGNORE 1
#define U_CALLBACK_COMPLETE 2
#define U_CALLBACK_UNAUTHORIZED 3
#define U_CALLBACK_ERROR 4
#define U_COOKIE_SAME_SITE_EMPTY 0
#define U_COOKIE_SAME_SITE_STRICT 1
#define U_COOKIE_SAME_SITE_LAX 2
#define U_COOKIE_SAME_SITE_NONE 3
#define U_USE_IPV4 0x0001
#define U_USE_IPV6 0x0010
#define U_USE_ALL (U_USE_IPV4|U_USE_IPV6)
#define U_SSL_VERIFY_PEER 0x0001
#define U_SSL_VERIFY_HOSTNAME 0x0010
#define U_POST_PROCESS_NONE 0x0000
#define U_POST_PROCESS_URL_ENCODED 0x0001
#define U_POST_PROCESS_MULTIPART_FORMDATA 0x0010
typedef enum {
U_OPT_NONE = 0,
U_OPT_HTTP_VERB = 1,
U_OPT_HTTP_URL = 2,
U_OPT_HTTP_PROXY = 3,
#if MHD_VERSION >= 0x00095208
U_OPT_NETWORK_TYPE = 4,
#endif
U_OPT_CHECK_SERVER_CERTIFICATE = 5,
U_OPT_CHECK_SERVER_CERTIFICATE_FLAG = 6,
U_OPT_CHECK_PROXY_CERTIFICATE = 7,
U_OPT_CHECK_PROXY_CERTIFICATE_FLAG = 8,
U_OPT_FOLLOW_REDIRECT = 9,
U_OPT_CA_PATH = 10,
U_OPT_TIMEOUT = 11,
U_OPT_AUTH_BASIC_USER = 12,
U_OPT_AUTH_BASIC_PASSWORD = 13,
U_OPT_AUTH_BASIC = 14,
U_OPT_URL_PARAMETER = 15,
U_OPT_HEADER_PARAMETER = 16,
U_OPT_COOKIE_PARAMETER = 17,
U_OPT_POST_BODY_PARAMETER = 18,
U_OPT_URL_PARAMETER_REMOVE = 19,
U_OPT_HEADER_PARAMETER_REMOVE = 20,
U_OPT_COOKIE_PARAMETER_REMOVE = 21,
U_OPT_POST_BODY_PARAMETER_REMOVE = 22,
U_OPT_BINARY_BODY = 23,
U_OPT_STRING_BODY = 24,
#ifndef U_DISABLE_JANSSON
U_OPT_JSON_BODY = 25,
#endif
#ifndef U_DISABLE_GNUTLS
U_OPT_CLIENT_CERT_FILE = 26,
U_OPT_CLIENT_KEY_FILE = 27,
U_OPT_CLIENT_KEY_PASSWORD = 28,
#endif
U_OPT_STATUS = 29,
U_OPT_AUTH_REALM = 30,
U_OPT_SHARED_DATA = 31,
U_OPT_HTTP_URL_APPEND = 32
} u_option;
/*************
* Structures
*************/
struct _u_map {
int nb_values; /* !< Values count */
char ** keys; /* !< Array of keys */
char ** values; /* !< Array of values */
size_t * lengths; /* !< Lengths of each values */
};
struct _u_cookie {
char * key; /* !< key if the cookie */
char * value; /* !< value of the cookie */
char * expires; /* !< expiration date of the cookie */
unsigned int max_age; /* !< duration of the cookie in seconds */
char * domain; /* !< domain for the cookie */
char * path; /* !< url path for the cookie */
int secure; /* !< flag to set cookie secure or not */
int http_only; /* !< flag to set cookie for HTTP connections only or not */
int same_site; /* !< flag to set same_site option to the cookie */
};
struct _u_request {
char * http_protocol; /* !< http protocol used (1.0 or 1.1) */
char * http_verb; /* !< http method (GET, POST, PUT, DELETE, etc.) */
char * http_url; /* !< full url used to call this callback function or full url to call when used in a ulfius_send_http_request */
char * url_path; /* !< url path only used to call this callback function (ex, if http_url is /path/?param=1, url_path is /path/) */
char * proxy; /* !<proxy address to use for outgoing connections, used by ulfius_send_http_request */
#if MHD_VERSION >= 0x00095208
unsigned short network_type; /* !< Force connect to ipv4, ipv6 addresses or both, values available are U_USE_ALL, U_USE_IPV4 or U_USE_IPV6 */
#endif
int check_server_certificate; /* !< check server certificate and hostname, default true, used by ulfius_send_http_request */
int check_server_certificate_flag; /* !< check certificate peer and or server hostname if check_server_certificate is enabled, values available are U_SSL_VERIFY_PEER, U_SSL_VERIFY_HOSTNAME or both, default value is both (U_SSL_VERIFY_PEER|U_SSL_VERIFY_HOSTNAME), used by ulfius_send_http_request */
int check_proxy_certificate; /* !< check proxy certificate and hostname, default true, used by ulfius_send_http_request, requires libcurl >= 7.52 */
int check_proxy_certificate_flag; /* !< check certificate peer and or proxy hostname if check_proxy_certificate is enabled, values available are U_SSL_VERIFY_PEER, U_SSL_VERIFY_HOSTNAME or both, default value is both (U_SSL_VERIFY_PEER|U_SSL_VERIFY_HOSTNAME), used by ulfius_send_http_request, requires libcurl >= 7.52 */
int follow_redirect; /* !< follow url redirections, used by ulfius_send_http_request */
char * ca_path; /* !< specify a path to CA certificates instead of system path, used by ulfius_send_http_request */
unsigned long timeout; /* !< connection timeout used by ulfius_send_http_request, default is 0 */
struct sockaddr * client_address; /* !< IP address of the client */
char * auth_basic_user; /* !< basic authentication username */
char * auth_basic_password; /* !< basic authentication password */
struct _u_map * map_url; /* !< map containing the url variables, both from the route and the ?key=value variables */
struct _u_map * map_header; /* !< map containing the header variables */
struct _u_map * map_cookie; /* !< map containing the cookie variables */
struct _u_map * map_post_body; /* !< map containing the post body variables (if available) */
void * binary_body; /* !< raw body */
size_t binary_body_length; /* !< length of raw body */
unsigned int callback_position; /* !< position of the current callback function in the callback list, starts at 0 */
#ifndef U_DISABLE_GNUTLS
gnutls_x509_crt_t client_cert; /* !< x509 certificate of the client if the instance uses client certificate authentication and the client is authenticated, available only if GnuTLS support is enabled */
char * client_cert_file; /* !< path to client certificate file for sending http requests with certificate authentication, available only if GnuTLS support is enabled */
char * client_key_file; /* !< path to client key file for sending http requests with certificate authentication, available only if GnuTLS support is enabled */
char * client_key_password; /* !< password to unlock client key file, available only if GnuTLS support is enabled */
#endif
};
struct _u_response {
long status; /* !< HTTP status code (200, 404, 500, etc) */
char * protocol; /* !< HTTP Protocol sent */
struct _u_map * map_header; /* !< map containing the header variables */
unsigned int nb_cookies; /* !< number of cookies sent */
struct _u_cookie * map_cookie; /* !< array of cookies sent */
char * auth_realm; /* !< realm to send to the client on authenticationb failed */
void * binary_body; /* !< raw binary content */
size_t binary_body_length; /* !< length of the binary_body */
ssize_t (* stream_callback) (void * stream_user_data, uint64_t offset, char * out_buf, size_t max); /* !< callback function to stream data in response body */
void (* stream_callback_free) (void * stream_user_data); /* !< callback function to free data allocated for streaming */
uint64_t stream_size; /* !< size of the streamed data (U_STREAM_SIZE_UNKNOWN if unknown) */
size_t stream_block_size; /* !< size of each block to be streamed, set according to your system */
void * stream_user_data; /* !< user defined data that will be available in your callback stream functions */
void * websocket_handle; /* !< handle for websocket extension */
void * shared_data; /* !< any data shared between callback functions, must be allocated and freed by the callback functions */
void (* free_shared_data)(void * shared_data); /* !< pointer to a function that will free shared_data */
unsigned int timeout; /* !< Timeout in seconds to close the connection because of inactivity between the client and the server */
};
struct _u_endpoint {
char * http_method; /* !< http verb (GET, POST, PUT, etc.) in upper case */
char * url_prefix; /* !< prefix for the url (optional) */
char * url_format; /* !< string used to define the endpoint format, separate words with / to define a variable in the url, prefix it with @ or :, example: /test/resource/:name/elements, on an url_format that ends with '*', the rest of the url will not be tested */
unsigned int priority; /* !< endpoint priority in descending order (0 is the higher priority) */
int (* callback_function)(const struct _u_request * request, /* !< pointer to a function that will be executed each time the endpoint is called, you must declare the function as described. */
struct _u_response * response,
void * user_data);
void * user_data; /* !< pointer to a data or a structure that will be available in callback_function */
};
struct _u_instance {
struct MHD_Daemon * mhd_daemon; /* !< pointer to the libmicrohttpd daemon */
int status; /* !< status of the current instance, status are U_STATUS_STOP, U_STATUS_RUNNING or U_STATUS_ERROR */
unsigned int port; /* !< port number to listen to */
#if MHD_VERSION >= 0x00095208
unsigned short network_type; /* !< Listen to ipv4 and or ipv6 connections, values available are U_USE_ALL, U_USE_IPV4 or U_USE_IPV6 */
#endif
struct sockaddr_in * bind_address; /* !< ipv4 address to listen to (optional) */
struct sockaddr_in6 * bind_address6; /* !< ipv6 address to listen to (optional) */
unsigned int timeout; /* !< Timeout to close the connection because of inactivity between the client and the server */
int nb_endpoints; /* !< Number of available endpoints */
char * default_auth_realm; /* !< Default realm on authentication error */
struct _u_endpoint * endpoint_list; /* !< List of available endpoints */
struct _u_endpoint * default_endpoint; /* !< Default endpoint if no other endpoint match the current url */
struct _u_map * default_headers; /* !< Default headers that will be added to all response->map_header */
size_t max_post_param_size; /* !< maximum size for a post parameter, 0 means no limit, default 0 */
size_t max_post_body_size; /* !< maximum size for the entire post body, 0 means no limit, default 0 */
void * websocket_handler; /* !< handler for the websocket structure */
int (* file_upload_callback) (const struct _u_request * request, /* !< callback function to manage file upload by blocks */
const char * key,
const char * filename,
const char * content_type,
const char * transfer_encoding,
const char * data,
uint64_t off,
size_t size,
void * cls);
void * file_upload_cls; /* !< any pointer to pass to the file_upload_callback function */
int mhd_response_copy_data; /* !< to choose between MHD_RESPMEM_MUST_COPY and MHD_RESPMEM_MUST_FREE, only if you use MHD < 0.9.61, otherwise this option is skipped because it's useless */
int check_utf8; /* !< check that all parameters values in the request (url, header and post_body), are valid utf8 strings, if a parameter value has non utf8 character, the value, will be ignored, default 1 */
#ifndef U_DISABLE_GNUTLS
int use_client_cert_auth; /* !< Internal variable use to indicate if the instance uses client certificate authentication, Do not change this value, available only if websocket support is enabled */
#endif
int allowed_post_processor; /* !< Specifies which content-type are allowed to process in the request->map_post_body parameters list, default value is U_POST_PROCESS_URL_ENCODED|U_POST_PROCESS_MULTIPART_FORMDATA, to disable all, use U_POST_PROCESS_NONE */
};
struct connection_info_struct {
struct _u_instance * u_instance;
struct MHD_PostProcessor * post_processor;
int has_post_processor;
int callback_first_iteration;
struct _u_request * request;
size_t max_post_param_size;
struct _u_map map_url_initial;
};
/**********************************
* Instance functions declarations
**********************************/
void u_free(void * data);
int ulfius_global_init(void);
void ulfius_global_close(void);
int ulfius_init_instance(struct _u_instance * u_instance, unsigned int port, struct sockaddr_in * bind_address, const char * default_auth_realm);
#if MHD_VERSION >= 0x00095208
int ulfius_init_instance_ipv6(struct _u_instance * u_instance, unsigned int port, struct sockaddr_in6 * bind_address, unsigned short network_type, const char * default_auth_realm);
#endif
void ulfius_clean_instance(struct _u_instance * u_instance);
int ulfius_start_framework(struct _u_instance * u_instance);
int ulfius_start_secure_framework(struct _u_instance * u_instance, const char * key_pem, const char * cert_pem);
#ifndef U_DISABLE_GNUTLS
int ulfius_start_secure_ca_trust_framework(struct _u_instance * u_instance, const char * key_pem, const char * cert_pem, const char * root_ca_pem);
#endif
int ulfius_start_framework_with_mhd_options(struct _u_instance * u_instance, unsigned int mhd_flags, struct MHD_OptionItem * mhd_ops);
void mhd_request_completed (void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe);
void * ulfius_uri_logger (void * cls, const char * uri);
int ulfius_stop_framework(struct _u_instance * u_instance);
int ulfius_set_upload_file_callback_function(struct _u_instance * u_instance,
int (* file_upload_callback) (const struct _u_request * request,
const char * key,
const char * filename,
const char * content_type,
const char * transfer_encoding,
const char * data,
uint64_t off,
size_t size,
void * cls),
void * cls);
/***********************************
* Endpoints functions declarations
***********************************/
int ulfius_add_endpoint(struct _u_instance * u_instance, const struct _u_endpoint * u_endpoint);
int ulfius_add_endpoint_by_val(struct _u_instance * u_instance,
const char * http_method,
const char * url_prefix,
const char * url_format,
unsigned int priority,
int (* callback_function)(const struct _u_request * request, // Input parameters (set by the framework)
struct _u_response * response, // Output parameters (set by the user)
void * user_data),
void * user_data);
int ulfius_add_endpoint_list(struct _u_instance * u_instance, const struct _u_endpoint ** u_endpoint_list);
int ulfius_remove_endpoint(struct _u_instance * u_instance, const struct _u_endpoint * u_endpoint);
int ulfius_set_default_endpoint(struct _u_instance * u_instance,
int (* callback_function)(const struct _u_request * request, struct _u_response * response, void * user_data),
void * user_data);
int ulfius_remove_endpoint_by_val(struct _u_instance * u_instance, const char * http_method, const char * url_prefix, const char * url_format);
const struct _u_endpoint * ulfius_empty_endpoint(void);
int ulfius_copy_endpoint(struct _u_endpoint * dest, const struct _u_endpoint * source);
struct _u_endpoint * ulfius_duplicate_endpoint_list(const struct _u_endpoint * endpoint_list);
void ulfius_clean_endpoint(struct _u_endpoint * endpoint);
void ulfius_clean_endpoint_list(struct _u_endpoint * endpoint_list);
int ulfius_equals_endpoints(const struct _u_endpoint * endpoint1, const struct _u_endpoint * endpoint2);
#ifndef U_DISABLE_CURL
/********************************************
* Requests/Responses functions declarations
********************************************/
int ulfius_send_http_request(const struct _u_request * request, struct _u_response * response);
int ulfius_send_http_request_with_limit(const struct _u_request * request, struct _u_response * response, size_t response_body_limit, size_t max_header);
int ulfius_send_http_streaming_request(const struct _u_request * request, struct _u_response * response, size_t (* write_body_function)(void * contents, size_t size, size_t nmemb, void * user_data), void * write_body_data);
int ulfius_send_http_streaming_request_max_header(const struct _u_request * request, struct _u_response * response, size_t (* write_body_function)(void * contents, size_t size, size_t nmemb, void * user_data), void * write_body_data, size_t max_header);
int ulfius_send_smtp_email(const char * host,
const int port,
const int use_tls,
const int verify_certificate,
const char * user,
const char * password,
const char * from,
const char * to,
const char * cc,
const char * bcc,
const char * subject,
const char * mail_body);
int ulfius_send_smtp_rich_email(const char * host,
const int port,
const int use_tls,
const int verify_certificate,
const char * user,
const char * password,
const char * from,
const char * to,
const char * cc,
const char * bcc,
const char * content_type,
const char * subject,
const char * mail_body);
#endif
int ulfius_add_cookie_to_response(struct _u_response * response, const char * key, const char * value, const char * expires, const unsigned int max_age,
const char * domain, const char * path, const int secure, const int http_only);
int ulfius_add_same_site_cookie_to_response(struct _u_response * response, const char * key, const char * value, const char * expires, const unsigned int max_age,
const char * domain, const char * path, const int secure, const int http_only, const int same_site);
int ulfius_add_header_to_response(struct _u_response * response, const char * key, const char * value);
int ulfius_set_string_body_request(struct _u_request * request, const char * string_body);
int ulfius_set_binary_body_request(struct _u_request * request, const char * binary_body, const size_t length);
int ulfius_set_empty_body_request(struct _u_request * request);
int ulfius_set_string_body_response(struct _u_response * response, const unsigned int status, const char * body);
int ulfius_set_binary_body_response(struct _u_response * response, const unsigned int status, const char * body, const size_t length);
int ulfius_set_empty_body_response(struct _u_response * response, const unsigned int status);
int ulfius_set_stream_response(struct _u_response * response,
const unsigned int status,
ssize_t (* stream_callback) (void * stream_user_data, uint64_t offset, char * out_buf, size_t max),
void (* stream_callback_free) (void * stream_user_data),
uint64_t stream_size,
size_t stream_block_size,
void * stream_user_data);
int ulfius_init_request(struct _u_request * request);
int ulfius_clean_request(struct _u_request * request);
int ulfius_clean_request_full(struct _u_request * request);
int ulfius_copy_request(struct _u_request * dest, const struct _u_request * source);
int ulfius_set_request_properties(struct _u_request * request, ...);
struct _u_request * ulfius_duplicate_request(const struct _u_request * request);
char * ulfius_export_request_http(const struct _u_request * request);
int ulfius_init_response(struct _u_response * response);
int ulfius_clean_response(struct _u_response * response);
int ulfius_clean_response_full(struct _u_response * response);
int ulfius_copy_response(struct _u_response * dest, const struct _u_response * source);
int ulfius_clean_cookie(struct _u_cookie * cookie);
int ulfius_copy_cookie(struct _u_cookie * dest, const struct _u_cookie * source);
struct _u_response * ulfius_duplicate_response(const struct _u_response * response);
int ulfius_set_response_properties(struct _u_response * response, ...);
int ulfius_set_response_shared_data(struct _u_response * response, void * shared_data, void (* free_shared_data) (void * shared_data));
char * ulfius_export_response_http(const struct _u_response * response);
char * ulfius_url_decode(const char * str);
char * ulfius_url_encode(const char * str);
#ifndef U_DISABLE_JANSSON
json_t * ulfius_get_json_body_request(const struct _u_request * request, json_error_t * json_error);
int ulfius_set_json_body_request(struct _u_request * request, json_t * j_body);
json_t * ulfius_get_json_body_response(struct _u_response * response, json_error_t * json_error);
int ulfius_set_json_body_response(struct _u_response * response, const unsigned int status, const json_t * j_body);
#endif
/************************************************************************
* _u_map declarations *
* _u_map is a simple map structure that handles sets of key/value maps *
************************************************************************/
int u_map_init(struct _u_map * u_map);
int u_map_clean(struct _u_map * u_map);
int u_map_clean_full(struct _u_map * u_map);
int u_map_clean_enum(char ** array);
const char ** u_map_enum_keys(const struct _u_map * u_map);
const char ** u_map_enum_values(const struct _u_map * u_map);
int u_map_has_key(const struct _u_map * u_map, const char * key);
int u_map_has_value(const struct _u_map * u_map, const char * value);
int u_map_has_value_binary(const struct _u_map * u_map, const char * value, size_t length);
int u_map_has_key_case(const struct _u_map * u_map, const char * key);
int u_map_has_value_case(const struct _u_map * u_map, const char * value);
int u_map_put(struct _u_map * u_map, const char * key, const char * value);
int u_map_put_binary(struct _u_map * u_map, const char * key, const char * value, uint64_t offset, size_t length);
ssize_t u_map_get_length(const struct _u_map * u_map, const char * key);
ssize_t u_map_get_case_length(const struct _u_map * u_map, const char * key);
const char * u_map_get(const struct _u_map * u_map, const char * key);
const char * u_map_get_case(const struct _u_map * u_map, const char * key);
int u_map_remove_from_key(struct _u_map * u_map, const char * key);
int u_map_remove_from_key_case(struct _u_map * u_map, const char * key);
int u_map_remove_from_value(struct _u_map * u_map, const char * value);
int u_map_remove_from_value_case(struct _u_map * u_map, const char * value);
int u_map_remove_from_value_binary(struct _u_map * u_map, const char * key, size_t length);
int u_map_remove_at(struct _u_map * u_map, const int index);
struct _u_map * u_map_copy(const struct _u_map * source);
int u_map_copy_into(struct _u_map * dest, const struct _u_map * source);
int u_map_count(const struct _u_map * source);
int u_map_empty(struct _u_map * u_map);
#ifndef U_DISABLE_WEBSOCKET
/**********************************
* Websocket functions declarations
**********************************/
#define U_WEBSOCKET_USER_AGENT "Ulfius Websocket Client Framework"
#define U_WEBSOCKET_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
#define U_WEBSOCKET_UPGRADE_VALUE "websocket"
#define U_WEBSOCKET_BAD_REQUEST_BODY "Error in websocket handshake, wrong parameters"
#define U_WEBSOCKET_USEC_WAIT 50
#define WEBSOCKET_MAX_CLOSE_TRY 10
#define U_WEBSOCKET_BIT_FIN 0x80
#define U_WEBSOCKET_MASK 0x80
#define U_WEBSOCKET_LEN_MASK 0x7F
#define U_WEBSOCKET_OPCODE_CONTINUE 0x00
#define U_WEBSOCKET_OPCODE_TEXT 0x01
#define U_WEBSOCKET_OPCODE_BINARY 0x02
#define U_WEBSOCKET_OPCODE_CLOSE 0x08
#define U_WEBSOCKET_OPCODE_PING 0x09
#define U_WEBSOCKET_OPCODE_PONG 0x0A
#define U_WEBSOCKET_OPCODE_CLOSED 0xFD
#define U_WEBSOCKET_OPCODE_ERROR 0xFE
#define U_WEBSOCKET_OPCODE_NONE 0xFF
#define U_WEBSOCKET_NONE 0
#define U_WEBSOCKET_SERVER 1
#define U_WEBSOCKET_CLIENT 2
#define U_WEBSOCKET_STATUS_OPEN 0
#define U_WEBSOCKET_STATUS_CLOSE 1
#define U_WEBSOCKET_STATUS_ERROR 2
#define U_WEBSOCKET_RSV1 0x40
#define U_WEBSOCKET_RSV2 0x20
#define U_WEBSOCKET_RSV3 0x10
#define WEBSOCKET_RESPONSE_HTTP 0x0001
#define WEBSOCKET_RESPONSE_UPGRADE 0x0002
#define WEBSOCKET_RESPONSE_CONNECTION 0x0004
#define WEBSOCKET_RESPONSE_ACCEPT 0x0008
#define WEBSOCKET_RESPONSE_PROTCOL 0x0010
#define WEBSOCKET_RESPONSE_EXTENSION 0x0020
#define WEBSOCKET_DEFLATE_CHUNK_SIZE 32768
#define WEBSOCKET_DEFLATE_WINDOWS_BITS 15
#define U_WEBSOCKET_KEEP_NONE 0x00
#define U_WEBSOCKET_KEEP_INCOMING 0x01
#define U_WEBSOCKET_KEEP_OUTCOMING 0x10
struct _websocket_deflate_context {
z_stream infstream;
z_stream defstream;
int deflate_mask;
int inflate_mask;
unsigned int server_no_context_takeover;
unsigned int client_no_context_takeover;
unsigned int server_max_window_bits;
unsigned int client_max_window_bits;
};
struct _websocket_extension {
char * extension_server;
char * extension_client;
uint8_t rsv;
int (* websocket_extension_message_out_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context);
void * websocket_extension_message_out_perform_user_data;
int (* websocket_extension_message_in_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context);
void * websocket_extension_message_in_perform_user_data;
int (* websocket_extension_server_match)(const char * extension_client,
const char ** extension_client_list,
char ** extension_server,
void * user_data,
void ** context);
void * websocket_extension_server_match_user_data;
int (* websocket_extension_client_match)(const char * extension_server,
void * user_data,
void ** context);
void * websocket_extension_client_match_user_data;
void (* websocket_extension_free_context)(void * user_data,
void * context);
void * websocket_extension_free_context_user_data;
int enabled;
void * context;
};
struct _websocket_manager {
#ifndef U_DISABLE_WS_MESSAGE_LIST
struct _websocket_message_list * message_list_incoming; /* !< list of incoming messages */
struct _websocket_message_list * message_list_outcoming; /* !< list of outcoming messages */
int keep_messages; /* !< keep incoming and/or outcoming messages, flags available are U_WEBSOCKET_KEEP_INCOMING, U_WEBSOCKET_KEEP_OUTCOMING, U_WEBSOCKET_KEEP_NONE, default is U_WEBSOCKET_KEEP_INCOMING|U_WEBSOCKET_KEEP_OUTCOMING */
#endif
int connected; /* !< flag to know if the websocket is connected or not */
int ping_sent; /* !< flag to know if the websocket has sent a ping frame or not, before receiving a pong */
int close_flag; /* !< flag to set before closing a websocket */
MHD_socket mhd_sock; /* !< reference to libmicrohttpd's socket for websocket server */
int tcp_sock; /* !< tcp socket for websocket client */
int tls; /* !< set to 1 if the websocket is in a TLS socket */
gnutls_session_t gnutls_session; /* !< GnuTLS session for websocket client */
gnutls_certificate_credentials_t xcred; /* !< certificate credential used by GnuTLS */
char * protocol; /* !< websocket protocol */
char * extensions; /* !< websocket extension */
pthread_mutex_t read_lock; /* !< mutex to read data in the socket */
pthread_mutex_t write_lock; /* !< mutex to write data in the socket */
pthread_mutex_t status_lock; /* !< mutex to broadcast new status */
pthread_cond_t status_cond; /* !< condition to broadcast new status */
struct pollfd fds_in;
struct pollfd fds_out;
int type;
int rsv_expected;
struct _pointer_list * websocket_extension_list;
};
struct _websocket_message {
time_t datestamp; /* !< date stamp of the message */
uint8_t rsv; /* !< flags RSV1-3 of the message */
uint8_t opcode; /* !< opcode for the message (string or binary) */
uint8_t has_mask; /* !< does the message contain a mask? */
uint8_t mask[4]; /* !< mask used if any */
size_t data_len; /* !< length of the data */
char * data; /* !< message data */
size_t fragment_len; /* !< length of the fragment, 0 if not fragmented */
uint8_t fin; /* !< flag fin (end of fragmented message) */
};
#ifndef U_DISABLE_WS_MESSAGE_LIST
struct _websocket_message_list {
struct _websocket_message ** list; /* !< messages list */
size_t len; /* !< message list length */
};
#endif
struct _websocket {
struct _u_instance * instance; /* !< reference to the ulfius instance if any */
struct _u_request * request; /* !< refrence to the ulfius request of any */
void (* websocket_manager_callback) (const struct _u_request * request, /* !< reference to a function called after the websocket handshake */
struct _websocket_manager * websocket_manager,
void * websocket_manager_user_data);
void * websocket_manager_user_data; /* !< a user-defined reference that will be available in websocket_manager_callback */
void (* websocket_incoming_message_callback) (const struct _u_request * request, /* !< reference to a function called each time a message arrives */
struct _websocket_manager * websocket_manager,
const struct _websocket_message * message,
void * websocket_incoming_user_data);
void * websocket_incoming_user_data; /* !< a user-defined reference that will be available in websocket_incoming_message_callback */
void (* websocket_onclose_callback) (const struct _u_request * request, /* !< reference to a function called after the websocket connection ends */
struct _websocket_manager * websocket_manager,
void * websocket_onclose_user_data);
void * websocket_onclose_user_data; /* !< a user-defined reference that will be available in websocket_onclose_callback */
struct _websocket_manager * websocket_manager; /* !< refrence to the websocket manager if any */
struct MHD_UpgradeResponseHandle * urh; /* !< reference used by libmicrohttpd to upgrade the connection */
};
struct _websocket_client_handler {
struct _websocket * websocket; /* !< the websocket to use */
struct _u_response * response; /* !< the response attached to the websocket */
};
/********************************/
/********************************/
int ulfius_websocket_send_message(struct _websocket_manager * websocket_manager,
const uint8_t opcode,
const uint64_t data_len,
const char * data);
int ulfius_websocket_send_fragmented_message(struct _websocket_manager * websocket_manager,
const uint8_t opcode,
const uint64_t data_len,
const char * data,
const uint64_t fragment_len);
#ifndef U_DISABLE_JANSSON
int ulfius_websocket_send_json_message(struct _websocket_manager * websocket_manager,
json_t * j_message);
json_t * ulfius_websocket_parse_json_message(const struct _websocket_message * message, json_error_t * json_error);
#endif
#ifndef U_DISABLE_WS_MESSAGE_LIST
struct _websocket_message * ulfius_websocket_pop_first_message(struct _websocket_message_list * message_list);
#endif
void ulfius_clear_websocket_message(struct _websocket_message * message);
/********************************/
/********************************/
int ulfius_set_websocket_response(struct _u_response * response,
const char * websocket_protocol,
const char * websocket_extensions,
void (* websocket_manager_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
void * websocket_manager_user_data),
void * websocket_manager_user_data,
void (* websocket_incoming_message_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
const struct _websocket_message * message,
void * websocket_incoming_user_data),
void * websocket_incoming_user_data,
void (* websocket_onclose_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
void * websocket_onclose_user_data),
void * websocket_onclose_user_data);
int ulfius_add_websocket_extension_message_perform(struct _u_response * response,
const char * extension_server,
uint8_t rsv,
int (* websocket_extension_message_out_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context),
void * websocket_extension_message_out_perform_user_data,
int (* websocket_extension_message_in_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context),
void * websocket_extension_message_in_perform_user_data,
int (* websocket_extension_server_match)(const char * extension_client,
const char ** extension_client_list,
char ** extension_server,
void * user_data,
void ** context),
void * websocket_extension_server_match_user_data,
void (* websocket_extension_free_context)(void * user_data,
void * context),
void * websocket_extension_free_context_user_data);
int websocket_extension_message_out_deflate(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context);
int websocket_extension_message_in_inflate(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context);
void websocket_extension_deflate_free_context(void * user_data, void * context);
int websocket_extension_server_match_deflate(const char * extension_client, const char ** extension_client_list, char ** extension_server, void * user_data, void ** context);
int ulfius_add_websocket_deflate_extension(struct _u_response * response);
int ulfius_websocket_send_close_signal(struct _websocket_manager * websocket_manager);
int ulfius_websocket_status(struct _websocket_manager * websocket_manager);
int ulfius_websocket_wait_close(struct _websocket_manager * websocket_manager, unsigned int timeout);
/********************************/
/********************************/
int ulfius_open_websocket_client_connection(struct _u_request * request,
void (* websocket_manager_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
void * websocket_manager_user_data),
void * websocket_manager_user_data,
void (* websocket_incoming_message_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
const struct _websocket_message * message,
void * websocket_incoming_user_data),
void * websocket_incoming_user_data,
void (* websocket_onclose_callback) (const struct _u_request * request,
struct _websocket_manager * websocket_manager,
void * websocket_onclose_user_data),
void * websocket_onclose_user_data,
struct _websocket_client_handler * websocket_client_handler,
struct _u_response * response);
int ulfius_add_websocket_client_extension_message_perform(struct _websocket_client_handler * websocket_client_handler,
const char * extension,
uint8_t rsv,
int (* websocket_extension_message_out_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context),
void * websocket_extension_message_out_perform_user_data,
int (* websocket_extension_message_in_perform)(const uint8_t opcode,
const uint64_t data_len_in,
const char * data_in,
uint64_t * data_len_out,
char ** data_out,
const uint64_t fragment_len,
void * user_data,
void * context),
void * websocket_extension_message_in_perform_user_data,
int (* websocket_extension_client_match)(const char * extension_server,
void * user_data,
void ** context),
void * websocket_extension_client_match_user_data,
void (* websocket_extension_free_context)(void * user_data,
void * context),
void * websocket_extension_free_context_user_data);
int websocket_extension_client_match_deflate(const char * extension_server, void * user_data, void ** context);
int ulfius_add_websocket_client_deflate_extension(struct _websocket_client_handler * websocket_client_handler);
int ulfius_websocket_client_connection_send_close_signal(struct _websocket_client_handler * websocket_client_handler);
int ulfius_websocket_client_connection_close(struct _websocket_client_handler * websocket_client_handler);
int ulfius_websocket_client_connection_status(struct _websocket_client_handler * websocket_client_handler);
int ulfius_websocket_client_connection_wait_close(struct _websocket_client_handler * websocket_client_handler, unsigned int timeout);
int ulfius_set_websocket_request(struct _u_request * request,
const char * url,
const char * websocket_protocol,
const char * websocket_extensions);
#endif
#define ULFIUS_URL_SEPARATOR "/"
#define ULFIUS_HTTP_ENCODING_JSON "application/json"
#define ULFIUS_HTTP_HEADER_CONTENT "Content-Type"
#define ULFIUS_HTTP_NOT_FOUND_BODY "Resource not found"
#define ULFIUS_HTTP_ERROR_BODY "Server Error"
#define ULFIUS_COOKIE_ATTRIBUTE_EXPIRES "Expires"
#define ULFIUS_COOKIE_ATTRIBUTE_MAX_AGE "Max-Age"
#define ULFIUS_COOKIE_ATTRIBUTE_DOMAIN "Domain"
#define ULFIUS_COOKIE_ATTRIBUTE_PATH "Path"
#define ULFIUS_COOKIE_ATTRIBUTE_SECURE "Secure"
#define ULFIUS_COOKIE_ATTRIBUTE_HTTPONLY "HttpOnly"
#define ULFIUS_POSTBUFFERSIZE 65536
#define U_STATUS_STOP 0
#define U_STATUS_RUNNING 1
#define U_STATUS_ERROR 2
#ifndef U_DISABLE_WEBSOCKET
struct _websocket_handle {
char * websocket_protocol; /* !< protocol for the websocket */
char * websocket_extensions; /* !< extensions for the websocket */
void (* websocket_manager_callback) (const struct _u_request * request, /* !< callback function for working with the websocket */
struct _websocket_manager * websocket_manager,
void * websocket_manager_user_data);
void * websocket_manager_user_data; /* !< user-defined data that will be handled to websocket_manager_callback */
void (* websocket_incoming_message_callback) (const struct _u_request * request, /* !< callback function that will be called every time a message arrives from the client in the websocket */
struct _websocket_manager * websocket_manager,
const struct _websocket_message * message,
void * websocket_incoming_user_data);
void * websocket_incoming_user_data; /* !< user-defined data that will be handled to websocket_incoming_message_callback */
void (* websocket_onclose_callback) (const struct _u_request * request, /* !< callback function that will be called if the websocket is open while the program calls ulfius_stop_framework */
struct _websocket_manager * websocket_manager,
void * websocket_onclose_user_data);
void * websocket_onclose_user_data; /* !< user-defined data that will be handled to websocket_onclose_callback */
int rsv_expected;
struct _pointer_list * websocket_extension_list;
};
struct _websocket_handler {
pthread_mutex_t websocket_active_lock; /* !< mutex to change nb_websocket_active value */
size_t nb_websocket_active; /* !< number of active websocket */
struct _websocket ** websocket_active; /* !< array of active websocket */
pthread_mutex_t websocket_close_lock; /* !< mutex to broadcast close signal */
pthread_cond_t websocket_close_cond; /* !< condition to broadcast close signal */
int pthread_init;
};
#endif // U_DISABLE_WEBSOCKET
#ifndef U_DISABLE_GNUTLS
char * ulfius_export_client_certificate_pem(const struct _u_request * request);
int ulfius_import_client_certificate_pem(struct _u_request * request, const char * str_cert);
#endif // U_DISABLE_GNUTLS
#ifdef __cplusplus
}
#endif
#endif // __ULFIUS_H__
ulfius_export_client_certificate_pem
char * ulfius_export_client_certificate_pem(const struct _u_request *request)
Definition u_request.c:1008
ulfius_import_client_certificate_pem
int ulfius_import_client_certificate_pem(struct _u_request *request, const char *str_cert)
Definition u_request.c:1032
u_option
u_option
Definition ulfius.h:145
U_OPT_POST_BODY_PARAMETER_REMOVE
@ U_OPT_POST_BODY_PARAMETER_REMOVE
Remove from map containing the post body variables (if available), expected option value type: const ...
Definition ulfius.h:170
U_OPT_CHECK_PROXY_CERTIFICATE
@ U_OPT_CHECK_PROXY_CERTIFICATE
check proxy certificate and hostname, default true, used by ulfius_send_http_request,...
Definition ulfius.h:155
U_OPT_CLIENT_KEY_PASSWORD
@ U_OPT_CLIENT_KEY_PASSWORD
password to unlock client key file, available only if GnuTLS support is enabled, expected option valu...
Definition ulfius.h:179
U_OPT_STATUS
@ U_OPT_STATUS
HTTP response status code (200, 404, 500, etc), expected option value type: long.
Definition ulfius.h:181
U_OPT_FOLLOW_REDIRECT
@ U_OPT_FOLLOW_REDIRECT
follow url redirections, used by ulfius_send_http_request, expected option value type: int
Definition ulfius.h:157
U_OPT_COOKIE_PARAMETER
@ U_OPT_COOKIE_PARAMETER
Add to the map containing the cookie variables, expected option value type: const char *,...
Definition ulfius.h:165
U_OPT_TIMEOUT
@ U_OPT_TIMEOUT
connection timeout used by ulfius_send_http_request, default is 0 or Timeout in seconds to close the ...
Definition ulfius.h:159
U_OPT_AUTH_BASIC_USER
@ U_OPT_AUTH_BASIC_USER
basic authentication username, expected option value type: const char *
Definition ulfius.h:160
U_OPT_CA_PATH
@ U_OPT_CA_PATH
specify a path to CA certificates instead of system path, used by ulfius_send_http_request,...
Definition ulfius.h:158
U_OPT_AUTH_REALM
@ U_OPT_AUTH_REALM
realm to send to the client response on authenticationb failed, expected option value type: const cha...
Definition ulfius.h:182
U_OPT_HTTP_URL
@ U_OPT_HTTP_URL
full url used to call this callback function or full url to call when used in a ulfius_send_http_requ...
Definition ulfius.h:148
U_OPT_HEADER_PARAMETER_REMOVE
@ U_OPT_HEADER_PARAMETER_REMOVE
Remove from map containing the header variables, expected option value type: const char *.
Definition ulfius.h:168
U_OPT_CLIENT_CERT_FILE
@ U_OPT_CLIENT_CERT_FILE
path to client certificate file for sending http requests with certificate authentication,...
Definition ulfius.h:177
U_OPT_CLIENT_KEY_FILE
@ U_OPT_CLIENT_KEY_FILE
path to client key file for sending http requests with certificate authentication,...
Definition ulfius.h:178
U_OPT_JSON_BODY
@ U_OPT_JSON_BODY
Set a stringified json_t * body to the request or the reponse, expected option value type: json_t *.
Definition ulfius.h:174
U_OPT_HTTP_PROXY
@ U_OPT_HTTP_PROXY
proxy address to use for outgoing connections, used by ulfius_send_http_request, expected option valu...
Definition ulfius.h:149
U_OPT_COOKIE_PARAMETER_REMOVE
@ U_OPT_COOKIE_PARAMETER_REMOVE
Remove from map containing the cookie variables, expected option value type: const char *.
Definition ulfius.h:169
U_OPT_HTTP_VERB
@ U_OPT_HTTP_VERB
http method (GET, POST, PUT, DELETE, etc.), expected option value type: const char *
Definition ulfius.h:147
U_OPT_NONE
@ U_OPT_NONE
Empty option to complete a ulfius_set_request_properties or ulfius_set_request_properties.
Definition ulfius.h:146
U_OPT_BINARY_BODY
@ U_OPT_BINARY_BODY
Set a raw body to the request or the reponse, expected option value type: const char *,...
Definition ulfius.h:171
U_OPT_AUTH_BASIC_PASSWORD
@ U_OPT_AUTH_BASIC_PASSWORD
basic authentication password, expected option value type: const char *
Definition ulfius.h:161
U_OPT_SHARED_DATA
@ U_OPT_SHARED_DATA
any data shared between callback functions, must be allocated and freed by the callback functions,...
Definition ulfius.h:183
U_OPT_URL_PARAMETER_REMOVE
@ U_OPT_URL_PARAMETER_REMOVE
Remove from the map containing the url variables, both from the route and the ?key=value variables,...
Definition ulfius.h:167
U_OPT_CHECK_SERVER_CERTIFICATE
@ U_OPT_CHECK_SERVER_CERTIFICATE
check server certificate and hostname, default true, used by ulfius_send_http_request,...
Definition ulfius.h:153
U_OPT_POST_BODY_PARAMETER
@ U_OPT_POST_BODY_PARAMETER
Add to the map containing the post body variables (if available), expected option value type: const c...
Definition ulfius.h:166
U_OPT_CHECK_PROXY_CERTIFICATE_FLAG
@ U_OPT_CHECK_PROXY_CERTIFICATE_FLAG
check certificate peer and or proxy hostname if check_proxy_certificate is enabled,...
Definition ulfius.h:156
U_OPT_STRING_BODY
@ U_OPT_STRING_BODY
Set a char * body to the request or the reponse, expected option value type: const char *.
Definition ulfius.h:172
U_OPT_URL_PARAMETER
@ U_OPT_URL_PARAMETER
Add to the map containing the url variables, both from the route and the ?key=value variables,...
Definition ulfius.h:163
U_OPT_HEADER_PARAMETER
@ U_OPT_HEADER_PARAMETER
Add to the map containing the header variables, expected option value type: const char *,...
Definition ulfius.h:164
U_OPT_AUTH_BASIC
@ U_OPT_AUTH_BASIC
basic authentication user, then password, expected option value type: const char *,...
Definition ulfius.h:162
U_OPT_HTTP_URL_APPEND
@ U_OPT_HTTP_URL_APPEND
append char * value to the current url, expected option value type: const char *
Definition ulfius.h:184
U_OPT_CHECK_SERVER_CERTIFICATE_FLAG
@ U_OPT_CHECK_SERVER_CERTIFICATE_FLAG
check certificate peer and or server hostname if check_server_certificate is enabled,...
Definition ulfius.h:154
ulfius_add_cookie_to_response
int ulfius_add_cookie_to_response(struct _u_response *response, const char *key, const char *value, const char *expires, const unsigned int max_age, const char *domain, const char *path, const int secure, const int http_only)
Definition u_response.c:206
ulfius_add_same_site_cookie_to_response
int ulfius_add_same_site_cookie_to_response(struct _u_response *response, const char *key, const char *value, const char *expires, const unsigned int max_age, const char *domain, const char *path, const int secure, const int http_only, const int same_site)
Definition u_response.c:211
ulfius_clean_endpoint_list
void ulfius_clean_endpoint_list(struct _u_endpoint *endpoint_list)
Definition ulfius.c:1394
ulfius_add_endpoint_list
int ulfius_add_endpoint_list(struct _u_instance *u_instance, const struct _u_endpoint **u_endpoint_list)
Definition ulfius.c:1445
ulfius_add_endpoint
int ulfius_add_endpoint(struct _u_instance *u_instance, const struct _u_endpoint *u_endpoint)
Definition ulfius.c:1405
ulfius_remove_endpoint
int ulfius_remove_endpoint(struct _u_instance *u_instance, const struct _u_endpoint *u_endpoint)
Definition ulfius.c:1462
ulfius_copy_endpoint
int ulfius_copy_endpoint(struct _u_endpoint *dest, const struct _u_endpoint *source)
Definition ulfius.c:1336
ulfius_empty_endpoint
const struct _u_endpoint * ulfius_empty_endpoint(void)
Definition ulfius.c:1516
ulfius_remove_endpoint_by_val
int ulfius_remove_endpoint_by_val(struct _u_instance *u_instance, const char *http_method, const char *url_prefix, const char *url_format)
Definition ulfius.c:1568
ulfius_add_endpoint_by_val
int ulfius_add_endpoint_by_val(struct _u_instance *u_instance, const char *http_method, const char *url_prefix, const char *url_format, unsigned int priority, int(*callback_function)(const struct _u_request *request, struct _u_response *response, void *user_data), void *user_data)
Definition ulfius.c:1545
ulfius_duplicate_endpoint_list
struct _u_endpoint * ulfius_duplicate_endpoint_list(const struct _u_endpoint *endpoint_list)
Definition ulfius.c:1358
ulfius_equals_endpoints
int ulfius_equals_endpoints(const struct _u_endpoint *endpoint1, const struct _u_endpoint *endpoint2)
Definition ulfius.c:1527
ulfius_set_default_endpoint
int ulfius_set_default_endpoint(struct _u_instance *u_instance, int(*callback_function)(const struct _u_request *request, struct _u_response *response, void *user_data), void *user_data)
Definition ulfius.c:1581
ulfius_clean_endpoint
void ulfius_clean_endpoint(struct _u_endpoint *endpoint)
Definition ulfius.c:1379
ulfius_send_smtp_email
int ulfius_send_smtp_email(const char *host, const int port, const int use_tls, const int verify_certificate, const char *user, const char *password, const char *from, const char *to, const char *cc, const char *bcc, const char *subject, const char *mail_body)
Definition u_send_request.c:1028
ulfius_send_http_streaming_request
int ulfius_send_http_streaming_request(const struct _u_request *request, struct _u_response *response, size_t(*write_body_function)(void *contents, size_t size, size_t nmemb, void *user_data), void *write_body_data)
Definition u_send_request.c:267
ulfius_send_http_request_with_limit
int ulfius_send_http_request_with_limit(const struct _u_request *request, struct _u_response *response, size_t response_body_limit, size_t max_header)
Definition u_send_request.c:230
ulfius_send_smtp_rich_email
int ulfius_send_smtp_rich_email(const char *host, const int port, const int use_tls, const int verify_certificate, const char *user, const char *password, const char *from, const char *to, const char *cc, const char *bcc, const char *content_type, const char *subject, const char *mail_body)
Definition u_send_request.c:824
ulfius_send_http_request
int ulfius_send_http_request(const struct _u_request *request, struct _u_response *response)
Definition u_send_request.c:192
ulfius_send_http_streaming_request_max_header
int ulfius_send_http_streaming_request_max_header(const struct _u_request *request, struct _u_response *response, size_t(*write_body_function)(void *contents, size_t size, size_t nmemb, void *user_data), void *write_body_data, size_t max_header)
Definition u_send_request.c:281
mhd_request_completed
void mhd_request_completed(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition ulfius.c:307
ulfius_init_instance
int ulfius_init_instance(struct _u_instance *u_instance, unsigned int port, struct sockaddr_in *bind_address, const char *default_auth_realm)
Definition ulfius.c:1732
ulfius_clean_instance
void ulfius_clean_instance(struct _u_instance *u_instance)
Definition ulfius.c:1624
ulfius_start_framework_with_mhd_options
int ulfius_start_framework_with_mhd_options(struct _u_instance *u_instance, unsigned int mhd_flags, struct MHD_OptionItem *mhd_ops)
Definition ulfius.c:1274
ulfius_stop_framework
int ulfius_stop_framework(struct _u_instance *u_instance)
Definition ulfius.c:1301
ulfius_start_secure_ca_trust_framework
int ulfius_start_secure_ca_trust_framework(struct _u_instance *u_instance, const char *key_pem, const char *cert_pem, const char *root_ca_pem)
Definition ulfius.c:1232
ulfius_start_framework
int ulfius_start_framework(struct _u_instance *u_instance)
Definition ulfius.c:1166
ulfius_uri_logger
void * ulfius_uri_logger(void *cls, const char *uri)
Definition ulfius.c:207
ulfius_start_secure_framework
int ulfius_start_secure_framework(struct _u_instance *u_instance, const char *key_pem, const char *cert_pem)
Definition ulfius.c:1183
ulfius_set_upload_file_callback_function
int ulfius_set_upload_file_callback_function(struct _u_instance *u_instance, int(*file_upload_callback)(const struct _u_request *request, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size, void *cls), void *cls)
Definition ulfius.c:1604
ulfius_global_close
void ulfius_global_close(void)
Definition ulfius.c:1930
ulfius_global_init
int ulfius_global_init(void)
Definition ulfius.c:1906
u_free
void u_free(void *data)
Definition ulfius.c:1746
ulfius_add_header_to_response
int ulfius_add_header_to_response(struct _u_response *response, const char *key, const char *value)
Definition u_response.c:717
ulfius_set_empty_body_request
int ulfius_set_empty_body_request(struct _u_request *request)
Definition u_request.c:751
ulfius_set_string_body_response
int ulfius_set_string_body_response(struct _u_response *response, const unsigned int status, const char *body)
Definition u_response.c:516
ulfius_set_string_body_request
int ulfius_set_string_body_request(struct _u_request *request, const char *string_body)
Definition u_request.c:704
ulfius_set_binary_body_response
int ulfius_set_binary_body_response(struct _u_response *response, const unsigned int status, const char *body, const size_t length)
Definition u_response.c:534
ulfius_set_binary_body_request
int ulfius_set_binary_body_request(struct _u_request *request, const char *binary_body, const size_t length)
Definition u_request.c:726
ulfius_set_empty_body_response
int ulfius_set_empty_body_response(struct _u_response *response, const unsigned int status)
Definition u_response.c:555
ulfius_copy_cookie
int ulfius_copy_cookie(struct _u_cookie *dest, const struct _u_cookie *source)
Definition u_response.c:307
ulfius_init_request
int ulfius_init_request(struct _u_request *request)
Definition u_request.c:267
ulfius_init_response
int ulfius_init_response(struct _u_response *response)
Definition u_response.c:373
ulfius_get_json_body_response
json_t * ulfius_get_json_body_response(struct _u_response *response, json_error_t *json_error)
Definition u_response.c:709
ulfius_get_json_body_request
json_t * ulfius_get_json_body_request(const struct _u_request *request, json_error_t *json_error)
Definition u_request.c:979
ulfius_copy_response
int ulfius_copy_response(struct _u_response *dest, const struct _u_response *source)
Definition u_response.c:426
ulfius_clean_request_full
int ulfius_clean_request_full(struct _u_request *request)
Definition u_request.c:366
ulfius_clean_response
int ulfius_clean_response(struct _u_response *response)
Definition u_response.c:332
ulfius_set_response_properties
int ulfius_set_response_properties(struct _u_response *response,...)
Definition u_response.c:594
ulfius_clean_request
int ulfius_clean_request(struct _u_request *request)
Definition u_request.c:323
ulfius_export_response_http
char * ulfius_export_response_http(const struct _u_response *response)
Definition u_response.c:725
ulfius_copy_request
int ulfius_copy_request(struct _u_request *dest, const struct _u_request *source)
Definition u_request.c:380
ulfius_export_request_http
char * ulfius_export_request_http(const struct _u_request *request)
Definition u_request.c:792
ulfius_set_json_body_response
int ulfius_set_json_body_response(struct _u_response *response, const unsigned int status, const json_t *j_body)
Definition u_response.c:682
ulfius_set_request_properties
int ulfius_set_request_properties(struct _u_request *request,...)
Definition u_request.c:494
ulfius_duplicate_response
struct _u_response * ulfius_duplicate_response(const struct _u_response *response)
Definition u_response.c:493
ulfius_duplicate_request
struct _u_request * ulfius_duplicate_request(const struct _u_request *request)
Definition u_request.c:767
ulfius_clean_cookie
int ulfius_clean_cookie(struct _u_cookie *cookie)
Definition u_response.c:289
ulfius_set_json_body_request
int ulfius_set_json_body_request(struct _u_request *request, json_t *j_body)
Definition u_request.c:953
ulfius_clean_response_full
int ulfius_clean_response_full(struct _u_response *response)
Definition u_response.c:364
ulfius_set_response_shared_data
int ulfius_set_response_shared_data(struct _u_response *response, void *shared_data, void(*free_shared_data)(void *shared_data))
Definition u_response.c:663
ulfius_set_stream_response
int ulfius_set_stream_response(struct _u_response *response, const unsigned int status, ssize_t(*stream_callback)(void *stream_user_data, uint64_t offset, char *out_buf, size_t max), void(*stream_callback_free)(void *stream_user_data), uint64_t stream_size, size_t stream_block_size, void *stream_user_data)
Definition u_response.c:569
u_map_init
int u_map_init(struct _u_map *u_map)
Definition u_map.c:32
u_map_remove_from_value_binary
int u_map_remove_from_value_binary(struct _u_map *u_map, const char *key, size_t length)
Definition u_map.c:296
u_map_remove_from_key
int u_map_remove_from_key(struct _u_map *u_map, const char *key)
Definition u_map.c:246
u_map_clean
int u_map_clean(struct _u_map *u_map)
Definition u_map.c:70
u_map_remove_at
int u_map_remove_at(struct _u_map *u_map, const int index)
Definition u_map.c:342
u_map_get
const char * u_map_get(const struct _u_map *u_map, const char *key)
Definition u_map.c:377
u_map_remove_from_value_case
int u_map_remove_from_value_case(struct _u_map *u_map, const char *value)
Definition u_map.c:319
u_map_get_case_length
ssize_t u_map_get_case_length(const struct _u_map *u_map, const char *key)
Definition u_map.c:447
u_map_remove_from_key_case
int u_map_remove_from_key_case(struct _u_map *u_map, const char *key)
Definition u_map.c:269
u_map_get_case
const char * u_map_get_case(const struct _u_map *u_map, const char *key)
Definition u_map.c:419
u_map_enum_values
const char ** u_map_enum_values(const struct _u_map *u_map)
Definition u_map.c:116
u_map_enum_keys
const char ** u_map_enum_keys(const struct _u_map *u_map)
Definition u_map.c:112
u_map_has_value
int u_map_has_value(const struct _u_map *u_map, const char *value)
Definition u_map.c:132
u_map_has_value_case
int u_map_has_value_case(const struct _u_map *u_map, const char *value)
Definition u_map.c:407
u_map_clean_enum
int u_map_clean_enum(char **array)
Definition u_map.c:98
u_map_clean_full
int u_map_clean_full(struct _u_map *u_map)
Definition u_map.c:89
u_map_has_key_case
int u_map_has_key_case(const struct _u_map *u_map, const char *key)
Definition u_map.c:395
u_map_get_length
ssize_t u_map_get_length(const struct _u_map *u_map, const char *key)
Definition u_map.c:433
u_map_empty
int u_map_empty(struct _u_map *u_map)
Definition u_map.c:516
u_map_copy_into
int u_map_copy_into(struct _u_map *dest, const struct _u_map *source)
Definition u_map.c:489
u_map_put
int u_map_put(struct _u_map *u_map, const char *key, const char *value)
Definition u_map.c:148
u_map_has_value_binary
int u_map_has_value_binary(const struct _u_map *u_map, const char *value, size_t length)
Definition u_map.c:136
u_map_has_key
int u_map_has_key(const struct _u_map *u_map, const char *key)
Definition u_map.c:120
u_map_remove_from_value
int u_map_remove_from_value(struct _u_map *u_map, const char *value)
Definition u_map.c:292
u_map_put_binary
int u_map_put_binary(struct _u_map *u_map, const char *key, const char *value, uint64_t offset, size_t length)
Definition u_map.c:156
u_map_count
int u_map_count(const struct _u_map *source)
Definition u_map.c:507
u_map_copy
struct _u_map * u_map_copy(const struct _u_map *source)
Definition u_map.c:461
ulfius_url_decode
char * ulfius_url_decode(const char *str)
Definition ulfius.c:1877
ulfius_url_encode
char * ulfius_url_encode(const char *str)
Definition ulfius.c:1843
_u_cookie
Definition ulfius.h:215
_u_cookie::key
char * key
Definition ulfius.h:216
_u_cookie::path
char * path
Definition ulfius.h:221
_u_cookie::expires
char * expires
Definition ulfius.h:218
_u_cookie::domain
char * domain
Definition ulfius.h:220
_u_cookie::http_only
int http_only
Definition ulfius.h:223
_u_cookie::secure
int secure
Definition ulfius.h:222
_u_cookie::same_site
int same_site
Definition ulfius.h:224
_u_cookie::value
char * value
Definition ulfius.h:217
_u_cookie::max_age
unsigned int max_age
Definition ulfius.h:219
_u_endpoint
Contains all informations needed for an endpoint.
Definition ulfius.h:299
_u_endpoint::callback_function
int(* callback_function)(const struct _u_request *request, struct _u_response *response, void *user_data)
Definition ulfius.h:304
_u_endpoint::user_data
void * user_data
Definition ulfius.h:307
_u_endpoint::priority
unsigned int priority
Definition ulfius.h:303
_u_endpoint::http_method
char * http_method
Definition ulfius.h:300
_u_endpoint::url_format
char * url_format
Definition ulfius.h:302
_u_endpoint::url_prefix
char * url_prefix
Definition ulfius.h:301
_u_instance
Contains the needed data for an ulfius instance to work.
Definition ulfius.h:316
_u_instance::status
int status
Definition ulfius.h:318
_u_instance::max_post_param_size
size_t max_post_param_size
Definition ulfius.h:331
_u_instance::mhd_daemon
struct MHD_Daemon * mhd_daemon
Definition ulfius.h:317
_u_instance::allowed_post_processor
int allowed_post_processor
Definition ulfius.h:349
_u_instance::port
unsigned int port
Definition ulfius.h:319
_u_instance::timeout
unsigned int timeout
Definition ulfius.h:325
_u_instance::max_post_body_size
size_t max_post_body_size
Definition ulfius.h:332
_u_instance::bind_address
struct sockaddr_in * bind_address
Definition ulfius.h:323
_u_instance::file_upload_cls
void * file_upload_cls
Definition ulfius.h:343
_u_instance::default_headers
struct _u_map * default_headers
Definition ulfius.h:330
_u_instance::check_utf8
int check_utf8
Definition ulfius.h:345
_u_instance::bind_address6
struct sockaddr_in6 * bind_address6
Definition ulfius.h:324
_u_instance::endpoint_list
struct _u_endpoint * endpoint_list
Definition ulfius.h:328
_u_instance::nb_endpoints
int nb_endpoints
Definition ulfius.h:326
_u_instance::default_endpoint
struct _u_endpoint * default_endpoint
Definition ulfius.h:329
_u_instance::websocket_handler
void * websocket_handler
Definition ulfius.h:333
_u_instance::file_upload_callback
int(* file_upload_callback)(const struct _u_request *request, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size, void *cls)
Definition ulfius.h:334
_u_instance::default_auth_realm
char * default_auth_realm
Definition ulfius.h:327
_u_instance::mhd_response_copy_data
int mhd_response_copy_data
Definition ulfius.h:344
_u_instance::use_client_cert_auth
int use_client_cert_auth
Definition ulfius.h:347
_u_map
Definition ulfius.h:204
_u_map::nb_values
int nb_values
Definition ulfius.h:205
_u_map::lengths
size_t * lengths
Definition ulfius.h:208
_u_map::keys
char ** keys
Definition ulfius.h:206
_u_map::values
char ** values
Definition ulfius.h:207
_u_request
definition of the parameters available in a struct _u_request
Definition ulfius.h:233
_u_request::timeout
unsigned long timeout
Definition ulfius.h:248
_u_request::check_server_certificate_flag
int check_server_certificate_flag
Definition ulfius.h:243
_u_request::follow_redirect
int follow_redirect
Definition ulfius.h:246
_u_request::auth_basic_password
char * auth_basic_password
Definition ulfius.h:251
_u_request::http_protocol
char * http_protocol
Definition ulfius.h:234
_u_request::check_proxy_certificate_flag
int check_proxy_certificate_flag
Definition ulfius.h:245
_u_request::client_key_password
char * client_key_password
Definition ulfius.h:263
_u_request::binary_body
void * binary_body
Definition ulfius.h:256
_u_request::client_cert
gnutls_x509_crt_t client_cert
Definition ulfius.h:260
_u_request::map_cookie
struct _u_map * map_cookie
Definition ulfius.h:254
_u_request::binary_body_length
size_t binary_body_length
Definition ulfius.h:257
_u_request::map_header
struct _u_map * map_header
Definition ulfius.h:253
_u_request::check_server_certificate
int check_server_certificate
Definition ulfius.h:242
_u_request::client_address
struct sockaddr * client_address
Definition ulfius.h:249
_u_request::ca_path
char * ca_path
Definition ulfius.h:247
_u_request::map_post_body
struct _u_map * map_post_body
Definition ulfius.h:255
_u_request::check_proxy_certificate
int check_proxy_certificate
Definition ulfius.h:244
_u_request::client_key_file
char * client_key_file
Definition ulfius.h:262
_u_request::url_path
char * url_path
Definition ulfius.h:237
_u_request::auth_basic_user
char * auth_basic_user
Definition ulfius.h:250
_u_request::http_verb
char * http_verb
Definition ulfius.h:235
_u_request::callback_position
unsigned int callback_position
Definition ulfius.h:258
_u_request::proxy
char * proxy
Definition ulfius.h:238
_u_request::http_url
char * http_url
Definition ulfius.h:236
_u_request::map_url
struct _u_map * map_url
Definition ulfius.h:252
_u_request::client_cert_file
char * client_cert_file
Definition ulfius.h:261
_u_response
definition of the parameters available in a struct _u_response
Definition ulfius.h:273
_u_response::protocol
char * protocol
Definition ulfius.h:275
_u_response::stream_block_size
size_t stream_block_size
Definition ulfius.h:285
_u_response::stream_user_data
void * stream_user_data
Definition ulfius.h:286
_u_response::stream_callback
ssize_t(* stream_callback)(void *stream_user_data, uint64_t offset, char *out_buf, size_t max)
Definition ulfius.h:282
_u_response::websocket_handle
void * websocket_handle
Definition ulfius.h:287
_u_response::stream_size
uint64_t stream_size
Definition ulfius.h:284
_u_response::binary_body_length
size_t binary_body_length
Definition ulfius.h:281
_u_response::map_header
struct _u_map * map_header
Definition ulfius.h:276
_u_response::status
long status
Definition ulfius.h:274
_u_response::nb_cookies
unsigned int nb_cookies
Definition ulfius.h:277
_u_response::timeout
unsigned int timeout
Definition ulfius.h:290
_u_response::map_cookie
struct _u_cookie * map_cookie
Definition ulfius.h:278
_u_response::auth_realm
char * auth_realm
Definition ulfius.h:279
_u_response::stream_callback_free
void(* stream_callback_free)(void *stream_user_data)
Definition ulfius.h:283
_u_response::free_shared_data
void(* free_shared_data)(void *shared_data)
Definition ulfius.h:289
_u_response::binary_body
void * binary_body
Definition ulfius.h:280
_u_response::shared_data
void * shared_data
Definition ulfius.h:288
connection_info_struct
Definition ulfius.h:359
connection_info_struct::request
struct _u_request * request
Definition ulfius.h:364
connection_info_struct::map_url_initial
struct _u_map map_url_initial
Definition ulfius.h:366
connection_info_struct::u_instance
struct _u_instance * u_instance
Definition ulfius.h:360
connection_info_struct::max_post_param_size
size_t max_post_param_size
Definition ulfius.h:365
connection_info_struct::post_processor
struct MHD_PostProcessor * post_processor
Definition ulfius.h:361
connection_info_struct::callback_first_iteration
int callback_first_iteration
Definition ulfius.h:363
connection_info_struct::has_post_processor
int has_post_processor
Definition ulfius.h:362
websocket_extension_message_in_inflate
int websocket_extension_message_in_inflate(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context)
Definition u_websocket.c:2040
ulfius_add_websocket_extension_message_perform
int ulfius_add_websocket_extension_message_perform(struct _u_response *response, const char *extension_server, uint8_t rsv, int(*websocket_extension_message_out_perform)(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context), void *websocket_extension_message_out_perform_user_data, int(*websocket_extension_message_in_perform)(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context), void *websocket_extension_message_in_perform_user_data, int(*websocket_extension_server_match)(const char *extension_client, const char **extension_client_list, char **extension_server, void *user_data, void **context), void *websocket_extension_server_match_user_data, void(*websocket_extension_free_context)(void *user_data, void *context), void *websocket_extension_free_context_user_data)
Definition u_websocket.c:1881
ulfius_websocket_client_connection_send_close_signal
int ulfius_websocket_client_connection_send_close_signal(struct _websocket_client_handler *websocket_client_handler)
Definition u_websocket.c:2761
ulfius_websocket_send_close_signal
int ulfius_websocket_send_close_signal(struct _websocket_manager *websocket_manager)
Definition u_websocket.c:2278
websocket_extension_server_match_deflate
int websocket_extension_server_match_deflate(const char *extension_client, const char **extension_client_list, char **extension_server, void *user_data, void **context)
Definition u_websocket.c:2118
ulfius_add_websocket_client_deflate_extension
int ulfius_add_websocket_client_deflate_extension(struct _websocket_client_handler *websocket_client_handler)
Definition u_websocket.c:2752
ulfius_websocket_client_connection_wait_close
int ulfius_websocket_client_connection_wait_close(struct _websocket_client_handler *websocket_client_handler, unsigned int timeout)
Definition u_websocket.c:2815
ulfius_add_websocket_client_extension_message_perform
int ulfius_add_websocket_client_extension_message_perform(struct _websocket_client_handler *websocket_client_handler, const char *extension, uint8_t rsv, int(*websocket_extension_message_out_perform)(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context), void *websocket_extension_message_out_perform_user_data, int(*websocket_extension_message_in_perform)(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context), void *websocket_extension_message_in_perform_user_data, int(*websocket_extension_client_match)(const char *extension_server, void *user_data, void **context), void *websocket_extension_client_match_user_data, void(*websocket_extension_free_context)(void *user_data, void *context), void *websocket_extension_free_context_user_data)
Definition u_websocket.c:2438
ulfius_websocket_client_connection_status
int ulfius_websocket_client_connection_status(struct _websocket_client_handler *websocket_client_handler)
Definition u_websocket.c:2801
ulfius_websocket_parse_json_message
json_t * ulfius_websocket_parse_json_message(const struct _websocket_message *message, json_error_t *json_error)
Definition u_websocket.c:1614
ulfius_websocket_wait_close
int ulfius_websocket_wait_close(struct _websocket_manager *websocket_manager, unsigned int timeout)
Definition u_websocket.c:2307
ulfius_websocket_status
int ulfius_websocket_status(struct _websocket_manager *websocket_manager)
Definition u_websocket.c:2293
ulfius_websocket_send_json_message
int ulfius_websocket_send_json_message(struct _websocket_manager *websocket_manager, json_t *j_message)
Definition u_websocket.c:1594
ulfius_websocket_pop_first_message
struct _websocket_message * ulfius_websocket_pop_first_message(struct _websocket_message_list *message_list)
Definition u_websocket.c:1629
ulfius_open_websocket_client_connection
int ulfius_open_websocket_client_connection(struct _u_request *request, void(*websocket_manager_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, void *websocket_manager_user_data), void *websocket_manager_user_data, void(*websocket_incoming_message_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, const struct _websocket_message *message, void *websocket_incoming_user_data), void *websocket_incoming_user_data, void(*websocket_onclose_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, void *websocket_onclose_user_data), void *websocket_onclose_user_data, struct _websocket_client_handler *websocket_client_handler, struct _u_response *response)
Definition u_websocket.c:2524
websocket_extension_message_out_deflate
int websocket_extension_message_out_deflate(const uint8_t opcode, const uint64_t data_len_in, const char *data_in, uint64_t *data_len_out, char **data_out, const uint64_t fragment_len, void *user_data, void *context)
Definition u_websocket.c:1950
ulfius_set_websocket_response
int ulfius_set_websocket_response(struct _u_response *response, const char *websocket_protocol, const char *websocket_extensions, void(*websocket_manager_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, void *websocket_manager_user_data), void *websocket_manager_user_data, void(*websocket_incoming_message_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, const struct _websocket_message *message, void *websocket_incoming_user_data), void *websocket_incoming_user_data, void(*websocket_onclose_callback)(const struct _u_request *request, struct _websocket_manager *websocket_manager, void *websocket_onclose_user_data), void *websocket_onclose_user_data)
Definition u_websocket.c:1834
ulfius_add_websocket_deflate_extension
int ulfius_add_websocket_deflate_extension(struct _u_response *response)
Definition u_websocket.c:2266
websocket_extension_deflate_free_context
void websocket_extension_deflate_free_context(void *user_data, void *context)
Definition u_websocket.c:2259
ulfius_websocket_client_connection_close
int ulfius_websocket_client_connection_close(struct _websocket_client_handler *websocket_client_handler)
Definition u_websocket.c:2774
ulfius_set_websocket_request
int ulfius_set_websocket_request(struct _u_request *request, const char *url, const char *websocket_protocol, const char *websocket_extensions)
Definition u_websocket.c:2396
ulfius_websocket_send_message
int ulfius_websocket_send_message(struct _websocket_manager *websocket_manager, const uint8_t opcode, const uint64_t data_len, const char *data)
Definition u_websocket.c:1582
ulfius_websocket_send_fragmented_message
int ulfius_websocket_send_fragmented_message(struct _websocket_manager *websocket_manager, const uint8_t opcode, const uint64_t data_len, const char *data, const uint64_t fragment_len)
Definition u_websocket.c:1482
websocket_extension_client_match_deflate
int websocket_extension_client_match_deflate(const char *extension_server, void *user_data, void **context)
Definition u_websocket.c:2641
ulfius_clear_websocket_message
void ulfius_clear_websocket_message(struct _websocket_message *message)
Definition u_websocket.c:1652