Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IoT
Open IoT SDK
examples
total-solutions
Commits
c1e2a4a1
Verified
Commit
c1e2a4a1
authored
May 20, 2022
by
Vincent Coubard
Browse files
Convert iot socket to CDI APIs
Signed-off-by:
Vincent Coubard
<
vincent.coubard@arm.com
>
parent
d391136c
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
bsp/aws_configs/aws_secure_sockets_config.h
View file @
c1e2a4a1
/*
* FreeRTOS V202107.00
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -26,6 +27,7 @@
#ifndef IOT_SECURE_SOCKETS_CONFIG_H
#define IOT_SECURE_SOCKETS_CONFIG_H
#include
"RTOS_config.h"
/**
* @brief Byte order of the target MCU.
...
...
bsp/aws_libraries/abstractions/secure_sockets/include/iot_secure_sockets.h
View file @
c1e2a4a1
/*
* FreeRTOS Secure Sockets V1.3.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -50,10 +51,11 @@
*/
#include
<stdint.h>
#include
<stddef.h>
#include
"cmsis_os2.h"
#include
"RTOS_config.h"
#include
"iot_secure_sockets_config.h"
#include
"iot_secure_sockets_config_defaults.h"
#include
"iot_secure_sockets_wrapper_metrics.h"
#include
"iot_lib_init.h"
/**
* @ingroup SecureSockets_datatypes_handles
...
...
@@ -464,13 +466,13 @@ int32_t SOCKETS_Close( Socket_t xSocket );
* - Berkeley Socket Options
* - @ref SOCKETS_SO_RCVTIMEO
* - Sets the receive timeout
* - pvOptionValue (
TickType
_t) is the number of milliseconds that the
* - pvOptionValue (
uint32
_t) is the number of milliseconds that the
* receive function should wait before timing out.
* - Setting pvOptionValue = 0 causes receive to wait forever.
* - See PORT_SPECIFIC_LINK for device limitations.
* - @ref SOCKETS_SO_SNDTIMEO
* - Sets the send timeout
* - pvOptionValue (
TickType
_t) is the number of milliseconds that the
* - pvOptionValue (
uint32
_t) is the number of milliseconds that the
* send function should wait before timing out.
* - Setting pvOptionValue = 0 causes send to wait forever.
* - See PORT_SPECIFIC_LINK for device limitations.
...
...
bsp/aws_libraries/abstractions/secure_sockets/lwip/iot_secure_sockets.c
View file @
c1e2a4a1
This diff is collapsed.
Click to expand it.
bsp/aws_libraries/abstractions/transport/secure_sockets/transport_secure_sockets.c
View file @
c1e2a4a1
/*
* FreeRTOS Transport Secure Sockets V1.0.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -34,6 +35,8 @@
/* TCP/IP abstraction includes. */
#include
"transport_secure_sockets.h"
#include
"cmsis_os2.h"
/*-----------------------------------------------------------*/
/**
...
...
@@ -349,42 +352,39 @@ static int32_t transportTimeoutSetup( Socket_t tcpSocket,
uint32_t
sendTimeoutMs
,
uint32_t
recvTimeoutMs
)
{
TickType
_t
receiveTimeout
=
0
,
sendTimeout
=
0
;
uint32
_t
receiveTimeout
=
0
,
sendTimeout
=
0
;
int32_t
secureSocketStatus
=
(
int32_t
)
SOCKETS_ERROR_NONE
;
configASSERT
(
tcpSocket
!=
SOCKETS_INVALID_SOCKET
);
/* Secure Sockets uses
TickType
_t therefore replace the timeout value with
portMAX_DELAY
if it is exceeded. */
/* Secure Sockets uses
uint32
_t therefore replace the timeout value with
osWaitForever
if it is exceeded. */
receiveTimeout
=
pdMS_TO_TICKS
(
recvTimeoutMs
);
if
(
receiveTimeout
>
portMAX_DELAY
)
if
(
receiveTimeout
>
osWaitForever
)
{
receiveTimeout
=
portMAX_DELAY
;
receiveTimeout
=
osWaitForever
;
}
secureSocketStatus
=
SOCKETS_SetSockOpt
(
tcpSocket
,
0
,
SOCKETS_SO_RCVTIMEO
,
&
receiveTimeout
,
sizeof
(
TickType
_t
)
);
sizeof
(
uint32
_t
)
);
if
(
secureSocketStatus
==
SOCKETS_ERROR_NONE
)
{
/* Secure Sockets uses TickType_t therefore replace timeout vale with portMAX_DELAY if it exceeds. */
if
(
pdMS_TO_TICKS
(
sendTimeoutMs
)
>
portMAX_DELAY
)
{
sendTimeout
=
portMAX_DELAY
;
}
else
/* Secure Sockets uses uint32_t therefore replace timeout vale with osWaitForever if it exceeds. */
sendTimeout
=
pdMS_TO_TICKS
(
sendTimeoutMs
);
if
(
sendTimeout
>
osWaitForever
)
{
sendTimeout
=
pdMS_TO_TICKS
(
sendTimeoutMs
)
;
sendTimeout
=
osWaitForever
;
}
secureSocketStatus
=
SOCKETS_SetSockOpt
(
tcpSocket
,
0
,
SOCKETS_SO_SNDTIMEO
,
&
sendTimeout
,
sizeof
(
TickType
_t
)
);
sizeof
(
uint32
_t
)
);
if
(
secureSocketStatus
!=
(
int32_t
)
SOCKETS_ERROR_NONE
)
{
...
...
bsp/aws_libraries/abstractions/transport/secure_sockets/transport_secure_sockets.h
View file @
c1e2a4a1
/*
* FreeRTOS Transport Secure Sockets V1.0.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -31,6 +32,9 @@
#ifndef TRANSPORT_SECURE_SOCKETS_H
#define TRANSPORT_SECURE_SOCKETS_H
#include
"cmsis_os2.h"
#include
"RTOS_config.h"
/* bool is defined in only C99+. */
#if defined( __cplusplus ) || ( defined( __STDC_VERSION__ ) && ( __STDC_VERSION__ >= 199901L ) )
#include
<stdbool.h>
...
...
@@ -45,10 +49,6 @@
#include
"transport_interface.h"
#include
"iot_secure_sockets.h"
/* Kernel include. */
#include
"FreeRTOS.h"
#include
"task.h"
/* Include header that defines log levels. */
#include
"logging_levels.h"
...
...
bsp/aws_libraries/freertos_plus/standard/tls/include/iot_tls.h
View file @
c1e2a4a1
/*
* FreeRTOS TLS V1.3.1
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -26,9 +27,7 @@
#ifndef __AWS__TLS__H__
#define __AWS__TLS__H__
#ifndef INC_FREERTOS_H
#error "include FreeRTOS.h must appear in source files before include iot_tls.h"
#endif
#include
"RTOS_config.h"
/**
* @defgroup TlsErrors TLS Error Codes
...
...
bsp/aws_libraries/freertos_plus/standard/tls/src/iot_tls.c
View file @
c1e2a4a1
/*
* FreeRTOS TLS V1.3.1
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -24,13 +25,12 @@
*/
/* FreeRTOS includes. */
#include
"
FreeRTOS
.h"
#include
"
cmsis_os2
.h"
#include
"FreeRTOSIPConfig.h"
#include
"iot_tls.h"
#include
"iot_crypto.h"
#include
"core_pkcs11_config.h"
#include
"core_pkcs11.h"
#include
"task.h"
#include
"aws_clientcredential_keys.h"
#include
"iot_default_root_certificates.h"
#include
"core_pki_utils.h"
...
...
@@ -57,6 +57,8 @@
#include
<time.h>
#include
<stdio.h>
#define ERRNO_NOSPACE 28
/**
* @brief Represents string to be logged when mbedTLS returned error
* does not contain a high-level code.
...
...
@@ -1044,7 +1046,7 @@ BaseType_t TLS_Send( void * pvContext,
/* Sent data, so update the tally and keep looping. */
xWritten
+=
(
size_t
)
xResult
;
}
else
if
(
(
0
==
xResult
)
||
(
-
pdFREERTOS_
ERRNO_
E
NOSP
C
==
xResult
)
)
else
if
(
(
0
==
xResult
)
||
(
-
ERRNO_NOSP
ACE
==
xResult
)
)
{
/* No data sent. The secure sockets
* API supports non-blocking send, so stop the loop but don't
...
...
bsp/lwip-config/user_lwipopts.h
View file @
c1e2a4a1
...
...
@@ -3,8 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 1
#define MEM_ALIGNMENT 4U
#define MEM_SIZE (20 * 1024)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment