mcl_http_response.h File Reference

HTTP response module header file. More...

Include dependency graph for mcl_http_response.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mcl_http_response_t
 

Enumerations

enum  E_MCL_HTTP_STATUS_CODE {
  MCL_HTTP_STATUS_CODE_UNKNOWN = 0, MCL_HTTP_STATUS_CODE_CONTINUE = 100, MCL_HTTP_STATUS_CODE_SUCCESS = 200, MCL_HTTP_STATUS_CODE_CREATED = 201,
  MCL_HTTP_STATUS_CODE_PARTIAL_CONTENT = 206, MCL_HTTP_STATUS_CODE_MOVED_PERMANENTLY = 301, MCL_HTTP_STATUS_CODE_USE_PROXY = 305, MCL_HTTP_STATUS_CODE_BAD_REQUEST = 400,
  MCL_HTTP_STATUS_CODE_UNAUTHORIZED = 401, MCL_HTTP_STATUS_CODE_FORBIDDEN = 403, MCL_HTTP_STATUS_CODE_NOT_FOUND = 404, MCL_HTTP_STATUS_CODE_METHOD_NOT_ALLOWED = 405,
  MCL_HTTP_STATUS_CODE_PROXY_AUTH_REQUIRED = 407, MCL_HTTP_STATUS_CODE_REQUEST_TIMEOUT = 408, MCL_HTTP_STATUS_CODE_CONFLICT = 409, MCL_HTTP_STATUS_CODE_PRECONDITION_FAILED = 412,
  MCL_HTTP_STATUS_CODE_PAYLOAD_TOO_LARGE = 413, MCL_HTTP_RESULT_CODE_TOO_MANY_REQUESTS = 429, MCL_HTTP_STATUS_CODE_INTERNAL_SERVER_ERR = 500, MCL_HTTP_STATUS_CODE_NOT_IMPLEMENTED = 501,
  MCL_HTTP_STATUS_CODE_BAD_GATEWAY = 502, MCL_HTTP_STATUS_CODE_SERVICE_UNAVAILABLE = 503, MCL_HTTP_STATUS_CODE_GATEWAY_TIMEOUT = 504, MCL_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED = 505
}
 

Functions

MCL_CORE_EXPORT mcl_error_t mcl_http_response_initialize (mcl_list_t *header, mcl_uint8_t *payload, mcl_size_t payload_size, E_MCL_HTTP_STATUS_CODE status_code, mcl_http_response_t **http_response)
 
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_header (mcl_http_response_t *http_response, const char *header_name, char **header_value)
 
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_status (mcl_http_response_t *http_response)
 
MCL_CORE_EXPORT void mcl_http_response_destroy (mcl_http_response_t **http_response)
 

Detailed Description

HTTP response module header file.

This module is used internally by other MCL modules to analyze and parse received HTTP response messages. HTTP response (mcl_http_response_t) can be initialized and prepared with mcl_http_response_initialize function. Following initialization, value of HTTP header can be reached with mcl_http_response_get_header. HTTP response has to be destroyed when it is no longer needed using mcl_http_response_destroy function.

Definition in file mcl_http_response.h.

Enumeration Type Documentation

HTTP Status Codes

Enumerator
MCL_HTTP_STATUS_CODE_UNKNOWN 

Unknown status code.

MCL_HTTP_STATUS_CODE_CONTINUE 

Actual code : 100.

MCL_HTTP_STATUS_CODE_SUCCESS 

Actual code : 200.

MCL_HTTP_STATUS_CODE_CREATED 

Actual code : 201.

MCL_HTTP_STATUS_CODE_PARTIAL_CONTENT 

Actual code : 206.

MCL_HTTP_STATUS_CODE_MOVED_PERMANENTLY 

Actual code : 301.

MCL_HTTP_STATUS_CODE_USE_PROXY 

Actual code : 305.

MCL_HTTP_STATUS_CODE_BAD_REQUEST 

Actual code : 400.

MCL_HTTP_STATUS_CODE_UNAUTHORIZED 

Actual code : 401.

MCL_HTTP_STATUS_CODE_FORBIDDEN 

Actual code : 403.

MCL_HTTP_STATUS_CODE_NOT_FOUND 

Actual code : 404.

MCL_HTTP_STATUS_CODE_METHOD_NOT_ALLOWED 

Actual code : 405.

MCL_HTTP_STATUS_CODE_PROXY_AUTH_REQUIRED 

Actual code : 407.

MCL_HTTP_STATUS_CODE_REQUEST_TIMEOUT 

Actual code : 408.

MCL_HTTP_STATUS_CODE_CONFLICT 

Actual code : 409.

MCL_HTTP_STATUS_CODE_PRECONDITION_FAILED 

Actual code : 412.

MCL_HTTP_STATUS_CODE_PAYLOAD_TOO_LARGE 

Actual code : 413.

MCL_HTTP_RESULT_CODE_TOO_MANY_REQUESTS 

Actual code : 429.

MCL_HTTP_STATUS_CODE_INTERNAL_SERVER_ERR 

Actual code : 500.

MCL_HTTP_STATUS_CODE_NOT_IMPLEMENTED 

Actual code : 501.

MCL_HTTP_STATUS_CODE_BAD_GATEWAY 

Actual code : 502.

MCL_HTTP_STATUS_CODE_SERVICE_UNAVAILABLE 

Actual code : 503.

MCL_HTTP_STATUS_CODE_GATEWAY_TIMEOUT 

Actual code : 504.

MCL_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED 

Actual code : 505.

Definition at line 30 of file mcl_http_response.h.

Function Documentation

MCL_CORE_EXPORT void mcl_http_response_destroy ( mcl_http_response_t **  http_response)

This function destroys the HTTP response handle.

Parameters
[in]http_responseHTTP response handle.

Definition at line 174 of file http_response.c.

References _free_string(), MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_list_destroy_with_content(), and MCL_NULL.

Referenced by core_processor_get_access_token(), and core_processor_register().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_header ( mcl_http_response_t http_response,
const char *  header_name,
char **  header_value 
)

This function gets the value of a specified HTTP header.

Parameters
[in]http_responseHTTP response handle to be used.
[in]header_nameName of the header whose value is requested.
[out]header_valueValue of the header will be stored in header_value.
Returns

Definition at line 44 of file http_response.c.

References mcl_list_node_t::data, mcl_http_response_t::header, MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_CALLOC, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_FUNCTION_LEAVE_LABEL, mcl_list_next(), mcl_list_reset(), MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, string_util_find(), string_util_find_case_insensitive(), string_util_strlen(), and string_util_strncpy().

Referenced by core_processor_get_access_token().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_CORE_EXPORT mcl_error_t mcl_http_response_initialize ( mcl_list_t header,
mcl_uint8_t payload,
mcl_size_t  payload_size,
E_MCL_HTTP_STATUS_CODE  status_code,
mcl_http_response_t **  http_response 
)

This function initializes an HTTP response message.

Parameters
[in]headerList of received HTTP headers.
[in]payloadThe received HTTP payload.
[in]payload_sizeSize of payload.
[in]status_codeThe received status code.
[out]http_responseHandle of the initialized mcl_http_response_t object.
Returns

Definition at line 17 of file http_response.c.

References MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.

Referenced by get_response(), and mcl_http_client_send().

Here is the caller graph for this function: