FreeRTOS: HTTPS Client
HTTPS Client v1.0.0 library
Return to main page ↑
iot_https_client.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS HTTPS Client V1.1.3
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef IOT_HTTPS_CLIENT_H_
32 #define IOT_HTTPS_CLIENT_H_
33 
34 /* The config header is always included first. */
35 #include "iot_config.h"
36 
37 /* HTTP types include. */
38 #include "types/iot_https_types.h"
39 
136 /* @[declare_https_client_init] */
138 /* @[declare_https_client_init] */
139 
150 /* @[declare_https_client_cleanup] */
151 void IotHttpsClient_Cleanup( void );
152 /* @[declare_https_client_cleanup] */
153 
159 #define IotHttpsClient_Deinit IotHttpsClient_Cleanup
160 
250 /* @[declare_https_client_connect] */
252  IotHttpsConnectionInfo_t * pConnInfo );
253 /* @[declare_https_client_connect] */
254 
294 /* @[declare_https_client_disconnect] */
296 /* @[declare_https_client_disconnect] */
297 
369 /* @[declare_https_client_initializerequest] */
371  IotHttpsRequestInfo_t * pReqInfo );
372 /* @[declare_https_client_initializerequest] */
373 
449 /* @[declare_https_client_addheader] */
451  char * pName,
452  uint32_t nameLen,
453  char * pValue,
454  uint32_t valueLen );
455 /* @[declare_https_client_addheader] */
456 
497 /* @[declare_https_client_writerequestbody] */
499  uint8_t * pBuf,
500  uint32_t len,
501  int isComplete );
502 /* @[declare_https_client_writerequestbody] */
503 
554 /* @[declare_https_client_sendsync] */
556  IotHttpsRequestHandle_t reqHandle,
557  IotHttpsResponseHandle_t * pRespHandle,
558  IotHttpsResponseInfo_t * pRespInfo,
559  uint32_t timeoutMs );
560 /* @[declare_https_client_sendsync] */
561 
602 /* @[declare_https_client_sendasync] */
604  IotHttpsRequestHandle_t reqHandle,
605  IotHttpsResponseHandle_t * pRespHandle,
606  IotHttpsResponseInfo_t * pRespInfo );
607 /* @[declare_https_client_sendasync] */
608 
654 /* @[declare_https_client_cancelrequestasync] */
656 /* @[declare_https_client_cancelrequestasync] */
657 
692 /* @[declare_https_client_cancelresponseasync] */
694 /* @[declare_https_client_cancelresponseasync] */
695 
743 /* @[declare_https_client_readresponsestatus] */
745  uint16_t * pStatus );
746 /* @[declare_https_client_readresponsestatus] */
747 
793 /* @[declare_https_client_readcontentlength] */
795  uint32_t * pContentLength );
796 /* @[declare_https_client_readcontentlength] */
797 
852 /* @[declare_https_client_readheader] */
854  char * pName,
855  uint32_t nameLen,
856  char * pValue,
857  uint32_t valueLen );
858 /* @[declare_https_client_readheader] */
859 
892 /* @[declare_https_client_readresponsebody] */
894  uint8_t * pBuf,
895  uint32_t * pLen );
896 /* @[declare_https_client_readresponsebody] */
897 
898 #endif /* IOT_HTTPS_CLIENT_ */
IotHttpsClient_SendSync
IotHttpsReturnCode_t IotHttpsClient_SendSync(IotHttpsConnectionHandle_t connHandle, IotHttpsRequestHandle_t reqHandle, IotHttpsResponseHandle_t *pRespHandle, IotHttpsResponseInfo_t *pRespInfo, uint32_t timeoutMs)
Synchronous send of the HTTPS request.
Definition: iot_https_client.c:2951
IotHttpsClient_ReadContentLength
IotHttpsReturnCode_t IotHttpsClient_ReadContentLength(IotHttpsResponseHandle_t respHandle, uint32_t *pContentLength)
Retrieve the HTTPS response content length.
Definition: iot_https_client.c:3364
IotHttpsClient_WriteRequestBody
IotHttpsReturnCode_t IotHttpsClient_WriteRequestBody(IotHttpsRequestHandle_t reqHandle, uint8_t *pBuf, uint32_t len, int isComplete)
Writes the request body to the network for the request represented by reqHandle.
Definition: iot_https_client.c:3057
IotHttpsClient_CancelResponseAsync
IotHttpsReturnCode_t IotHttpsClient_CancelResponseAsync(IotHttpsResponseHandle_t respHandle)
Cancel an Asynchronous response.
Definition: iot_https_client.c:3184
IotHttpsResponseHandle_t
struct _httpsResponse * IotHttpsResponseHandle_t
Opaque handle of an HTTP response.
Definition: iot_https_types.h:280
iot_https_types.h
Types of the HTTPS Client library.
IotHttpsRequestInfo_t
HTTP request configuration.
Definition: iot_https_types.h:796
IotHttpsResponseInfo_t
HTTP request configuration.
Definition: iot_https_types.h:884
IotHttpsRequestHandle_t
struct _httpsRequest * IotHttpsRequestHandle_t
Opaque handle of an HTTP request.
Definition: iot_https_types.h:263
IotHttpsConnectionHandle_t
struct _httpsConnection * IotHttpsConnectionHandle_t
Opaque handle of an HTTP connection.
Definition: iot_https_types.h:248
IotHttpsClient_ReadResponseBody
IotHttpsReturnCode_t IotHttpsClient_ReadResponseBody(IotHttpsResponseHandle_t respHandle, uint8_t *pBuf, uint32_t *pLen)
Read the HTTPS response body from the network.
Definition: iot_https_client.c:3109
IotHttpsClient_Cleanup
void IotHttpsClient_Cleanup(void)
One time clean up of the IoT HTTPS Client library.
Definition: iot_https_client.c:2582
IotHttpsClient_InitializeRequest
IotHttpsReturnCode_t IotHttpsClient_InitializeRequest(IotHttpsRequestHandle_t *pReqHandle, IotHttpsRequestInfo_t *pReqInfo)
Initializes the request by adding a formatted Request-Line to the start of HTTPS request header buffe...
Definition: iot_https_client.c:2731
IotHttpsClient_CancelRequestAsync
IotHttpsReturnCode_t IotHttpsClient_CancelRequestAsync(IotHttpsRequestHandle_t reqHandle)
Cancel an Asynchronous request.
Definition: iot_https_client.c:3171
IotHttpsClient_Disconnect
IotHttpsReturnCode_t IotHttpsClient_Disconnect(IotHttpsConnectionHandle_t connHandle)
Disconnect from the HTTPS server given the connection handle connHandle.
Definition: iot_https_client.c:2629
IotHttpsClient_SendAsync
IotHttpsReturnCode_t IotHttpsClient_SendAsync(IotHttpsConnectionHandle_t connHandle, IotHttpsRequestHandle_t reqHandle, IotHttpsResponseHandle_t *pRespHandle, IotHttpsResponseInfo_t *pRespInfo)
Asynchronous send of the the HTTPS request.
Definition: iot_https_client.c:3198
IotHttpsClient_Connect
IotHttpsReturnCode_t IotHttpsClient_Connect(IotHttpsConnectionHandle_t *pConnHandle, IotHttpsConnectionInfo_t *pConnInfo)
Explicitly connect to the HTTPS server given the connection configuration pConnConfig.
Definition: iot_https_client.c:2589
IotHttpsClient_AddHeader
IotHttpsReturnCode_t IotHttpsClient_AddHeader(IotHttpsRequestHandle_t reqHandle, char *pName, uint32_t nameLen, char *pValue, uint32_t valueLen)
Add a header to the current HTTPS request represented by reqHandle.
Definition: iot_https_client.c:2884
IotHttpsClient_ReadHeader
IotHttpsReturnCode_t IotHttpsClient_ReadHeader(IotHttpsResponseHandle_t respHandle, char *pName, uint32_t nameLen, char *pValue, uint32_t valueLen)
Retrieve the header of interest from the response represented by respHandle.
Definition: iot_https_client.c:3264
IotHttpsReturnCode_t
IotHttpsReturnCode_t
Return codes of HTTPS Client functions.
Definition: iot_https_types.h:294
IotHttpsClient_Init
IotHttpsReturnCode_t IotHttpsClient_Init(void)
One-time initialization of the IoT HTTPS Client library.
Definition: iot_https_client.c:2448
IotHttpsConnectionInfo_t
HTTP connection configuration.
Definition: iot_https_types.h:721
IotHttpsClient_ReadResponseStatus
IotHttpsReturnCode_t IotHttpsClient_ReadResponseStatus(IotHttpsResponseHandle_t respHandle, uint16_t *pStatus)
Retrieve the HTTPS response status.
Definition: iot_https_client.c:3245