2 * FreeRTOS Kernel V10.2.1
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
29 * This file contains the common functions for plain text, basic TLS, and mutual
\r
30 * authentication HTTPS demos. Aside from the difference in security level during
\r
31 * connect, the three demos perform the same interaction with a HTTPS host. The
\r
32 * demo creates a singe application task that loops through a set of examples
\r
33 * demonstrating how to the connect to the server, send a few types of requests to
\r
34 * the server (GET, HEAD, PUT, POST), and disconnect from the server again. All
\r
35 * of the responses and their associated HTTPS response status codes are printed
\r
38 * The plain text HTTP demo does not authenticate the server nor the client. The
\r
39 * basic TLS HTTPS demo builds on top of the plain text demo, adding broker
\r
40 * authentication and encryption. The mutual authentication HTTPS demo builds on
\r
41 * top of the basic TLS demo, enabling both server and client authentication.
\r
43 * For more information regarding the HTTPS library and the demo, please refer to:
\r
44 * https://www.freertos.org/https/index.html
\r
47 /* Standard includes. */
\r
51 /* Kernel includes. */
\r
52 #include "FreeRTOS.h"
\r
55 /* FreeRTOS+TCP includes. */
\r
56 #include "FreeRTOS_IP.h"
\r
58 /* IoT SDK includes. */
\r
59 #include "iot_https_client.h"
\r
60 #include "iot_taskpool_freertos.h"
\r
61 #include "platform/iot_network_freertos.h"
\r
63 /* HTTPS Demo Select */
\r
64 #include "demo_config.h"
\r
66 /* Select HTTPS profile based on the setting in demo_config.h */
\r
67 #if ( democonfigPROFILE_USE_AWS_IOT == 1 )
\r
68 #include "aws_iot_demo_profile.h"
\r
70 #include "https_demo_profile.h"
\r
73 /* Preprocessor check iot configuration */
\r
74 #include "aws_iot_setup_check.h"
\r
77 * Set the connection profile based on settings in demo_config.h. For more
\r
78 * information on each variable, please refer to the respective *_profile.h
\r
79 * file in FreeRTOS-Labs\Demo\FreeRTOS_IoT_Libraries\include.
\r
81 * Note that if you are running the https_tls_mutual_auth demo please make sure
\r
82 * to visit the following link for setup:
\r
83 * https://www.freertos.org/https/preconfiguredexamplesMA.html
\r
85 #if defined( AWS_IOT_DEMO_PROFILE_H )
\r
86 #define httpsexampleHTTPS_SERVER_ADDRESS awsiotdemoprofileAWS_ENDPOINT
\r
87 #define httpsexampleHTTPS_SERVER_PORT awsiotdemoprofileAWS_HTTPS_PORT
\r
88 #define httpsexampleHTTPS_SERVER_CERTIFICATE awsiotdemoprofileAWS_CERTIFICATE_PEM
\r
89 #define httpsexampleCLIENT_CERTIFICATE_PEM awsiotdemoprofileCLIENT_CERTIFICATE_PEM
\r
90 #define httpsexampleCLIENT_PRIVATE_KEY_PEM awsiotdemoprofileCLIENT_PRIVATE_KEY_PEM
\r
91 #elif defined( HTTPS_DEMO_PROFILE_H )
\r
92 #define httpsexampleHTTPS_SERVER_ADDRESS httpsdemoprofileSERVER_ADDRESS
\r
93 #define httpsexampleHTTPS_SERVER_PORT httpsdemoprofileSERVER_PORT
\r
94 #define httpsexampleHTTPS_SERVER_CERTIFICATE httpsdemoprofileSERVER_CERTIFICATE_PEM
\r
98 * Each preconfigured host supports different request paths. In this demo, we
\r
99 * are using httpbin and AWS IoT.
\r
101 * In the demos that uses httpbin.org see http://httpbin.org/#/HTTP_Methods for
\r
102 * details on supported REST API.
\r
104 #if defined( AWS_IOT_DEMO_PROFILE_H )
\r
105 #define httpsexampleHTTPS_POST_PATH "/topics/" awsiotdemoprofileCLIENT_IDENTIFIER
\r
106 #elif defined( HTTPS_DEMO_PROFILE_H )
\r
107 #define httpsexampleHTTPS_GET_PATH "/ip"
\r
108 #define httpsexampleHTTPS_HEAD_PATH "/ip"
\r
109 #define httpsexampleHTTPS_PUT_PATH "/put"
\r
110 #define httpsexampleHTTPS_POST_PATH "/post"
\r
114 * @brief The length in bytes of the user buffer to store the HTTPS Client library
\r
115 * connection context.
\r
117 * The minimum size can be found in @ref connectionUserBufferMinimumSize.
\r
119 #define httpsexampleCONNECTION_USER_BUFFER_LENGTH ( 512 )
\r
122 * @brief The length in bytes of the user buffer to store the HTTPS Client library
\r
125 * The minimum size can be found in @ref requestUserBufferMinimumSize.
\r
127 #define httpsexampleREQUEST_USER_BUFFER_LENGTH ( 512 )
\r
130 * @brief The length in bytes of the user buffer to store the HTTPS Client library
\r
131 * response context.
\r
133 #define httpsexampleRESPONSE_USER_BUFFER_LENGTH ( 512 )
\r
136 * @brief Some text to send as the request body for a PUT and POST request in
\r
139 #define httpsexampleREQUEST_BODY_TEXT "Hello, world!"
\r
142 * @brief The length in bytes of the buffer used to receive the response body.
\r
144 #define httpsexampleRESPONSE_BODY_BUFFER_LENGTH ( 512 )
\r
147 * @brief Timeout in ms for HTTPS operations in this example.
\r
149 #define httpsexampleHTTPS_TIMEOUT_MS ( 5000 )
\r
151 /*-----------------------------------------------------------*/
\r
154 * @brief The HTTPS connection handle used in this example.
\r
156 static IotHttpsConnectionHandle_t xHTTPSConnection = IOT_HTTPS_CONNECTION_HANDLE_INITIALIZER;
\r
159 * @brief A buffer used to store the HTTPS Client library's connection context.
\r
161 static uint8_t ucHTTPSConnectionUserBuffer[ httpsexampleCONNECTION_USER_BUFFER_LENGTH ] = { 0 };
\r
164 * @brief A buffer used to store the HTTPS Client library's request context and
\r
167 static uint8_t ucHTTPSRequestUserBuffer[ httpsexampleREQUEST_USER_BUFFER_LENGTH ] = { 0 };
\r
170 * @brief A buffer used to store the HTTPS Client library's response context and
\r
173 static uint8_t ucHTTPSResponseUserBuffer[ httpsexampleRESPONSE_USER_BUFFER_LENGTH ] = { 0 };
\r
176 * @brief The request body.
\r
178 static char cHTTPSRequestBodyBuffer[] = httpsexampleREQUEST_BODY_TEXT;
\r
181 * @brief A buffer used to receive the HTTPS Client library's response body.
\r
183 static uint8_t ucHTTPSResponseBodyBuffer[ httpsexampleRESPONSE_BODY_BUFFER_LENGTH ] = { 0 };
\r
186 * @brief The task used to demonstrate the HTTPS Client API.
\r
188 * @param[in] pvParameters Parameters as passed at the time of task creation. Not
\r
189 * used in this example.
\r
191 static void prvHTTPSDemoTask( void * pvParameters );
\r
194 * @brief Connects to the HTTPS server as specified in httpsexampleHTTPS_SERVER_ADDRESS
\r
195 * and httpsexampleHTTPS_SERVER_PORT.
\r
197 static void prvHTTPSConnect( void );
\r
200 * @brief Creates and sends an HTTPS request to the HTTPS server specified in
\r
201 * httpsexampleHTTPS_SERVER_ADDRESS and httpsexampleHTTPS_SERVER_PORT.
\r
203 * @param[in] xMethod The HTTPS method to use. Please #IotHttpsMethod_t for
\r
204 * possible parameters.
\r
205 * @param[in] pcPath The path for the HTTPS request.
\r
206 * @param[in] ulPathLength The length of the input pcPath.
\r
208 static void prvHTTPSRequest( IotHttpsMethod_t xMethod,
\r
209 const char * pcPath,
\r
210 uint32_t ulPathLength );
\r
213 * @brief Disconnects from the HTTPS server.
\r
215 static void prvHTTPSDisconnect( void );
\r
218 * @brief Initializes the IoT libraries used by this demo.
\r
220 static void prvInitialiseLibraries( void );
\r
222 /*-----------------------------------------------------------*/
\r
225 * @brief Parameters used to create the system task pool.
\r
227 static const IotTaskPoolInfo_t xTaskPoolParameters =
\r
229 /* Minimum number of threads in a task pool.
\r
230 * Note the slimmed down version of the task
\r
231 * pool used by this library does not auto-scale
\r
232 * the number of tasks in the pool so in this
\r
233 * case this sets the number of tasks in the
\r
237 /* Maximum number of threads in a task pool.
\r
238 * Note the slimmed down version of the task
\r
239 * pool used by this library does not auto-scale
\r
240 * the number of tasks in the pool so in this
\r
241 * case this parameter is just ignored. */
\r
244 /* Stack size for every task pool thread - in
\r
245 * bytes, hence multiplying by the number of bytes
\r
246 * in a word as configMINIMAL_STACK_SIZE is
\r
247 * specified in words. */
\r
248 configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ),
\r
249 /* Priority for every task pool thread. */
\r
252 /*-----------------------------------------------------------*/
\r
254 static const IotHttpsConnectionInfo_t xConnectionInfo =
\r
256 /* No connection to the HTTPS server has been established yet and we want to
\r
257 * establish a new connection. */
\r
258 .pAddress = httpsexampleHTTPS_SERVER_ADDRESS,
\r
259 .addressLen = sizeof( httpsexampleHTTPS_SERVER_ADDRESS ) - 1,
\r
260 .port = httpsexampleHTTPS_SERVER_PORT,
\r
261 .userBuffer.pBuffer = ucHTTPSConnectionUserBuffer,
\r
262 .userBuffer.bufferLen = sizeof( ucHTTPSConnectionUserBuffer ),
\r
264 /* Use FreeRTOS+TCP network. */
\r
265 .pNetworkInterface = IOT_NETWORK_INTERFACE_FREERTOS,
\r
267 /* The HTTPS Client library uses TLS by default as indicated by the "S"
\r
268 * postfixed to "HTTP" in the name of the library and its types and
\r
269 * functions. There are no configurations in the flags to enable TLS. */
\r
272 /* Optional TLS extensions. For this demo, they are disabled. */
\r
273 .pAlpnProtocols = NULL,
\r
274 .alpnProtocolsLen = 0,
\r
276 /* Provide the certificate for authenticating the server. */
\r
277 #if ( democonfigENABLE_TLS == 1 )
\r
278 .pCaCert = httpsexampleHTTPS_SERVER_CERTIFICATE,
\r
279 .caCertLen = sizeof( httpsexampleHTTPS_SERVER_CERTIFICATE ),
\r
285 /* The HTTPS server at httpbin.org:443 does not require client certificates,
\r
286 * but AWS IoT does.
\r
287 * If the server were to require a client certificate, the following members
\r
288 * need to be set. */
\r
289 #if ( democonfigENABLE_MUTUAL_AUTH == 1 )
\r
290 .pClientCert = httpsexampleCLIENT_CERTIFICATE_PEM,
\r
291 .clientCertLen = sizeof( httpsexampleCLIENT_CERTIFICATE_PEM ),
\r
292 .pPrivateKey = httpsexampleCLIENT_PRIVATE_KEY_PEM,
\r
293 .privateKeyLen = sizeof( httpsexampleCLIENT_PRIVATE_KEY_PEM )
\r
295 .pClientCert = NULL,
\r
296 .clientCertLen = 0,
\r
297 .pPrivateKey = NULL,
\r
301 /*-----------------------------------------------------------*/
\r
303 void vStartSimpleHTTPSDemo( void )
\r
305 /* This example uses a single application task, which in turn is used to
\r
306 * connect, send a few requests, and disconnect from the HTTPS server. */
\r
307 xTaskCreate( prvHTTPSDemoTask, /* Function that implements the task. */
\r
308 "HTTPSDemo", /* Text name for the task - only used for debugging. */
\r
309 democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
\r
310 NULL, /* Task parameter - not used in this case. */
\r
311 tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
\r
312 NULL ); /* Used to pass out a handle to the created task - not used in this case. */
\r
314 /*-----------------------------------------------------------*/
\r
316 static void prvHTTPSDemoTask( void * pvParameters )
\r
318 /* Remove compiler warnings about unused parameters. */
\r
319 ( void ) pvParameters;
\r
321 /* One time initialization of the libraries used by this demo. */
\r
322 prvInitialiseLibraries();
\r
326 /****************************** Connect. ******************************/
\r
328 /* Establish a connection to the HTTPS server. This example connects to
\r
329 * the HTTPS server as specified in httpsexampleHTTPS_SERVER_ADDRESS and
\r
330 * httpsexampleHTTPS_SERVER_PORT at the top of this file. Please change
\r
331 * it to the HTTPS server you want to connect to. */
\r
332 configPRINTF( ( "Attempt to connect to %s:%d\r\n", httpsexampleHTTPS_SERVER_ADDRESS, httpsexampleHTTPS_SERVER_PORT ) );
\r
334 configPRINTF( ( "Connected to %s:%d\r\n", httpsexampleHTTPS_SERVER_ADDRESS, httpsexampleHTTPS_SERVER_PORT ) );
\r
336 /*********************** Send HTTPS requests. ************************/
\r
338 /* The client is now connected to the server. This example will send a
\r
339 * GET, HEAD, PUT, and POST request. For AWS IoT profile, the example will
\r
340 * only send a POST request.
\r
342 #if defined( httpsexampleHTTPS_GET_PATH )
\r
343 configPRINTF( ( "Sending HTTPS GET request...\r\n" ) );
\r
344 prvHTTPSRequest( IOT_HTTPS_METHOD_GET,
\r
345 httpsexampleHTTPS_GET_PATH,
\r
346 sizeof( httpsexampleHTTPS_GET_PATH ) - 1 );
\r
348 #if defined( httpsexampleHTTPS_HEAD_PATH )
\r
349 configPRINTF( ( "Sending HTTPS HEAD request...\r\n" ) );
\r
350 prvHTTPSRequest( IOT_HTTPS_METHOD_HEAD,
\r
351 httpsexampleHTTPS_HEAD_PATH,
\r
352 sizeof( httpsexampleHTTPS_HEAD_PATH ) - 1 );
\r
354 #if defined( httpsexampleHTTPS_PUT_PATH )
\r
355 configPRINTF( ( "Sending HTTPS PUT request...\r\n" ) );
\r
356 prvHTTPSRequest( IOT_HTTPS_METHOD_PUT,
\r
357 httpsexampleHTTPS_PUT_PATH,
\r
358 sizeof( httpsexampleHTTPS_PUT_PATH ) - 1 );
\r
360 #if defined( httpsexampleHTTPS_POST_PATH )
\r
361 configPRINTF( ( "Sending HTTPS POST request...\r\n" ) );
\r
362 prvHTTPSRequest( IOT_HTTPS_METHOD_POST,
\r
363 httpsexampleHTTPS_POST_PATH,
\r
364 sizeof( httpsexampleHTTPS_POST_PATH ) - 1 );
\r
367 /**************************** Disconnect. *****************************/
\r
369 prvHTTPSDisconnect();
\r
370 configPRINTF( ( "Disconnected from %s:%d\r\n\r\n", httpsexampleHTTPS_SERVER_ADDRESS, httpsexampleHTTPS_SERVER_PORT ) );
\r
372 /* Wait between iterations to avoid server throttling. */
\r
374 configPRINTF( ( "prvHTTPSDemoTask() completed an iteration successfully. "
\r
375 "Total free heap is %u\r\n",
\r
376 xPortGetFreeHeapSize() ) );
\r
377 configPRINTF( ( "Demo completed successfully.\r\n" ) );
\r
378 configPRINTF( ( "Short delay before starting the next iteration.... \r\n\r\n" ) );
\r
379 vTaskDelay( pdMS_TO_TICKS( httpsexampleHTTPS_TIMEOUT_MS ) );
\r
383 /*-----------------------------------------------------------*/
\r
385 static void prvHTTPSConnect( void )
\r
387 IotHttpsReturnCode_t xHTTPSClientResult;
\r
389 /* Establish the connection to the HTTPS server - It is a blocking call and
\r
390 * will return only when the connection is complete or a timeout occurs. */
\r
391 xHTTPSClientResult = IotHttpsClient_Connect( &( xHTTPSConnection ),
\r
392 &( xConnectionInfo ) );
\r
393 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r
396 /*-----------------------------------------------------------*/
\r
398 static void prvHTTPSRequest( IotHttpsMethod_t xMethod,
\r
399 const char * pcPath,
\r
400 uint32_t ulPathLength )
\r
402 IotHttpsReturnCode_t xHTTPSClientResult;
\r
403 IotHttpsRequestInfo_t xHTTPSRequestInfo = IOT_HTTPS_REQUEST_INFO_INITIALIZER;
\r
404 IotHttpsResponseInfo_t xHTTPSResponseInfo = IOT_HTTPS_RESPONSE_INFO_INITIALIZER;
\r
405 IotHttpsRequestHandle_t xHTTPSRequest = IOT_HTTPS_REQUEST_HANDLE_INITIALIZER;
\r
406 IotHttpsResponseHandle_t xHTTPSResponse = IOT_HTTPS_RESPONSE_HANDLE_INITIALIZER;
\r
407 IotHttpsSyncInfo_t xHTTPSSyncRequestInfo = IOT_HTTPS_SYNC_INFO_INITIALIZER;
\r
408 IotHttpsSyncInfo_t xHTTPSSyncResponseInfo = IOT_HTTPS_SYNC_INFO_INITIALIZER;
\r
409 uint16_t usResponseStatus = 0;
\r
411 configASSERT( pcPath != NULL );
\r
413 /************************** HTTPS request setup. ***************************/
\r
415 if( ( xMethod == IOT_HTTPS_METHOD_PUT ) || ( xMethod == IOT_HTTPS_METHOD_POST ) )
\r
417 xHTTPSSyncRequestInfo.pBody = ( uint8_t * ) cHTTPSRequestBodyBuffer;
\r
418 xHTTPSSyncRequestInfo.bodyLen = sizeof( cHTTPSRequestBodyBuffer );
\r
422 xHTTPSSyncRequestInfo.pBody = NULL;
\r
423 xHTTPSSyncRequestInfo.bodyLen = 0;
\r
426 xHTTPSRequestInfo.pHost = httpsexampleHTTPS_SERVER_ADDRESS;
\r
427 xHTTPSRequestInfo.hostLen = sizeof( httpsexampleHTTPS_SERVER_ADDRESS ) - 1;
\r
428 xHTTPSRequestInfo.pPath = pcPath;
\r
429 xHTTPSRequestInfo.pathLen = ulPathLength;
\r
430 xHTTPSRequestInfo.method = xMethod;
\r
431 xHTTPSRequestInfo.isNonPersistent = false;
\r
432 xHTTPSRequestInfo.userBuffer.pBuffer = ucHTTPSRequestUserBuffer;
\r
433 xHTTPSRequestInfo.userBuffer.bufferLen = sizeof( ucHTTPSRequestUserBuffer ) - 1;
\r
434 xHTTPSRequestInfo.isAsync = false;
\r
435 xHTTPSRequestInfo.u.pSyncInfo = &xHTTPSSyncRequestInfo;
\r
437 xHTTPSClientResult = IotHttpsClient_InitializeRequest( &( xHTTPSRequest ),
\r
438 &( xHTTPSRequestInfo ) );
\r
439 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r
441 /************************** HTTPS response setup. **************************/
\r
443 memset( ucHTTPSResponseBodyBuffer, 0, sizeof( ucHTTPSResponseBodyBuffer ) );
\r
445 if( xMethod == IOT_HTTPS_METHOD_HEAD )
\r
447 xHTTPSSyncResponseInfo.pBody = NULL;
\r
448 xHTTPSSyncResponseInfo.bodyLen = 0;
\r
452 xHTTPSSyncResponseInfo.pBody = ucHTTPSResponseBodyBuffer;
\r
453 xHTTPSSyncResponseInfo.bodyLen = sizeof( ucHTTPSResponseBodyBuffer );
\r
456 xHTTPSResponseInfo.userBuffer.pBuffer = ucHTTPSResponseUserBuffer;
\r
457 xHTTPSResponseInfo.userBuffer.bufferLen = sizeof( ucHTTPSResponseUserBuffer );
\r
458 xHTTPSResponseInfo.pSyncInfo = &xHTTPSSyncResponseInfo;
\r
460 /*************************** Send HTTPS request. ***************************/
\r
462 /* This synchronous send function blocks until the full response is received
\r
463 * from the network. */
\r
464 xHTTPSClientResult = IotHttpsClient_SendSync( xHTTPSConnection,
\r
466 &( xHTTPSResponse ),
\r
467 &( xHTTPSResponseInfo ),
\r
468 httpsexampleHTTPS_TIMEOUT_MS );
\r
469 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r
471 /* The response status is only available if the httpsexampleRESPONSE_USER_BUFFER
\r
472 * is large enough to fit not only the HTTPS Client response context, but
\r
473 * also the Status-Line of the response. The Status-Line and the response
\r
474 * headers are stored in the provided ucHTTPSResponseUserBuffer right after
\r
475 * the HTTPS Client response context. */
\r
476 xHTTPSClientResult = IotHttpsClient_ReadResponseStatus( xHTTPSResponse,
\r
477 &usResponseStatus );
\r
478 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r
480 configPRINTF( ( "Response status: %d\r\n", usResponseStatus ) );
\r
481 configPRINTF( ( "Response body: \r\n%s\r\n", ucHTTPSResponseBodyBuffer ) );
\r
483 /* The response body may be too large for the print buffer. These extra
\r
484 * carriage returns and newlines help with clobbering. */
\r
485 configPRINTF( ( "\r\n\r\n" ) );
\r
488 /*-----------------------------------------------------------*/
\r
490 static void prvHTTPSDisconnect( void )
\r
492 IotHttpsReturnCode_t xHTTPSClientResult;
\r
494 /* The application must always explicitly disconnect from the server with
\r
495 * this API if the last request sent on the connection was a persistent
\r
497 xHTTPSClientResult = IotHttpsClient_Disconnect( xHTTPSConnection );
\r
498 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r
502 static void prvInitialiseLibraries( void )
\r
504 IotTaskPoolError_t xTaskPoolResult;
\r
505 IotHttpsReturnCode_t xHTTPSClientResult;
\r
506 IotNetworkError_t xNetworkResult;
\r
508 /* The HTTPS Client library needs a task pool, so create the system task pool. */
\r
509 xTaskPoolResult = IotTaskPool_CreateSystemTaskPool( &( xTaskPoolParameters ) );
\r
510 configASSERT( xTaskPoolResult == IOT_TASKPOOL_SUCCESS );
\r
512 /* Initialize the network stack abstraction for FreeRTOS. */
\r
513 xNetworkResult = IotNetworkFreeRTOS_Init();
\r
514 configASSERT( xNetworkResult == IOT_NETWORK_SUCCESS );
\r
516 /* HTTPS Client library must be initialized before it can be used. This is
\r
517 * just one time initialization. */
\r
518 xHTTPSClientResult = IotHttpsClient_Init();
\r
519 configASSERT( xHTTPSClientResult == IOT_HTTPS_OK );
\r