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 
58 struct _u_endpoint ** ulfius_endpoint_match(const char * method, const char * url, struct _u_endpoint * endpoint_list);
59 
65 int ulfius_parse_url(const char * url, const struct _u_endpoint * endpoint, struct _u_map * map, int check_utf8);
66 
72 int ulfius_set_response_header(struct MHD_Response * response, const struct _u_map * response_map_header);
73 
79 int ulfius_set_response_cookie(struct MHD_Response * mhd_response, const struct _u_response * response);
80 
100 const 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 
109 void ulfius_free_websocket_extension_pointer_list(void * extension);
110 
111 void ulfius_free_websocket_extension(struct _websocket_extension * websocket_extension);
112 
113 int ulfius_init_websocket_extension(struct _websocket_extension * websocket_extension);
114 
122 void 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 
133 int ulfius_generate_handshake_answer(const char * key, char * out_digest);
134 
140 int ulfius_check_list_match(const char * source, const char * match, const char * separator, char ** result);
141 
147 int ulfius_check_first_match(const char * source, const char * match, const char * separator, char ** result);
148 
149 #ifndef U_DISABLE_WS_MESSAGE_LIST
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 #endif
167 
171 int ulfius_clear_websocket(struct _websocket * websocket);
172 
176 void ulfius_clear_websocket_manager(struct _websocket_manager * websocket_manager);
177 
181 int ulfius_close_websocket(struct _websocket * websocket);
182 
186 int ulfius_instance_add_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
187 
191 int ulfius_instance_remove_websocket_active(struct _u_instance * instance, struct _websocket * websocket);
192 
197 int ulfius_init_websocket(struct _websocket * websocket);
198 
203 int ulfius_init_websocket_manager(struct _websocket_manager * websocket_manager);
204 
208 int ulfius_check_handshake_response(const char * key, const char * response);
209 
210 #endif // U_DISABLE_WEBSOCKET
211 
212 #endif // __U_PRIVATE_H__
Contains all informations needed for an endpoint.
Definition: ulfius.h:299
Contains the needed data for an ulfius instance to work.
Definition: ulfius.h:316
Definition: ulfius.h:204
definition of the parameters available in a struct _u_response
Definition: ulfius.h:273
int ulfius_generate_handshake_answer(const char *key, char *out_digest)
Definition: u_websocket.c:1245
const unsigned char * utf8_check(const char *s_orig, size_t len)
Definition: ulfius.c:1769
int ulfius_clear_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1667
int ulfius_init_websocket_manager(struct _websocket_manager *websocket_manager)
Definition: u_websocket.c:1746
int ulfius_instance_add_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition: u_websocket.c:1409
void ulfius_clear_websocket_message_list(struct _websocket_message_list *message_list)
Definition: u_websocket.c:1694
int ulfius_parse_url(const char *url, const struct _u_endpoint *endpoint, struct _u_map *map, int check_utf8)
Definition: u_request.c:196
void ulfius_clear_websocket_manager(struct _websocket_manager *websocket_manager)
Definition: u_websocket.c:1800
int ulfius_check_handshake_response(const char *key, const char *response)
Definition: u_websocket.c:1228
int ulfius_set_response_cookie(struct MHD_Response *mhd_response, const struct _u_response *response)
Definition: u_response.c:177
int ulfius_init_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1711
int ulfius_close_websocket(struct _websocket *websocket)
Definition: u_websocket.c:1385
int ulfius_check_first_match(const char *source, const char *match, const char *separator, char **result)
Definition: u_websocket.c:1345
int ulfius_init_websocket_message_list(struct _websocket_message_list *message_list)
Definition: u_websocket.c:1273
int ulfius_check_list_match(const char *source, const char *match, const char *separator, char **result)
Definition: u_websocket.c:1308
int ulfius_instance_remove_websocket_active(struct _u_instance *instance, struct _websocket *websocket)
Definition: u_websocket.c:1434
int ulfius_init_websocket_extension(struct _websocket_extension *websocket_extension)
Definition: u_websocket.c:76
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
void ulfius_free_websocket_extension_pointer_list(void *extension)
Definition: u_websocket.c:64
void ulfius_free_websocket_extension(struct _websocket_extension *websocket_extension)
Definition: u_websocket.c:68
struct _u_endpoint ** ulfius_endpoint_match(const char *method, const char *url, struct _u_endpoint *endpoint_list)
Definition: u_request.c:139
int ulfius_set_response_header(struct MHD_Response *response, const struct _u_map *response_map_header)
Definition: u_response.c:153
int ulfius_push_websocket_message(struct _websocket_message_list *message_list, struct _websocket_message *message)
Definition: u_websocket.c:1287
Ulfius framework.