Azure IoT middleware for FreeRTOS
Macros | Typedefs | Enumerations | Functions
azure_iot_http.h File Reference

The port file for HTTP APIs. More...

#include <stdint.h>
#include "azure_iot_http_port.h"
#include "azure_iot_transport_interface.h"

Go to the source code of this file.

Macros

#define azureiothttpHttpRangeRequestEndOfFile   -1
 Value to request the end of the file.
 

Typedefs

typedef AzureIoTHTTP_t * AzureIoTHTTPHandle_t
 The handle for the Azure HTTP client.
 
typedef enum AzureIoTHTTPResult AzureIoTHTTPResult_t
 Azure HTTP return codes.
 

Enumerations

enum  AzureIoTHTTPResult {
  eAzureIoTHTTPSuccess = 0 , eAzureIoTHTTPInvalidParameter , eAzureIoTHTTPNetworkError , eAzureIoTHTTPPartialResponse ,
  eAzureIoTHTTPNoResponse , eAzureIoTHTTPInsufficientMemory , eAzureIoTHTTPSecurityAlertResponseHeadersSizeLimitExceeded , eAzureIoTHTTPSecurityAlertExtraneousResponseData ,
  eAzureIoTHTTPSecurityAlertInvalidChunkHeader , eAzureIoTHTTPSecurityAlertInvalidProtocolVersion , eAzureIoTHTTPSecurityAlertInvalidStatusCode , eAzureIoTHTTPSecurityAlertInvalidCharacter ,
  eAzureIoTHTTPSecurityAlertInvalidContentLength , eAzureIoTHTTPParserInternalError , eAzureIoTHTTPHeaderNotFound , eAzureIoTHTTPInvalidResponse ,
  eAzureIoTHTTPError
}
 Azure HTTP return codes.
 

Functions

AzureIoTHTTPResult_t AzureIoTHTTP_Init (AzureIoTHTTPHandle_t xHTTPHandle, AzureIoTTransportInterface_t *pxHTTPTransport, const char *pucURL, uint32_t ulURLLength, const char *pucPath, uint32_t ulPathLength, char *pucHeaderBuffer, uint32_t ulHeaderBufferLength)
 Initialize the Azure HTTP client. More...
 
AzureIoTHTTPResult_t AzureIoTHTTP_Request (AzureIoTHTTPHandle_t xHTTPHandle, int32_t lRangeStart, int32_t lRangeEnd, char *pucDataBuffer, uint32_t ulDataBufferLength, char **ppucOutData, uint32_t *pulOutDataLength)
 Send an HTTP GET request. More...
 
AzureIoTHTTPResult_t AzureIoTHTTP_RequestSizeInit (AzureIoTHTTPHandle_t xHTTPHandle, AzureIoTTransportInterface_t *pxHTTPTransport, const char *pucURL, uint32_t ulURLLength, const char *pucPath, uint32_t ulPathLength, char *pucHeaderBuffer, uint32_t ulHeaderBufferLength)
 Initialize a size request. More...
 
int32_t AzureIoTHTTP_RequestSize (AzureIoTHTTPHandle_t xHTTPHandle, char *pucDataBuffer, uint32_t ulDataBufferLength)
 Send a size request. More...
 
AzureIoTHTTPResult_t AzureIoTHTTP_Deinit (AzureIoTHTTPHandle_t xHTTPHandle)
 Deinitialize the Azure HTTP client. More...
 

Detailed Description

The port file for HTTP APIs.

Used in ADU.

Function Documentation

◆ AzureIoTHTTP_Deinit()

AzureIoTHTTPResult_t AzureIoTHTTP_Deinit ( AzureIoTHTTPHandle_t  xHTTPHandle)

Deinitialize the Azure HTTP client.

Parameters
[in]xHTTPHandleThe HTTP handle to use for this operation.
Returns
AzureIoTHTTPResult_t
Return values
eAzureIoTHTTPSuccessif success.
Otherwiseif failure.

◆ AzureIoTHTTP_Init()

AzureIoTHTTPResult_t AzureIoTHTTP_Init ( AzureIoTHTTPHandle_t  xHTTPHandle,
AzureIoTTransportInterface_t pxHTTPTransport,
const char *  pucURL,
uint32_t  ulURLLength,
const char *  pucPath,
uint32_t  ulPathLength,
char *  pucHeaderBuffer,
uint32_t  ulHeaderBufferLength 
)

Initialize the Azure HTTP client.

Parameters
[in]xHTTPHandleThe HTTP handle to use for this operation.
[in]pxHTTPTransportThe Azure IoT Transport interface to use for this operation.
[in]pucURLThe URL to use for this request.
[in]ulURLLengthThe length pucURL.
[in]pucPathThe path to use for this request.
[in]ulPathLengthThe length pucPath.
[out]pucHeaderBufferThe buffer into which the headers for the request will be placed.
[in]ulHeaderBufferLengthThe length of pucHeaderBuffer.
Returns
AzureIoTHTTPResult_t

◆ AzureIoTHTTP_Request()

AzureIoTHTTPResult_t AzureIoTHTTP_Request ( AzureIoTHTTPHandle_t  xHTTPHandle,
int32_t  lRangeStart,
int32_t  lRangeEnd,
char *  pucDataBuffer,
uint32_t  ulDataBufferLength,
char **  ppucOutData,
uint32_t *  pulOutDataLength 
)

Send an HTTP GET request.

Parameters
[in]xHTTPHandleThe HTTP handle to use for this operation.
[in]lRangeStartThe start point for the request payload.
[in]lRangeEndThe end point for the request payload.
[out]pucDataBufferThe buffer into which the response header and payload will be placed.
[in]ulDataBufferLengthThe length of pucDataBuffer.
[out]ppucOutDataThe pointer to the point in the buffer where the payload starts.
[out]pulOutDataLengthThe length of the payload returned by ppucOutData.
Returns
AzureIoTHTTPResult_t

◆ AzureIoTHTTP_RequestSize()

int32_t AzureIoTHTTP_RequestSize ( AzureIoTHTTPHandle_t  xHTTPHandle,
char *  pucDataBuffer,
uint32_t  ulDataBufferLength 
)

Send a size request.

Parameters
[in]xHTTPHandleThe HTTP handle to use for this operation.
[out]pucDataBufferThe buffer where the response will be placed.
[in]ulDataBufferLengthThe size of pucDataBuffer.
Returns
int32_t
Return values
Thesize of the file if success.
-1if failure.

◆ AzureIoTHTTP_RequestSizeInit()

AzureIoTHTTPResult_t AzureIoTHTTP_RequestSizeInit ( AzureIoTHTTPHandle_t  xHTTPHandle,
AzureIoTTransportInterface_t pxHTTPTransport,
const char *  pucURL,
uint32_t  ulURLLength,
const char *  pucPath,
uint32_t  ulPathLength,
char *  pucHeaderBuffer,
uint32_t  ulHeaderBufferLength 
)

Initialize a size request.

Parameters
[in]xHTTPHandleThe HTTP handle to use for this operation.
[in]pxHTTPTransportThe Azure IoT Transport interface to use for this operation.
[in]pucURLThe URL to use for this request.
[in]ulURLLengthThe length pucURL.
[in]pucPathThe path to use for this request.
[in]ulPathLengthThe length pucPath.
[out]pucHeaderBufferThe buffer into which the response will be placed.
[in]ulHeaderBufferLengthThe size of pucHeaderBuffer.
Returns
AzureIoTHTTPResult_t