diff options
Diffstat (limited to 'tinyHTTP/include')
26 files changed, 375 insertions, 407 deletions
diff --git a/tinyHTTP/include/thttp.h b/tinyHTTP/include/thttp.h index e2ec237..71da8e8 100755 --- a/tinyHTTP/include/thttp.h +++ b/tinyHTTP/include/thttp.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -42,12 +42,12 @@ /**@def THTTP_STACK_SET_LOCAL_IP(STR) * Sets local IP address to bind to. By default, the stack will bind to "0.0.0.0" or "::" depending on -* whether IPv4 is used or not (IPv6). +* whether IPv4 is used or not (IPv6). * This is a helper macro for @ref thttp_stack_create and @ref thttp_stack_set. * @param IP_STR The IP address (const char*). * * @code -* thttp_stack_create(callback, +* thttp_stack_create(callback, * THTTP_STACK_SET_LOCAL_IP("192.168.0.15"), * THTTP_STACK_SET_NULL()); * @endcode @@ -60,7 +60,7 @@ * @param PORT_INT The Port (int32_t). * * @code -* thttp_stack_create(callback, +* thttp_stack_create(callback, * THTTP_STACK_SET_LOCAL_PORT(1234), * THTTP_STACK_SET_NULL()); * @endcode @@ -75,7 +75,7 @@ * @param PRIV_FILE_STR Path to the Private key file. * * @code -* thttp_stack_create(callback, +* thttp_stack_create(callback, * THTTP_STACK_SET_TLS_CERTS("C:\\tls\\ca.pki-crt.pem", "C:\\tls\\pub-crt.pem", "C:\\tls\\priv-key.pem"), * THTTP_STACK_SET_NULL()); * @endcode @@ -83,80 +83,77 @@ THTTP_BEGIN_DECLS -typedef enum thttp_stack_param_type_e -{ - thttp_pname_null = 0, +typedef enum thttp_stack_param_type_e { + thttp_pname_null = 0, #define THTTP_STACK_SET_NULL() thttp_pname_null - /* Network */ - thttp_pname_local_ip, - thttp_pname_local_port, - thttp_pname_proxy, + /* Network */ + thttp_pname_local_ip, + thttp_pname_local_port, + thttp_pname_proxy, #define THTTP_STACK_SET_LOCAL_IP(IP_STR) thttp_pname_local_ip, (const char*)IP_STR #define THTTP_STACK_SET_LOCAL_PORT(PORT_INT) thttp_pname_local_port, (int)PORT_INT #define THTTP_STACK_SET_PROXY(IP_STR, PORT_INT) thttp_pname_proxy, (const char*)IP_STR, (int)PORT_INT - /* Modes */ - thttp_pname_mode_client, - thttp_pname_mode_server, + /* Modes */ + thttp_pname_mode_client, + thttp_pname_mode_server, #define THTTP_STACK_SET_MODE_CLIENT() thttp_pname_mode_client #define THTTP_STACK_SET_MODE_SERVER() thttp_pname_mode_server - /* TLS */ - thttp_pname_tls_enabled, + /* TLS */ + thttp_pname_tls_enabled, #define THTTP_STACK_SET_TLS_ENABLED(ENABLED_BOOL) thttp_pname_tls_enabled, (tsk_bool_t)ENABLED_BOOL - thttp_pname_tls_certs_verify, + thttp_pname_tls_certs_verify, #define THTTP_STACK_SET_TLS_CERTS_VERIFY(CERTS_VERIFY_BOOL) thttp_pname_tls_certs_verify, (tsk_bool_t)CERTS_VERIFY_BOOL - thttp_pname_tls_certs, + thttp_pname_tls_certs, #define THTTP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) thttp_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR - /* User Data */ - thttp_pname_userdata, + /* User Data */ + thttp_pname_userdata, #define THTTP_STACK_SET_USERDATA(USERDATA_PTR) thttp_pname_userdata, (const void*)USERDATA_PTR } thttp_stack_param_type_t; -typedef enum thttp_stack_mode_e -{ - thttp_stack_mode_none, - thttp_stack_mode_client = (0x01 << 0), - thttp_stack_mode_server = (0x01 << 1), - thttp_stack_mode_hybrid = (thttp_stack_mode_client | thttp_stack_mode_server) +typedef enum thttp_stack_mode_e { + thttp_stack_mode_none, + thttp_stack_mode_client = (0x01 << 0), + thttp_stack_mode_server = (0x01 << 1), + thttp_stack_mode_hybrid = (thttp_stack_mode_client | thttp_stack_mode_server) } thttp_stack_mode_t; /** HTTP/HTTPS Stack. */ -typedef struct thttp_stack_s -{ - TSK_DECLARE_OBJECT; - - tsk_bool_t started; - enum thttp_stack_mode_e mode; - thttp_stack_callback_f callback; - - /* Network */ - char* local_ip; - int local_port; - char* proxy_ip; - int proxy_port; - tnet_transport_t *transport; - - /* TLS */ - struct { - tsk_bool_t enabled; - tsk_bool_t verify; - char* ca; - char* pbk; - char* pvk; - }tls; - - thttp_sessions_L_t* sessions; - - const void* userdata; - - TSK_DECLARE_SAFEOBJ; +typedef struct thttp_stack_s { + TSK_DECLARE_OBJECT; + + tsk_bool_t started; + enum thttp_stack_mode_e mode; + thttp_stack_callback_f callback; + + /* Network */ + char* local_ip; + int local_port; + char* proxy_ip; + int proxy_port; + tnet_transport_t *transport; + + /* TLS */ + struct { + tsk_bool_t enabled; + tsk_bool_t verify; + char* ca; + char* pbk; + char* pvk; + } tls; + + thttp_sessions_L_t* sessions; + + const void* userdata; + + TSK_DECLARE_SAFEOBJ; } thttp_stack_t; diff --git a/tinyHTTP/include/tinyhttp.h b/tinyHTTP/include/tinyhttp.h index a374cad..cbef7da 100755 --- a/tinyHTTP/include/tinyhttp.h +++ b/tinyHTTP/include/tinyhttp.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyHTTP/include/tinyhttp/auth/thttp_auth.h b/tinyHTTP/include/tinyhttp/auth/thttp_auth.h index 9b88ccc..8e791ac 100755 --- a/tinyHTTP/include/tinyhttp/auth/thttp_auth.h +++ b/tinyHTTP/include/tinyhttp/auth/thttp_auth.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -55,8 +55,8 @@ TINYHTTP_API int thttp_auth_digest_HA1sess(const char* username, const char* rea TINYHTTP_API int thttp_auth_digest_HA2(const char* method, const char* url, const tsk_buffer_t* entity_body, const char* qop, tsk_md5string_t* ha2); -TINYHTTP_API int thttp_auth_digest_response(const tsk_md5string_t *ha1, const char* nonce, const nonce_count_t noncecount, const char* cnonce, - const char* qop, const tsk_md5string_t* ha2, tsk_md5string_t* response); +TINYHTTP_API int thttp_auth_digest_response(const tsk_md5string_t *ha1, const char* nonce, const nonce_count_t noncecount, const char* cnonce, + const char* qop, const tsk_md5string_t* ha2, tsk_md5string_t* response); TINYHTTP_API tsk_size_t thttp_auth_ws_response(const char* key, thttp_auth_ws_keystring_t* response); diff --git a/tinyHTTP/include/tinyhttp/auth/thttp_challenge.h b/tinyHTTP/include/tinyhttp/auth/thttp_challenge.h index 23596df..37847c6 100755 --- a/tinyHTTP/include/tinyhttp/auth/thttp_challenge.h +++ b/tinyHTTP/include/tinyhttp/auth/thttp_challenge.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2010-2015 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -39,21 +39,20 @@ THTTP_BEGIN_DECLS -typedef struct thttp_challenge_s -{ - TSK_DECLARE_OBJECT; +typedef struct thttp_challenge_s { + TSK_DECLARE_OBJECT; - tsk_bool_t isproxy; + tsk_bool_t isproxy; - char* scheme; - char* realm; - char* nonce; - char* opaque; - char* algorithm; - const char* qop; + char* scheme; + char* realm; + char* nonce; + char* opaque; + char* algorithm; + const char* qop; - tsk_md5string_t cnonce; - unsigned nc; + tsk_md5string_t cnonce; + unsigned nc; } thttp_challenge_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header.h b/tinyHTTP/include/tinyhttp/headers/thttp_header.h index 0545ebf..055fdb1 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -58,32 +58,30 @@ typedef int (*thttp_header_value_tostring_f)(const struct thttp_header_s* header * * @brief List of all supported headers. **/ -typedef enum thttp_header_type_e -{ - thttp_htype_Authorization, - thttp_htype_Content_Length, - thttp_htype_Content_Type, - thttp_htype_Dummy, - thttp_htype_ETag, - thttp_htype_Proxy_Authenticate, - thttp_htype_Proxy_Authorization, - thttp_htype_Sec_WebSocket_Accept, - thttp_htype_Sec_WebSocket_Protocol, - thttp_htype_Sec_WebSocket_Key, - thttp_htype_Sec_WebSocket_Version, - thttp_htype_Transfer_Encoding, - thttp_htype_WWW_Authenticate, +typedef enum thttp_header_type_e { + thttp_htype_Authorization, + thttp_htype_Content_Length, + thttp_htype_Content_Type, + thttp_htype_Dummy, + thttp_htype_ETag, + thttp_htype_Proxy_Authenticate, + thttp_htype_Proxy_Authorization, + thttp_htype_Sec_WebSocket_Accept, + thttp_htype_Sec_WebSocket_Protocol, + thttp_htype_Sec_WebSocket_Key, + thttp_htype_Sec_WebSocket_Version, + thttp_htype_Transfer_Encoding, + thttp_htype_WWW_Authenticate, } thttp_header_type_t; /*================================ */ -typedef struct thttp_header_s -{ - TSK_DECLARE_OBJECT; - thttp_header_type_t type; - thttp_header_value_tostring_f tostring; - tsk_params_L_t *params; +typedef struct thttp_header_s { + TSK_DECLARE_OBJECT; + thttp_header_type_t type; + thttp_header_value_tostring_f tostring; + tsk_params_L_t *params; } thttp_header_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Authorization.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Authorization.h index 0543b5b..e591990 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Authorization.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Authorization.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -43,23 +43,22 @@ THTTP_BEGIN_DECLS /// credentials = "Digest" digest-response /// digest-response = digest-response-value *(COMMA digest-response-value) /// digest-response-value = ( username / realm / nonce / digest-url / auth-response / [ algorithm ] / [cnonce] / [opaque] / [message-qop] / [nonce-count] / [auth-param] ) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_Authorization_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_Authorization_s { + THTTP_DECLARE_HEADER; - char* scheme; - char* username; - char* realm; - char* nonce; - char* uri; - char* response; - char* algorithm; - char* cnonce; - char* opaque; - char* qop; - char* nc; + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; } thttp_header_Authorization_t; typedef thttp_header_Authorization_t thttp_header_Proxy_Authorization_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Length.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Length.h index 9d7b4a9..3e87d69 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Length.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Length.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -42,13 +42,12 @@ THTTP_BEGIN_DECLS /// /// @par ABNF: Content-Length / l /// Content-Length = "Content-Length" HCOLON 1*DIGIT -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_Content_Length_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_Content_Length_s { + THTTP_DECLARE_HEADER; - uint32_t length; + uint32_t length; } thttp_header_Content_Length_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Type.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Type.h index 17e0d53..51a8a9f 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Type.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Content_Type.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -54,13 +54,12 @@ THTTP_BEGIN_DECLS /// m-parameter = m-attribute EQUAL m-value /// m-attribute = token /// m-value = token / quoted-string -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_Content_Type_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_Content_Type_s { + THTTP_DECLARE_HEADER; - char* type; + char* type; } thttp_header_Content_Type_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Dummy.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Dummy.h index 9e5293d..e56e157 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Dummy.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Dummy.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -41,14 +41,13 @@ THTTP_BEGIN_DECLS /// HTTP Dummy header. /// /// @par ABNF : token SP* HCOLON SP*<: any* -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_Dummy_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_Dummy_s { + THTTP_DECLARE_HEADER; - char *name; - char *value; + char *name; + char *value; } thttp_header_Dummy_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_ETag.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_ETag.h index 651520b..1c45cc1 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_ETag.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_ETag.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -45,12 +45,11 @@ THTTP_BEGIN_DECLS /// weak = "W/" /// opaque-tag = quoted-string //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_ETag_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_ETag_s { + THTTP_DECLARE_HEADER; - char *value; - tsk_bool_t isWeak; + char *value; + tsk_bool_t isWeak; } thttp_header_ETag_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Accept.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Accept.h index b13ab4e..3813a0d 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Accept.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Accept.h @@ -2,19 +2,19 @@ * Copyright (C) 2012 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -36,11 +36,10 @@ THTTP_BEGIN_DECLS #define THTTP_HEADER_SEC_WEBSOCKET_ACCEPT_VA_ARGS(key) thttp_header_Sec_WebSocket_Accept_def_t, (const char*)key -typedef struct thttp_header_Sec_WebSocket_Accept_s -{ - THTTP_DECLARE_HEADER; - - char *value; +typedef struct thttp_header_Sec_WebSocket_Accept_s { + THTTP_DECLARE_HEADER; + + char *value; } thttp_header_Sec_WebSocket_Accept_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Key.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Key.h index 679551a..42da71e 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Key.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Key.h @@ -2,19 +2,19 @@ * Copyright (C) 2012 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -36,11 +36,10 @@ THTTP_BEGIN_DECLS #define THTTP_HEADER_SEC_WEBSOCKET_KEY_VA_ARGS(key) thttp_header_Sec_WebSocket_Key_def_t, (const char*)key -typedef struct thttp_header_Sec_WebSocket_Key_s -{ - THTTP_DECLARE_HEADER; - - char *value; +typedef struct thttp_header_Sec_WebSocket_Key_s { + THTTP_DECLARE_HEADER; + + char *value; } thttp_header_Sec_WebSocket_Key_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Protocol.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Protocol.h index c132c66..4fb6732 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Protocol.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Protocol.h @@ -2,19 +2,19 @@ * Copyright (C) 2012 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -38,11 +38,10 @@ THTTP_BEGIN_DECLS #define THTTP_HEADER_SEC_WEBSOCKET_PROTOCOL_VA_ARGS(protocol) thttp_header_Sec_WebSocket_Protocol_def_t, (const char*)protocol -typedef struct thttp_header_Sec_WebSocket_Protocol_s -{ - THTTP_DECLARE_HEADER; - - tsk_strings_L_t *values; +typedef struct thttp_header_Sec_WebSocket_Protocol_s { + THTTP_DECLARE_HEADER; + + tsk_strings_L_t *values; } thttp_header_Sec_WebSocket_Protocol_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Version.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Version.h index 777d787..32d44bc 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Version.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Sec_WebSocket_Version.h @@ -2,19 +2,19 @@ * Copyright (C) 2012 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -38,11 +38,10 @@ THTTP_BEGIN_DECLS #define THTTP_HEADER_SEC_WEBSOCKET_VERSION_VA_ARGS(version) thttp_header_Sec_WebSocket_Version_def_t, (const char*)version -typedef struct thttp_header_Sec_WebSocket_Version_s -{ - THTTP_DECLARE_HEADER; - - tsk_strings_L_t *values; +typedef struct thttp_header_Sec_WebSocket_Version_s { + THTTP_DECLARE_HEADER; + + tsk_strings_L_t *values; } thttp_header_Sec_WebSocket_Version_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_Transfer_Encoding.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_Transfer_Encoding.h index 762834e..697b20e 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_Transfer_Encoding.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_Transfer_Encoding.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -47,13 +47,12 @@ THTTP_BEGIN_DECLS /// parameter = attribute "=" value /// attribute = token /// value = token / quoted-string -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_Transfer_Encoding_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_Transfer_Encoding_s { + THTTP_DECLARE_HEADER; - char* encoding; + char* encoding; } thttp_header_Transfer_Encoding_t; diff --git a/tinyHTTP/include/tinyhttp/headers/thttp_header_WWW_Authenticate.h b/tinyHTTP/include/tinyhttp/headers/thttp_header_WWW_Authenticate.h index f01dc23..604c557 100755 --- a/tinyHTTP/include/tinyhttp/headers/thttp_header_WWW_Authenticate.h +++ b/tinyHTTP/include/tinyhttp/headers/thttp_header_WWW_Authenticate.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -52,20 +52,19 @@ THTTP_BEGIN_DECLS /// stale = "stale" EQUAL ( "true" / "false" ) /// qop-options = "qop" EQUAL LDQUOT qop-value *("," qop-value) RDQUOT /// qop-value = "auth" / "auth-int" / token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_header_WWW_Authenticate_s -{ - THTTP_DECLARE_HEADER; +typedef struct thttp_header_WWW_Authenticate_s { + THTTP_DECLARE_HEADER; - char* scheme; - char* realm; - char* domain; - char* nonce; - char* opaque; - tsk_bool_t stale; - char* algorithm; - char* qop; + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + tsk_bool_t stale; + char* algorithm; + char* qop; } thttp_header_WWW_Authenticate_t; diff --git a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_header.h b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_header.h index 8162fb9..408e26f 100755 --- a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_header.h +++ b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_header.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_message.h b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_message.h index 09aad4b..d7b9881 100755 --- a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_message.h +++ b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_message.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_url.h b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_url.h index 4bfdb99..1064194 100755 --- a/tinyHTTP/include/tinyhttp/parsers/thttp_parser_url.h +++ b/tinyHTTP/include/tinyhttp/parsers/thttp_parser_url.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * diff --git a/tinyHTTP/include/tinyhttp/thttp_action.h b/tinyHTTP/include/tinyhttp/thttp_action.h index afc98d6..4773728 100755 --- a/tinyHTTP/include/tinyhttp/thttp_action.h +++ b/tinyHTTP/include/tinyhttp/thttp_action.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -41,52 +41,49 @@ THTTP_BEGIN_DECLS -typedef uint64_t thttp_action_id_t; +typedef uint64_t thttp_action_id_t; #define THTTP_ACTION_INVALID_ID 0 #define THTTP_ACTION_INVALID_HANDLE tsk_null /** List of all supported options. * To pass an option to the sesion, use @ref THTTP_ACTION_SET_OPTION() macro. */ -typedef enum thttp_action_option_e -{ - THTTP_ACTION_OPTION_TIMEOUT, +typedef enum thttp_action_option_e { + THTTP_ACTION_OPTION_TIMEOUT, } thttp_action_option_t; /** List of actions. */ -typedef enum thttp_action_type_e -{ - /* Outgoing GET, PUT, HEAD, DELETE, .... */ - thttp_atype_o_request, - /* Incoming message */ - thttp_atype_i_message, +typedef enum thttp_action_type_e { + /* Outgoing GET, PUT, HEAD, DELETE, .... */ + thttp_atype_o_request, + /* Incoming message */ + thttp_atype_i_message, - /* common */ - thttp_thttp_atype_closed, - thttp_atype_error, - thttp_atype_close, - thttp_atype_cancel, - thttp_atype_timedout, + /* common */ + thttp_thttp_atype_closed, + thttp_atype_error, + thttp_atype_close, + thttp_atype_cancel, + thttp_atype_timedout, } thttp_action_type_t; -typedef enum thttp_action_param_type_e -{ - thttp_aptype_null = 0, +typedef enum thttp_action_param_type_e { + thttp_aptype_null = 0, - thttp_aptype_option, - thttp_aptype_header, - thttp_aptype_payload, + thttp_aptype_option, + thttp_aptype_header, + thttp_aptype_payload, } thttp_action_param_type_t; /**@ingroup thttp_action_group * @def THTTP_ACTION_SET_OPTION -* Adds or updates an option. +* Adds or updates an option. * This is a helper macro for @a thttp_action_*() functions. * @param ID_ENUM The id of the option to add/update (@ref thttp_action_option_t). * @param VALUE_STR The new value of the parameter (<i>const char*</i>). @@ -113,7 +110,7 @@ thttp_action_GET(session, "http://www.doubango.org" */ /**@ingroup thttp_action_group * @def THTTP_ACTION_SET_PAYLOAD -* Adds a content (or payload) to the request. You should also add a content-type header by using +* Adds a content (or payload) to the request. You should also add a content-type header by using * @ref THTTP_ACTION_SET_HEADER() macro. You should not add the content-length header. * This is a helper macro for @a thttp_action_*() functions. * @param PAY_PTR A pointer to the payload (<i>const void*</i>). @@ -124,7 +121,7 @@ thttp_action_PUT(session, "http://www.doubango.org" THTTP_ACTION_SET_HEADER("Pragma", "No-Cache"), THTTP_ACTION_SET_HEADER("Connection", "Keep-Alive"), THTTP_ACTION_SET_HEADER("Content-length", "application/mytype"), - + THTTP_ACTION_SET_PAYLOAD("Salut", 5), THTTP_ACTION_SET_NULL()); @@ -139,17 +136,16 @@ thttp_action_PUT(session, "http://www.doubango.org" #define THTTP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) thttp_aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE #define THTTP_ACTION_SET_NULL() thttp_aptype_null -typedef struct thttp_action_s -{ - TSK_DECLARE_OBJECT; - - thttp_action_type_t type; - const char* url; - const char* method; - - tsk_options_L_t *options; - tsk_params_L_t *headers; - tsk_buffer_t* payload; +typedef struct thttp_action_s { + TSK_DECLARE_OBJECT; + + thttp_action_type_t type; + const char* url; + const char* method; + + tsk_options_L_t *options; + tsk_params_L_t *headers; + tsk_buffer_t* payload; } thttp_action_t; diff --git a/tinyHTTP/include/tinyhttp/thttp_dialog.h b/tinyHTTP/include/tinyhttp/thttp_dialog.h index f9885ab..bd15f3a 100755 --- a/tinyHTTP/include/tinyhttp/thttp_dialog.h +++ b/tinyHTTP/include/tinyhttp/thttp_dialog.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -42,20 +42,19 @@ struct thttp_message_s; typedef uint64_t thttp_dialog_id_t; -typedef struct thttp_dialog_s -{ - TSK_DECLARE_OBJECT; - - thttp_dialog_id_t id; - uint64_t timestamp; - - tsk_fsm_t* fsm; - - tsk_buffer_t* buf; - - struct thttp_session_s* session; - struct thttp_action_s* action; - tsk_bool_t answered; +typedef struct thttp_dialog_s { + TSK_DECLARE_OBJECT; + + thttp_dialog_id_t id; + uint64_t timestamp; + + tsk_fsm_t* fsm; + + tsk_buffer_t* buf; + + struct thttp_session_s* session; + struct thttp_action_s* action; + tsk_bool_t answered; } thttp_dialog_t; diff --git a/tinyHTTP/include/tinyhttp/thttp_event.h b/tinyHTTP/include/tinyhttp/thttp_event.h index 9c57b97..4f885cb 100755 --- a/tinyHTTP/include/tinyhttp/thttp_event.h +++ b/tinyHTTP/include/tinyhttp/thttp_event.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -40,27 +40,25 @@ THTTP_BEGIN_DECLS #define THTTP_EVENT(self) ((thttp_event_t*)(self)) -typedef enum thttp_event_type_e -{ - thttp_event_dialog_started, - thttp_event_message, - thttp_event_auth_failed, - thttp_event_closed, - thttp_event_transport_error, - thttp_event_dialog_terminated +typedef enum thttp_event_type_e { + thttp_event_dialog_started, + thttp_event_message, + thttp_event_auth_failed, + thttp_event_closed, + thttp_event_transport_error, + thttp_event_dialog_terminated } thttp_event_type_t; -typedef struct thttp_event_s -{ - TSK_DECLARE_OBJECT; - - thttp_event_type_t type; - const thttp_session_handle_t* session; - - char* description; - - struct thttp_message_s *message; +typedef struct thttp_event_s { + TSK_DECLARE_OBJECT; + + thttp_event_type_t type; + const thttp_session_handle_t* session; + + char* description; + + struct thttp_message_s *message; } thttp_event_t; diff --git a/tinyHTTP/include/tinyhttp/thttp_message.h b/tinyHTTP/include/tinyhttp/thttp_message.h index 4f9d1e5..8bfc5c0 100755 --- a/tinyHTTP/include/tinyhttp/thttp_message.h +++ b/tinyHTTP/include/tinyhttp/thttp_message.h @@ -1,19 +1,19 @@ /* * Copyright (C) 2010-2015 Mamadou DIOP. * -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -166,45 +166,43 @@ THTTP_BEGIN_DECLS #define THTTP_RESPONSE_IS_6XX(self) THTTP_RESPONSE_IS_NXX(self, 6) #define THTTP_RESPONSE_IS_23456(self) (200<= THTTP_RESPONSE_CODE((self)) && THTTP_RESPONSE_CODE((self)) <= 699) -/**Defines the message type (Request or Response). +/**Defines the message type (Request or Response). **/ -typedef enum thttp_message_type_e -{ - thttp_unknown, - thttp_request, - thttp_response +typedef enum thttp_message_type_e { + thttp_unknown, + thttp_request, + thttp_response } thttp_message_type_t; /**Represents a HTTP message. A HTTP message is either a request from a client to a server, * or a response from a server to a client. **/ -typedef struct thttp_message_s -{ - TSK_DECLARE_OBJECT; - - char *http_version; /**< The HTTP version. Only 'HTTP/1.1' is supported. */ - thttp_message_type_t type; /**< The type of this HTTP message. */ - - /* Request-Line */ - union{ - struct{ - char *method; - thttp_url_t *url; - } request; - struct{ - short status_code; - char *reason_phrase; - } response; - } line; - - /*== MOST COMMON HEADERS. */ - thttp_header_Content_Type_t *Content_Type; - thttp_header_Content_Length_t *Content_Length; - tsk_buffer_t *Content; - - /*== OTHER HEADERS*/ - thttp_headers_L_t *headers; +typedef struct thttp_message_s { + TSK_DECLARE_OBJECT; + + char *http_version; /**< The HTTP version. Only 'HTTP/1.1' is supported. */ + thttp_message_type_t type; /**< The type of this HTTP message. */ + + /* Request-Line */ + union { + struct { + char *method; + thttp_url_t *url; + } request; + struct { + short status_code; + char *reason_phrase; + } response; + } line; + + /*== MOST COMMON HEADERS. */ + thttp_header_Content_Type_t *Content_Type; + thttp_header_Content_Length_t *Content_Length; + tsk_buffer_t *Content; + + /*== OTHER HEADERS*/ + thttp_headers_L_t *headers; } thttp_message_t; @@ -220,19 +218,19 @@ TINYHTTP_API int thttp_message_append_content(thttp_message_t *self, const void* #if defined(__SYMBIAN32__) && 0 static void THTTP_MESSAGE_ADD_HEADER(thttp_message_t *self, ...) - { - va_list ap; - thttp_header_t *header; - const tsk_object_def_t *objdef; - - va_start(ap, self); - objdef = va_arg(ap, const tsk_object_def_t*); - header = tsk_object_new_2(objdef, &ap); - va_end(ap); - - thttp_message_add_header(self, header); - tsk_object_unref(header); - } +{ + va_list ap; + thttp_header_t *header; + const tsk_object_def_t *objdef; + + va_start(ap, self); + objdef = va_arg(ap, const tsk_object_def_t*); + header = tsk_object_new_2(objdef, &ap); + va_end(ap); + + thttp_message_add_header(self, header); + tsk_object_unref(header); +} #else #define THTTP_MESSAGE_ADD_HEADER(self, objdef, ...) \ { \ diff --git a/tinyHTTP/include/tinyhttp/thttp_session.h b/tinyHTTP/include/tinyhttp/thttp_session.h index 3d740e5..b61fe5f 100755 --- a/tinyHTTP/include/tinyhttp/thttp_session.h +++ b/tinyHTTP/include/tinyhttp/thttp_session.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2010-2015 Mamadou DIOP. -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -44,35 +44,33 @@ THTTP_BEGIN_DECLS //FD struct thttp_message_s; -typedef uint64_t thttp_session_id_t; +typedef uint64_t thttp_session_id_t; #define THTTP_SESSION_INVALID_ID 0 #define THTTP_SESSION_INVALID_HANDLE tsk_null /** List of all supported options. * To pass an option to the sesion, use @ref THTTP_SESSION_SET_OPTION() macro. */ -typedef enum thttp_session_option_e -{ - THTTP_SESSION_OPTION_TIMEOUT, - THTTP_SESSION_OPTION_TTL, - // To be continued... +typedef enum thttp_session_option_e { + THTTP_SESSION_OPTION_TIMEOUT, + THTTP_SESSION_OPTION_TTL, + // To be continued... } thttp_session_option_t; -typedef enum thttp_session_param_type_e -{ - httpp_null = 0, +typedef enum thttp_session_param_type_e { + httpp_null = 0, - httpp_option, - httpp_cred, - httpp_header, - httpp_userdata, + httpp_option, + httpp_cred, + httpp_header, + httpp_userdata, } thttp_session_param_type_t; /**@ingroup thttp_session_group * @def THTTP_SESSION_SET_OPTION -* Adds or updates an option. +* Adds or updates an option. * This is a helper macro for @ref thttp_session_create and @ref thttp_session_set. * @param ID_ENUM The id of the option to add/update (@ref thttp_session_option_t). * @param VALUE_STR The new value of the option (<i>const char*</i>). @@ -153,27 +151,26 @@ thttp_session_set(session, #define THTTP_SESSION_SET_USERDATA(USERDATA_PTR) httpp_userdata, (const void*)USERDATA_PTR #define THTTP_SESSION_SET_NULL() httpp_null -typedef struct thttp_session_s -{ - TSK_DECLARE_OBJECT; +typedef struct thttp_session_s { + TSK_DECLARE_OBJECT; - thttp_session_id_t id; - const struct thttp_stack_s* stack; - const void* userdata; // user's context - tsk_options_L_t *options; - tsk_params_L_t *headers; + thttp_session_id_t id; + const struct thttp_stack_s* stack; + const void* userdata; // user's context + tsk_options_L_t *options; + tsk_params_L_t *headers; - tnet_fd_t fd; + tnet_fd_t fd; - thttp_challenges_L_t *challenges; - thttp_dialogs_L_t* dialogs; + thttp_challenges_L_t *challenges; + thttp_dialogs_L_t* dialogs; - struct{ - char* usename; - char* password; - }cred; + struct { + char* usename; + char* password; + } cred; - TSK_DECLARE_SAFEOBJ; + TSK_DECLARE_SAFEOBJ; } thttp_session_t; diff --git a/tinyHTTP/include/tinyhttp/thttp_url.h b/tinyHTTP/include/tinyhttp/thttp_url.h index 802f84d..8f93fc2 100755 --- a/tinyHTTP/include/tinyhttp/thttp_url.h +++ b/tinyHTTP/include/tinyhttp/thttp_url.h @@ -7,12 +7,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -37,20 +37,18 @@ THTTP_BEGIN_DECLS /** Url type. */ -typedef enum thttp_url_type_e -{ - thttp_url_unknown, - thttp_url_http, - thttp_url_https, +typedef enum thttp_url_type_e { + thttp_url_unknown, + thttp_url_http, + thttp_url_https, } thttp_url_type_t; -typedef enum thttp_host_type_e -{ - thttp_host_unknown, - thttp_host_hostname, - thttp_host_ipv4, - thttp_host_ipv6 +typedef enum thttp_host_type_e { + thttp_host_unknown, + thttp_host_hostname, + thttp_host_ipv4, + thttp_host_ipv6 } thttp_host_type_t; @@ -64,17 +62,16 @@ thttp_host_type_t; /// hsegment = *[ uchar | ";" | ":" | "@" | "&" | "=" ] /// search = *[ uchar | ";" | ":" | "@" | "&" | "=" ] //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct thttp_url_s -{ - TSK_DECLARE_OBJECT; +typedef struct thttp_url_s { + TSK_DECLARE_OBJECT; - thttp_url_type_t type; - char *scheme; - char *host; /**< Host name. Hostname or IPv4address or IPv6address. */ - char *hpath; - char *search; - thttp_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ - uint16_t port; + thttp_url_type_t type; + char *scheme; + char *host; /**< Host name. Hostname or IPv4address or IPv6address. */ + char *hpath; + char *search; + thttp_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ + uint16_t port; } thttp_url_t; diff --git a/tinyHTTP/include/tinyhttp_config.h b/tinyHTTP/include/tinyhttp_config.h index bd2a743..5b9d874 100755 --- a/tinyHTTP/include/tinyhttp_config.h +++ b/tinyHTTP/include/tinyhttp_config.h @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. * @@ -62,13 +62,13 @@ # define TINYHTTP_GEXTERN extern #endif -/* Guards against C++ name mangling +/* Guards against C++ name mangling */ #ifdef __cplusplus # define THTTP_BEGIN_DECLS extern "C" { # define THTTP_END_DECLS } #else -# define THTTP_BEGIN_DECLS +# define THTTP_BEGIN_DECLS # define THTTP_END_DECLS #endif @@ -92,7 +92,7 @@ #endif #if HAVE_CONFIG_H - #include <config.h> +#include <config.h> #endif #endif // TINYHTTP_CONFIG_H |