Ulfius: include/u_private.h Source File

Ulfius HTTP Framework for REST Applications in C

u_private.h
Go to the documentation of this file.
1
26#ifndef __U_PRIVATE_H__
27#define __U_PRIVATE_H__
28
30#define UNUSED(x) (void)(x)
31
36#ifdef U_WITH_FREERTOS
37 #include <FreeRTOS_Sockets.h>
38 #define sockaddr freertos_sockaddr
39 typedef unsigned long int socklen_t;
40#else
41 #ifdef U_WITH_LWIP
42 #include <lwip/sockets.h>
43 #endif // U_WITH_LWIP
44#endif // U_WITH_FREERTOS
45
46#include <ulfius.h>
47
48/**********************************
49 * Internal functions declarations
50 **********************************/
51
58struct _u_endpoint ** ulfius_endpoint_match(const char * method, const char * url, struct _u_endpoint * endpoint_list);
59
65int ulfius_parse_url(const char * url, const struct _u_endpoint * endpoint, struct _u_map * map, int check_utf8);
66
72int ulfius_set_response_header(struct MHD_Response * response, const struct _u_map * response_map_header);
73
79int ulfius_set_response_cookie(struct MHD_Response * mhd_response, const struct _u_response * response);
80
100const unsigned char * utf8_check(const char * s_orig, size_t len);
101
102#ifndef U_DISABLE_WEBSOCKET
103
104#define _U_W_BUFF_LEN 256
105#define _U_W_EXT_DEFLATE "permessage-deflate"
106#define _U_W_EXT_DEFLATE_S_CTX "server_no_context_takeover"
107#define _U_W_EXT_DEFLATE_C_CTX "client_no_context_takeover"
108
109void ulfius_free_websocket_extension_pointer_list(void * extension);
110
111void ulfius_free_websocket_extension(struct _websocket_extension * websocket_extension);
112
113int ulfius_init_websocket_extension(struct _websocket_extension * websocket_extension);
114
122void ulfius_start_websocket_cb (void *cls,
123 struct MHD_Connection *connection,
124 void *con_cls,
125 const char *extra_in,
126 size_t extra_in_size,
127 MHD_socket sock,
128 struct MHD_UpgradeResponseHandle *urh);
129
133int ulfius_generate_handshake_answer(const char * key, char * out_digest);
134
140int ulfius_check_list_match(const char * source, const char * match, const char * separator, char ** result);
141
147int ulfius_check_first_match(const char * source, const char * match, const char * separator, char ** result);
148
149#ifndef U_DISABLE_WS_MESSAGE_LIST
154int ulfius_init_websocket_message_list(struct _websocket_message_list * message_list);
155
159void ulfius_clear_websocket_message_list(struct _websocket_message_list * message_list);
160
165int ulfius_push_websocket_message(struct _websocket_message_list * message_list, struct _websocket_message * message);
166#endif
167
171int ulfius_clear_websocket(struct _websocket * websocket);
172
176void ulfius_clear_websocket_manager(struct _websocket_manager * websocket_manager);
177
181int ulfius_close_websocket(struct _websocket * websocket);
182
186int ulfius_instance_add_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
187
191int ulfius_instance_remove_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
192
197int ulfius_init_websocket(struct _websocket * websocket);
198
203int ulfius_init_websocket_manager(struct _websocket_manager * websocket_manager);
204
208int ulfius_check_handshake_response(const char * key, const char * response);
209
210#endif // U_DISABLE_WEBSOCKET
211
212#endif // __U_PRIVATE_H__
_u_endpoint
Contains all informations needed for an endpoint.
Definition ulfius.h:299
_u_instance
Contains the needed data for an ulfius instance to work.
Definition ulfius.h:316
_u_map
Definition ulfius.h:204
_u_response
definition of the parameters available in a struct _u_response
Definition ulfius.h:273
ulfius_generate_handshake_answer
int ulfius_generate_handshake_answer(const char *key, char *out_digest)
Definition u_websocket.c:1245
ulfius_clear_websocket
int ulfius_clear_websocket(struct _websocket *websocket)
Definition u_websocket.c:1667
ulfius_init_websocket_manager
int ulfius_init_websocket_manager(struct _websocket_manager *websocket_manager)
Definition u_websocket.c:1746
ulfius_instance_add_websocket_active
int ulfius_instance_add_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition u_websocket.c:1409
ulfius_clear_websocket_message_list
void ulfius_clear_websocket_message_list(struct _websocket_message_list *message_list)
Definition u_websocket.c:1694
ulfius_parse_url
int ulfius_parse_url(const char *url, const struct _u_endpoint *endpoint, struct _u_map *map, int check_utf8)
Definition u_request.c:196
utf8_check
const unsigned char * utf8_check(const char *s_orig, size_t len)
Definition ulfius.c:1769
ulfius_clear_websocket_manager
void ulfius_clear_websocket_manager(struct _websocket_manager *websocket_manager)
Definition u_websocket.c:1800
ulfius_check_handshake_response
int ulfius_check_handshake_response(const char *key, const char *response)
Definition u_websocket.c:1228
ulfius_set_response_cookie
int ulfius_set_response_cookie(struct MHD_Response *mhd_response, const struct _u_response *response)
Definition u_response.c:177
ulfius_init_websocket
int ulfius_init_websocket(struct _websocket *websocket)
Definition u_websocket.c:1711
ulfius_close_websocket
int ulfius_close_websocket(struct _websocket *websocket)
Definition u_websocket.c:1385
ulfius_check_first_match
int ulfius_check_first_match(const char *source, const char *match, const char *separator, char **result)
Definition u_websocket.c:1345
ulfius_init_websocket_message_list
int ulfius_init_websocket_message_list(struct _websocket_message_list *message_list)
Definition u_websocket.c:1273
ulfius_check_list_match
int ulfius_check_list_match(const char *source, const char *match, const char *separator, char **result)
Definition u_websocket.c:1308
ulfius_instance_remove_websocket_active
int ulfius_instance_remove_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition u_websocket.c:1434
ulfius_init_websocket_extension
int ulfius_init_websocket_extension(struct _websocket_extension *websocket_extension)
Definition u_websocket.c:76
ulfius_start_websocket_cb
void ulfius_start_websocket_cb(void *cls, struct MHD_Connection *connection, void *con_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh)
Definition u_websocket.c:1182
ulfius_free_websocket_extension_pointer_list
void ulfius_free_websocket_extension_pointer_list(void *extension)
Definition u_websocket.c:64
ulfius_free_websocket_extension
void ulfius_free_websocket_extension(struct _websocket_extension *websocket_extension)
Definition u_websocket.c:68
ulfius_set_response_header
int ulfius_set_response_header(struct MHD_Response *response, const struct _u_map *response_map_header)
Definition u_response.c:153
ulfius_endpoint_match
struct _u_endpoint ** ulfius_endpoint_match(const char *method, const char *url, struct _u_endpoint *endpoint_list)
Definition u_request.c:139
ulfius_push_websocket_message
int ulfius_push_websocket_message(struct _websocket_message_list *message_list, struct _websocket_message *message)
Definition u_websocket.c:1287
ulfius.h
Ulfius framework.