Mark Radbourne / Mbed 2 deprecated iothub_client_sample_amqp

Dependencies:   EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed

Fork of iothub_client_sample_amqp by Azure IoT

Embed: (wiki syntax)

« Back to documentation index

httpapiex.h File Reference

httpapiex.h File Reference

This is a utility module that provides HTTP requests with build-in retry capabilities. More...

Go to the source code of this file.

Functions

 DEFINE_ENUM (HTTPAPIEX_RESULT, HTTPAPIEX_RESULT_VALUES)
 Enumeration specifying the status of calls to various APIs in this module.
 MOCKABLE_FUNCTION (, HTTPAPIEX_HANDLE, HTTPAPIEX_Create, const char *, hostName)
 Creates an HTTPAPIEX_HANDLE that can be used in further calls.
 MOCKABLE_FUNCTION (, HTTPAPIEX_RESULT, HTTPAPIEX_ExecuteRequest, HTTPAPIEX_HANDLE, handle, HTTPAPI_REQUEST_TYPE, requestType, const char *, relativePath, HTTP_HEADERS_HANDLE, requestHttpHeadersHandle, BUFFER_HANDLE, requestContent, unsigned int *, statusCode, HTTP_HEADERS_HANDLE, responseHttpHeadersHandle, BUFFER_HANDLE, responseContent)
 Tries to execute an HTTP request.
 MOCKABLE_FUNCTION (, void, HTTPAPIEX_Destroy, HTTPAPIEX_HANDLE, handle)
 Frees all resources used by the HTTPAPIEX_HANDLE object.
 MOCKABLE_FUNCTION (, HTTPAPIEX_RESULT, HTTPAPIEX_SetOption, HTTPAPIEX_HANDLE, handle, const char *, optionName, const void *, value)
 Sets the option optionName to the value pointed to by value.

Detailed Description

This is a utility module that provides HTTP requests with build-in retry capabilities.

HTTAPIEX is a utility module that provides HTTP requests with build-in retry capability to an HTTP server. Features over "regular" HTTPAPI include:

  • Optional parameters
  • Implementation independent
  • Retry mechanism
  • Persistent options

Definition in file httpapiex.h.


Function Documentation

DEFINE_ENUM ( HTTPAPIEX_RESULT  ,
HTTPAPIEX_RESULT_VALUES   
)

Enumeration specifying the status of calls to various APIs in this module.

MOCKABLE_FUNCTION ( HTTPAPIEX_RESULT  ,
HTTPAPIEX_SetOption  ,
HTTPAPIEX_HANDLE  ,
handle  ,
const char *  ,
optionName  ,
const void *  ,
value   
)

Sets the option optionName to the value pointed to by value.

Parameters:
handleThe HTTPAPIEX_HANDLE representing this session.
optionNameName of the option.
valueThe value to be set for the option.
Returns:
An HTTPAPIEX_RESULT indicating the status of the call.
MOCKABLE_FUNCTION ( void  ,
HTTPAPIEX_Destroy  ,
HTTPAPIEX_HANDLE  ,
handle   
)

Frees all resources used by the HTTPAPIEX_HANDLE object.

Parameters:
handleThe HTTPAPIEX_HANDLE object to be freed.
MOCKABLE_FUNCTION ( HTTPAPIEX_RESULT  ,
HTTPAPIEX_ExecuteRequest  ,
HTTPAPIEX_HANDLE  ,
handle  ,
HTTPAPI_REQUEST_TYPE  ,
requestType  ,
const char *  ,
relativePath  ,
HTTP_HEADERS_HANDLE  ,
requestHttpHeadersHandle  ,
BUFFER_HANDLE  ,
requestContent  ,
unsigned int *  ,
statusCode  ,
HTTP_HEADERS_HANDLE  ,
responseHttpHeadersHandle  ,
BUFFER_HANDLE  ,
responseContent   
)

Tries to execute an HTTP request.

Parameters:
handleA valid HTTPAPIEX_HANDLE value.
requestTypeA value from the HTTPAPI_REQUEST_TYPE enum.
relativePathRelative path to send the request to on the server.
requestHttpHeadersHandleHandle to the request HTTP headers.
requestContentThe request content.
statusCodeIf non-null, the HTTP status code is written to this pointer.
responseHttpHeadersHandleHandle to the response HTTP headers.
responseContentThe response content.

HTTPAPIEX_ExecuteRequest tries to execute an HTTP request of type requestType, on the server's relativePath, pushing the request HTTP headers requestHttpHeadersHandle, having the content of the request as pointed to by requestContent. If successful, HTTAPIEX_ExecuteRequest writes in the out parameter statusCode the HTTP status, populates the responseHeadersHandle with the response headers and copies the response body to responseContent.

Returns:
An HTTAPIEX_HANDLE suitable for further calls to the module.
MOCKABLE_FUNCTION ( HTTPAPIEX_HANDLE  ,
HTTPAPIEX_Create  ,
const char *  ,
hostName   
)

Creates an HTTPAPIEX_HANDLE that can be used in further calls.

Parameters:
hostNamePointer to a null-terminated string that contains the host name of an HTTP server.

If hostName is NULL then HTTPAPIEX_Create returns NULL. The hostName value is saved and associated with the returned handle. If creating the handle fails for any reason, then HTTAPIEX_Create returns NULL. Otherwise, HTTPAPIEX_Create returns an HTTAPIEX_HANDLE suitable for further calls to the module.

Returns:
An HTTAPIEX_HANDLE suitable for further calls to the module.