17 #ifndef HTTP_REQUEST_H_ 18 #define HTTP_REQUEST_H_ 24 #define BOUNDARY_SIGN_LENGTH 2 25 #define BOUNDARY_SIGN "--" 28 #define COLON_FORMAT_LENGTH 2 31 #define BOUNDARY_LENGTH 22 32 #define BOUNDARY_CHARACTER_COUNT 62 34 #define GROWTH_FACTOR 1.5 37 #define CONTENT_TYPE_LINE_LENGTH 65 40 #define CONTENT_TYPE_HEADER_LENGTH 14 43 #define CONTENT_ID_HEADER_LENGTH 12 46 #define NEW_LINE_LENGTH 2 47 #define NEW_LINE "\r\n" 51 #define BOUNDARY_LINE_LENGTH (BOUNDARY_SIGN_LENGTH + BOUNDARY_LENGTH + NEW_LINE_LENGTH) 54 #define HTTP_REQUEST_RESIZE_ENABLED MCL_TRUE 55 #define HTTP_REQUEST_RESIZE_DISABLED MCL_FALSE 317 #endif //HTTP_REQUEST_H_ HTTP definitions module header file.
string_array_t * header
Header of http request.
mcl_size_t(* payload_copy_callback_t)(void *destination, void *source, mcl_size_t size, void *user_context)
E_MCL_HTTP_METHOD method
Http method of http request.
E_MCL_ERROR_CODE http_request_start_tuple_sub_section(http_request_t *http_request, string_t *content_type, string_t *content_id, string_t **sub_boundary)
To start a sub tuple section inside of the http request body.
mcl_uint8_t * payload
Payload of http request.
mcl_bool_t finalized
The state of http request.
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
mcl_size_t max_http_payload_size
Maximum http payload size of http request.
E_MCL_ERROR_CODE http_request_add_raw_data(http_request_t *http_request, payload_copy_callback_t copy_callback, void *user_context, void *data, mcl_size_t data_size, mcl_size_t *actual_written_size)
To add raw data into an http_request.
E_MCL_HTTP_METHOD
HTTP Method Types.
E_MCL_ERROR_CODE http_request_add_header(http_request_t *http_request, string_t *header_name, string_t *header_value)
To be used to add an HTTP header to the request with it's value.
mcl_size_t payload_offset
Payload offset of http request.
void http_request_destroy(http_request_t **http_request)
To destroy the HTTP Request Handler.
E_MCL_ERROR_CODE http_request_finalize(http_request_t *http_request)
Adds closing boundary to the payload and resizes the payload buffer to release unused memory space...
mcl_size_t http_request_get_available_space_for_tuple(http_request_t *http_request)
To be used to get the available space left in the request buffer in order to add a tuple...
E_MCL_ERROR_CODE http_request_add_single(http_request_t *http_request, string_t *content_type, string_t *content_id, string_t *meta_string)
To be used to add a single to the HTTP Request.
String array module header file.
mcl_bool_t resize_enabled
The state or condition of being resizable.
mcl_size_t http_request_get_available_space_for_raw_data(http_request_t *http_request)
To be used to get the available space left in the request buffer in order to add a raw data...
E_MCL_ERROR_CODE http_request_initialize(E_MCL_HTTP_METHOD method, string_t *uri, mcl_size_t header_size, mcl_size_t payload_size, mcl_bool_t resize_enabled, string_t *user_agent, mcl_size_t max_http_payload_size, http_request_t **http_request)
HTTP Request Initializer.
E_MCL_ERROR_CODE http_request_add_tuple(http_request_t *http_request, string_t *meta, string_t *meta_content_type, payload_copy_callback_t payload_copy_callback, void *user_context, void *payload, mcl_size_t payload_size, string_t *payload_content_type)
To be used to add a tuple to the HTTP Request.
string_t * boundary
Boundary of http request.
E_MCL_ERROR_CODE http_request_start_tuple(http_request_t *http_request)
To start a new tuple structure inside the http request body.
mcl_size_t payload_size
Payload size of http request.
E_MCL_ERROR_CODE http_request_end_tuple_sub_section(http_request_t *http_request, string_t *sub_boundary)
To end a sub tuple section previously started with http_request_start_tuple_sub_section().
string_t * uri
Uri of http request.
mcl_size_t http_request_get_available_space_for_single(http_request_t *http_request)
To be used to get the available space left in the request buffer in order to add a single...