http_request.c File Reference

HTTP request module implementation file. More...

#include "http_request.h"
#include "definitions.h"
#include "string_util.h"
#include "mcl_core/mcl_assert.h"
#include "mcl_core/mcl_memory.h"
Include dependency graph for http_request.c:

Go to the source code of this file.

Functions

static void _http_request_header_destroy (char **header)
 
mcl_error_t mcl_http_request_initialize (mcl_http_request_t **http_request)
 
mcl_error_t mcl_http_request_add_header (mcl_http_request_t *http_request, const char *header_name, const char *header_value)
 
mcl_error_t mcl_http_request_set_parameter (mcl_http_request_t *http_request, E_MCL_HTTP_REQUEST_PARAMETER parameter, const void *value)
 
void mcl_http_request_destroy (mcl_http_request_t **http_request)
 

Detailed Description

HTTP request module implementation file.

Definition in file http_request.c.

Function Documentation

static void _http_request_header_destroy ( char **  header)
static

Definition at line 170 of file http_request.c.

References MCL_FREE.

Referenced by mcl_http_request_destroy().

Here is the caller graph for this function:

mcl_error_t mcl_http_request_add_header ( mcl_http_request_t http_request,
const char *  header_name,
const char *  header_value 
)

This function is used to add an HTTP header to the request with its value.

Parameters
[in]http_requestHTTP request handle to be used.
[in]header_nameHeader name.
[in]header_valueHeader value.
Returns

Definition at line 57 of file http_request.c.

References mcl_http_request_t::header, MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, MCL_FUNCTION_LEAVE_LABEL, mcl_list_add(), MCL_MALLOC, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, string_util_snprintf(), and string_util_strlen().

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:

void mcl_http_request_destroy ( mcl_http_request_t **  http_request)

This function destroys HTTP request data structure.

Parameters
[in]http_requestHTTP request handle to be freed.

Definition at line 155 of file http_request.c.

References _http_request_header_destroy(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_list_destroy_with_content(), and MCL_NULL.

Referenced by core_processor_get_access_token(), core_processor_register(), and mcl_http_request_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t mcl_http_request_initialize ( mcl_http_request_t **  http_request)

This function creates and initializes an mcl_http_request_t.

Parameters
[out]http_requestThe newly initialized HTTP request.
Returns

Definition at line 18 of file http_request.c.

References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_HTTP_GET, mcl_http_request_destroy(), mcl_list_initialize(), MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.

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_error_t mcl_http_request_set_parameter ( mcl_http_request_t http_request,
E_MCL_HTTP_REQUEST_PARAMETER  parameter,
const void *  value 
)

This function is used to set a parameter of HTTP request.

Parameters
[in]http_requestHTTP request handle to be used.
[in]parameterOne of the parameters listed in E_MCL_HTTP_REQUEST_PARAMETER.
[in]valueNew value of the parameter.
Returns

Definition at line 97 of file http_request.c.

References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_HTTP_END, MCL_HTTP_REQUEST_PARAMETER_BODY, MCL_HTTP_REQUEST_PARAMETER_BODY_SIZE, MCL_HTTP_REQUEST_PARAMETER_METHOD, MCL_HTTP_REQUEST_PARAMETER_STREAM_CALLBACK, MCL_HTTP_REQUEST_PARAMETER_STREAM_DATA, MCL_HTTP_REQUEST_PARAMETER_URL, MCL_INVALID_PARAMETER, MCL_NULL, MCL_OK, mcl_http_request_t::method, mcl_http_request_t::payload, mcl_http_request_t::payload_size, mcl_http_request_t::stream_callback, mcl_http_request_t::stream_data, string_util_reset(), and mcl_http_request_t::uri.

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: