diff options
Diffstat (limited to 'tinyHTTP/include/tinyhttp/thttp_action.h')
-rwxr-xr-x | tinyHTTP/include/tinyhttp/thttp_action.h | 74 |
1 files changed, 35 insertions, 39 deletions
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; |