http_client.h File Reference

HTTP client module header file. More...

#include "http_response.h"
#include "http_request.h"
#include "configuration.h"
Include dependency graph for http_client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  http_client_send_callback_info_t
 

Macros

#define SSL_CERTIFICATE_TYPE_PEM   "PEM"
 

Typedefs

typedef mcl_size_t(* http_client_read_callback) (void *buffer, mcl_size_t size, mcl_size_t count, void *user_context)
 

Functions

E_MCL_ERROR_CODE http_client_initialize (configuration_t *configuration, http_client_t **http_client)
 HTTP Client initializer. More...
 
E_MCL_ERROR_CODE http_client_send (http_client_t *http_client, http_request_t *http_request, http_client_send_callback_info_t *callback_info, http_response_t **http_response)
 Send/Receive function. More...
 
void http_client_destroy (http_client_t **http_client)
 To destroy the HTTP Client Handler. More...
 
mcl_size_t http_client_get_callback_termination_code ()
 To get the implementation specific code for returning from callback function in order to terminate the send operation. More...
 

Detailed Description

HTTP client module header file.


Date
Jul 20, 2016 HTTP client is responsible of sending and receiving data through TCP/IP. It uses http_request_t and http_response_t for sending and returning the messages.

Definition in file http_client.h.

Macro Definition Documentation

#define SSL_CERTIFICATE_TYPE_PEM   "PEM"

Definition at line 24 of file http_client.h.

Referenced by http_client_initialize().

Typedef Documentation

typedef mcl_size_t(* http_client_read_callback) (void *buffer, mcl_size_t size, mcl_size_t count, void *user_context)

Definition at line 26 of file http_client.h.

Function Documentation

void http_client_destroy ( http_client_t **  http_client)

To destroy the HTTP Client Handler.

Will release the resources of HTTP Request. After destroy operation, handler shouldn't be used.

Parameters
[in]http_clientHTTP Client Handler.

Definition at line 230 of file http_client_libcurl.c.

References DEBUG_ENTRY, DEBUG_LEAVE, MCL_DEBUG, MCL_FREE, and MCL_NULL.

Referenced by http_processor_destroy().

Here is the caller graph for this function:

mcl_size_t http_client_get_callback_termination_code ( )

To get the implementation specific code for returning from callback function in order to terminate the send operation.

Returns
Returns the termination code.

Definition at line 220 of file http_client_libcurl.c.

References DEBUG_ENTRY, and DEBUG_LEAVE.

Referenced by _get_payload_from_file().

Here is the caller graph for this function:

E_MCL_ERROR_CODE http_client_initialize ( configuration_t configuration,
http_client_t **  http_client 
)

HTTP Client initializer.

Initializes the underlying implementation (like libcurl) with the given configuration data.

Parameters
[in]configurationThe configuration data. This is the same configuration data given to configuration_t when initializing it.
[out]http_clientHandle for the http client initialized.
Returns

Definition at line 52 of file http_client_libcurl.c.

References _curl_debug_callback(), _response_header_callback(), _response_payload_callback(), _ssl_context_callback(), ASSERT_CODE_MESSAGE, string_t::buffer, curl_global_initialized, DEBUG_ENTRY, DEBUG_LEAVE, DOMAIN_SEPERATOR, configuration_t::http_request_timeout, string_t::length, MCL_DEBUG, MCL_FALSE, MCL_INITIALIZATION_FAIL, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, memory_calloc(), memory_free(), memory_malloc(), memory_realloc(), configuration_t::mindsphere_certificate, configuration_t::mindsphere_port, configuration_t::proxy_domain, configuration_t::proxy_hostname, configuration_t::proxy_password, configuration_t::proxy_port, configuration_t::proxy_type, configuration_t::proxy_username, SSL_CERTIFICATE_TYPE_PEM, string_destroy(), string_initialize_new(), string_util_snprintf(), string_util_strdup(), and SUPPORTED_CIPHERS_LIST.

Referenced by http_processor_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE http_client_send ( http_client_t http_client,
http_request_t http_request,
http_client_send_callback_info_t callback_info,
http_response_t **  http_response 
)

Send/Receive function.

Using underlying implementation, it sends the given data to the pre-configured destination and returns the response. This function is blocking until response received or timeout occurred.

Parameters
[in]http_clientHTTP Client Handler.
[in]http_requestHTTP Request object.
[in]callback_infoStruct holding callback information. Refer to its definition http_client_send_callback_info_t.
[out]http_responseHTTP Response object.
Returns

Definition at line 156 of file http_client_libcurl.c.

References _convert_to_mcl_error_code(), _set_request_options(), ASSERT_STATEMENT_CODE_MESSAGE, http_client_t::curl, libcurl_payload_t::data, DEBUG_ENTRY, DEBUG_LEAVE, http_response_initialize(), MCL_ERROR_RETURN, MCL_FREE, MCL_INFO, MCL_NEW, MCL_NULL, MCL_OK, libcurl_payload_t::size, string_array_destroy(), and string_array_initialize().

Referenced by http_processor_exchange(), http_processor_get_access_token(), http_processor_register(), and http_processor_stream().

Here is the call graph for this function:

Here is the caller graph for this function: