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
29 #include "ulfius.h"
30
32 #define UNUSED(x) (void)(x)
33
38 #ifdef U_WITH_FREERTOS
39 #include <FreeRTOS_Sockets.h>
40 #define sockaddr freertos_sockaddr
41 typedef unsigned long int socklen_t;
42 #else
43 #ifdef U_WITH_LWIP
44 #include <lwip/sockets.h>
45 #endif // U_WITH_LWIP
46 #endif // U_WITH_FREERTOS
47
48
49 /**********************************
50 * Internal functions declarations
51 **********************************/
52
59 struct _u_endpoint ** ulfius_endpoint_match(const char * method, const char * url, struct _u_endpoint * endpoint_list);
60
66 int ulfius_parse_url(const char * url, const struct _u_endpoint * endpoint, struct _u_map * map, int check_utf8);
67
73 int ulfius_set_response_header(struct MHD_Response * response, const struct _u_map * response_map_header);
74
80 int ulfius_set_response_cookie(struct MHD_Response * mhd_response, const struct _u_response * response);
81
101 const unsigned char * utf8_check(const char * s_orig, size_t len);
102
103 #ifndef U_DISABLE_WEBSOCKET
104
105 #define _U_W_BUFF_LEN 256
106 #define _U_W_EXT_DEFLATE "permessage-deflate"
107 #define _U_W_EXT_DEFLATE_S_CTX "server_no_context_takeover"
108 #define _U_W_EXT_DEFLATE_C_CTX "client_no_context_takeover"
109
110 void ulfius_free_websocket_extension_pointer_list(void * extension);
111
112 void ulfius_free_websocket_extension(struct _websocket_extension * websocket_extension);
113
114 int ulfius_init_websocket_extension(struct _websocket_extension * websocket_extension);
115
123 void ulfius_start_websocket_cb (void *cls,
124 struct MHD_Connection *connection,
125 void *con_cls,
126 const char *extra_in,
127 size_t extra_in_size,
128 MHD_socket sock,
129 struct MHD_UpgradeResponseHandle *urh);
130
134 int ulfius_generate_handshake_answer(const char * key, char * out_digest);
135
141 int ulfius_check_list_match(const char * source, const char * match, const char * separator, char ** result);
142
148 int ulfius_check_first_match(const char * source, const char * match, const char * separator, char ** result);
149
154 int ulfius_init_websocket_message_list(struct _websocket_message_list * message_list);
155
159 void ulfius_clear_websocket_message_list(struct _websocket_message_list * message_list);
160
165 int ulfius_push_websocket_message(struct _websocket_message_list * message_list, struct _websocket_message * message);
166
170 int ulfius_clear_websocket(struct _websocket * websocket);
171
175 void ulfius_clear_websocket_manager(struct _websocket_manager * websocket_manager);
176
180 int ulfius_close_websocket(struct _websocket * websocket);
181
185 int ulfius_instance_add_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
186
190 int ulfius_instance_remove_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
191
196 int ulfius_init_websocket(struct _websocket * websocket);
197
202 int ulfius_init_websocket_manager(struct _websocket_manager * websocket_manager);
203
207 int ulfius_check_handshake_response(const char * key, const char * response);
208
209 #endif // U_DISABLE_WEBSOCKET
210
211 #endif // __U_PRIVATE_H__
_u_endpoint
Contains all informations needed for an endpoint.
Definition: ulfius.h:293
_u_instance
Contains the needed data for an ulfius instance to work.
Definition: ulfius.h:310
_u_map
Definition: ulfius.h:198
_u_response
definition of the parameters available in a struct _u_response
Definition: ulfius.h:267
utf8_check
const unsigned char * utf8_check(const char *s_orig, size_t len)
Definition: ulfius.c:1767
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:231
ulfius_set_response_cookie
int ulfius_set_response_cookie(struct MHD_Response *mhd_response, const struct _u_response *response)
Definition: u_response.c:175
ulfius_endpoint_match
struct _u_endpoint ** ulfius_endpoint_match(const char *method, const char *url, struct _u_endpoint *endpoint_list)
Definition: u_request.c:174
ulfius_set_response_header
int ulfius_set_response_header(struct MHD_Response *response, const struct _u_map *response_map_header)
Definition: u_response.c:156
ulfius_generate_handshake_answer
int ulfius_generate_handshake_answer(const char *key, char *out_digest)
Definition: u_websocket.c:1211
ulfius_clear_websocket
int ulfius_clear_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1600
ulfius_init_websocket_manager
int ulfius_init_websocket_manager(struct _websocket_manager *websocket_manager)
Definition: u_websocket.c:1676
ulfius_instance_add_websocket_active
int ulfius_instance_add_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition: u_websocket.c:1370
ulfius_clear_websocket_message_list
void ulfius_clear_websocket_message_list(struct _websocket_message_list *message_list)
Definition: u_websocket.c:1626
ulfius_clear_websocket_manager
void ulfius_clear_websocket_manager(struct _websocket_manager *websocket_manager)
Definition: u_websocket.c:1724
ulfius_check_handshake_response
int ulfius_check_handshake_response(const char *key, const char *response)
Definition: u_websocket.c:1194
ulfius_init_websocket
int ulfius_init_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1642
ulfius_close_websocket
int ulfius_close_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1348
ulfius_check_first_match
int ulfius_check_first_match(const char *source, const char *match, const char *separator, char **result)
Definition: u_websocket.c:1308
ulfius_init_websocket_message_list
int ulfius_init_websocket_message_list(struct _websocket_message_list *message_list)
Definition: u_websocket.c:1237
ulfius_check_list_match
int ulfius_check_list_match(const char *source, const char *match, const char *separator, char **result)
Definition: u_websocket.c:1271
ulfius_instance_remove_websocket_active
int ulfius_instance_remove_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition: u_websocket.c:1395
ulfius_init_websocket_extension
int ulfius_init_websocket_extension(struct _websocket_extension *websocket_extension)
Definition: u_websocket.c:72
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:1148
ulfius_free_websocket_extension_pointer_list
void ulfius_free_websocket_extension_pointer_list(void *extension)
Definition: u_websocket.c:60
ulfius_free_websocket_extension
void ulfius_free_websocket_extension(struct _websocket_extension *websocket_extension)
Definition: u_websocket.c:64
ulfius_push_websocket_message
int ulfius_push_websocket_message(struct _websocket_message_list *message_list, struct _websocket_message *message)
Definition: u_websocket.c:1251
ulfius.h
Ulfius framework.