Added FreeRTOS+TCP
This commit is contained in:
parent
fcbe6dcfef
commit
0308e9bb92
119
Doc/global.prop
119
Doc/global.prop
|
|
@ -1,119 +0,0 @@
|
|||
# properties for all file types
|
||||
indent.automatic=1
|
||||
virtual.space=0
|
||||
view.whitespace=0
|
||||
view.endofline=0
|
||||
code.page=0
|
||||
caretline.visible=1
|
||||
highlight.matchingbraces=1
|
||||
print.syntax.coloring=1
|
||||
use.tab.color=1
|
||||
create.backup.files=0
|
||||
auto.load.ext.modfiles=0
|
||||
save.prj.before.dbg=0
|
||||
save.files.before.dbg=0
|
||||
function.scanner.project=0
|
||||
function.scanner.files=1
|
||||
function.scanner.modules=1
|
||||
|
||||
# properties for c/cpp files
|
||||
syntax.colouring.cpp=1
|
||||
use.tab.cpp=0
|
||||
tabsize.cpp=2
|
||||
line.margin.visible.cpp=1
|
||||
fold.cpp=1
|
||||
monospaced.font.cpp=1
|
||||
|
||||
# properties for asm files
|
||||
syntax.colouring.asm=1
|
||||
use.tab.asm=0
|
||||
tabsize.asm=4
|
||||
line.margin.visible.asm=1
|
||||
monospaced.font.asm=1
|
||||
|
||||
# properties for other files
|
||||
use.tabs=0
|
||||
tabsize=4
|
||||
line.margin.visible.txt=0
|
||||
monospaced.font.txt=1
|
||||
|
||||
# setting for code completion, syntax check and source browser information
|
||||
cc.autolist=1
|
||||
cc.highlightsyntax=1
|
||||
cc.showparameters=1
|
||||
cc.triggerlist=1
|
||||
cc.triggernumchars=3
|
||||
cc.enter.as.fillup=0
|
||||
cc.usealpha4inactcode=1
|
||||
cc.alphavalue=50
|
||||
cc.autoupdbi=1
|
||||
cc.updbiinterval=3
|
||||
|
||||
# autosave for editor files
|
||||
autosave=0
|
||||
autosave.interval=5
|
||||
|
||||
# vertical edge at right margin
|
||||
edge.mode=0
|
||||
edge.column=80
|
||||
|
||||
|
||||
# Specification for text selection and caret line
|
||||
selection.fore=#000000
|
||||
selection.back=#FFA953
|
||||
caret.fore=#F0F0F0
|
||||
caret.back=#000000
|
||||
|
||||
# Color for vertical edge
|
||||
edge.colour=#3A3A3A
|
||||
|
||||
# C/C++ Editor files
|
||||
template.cpp="#define","#define |";"#if","#if |\r\n\r\n#endif";\\
|
||||
"#include","#include ";"Header","// Header:\r\n// File Name: |\r\n// Author:\r\n// Date:\r\n";\\
|
||||
"continue","continue;";"do","do\r\n{\r\n\t// TODO: enter the block content here\r\n\t\r\n\t|\r\n} while ();\r\n";\\
|
||||
"enum","enum |\r\n{\r\n\t\r\n};\r\n";"for","for(|;;)\r\n{\r\n}";\\
|
||||
"fpointer_type","typedef int (* |F)();\r\n";"function","void function(|)\r\n{\r\n\r\n}\r\n";\\
|
||||
"if","if (|)";"ifelse","if (|)\r\n{\r\n}\r\nelse\r\n{\r\n}";\\
|
||||
"struct","struct | \r\n{\r\n\r\n};\r\n";"switch","switch (|)\r\n{\r\n\tcase:\r\n\t\tbreak;\r\n\tcase:\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n}";\\
|
||||
"void","void | ();\r\n";"while","while (|)\r\n{\r\n}";\\
|
||||
|
||||
font.monospace.cpp=Consolas
|
||||
style.cpp.32=font:Consolas,size:12,fore:#FFFFFF,back:#3A3A3A
|
||||
style.cpp.4=font:Consolas,size:12,fore:#8AD9DB,back:#3E3E3E
|
||||
style.cpp.10=font:Consolas,size:12,fore:#EEEEEE,back:#3A3A3A
|
||||
style.cpp.1=font:Consolas,size:12,fore:#88CA88,back:#3A3A3A
|
||||
style.cpp.2=font:Consolas,size:12,fore:#76D17A,back:#3A3A3A
|
||||
style.cpp.5=font:Consolas,size:12,fore:#6C9CFF,back:#3A3A3A
|
||||
style.cpp.6=font:Consolas,size:12,fore:#DD9775,back:#3A3A3A
|
||||
style.cpp.11=font:Consolas,size:12,fore:#E8E8E8,back:#3A3A3A
|
||||
style.cpp.9=font:Consolas,size:12,fore:#DDD37B,back:#3A3A3A
|
||||
style.cpp.7=font:Consolas,size:12,fore:#F0F0F0,back:#3A3A3A
|
||||
style.cpp.34=font:Consolas,size:12,fore:#94FF28,back:#000000
|
||||
style.cpp.35=font:Consolas,size:12,fore:#D20000,back:#3A3A3A
|
||||
style.cpp.16=font:Consolas,size:12,fore:#FF0F69,back:#3A3A3A
|
||||
style.cpp.12=font:Consolas,size:12,fore:#FF0000,back:#3A3A3A
|
||||
style.cpp.86=font:Consolas,size:12,fore:#696969,back:#FFFFFF
|
||||
|
||||
|
||||
# Asm Editor files
|
||||
font.monospace.asm=Consolas
|
||||
style.asm.32=font:Consolas,size:12,fore:#FFFFFF,back:#333333
|
||||
style.asm.1=font:Consolas,size:12,fore:#8ECF85,back:#333333
|
||||
style.asm.2=font:Consolas,size:12,fore:#FF0000,back:#333333
|
||||
style.asm.3=font:Consolas,size:12,fore:#7F007F,back:#FFFFFF
|
||||
style.asm.4=font:Consolas,size:12,fore:#7EE1E7,back:#333333
|
||||
style.asm.5=font:Consolas,size:12,fore:#668CFF,back:#333333
|
||||
style.asm.6=font:Consolas,size:12,fore:#DE8E74,back:#333333
|
||||
style.asm.7=font:Consolas,size:12,fore:#F0F0F0,back:#333333
|
||||
style.asm.9=font:Consolas,size:12,fore:#D3CB61,back:#333333
|
||||
style.asm.10=font:Consolas,size:12,fore:#EFEFEF,back:#333333
|
||||
style.asm.11=font:Consolas,size:12,fore:#EBEBEB,back:#333333
|
||||
style.asm.12=font:Consolas,size:12,fore:#DF0000,back:#333333
|
||||
style.asm.8=font:Consolas,size:12,fore:#FFFF00,back:#333333
|
||||
|
||||
|
||||
# Editor Text files
|
||||
font.monospace.txt=Consolas
|
||||
style.txt.32=font:Verdana,size:10,fore:#000000,back:#FFFFFF
|
||||
|
||||
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
#include "NetworkInterface.h"
|
||||
#include "NetworkBufferManagement.h"
|
||||
#include "FreeRTOS_DNS.h"
|
||||
|
||||
//#include "core_pkcs11.h"
|
||||
/* IPv4 multi-cast addresses range from 224.0.0.0.0 to 240.0.0.0. */
|
||||
#define ipFIRST_MULTI_CAST_IPv4 0xE0000000U /**< Lower bound of the IPv4 multicast address. */
|
||||
#define ipLAST_MULTI_CAST_IPv4 0xF0000000U /**< Higher bound of the IPv4 multicast address. */
|
||||
|
|
@ -2169,3 +2169,166 @@ BaseType_t FreeRTOS_IsNetworkUp( void )
|
|||
#ifdef FREERTOS_TCP_ENABLE_VERIFICATION
|
||||
#include "aws_freertos_ip_verification_access_ip_define.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#warning Define ulApplicationGetNextSequenceNumber & xApplicationGetRandomNumber
|
||||
#endif
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
// CK_RV xResult = 0;
|
||||
// SemaphoreHandle_t xSessionLock = NULL;
|
||||
// CK_SESSION_HANDLE xPkcs11Session = 0;
|
||||
// CK_FUNCTION_LIST_PTR pxPkcs11FunctionList = NULL;
|
||||
// uint32_t ulRandomValue = 0;
|
||||
// BaseType_t xReturn; /* Return pdTRUE if successful */
|
||||
|
||||
// xResult = prvSocketsGetCryptoSession( &xSessionLock,
|
||||
// &xPkcs11Session,
|
||||
// &pxPkcs11FunctionList );
|
||||
|
||||
// if( 0 == xResult )
|
||||
// {
|
||||
// /* Request a sequence of cryptographically random byte values using
|
||||
// * PKCS#11. */
|
||||
// xResult = pxPkcs11FunctionList->C_GenerateRandom( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &ulRandomValue,
|
||||
// sizeof( ulRandomValue ) );
|
||||
// }
|
||||
|
||||
// /* Check if any of the API calls failed. */
|
||||
// if( 0 == xResult )
|
||||
// {
|
||||
// xReturn = pdTRUE;
|
||||
// *( pulNumber ) = ulRandomValue;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// xReturn = pdFALSE;
|
||||
// *( pulNumber ) = 0uL;
|
||||
// }
|
||||
*( pulNumber ) = 0x12345678;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate a TCP Initial Sequence Number that is reasonably difficult
|
||||
* to predict, per https://tools.ietf.org/html/rfc6528.
|
||||
*/
|
||||
uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
// CK_RV xResult = CKR_OK;
|
||||
// SemaphoreHandle_t xSessionLock = NULL;
|
||||
// CK_SESSION_HANDLE xPkcs11Session = 0;
|
||||
// CK_FUNCTION_LIST_PTR pxPkcs11FunctionList = NULL;
|
||||
// CK_MECHANISM xMechSha256 = { 0 };
|
||||
// uint8_t ucSha256Result[ cryptoSHA256_DIGEST_BYTES ];
|
||||
// CK_ULONG ulLength = sizeof( ucSha256Result );
|
||||
// uint32_t ulNextSequenceNumber = 0;
|
||||
// static uint64_t ullKey;
|
||||
// static CK_BBOOL xKeyIsInitialized = CK_FALSE;
|
||||
|
||||
// /* Acquire a crypto session handle. */
|
||||
// xResult = prvSocketsGetCryptoSession( &xSessionLock,
|
||||
// &xPkcs11Session,
|
||||
// &pxPkcs11FunctionList );
|
||||
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xSemaphoreTake( xSessionLock, portMAX_DELAY );
|
||||
|
||||
// if( CK_FALSE == xKeyIsInitialized )
|
||||
// {
|
||||
// /* One-time initialization, per boot, of the random seed. */
|
||||
// xResult = pxPkcs11FunctionList->C_GenerateRandom( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &ullKey,
|
||||
// sizeof( ullKey ) );
|
||||
|
||||
// if( xResult == CKR_OK )
|
||||
// {
|
||||
// xKeyIsInitialized = CK_TRUE;
|
||||
// }
|
||||
// }
|
||||
|
||||
// xSemaphoreGive( xSessionLock );
|
||||
// }
|
||||
|
||||
// /* Lock the shared crypto session. */
|
||||
// xSemaphoreTake( xSessionLock, portMAX_DELAY );
|
||||
|
||||
// /* Start a hash. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xMechSha256.mechanism = CKM_SHA256;
|
||||
// xResult = pxPkcs11FunctionList->C_DigestInit( xPkcs11Session, &xMechSha256 );
|
||||
// }
|
||||
|
||||
// /* Hash the seed. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &ullKey,
|
||||
// sizeof( ullKey ) );
|
||||
// }
|
||||
|
||||
// /* Hash the source address. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &ulSourceAddress,
|
||||
// sizeof( ulSourceAddress ) );
|
||||
// }
|
||||
|
||||
// /* Hash the source port. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &usSourcePort,
|
||||
// sizeof( usSourcePort ) );
|
||||
// }
|
||||
|
||||
// /* Hash the destination address. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &ulDestinationAddress,
|
||||
// sizeof( ulDestinationAddress ) );
|
||||
// }
|
||||
|
||||
// /* Hash the destination port. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
// ( CK_BYTE_PTR ) &usDestinationPort,
|
||||
// sizeof( usDestinationPort ) );
|
||||
// }
|
||||
|
||||
// /* Get the hash. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// xResult = pxPkcs11FunctionList->C_DigestFinal( xPkcs11Session,
|
||||
// ucSha256Result,
|
||||
// &ulLength );
|
||||
// }
|
||||
|
||||
// xSemaphoreGive( xSessionLock );
|
||||
|
||||
// /* Use the first four bytes of the hash result as the starting point for
|
||||
// * all initial sequence numbers for connections based on the input 4-tuple. */
|
||||
// if( CKR_OK == xResult )
|
||||
// {
|
||||
// memcpy( &ulNextSequenceNumber,
|
||||
// ucSha256Result,
|
||||
// sizeof( ulNextSequenceNumber ) );
|
||||
|
||||
// /* Add the tick count of four-tick intervals. In theory, per the RFC
|
||||
// * (see above), this approach still allows server equipment to optimize
|
||||
// * handling of connections from the same device that haven't fully timed out. */
|
||||
// ulNextSequenceNumber += xTaskGetTickCount() / 4;
|
||||
// }
|
||||
uint32_t ulNextSequenceNumber = 0x87654321;
|
||||
return ulNextSequenceNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V3.1.0
|
||||
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_IP_CONFIG_H
|
||||
#define FREERTOS_IP_CONFIG_H
|
||||
|
||||
/* Empty configuration file to check the build with default configuration. */
|
||||
|
||||
/* It is not sensible for this macro to have a default value as it is hardware
|
||||
* dependent. */
|
||||
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,666 @@
|
|||
/*
|
||||
* FreeRTOS Secure Sockets V1.3.1
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iot_secure_sockets.h
|
||||
* @brief Secure Sockets Interface.
|
||||
*
|
||||
* Secure sockets is a portable layer for establishing a TCP/IP
|
||||
* connection, with the option of using TLS.
|
||||
*
|
||||
* Secure sockets is based on the Berkeley sockets API.
|
||||
* A few difference general differences between Berkeley and SOCKETS are:
|
||||
* - SOCKETS has additional socket options to enable TLS, server name
|
||||
* indication, and per-socket root of trust server certificates. See
|
||||
* SOCKETS_SetSockOpt() for more information.
|
||||
* - SOCKETS API return an error code, rather than returning -1 and setting
|
||||
* a global errno value.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AWS_SECURE_SOCKETS_H_
|
||||
#define _AWS_SECURE_SOCKETS_H_
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
* extern "C" {
|
||||
#endif
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "iot_secure_sockets_config.h"
|
||||
#include "iot_secure_sockets_config_defaults.h"
|
||||
#include "iot_lib_init.h"
|
||||
|
||||
/**
|
||||
* @ingroup SecureSockets_datatypes_handles
|
||||
* @brief The socket handle data type.
|
||||
*
|
||||
* For detail of socket, refer to [Network Sockets]
|
||||
* (https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/socket.html)
|
||||
*
|
||||
* Data contained by the Socket_t type is port specific.
|
||||
*/
|
||||
struct xSOCKET;
|
||||
typedef struct xSOCKET * Socket_t; /**< @brief Socket handle data type. */
|
||||
|
||||
/**
|
||||
* @brief The "size_t" of secure sockets.
|
||||
*
|
||||
* This type is used for compatibility with the expected Berkeley sockets
|
||||
* naming.
|
||||
*/
|
||||
#define Socklen_t uint32_t
|
||||
|
||||
/**
|
||||
* @anchor SocketsErrors
|
||||
* @name SocketsErrors
|
||||
* @brief Error codes returned by the SOCKETS API.
|
||||
*
|
||||
* Note that SOCKETS API may also propagate port-specific
|
||||
* error codes when they are more descriptive. See your
|
||||
* port's error codes for more details.
|
||||
* PORT_SPECIFIC_LINK
|
||||
*/
|
||||
/**@{ */
|
||||
|
||||
#define SOCKETS_ERROR_NONE ( 0 ) /*!< No error. */
|
||||
#define SOCKETS_SOCKET_ERROR ( -1 ) /*!< Catch-all sockets error code. */
|
||||
#define SOCKETS_EWOULDBLOCK ( -11 ) /*!< A resource is temporarily unavailable. */
|
||||
#define SOCKETS_ENOMEM ( -12 ) /*!< Memory allocation failed. */
|
||||
#define SOCKETS_EINVAL ( -22 ) /*!< Invalid argument. */
|
||||
#define SOCKETS_ENOPROTOOPT ( -109 ) /*!< A bad option was specified . */
|
||||
#define SOCKETS_ENOTCONN ( -126 ) /*!< The supplied socket is not connected. */
|
||||
#define SOCKETS_EISCONN ( -127 ) /*!< The supplied socket is already connected. */
|
||||
#define SOCKETS_ECLOSED ( -128 ) /*!< The supplied socket has already been closed. */
|
||||
#define SOCKETS_TLS_INIT_ERROR ( -1001 ) /*!< TLS initialization failed. */
|
||||
#define SOCKETS_TLS_HANDSHAKE_ERROR ( -1002 ) /*!< TLS handshake failed. */
|
||||
#define SOCKETS_TLS_SERVER_UNVERIFIED ( -1003 ) /*!< A connection was made but the server could not be verified. It is recommended that the socket be closed. */
|
||||
#define SOCKETS_TLS_RECV_ERROR ( -1004 ) /*!< TLS receive operation failed. */
|
||||
#define SOCKETS_TLS_SEND_ERROR ( -1005 ) /*!< TLS send operation failed. */
|
||||
#define SOCKETS_PERIPHERAL_RESET ( -1006 ) /*!< Communications peripheral has been reset. */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @brief Assigned to an Socket_t variable when the socket is not valid.
|
||||
*/
|
||||
#define SOCKETS_INVALID_SOCKET ( ( Socket_t ) ~0U )
|
||||
|
||||
/**
|
||||
* @anchor SocketDomains
|
||||
* @name SocketDomains
|
||||
*
|
||||
* @brief Options for the lDomain parameter of SOCKETS_Socket()
|
||||
* function.
|
||||
*
|
||||
* These select the protocol family to be used for communication.
|
||||
*/
|
||||
/**@{ */
|
||||
#define SOCKETS_AF_INET ( 2 ) /*!< IPv4 Internet Protocols. */
|
||||
#define SOCKETS_PF_INET SOCKETS_AF_INET /*!< IPv4 Internet Protocol. */
|
||||
#define SOCKETS_AF_INET6 ( 10 ) /*!< IPv6 Internet Protocols. This option is currently not supported. */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @anchor SocketTypes
|
||||
* @name SocketTypes
|
||||
*
|
||||
* @brief Options for the lType parameter of SOCKETS_Socket()
|
||||
* function.
|
||||
*
|
||||
* These specify the communication semantics.
|
||||
*/
|
||||
/**@{ */
|
||||
#define SOCKETS_SOCK_DGRAM ( 2 ) /*!< Datagram. */
|
||||
#define SOCKETS_SOCK_STREAM ( 1 ) /*!< Byte-stream. */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @anchor Protocols
|
||||
* @name Protocols
|
||||
*
|
||||
* @brief Options for the lProtocol parameter of SOCKETS_Socket() function.
|
||||
*
|
||||
*/
|
||||
/**@{ */
|
||||
#define SOCKETS_IPPROTO_UDP ( 17 ) /*!< UDP. This option is currently not supported. */
|
||||
#define SOCKETS_IPPROTO_TCP ( 6 ) /*!< TCP. */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @anchor SetSockOptOptions
|
||||
* @name SetSockOptOptions
|
||||
*
|
||||
* @brief Options for lOptionName in SOCKETS_SetSockOpt().
|
||||
*
|
||||
*/
|
||||
/**@{ */
|
||||
#define SOCKETS_SO_RCVTIMEO ( 0 ) /**< Set the receive timeout. */
|
||||
#define SOCKETS_SO_SNDTIMEO ( 1 ) /**< Set the send timeout. */
|
||||
#define SOCKETS_SO_SNDBUF ( 4 ) /**< Set the size of the send buffer (TCP only). */
|
||||
#define SOCKETS_SO_RCVBUF ( 5 ) /**< Set the size of the receive buffer (TCP only). */
|
||||
#define SOCKETS_SO_SERVER_NAME_INDICATION ( 6 ) /**< Toggle client use of TLS SNI. */
|
||||
#define SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE ( 7 ) /**< Override default TLS server certificate trust. Must be PEM encoded and length must include null terminator. */
|
||||
#define SOCKETS_SO_REQUIRE_TLS ( 8 ) /**< Toggle client enforcement of TLS. */
|
||||
#define SOCKETS_SO_NONBLOCK ( 9 ) /**< Socket is nonblocking. */
|
||||
#define SOCKETS_SO_ALPN_PROTOCOLS ( 10 ) /**< Application protocol list to be included in TLS ClientHello. */
|
||||
#define SOCKETS_SO_WAKEUP_CALLBACK ( 17 ) /**< Set the callback to be called whenever there is data available on the socket for reading. */
|
||||
#define SOCKETS_SO_TCPKEEPALIVE ( 18 ) /**< Enable or Disable TCP keep-alive functionality. */
|
||||
#define SOCKETS_SO_TCPKEEPALIVE_INTERVAL ( 19 ) /**< Set the time in seconds between individual TCP keep-alive probes. */
|
||||
#define SOCKETS_SO_TCPKEEPALIVE_COUNT ( 20 ) /**< Set the maximum number of keep-alive probes TCP should send before dropping the connection. */
|
||||
#define SOCKETS_SO_TCPKEEPALIVE_IDLE_TIME ( 21 ) /**< Set the time in seconds for which the connection needs to remain idle before TCP starts sending keep-alive probes. */
|
||||
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @anchor ShutdownFlags <br>
|
||||
* @name ShutdownFlags
|
||||
*
|
||||
* @brief Options for the ulHow parameter in SOCKETS_Shutdown().
|
||||
*/
|
||||
/**@{ */
|
||||
#define SOCKETS_SHUT_RD ( 0 ) /**< No further receives. */
|
||||
#define SOCKETS_SHUT_WR ( 1 ) /**< No further sends. */
|
||||
#define SOCKETS_SHUT_RDWR ( 2 ) /**< No further send or receive. */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* @brief Maximum length of an ASCII DNS name.
|
||||
*/
|
||||
#define securesocketsMAX_DNS_NAME_LENGTH ( 253 )
|
||||
|
||||
/**
|
||||
* @ingroup SecureSockets_datatypes_paramstructs
|
||||
* @brief Socket address.
|
||||
*
|
||||
* \sa PORT_SPECIFIC_LINK
|
||||
*/
|
||||
typedef struct SocketsSockaddr
|
||||
{
|
||||
uint8_t ucLength; /**< Length of SocketsSockaddr structure. */
|
||||
uint8_t ucSocketDomain; /**< Only SOCKETS_AF_INET is supported. */
|
||||
uint16_t usPort; /**< Port number. Convention is to call this sin_port. */
|
||||
uint32_t ulAddress; /**< IP Address. Convention is to call this sin_addr. */
|
||||
} SocketsSockaddr_t;
|
||||
|
||||
/**
|
||||
* @brief Well-known port numbers.
|
||||
*/
|
||||
#define securesocketsDEFAULT_TLS_DESTINATION_PORT 443
|
||||
|
||||
/**
|
||||
* @brief Secure Sockets library initialization function.
|
||||
*
|
||||
* This function does general initialization and setup. It must be called once
|
||||
* and only once before calling any other function.
|
||||
*
|
||||
* @return
|
||||
* * `pdPASS` if everything succeeds
|
||||
* * `pdFAIL` otherwise.
|
||||
*/
|
||||
extern BaseType_t SOCKETS_Init( void );
|
||||
|
||||
/**
|
||||
* @brief Creates a TCP socket.
|
||||
*
|
||||
* See the [FreeRTOS+TCP networking tutorial]
|
||||
* (https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial.html)
|
||||
* for more information on TCP sockets.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @sa SOCKETS_Close()
|
||||
*
|
||||
* @param[in] lDomain Must be set to SOCKETS_AF_INET. See @ref SocketDomains.
|
||||
* @param[in] lType Set to SOCKETS_SOCK_STREAM to create a TCP socket.
|
||||
* No other value is valid. See @ref SocketTypes.
|
||||
* @param[in] lProtocol Set to SOCKETS_IPPROTO_TCP to create a TCP socket.
|
||||
* No other value is valid. See @ref Protocols.
|
||||
*
|
||||
* @return
|
||||
* * If a socket is created successfully, then the socket handle is
|
||||
* returned
|
||||
* * @ref SOCKETS_INVALID_SOCKET is returned if an error occurred.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This call allocates memory and claims a socket resource.
|
||||
*/
|
||||
/* @[declare_secure_sockets_socket] */
|
||||
Socket_t SOCKETS_Socket( int32_t lDomain,
|
||||
int32_t lType,
|
||||
int32_t lProtocol );
|
||||
/* @[declare_secure_sockets_socket] */
|
||||
|
||||
/**
|
||||
* @brief Bind a TCP socket.
|
||||
*
|
||||
* See the [FreeRTOS+TCP networking tutorial]
|
||||
* (https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial.html)
|
||||
* for more information on TCP sockets.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @sa SOCKETS_Bind()
|
||||
* A pre-configured source port allows customers to bind to the specified local port instead of ephemeral port
|
||||
* for security and packet filter reasons.
|
||||
*
|
||||
* Limitations:
|
||||
*
|
||||
* i. The caller of SOCKETS_Bind() API should make sure the socket address has the correct local IP address for the interface.
|
||||
* ii. Some source ports may be unavailable depending on the TCP/IP stack implementation.
|
||||
*
|
||||
* NOTE: If the SOCKETS_Bind() API binds to a source port in ephemeral port range, and the caller calls SOCKETS_Bind() API
|
||||
* before SOCKETS_Connect() API, then a conflict of source port arises as another TCP connection
|
||||
* may pick the the same chosen port via tcp_new_port() API ( by scanning its internal TCP connection list )
|
||||
*
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket to which specified address to be bound.
|
||||
* @param[in] pxAddress A pointer to a SocketsSockaddr_t structure that contains
|
||||
* the address and port to be bound to the socket.
|
||||
* @param[in] xAddressLength Should be set to sizeof( @ref SocketsSockaddr_t ).
|
||||
*
|
||||
* @return
|
||||
* * If the bind was successful then SOCKETS_ERROR_NONE is returned.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_bind] */
|
||||
int32_t SOCKETS_Bind( Socket_t xSocket,
|
||||
SocketsSockaddr_t * pxAddress,
|
||||
Socklen_t xAddressLength );
|
||||
/* @[declare_secure_sockets_bind] */
|
||||
|
||||
/**
|
||||
* @brief Connects the socket to the specified IP address and port.
|
||||
*
|
||||
* The socket must first have been successfully created by a call to SOCKETS_Socket().
|
||||
*
|
||||
* \note To create a secure socket, SOCKETS_SetSockOpt() should be called with the
|
||||
* SOCKETS_SO_REQUIRE_TLS option \a before SOCKETS_Connect() is called.
|
||||
*
|
||||
* If this function returns an error the socket is considered invalid.
|
||||
*
|
||||
* \warning SOCKETS_Connect() is not safe to be called on the same socket
|
||||
* from multiple threads simultaneously with SOCKETS_Connect(),
|
||||
* SOCKETS_SetSockOpt(), SOCKETS_Shutdown(), SOCKETS_Close().
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket to be connected.
|
||||
* @param[in] pxAddress A pointer to a SocketsSockaddr_t structure that contains the
|
||||
* the address to connect the socket to.
|
||||
* @param[in] xAddressLength Should be set to sizeof( @ref SocketsSockaddr_t ).
|
||||
*
|
||||
* @return
|
||||
* * @ref SOCKETS_ERROR_NONE if a connection is established.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_connect] */
|
||||
int32_t SOCKETS_Connect( Socket_t xSocket,
|
||||
SocketsSockaddr_t * pxAddress,
|
||||
Socklen_t xAddressLength );
|
||||
/* @[declare_secure_sockets_connect] */
|
||||
|
||||
/**
|
||||
* @brief Receive data from a TCP socket.
|
||||
*
|
||||
* The socket must have already been created using a call to SOCKETS_Socket()
|
||||
* and connected to a remote socket using SOCKETS_Connect().
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket from which data is being received.
|
||||
* @param[out] pvBuffer The buffer into which the received data will be placed.
|
||||
* @param[in] xBufferLength The maximum number of bytes which can be received.
|
||||
* pvBuffer must be at least xBufferLength bytes long.
|
||||
* @param[in] ulFlags Not currently used. Should be set to 0.
|
||||
*
|
||||
* @return
|
||||
* * If the receive was successful then the number of bytes received (placed in the
|
||||
* buffer pointed to by pvBuffer) is returned.
|
||||
* * If a timeout occurred before data could be received then 0 is returned (timeout
|
||||
* is set using @ref SOCKETS_SO_RCVTIMEO).
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_recv] */
|
||||
int32_t SOCKETS_Recv( Socket_t xSocket,
|
||||
void * pvBuffer,
|
||||
size_t xBufferLength,
|
||||
uint32_t ulFlags );
|
||||
/* @[declare_secure_sockets_recv] */
|
||||
|
||||
/**
|
||||
* @brief Transmit data to the remote socket.
|
||||
*
|
||||
* The socket must have already been created using a call to SOCKETS_Socket() and
|
||||
* connected to a remote socket using SOCKETS_Connect().
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @param[in] xSocket The handle of the sending socket.
|
||||
* @param[in] pvBuffer The buffer containing the data to be sent.
|
||||
* @param[in] xDataLength The length of the data to be sent.
|
||||
* @param[in] ulFlags Not currently used. Should be set to 0.
|
||||
*
|
||||
* @return
|
||||
* * On success, the number of bytes actually sent is returned.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_send] */
|
||||
int32_t SOCKETS_Send( Socket_t xSocket,
|
||||
const void * pvBuffer,
|
||||
size_t xDataLength,
|
||||
uint32_t ulFlags );
|
||||
/* @[declare_secure_sockets_send] */
|
||||
|
||||
/**
|
||||
* @brief Closes all or part of a full-duplex connection on the socket.
|
||||
*
|
||||
* Disable reads and writes on a connected TCP socket. A connected TCP socket must be gracefully
|
||||
* shut down before it can be closed.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* \warning SOCKETS_Shutdown() is not safe to be called on the same socket
|
||||
* from multiple threads simultaneously with SOCKETS_Connect(),
|
||||
* SOCKETS_SetSockOpt(), SOCKETS_Shutdown(), SOCKETS_Close().
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket to shutdown.
|
||||
* @param[in] ulHow SOCKETS_SHUT_RD, SOCKETS_SHUT_WR or SOCKETS_SHUT_RDWR.
|
||||
* @ref ShutdownFlags
|
||||
*
|
||||
* @return
|
||||
* * If the operation was successful, 0 is returned.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_shutdown] */
|
||||
int32_t SOCKETS_Shutdown( Socket_t xSocket,
|
||||
uint32_t ulHow );
|
||||
/* @[declare_secure_sockets_shutdown] */
|
||||
|
||||
/**
|
||||
* @brief Closes the socket and frees the related resources.
|
||||
*
|
||||
* A socket should be shutdown gracefully before it is closed, and cannot be used after it has been closed.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* \warning SOCKETS_Close() is not safe to be called on the same socket
|
||||
* from multiple threads simultaneously with SOCKETS_Connect(),
|
||||
* SOCKETS_SetSockOpt(), SOCKETS_Shutdown(), SOCKETS_Close().
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket to close.
|
||||
*
|
||||
* @return
|
||||
* * On success, 0 is returned.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_close] */
|
||||
int32_t SOCKETS_Close( Socket_t xSocket );
|
||||
/* @[declare_secure_sockets_close] */
|
||||
|
||||
/**
|
||||
* @brief AWS IoT ALPN protocol name for MQTT over TLS on server port 443.
|
||||
*/
|
||||
#define socketsAWS_IOT_ALPN_MQTT "x-amzn-mqtt-ca"
|
||||
|
||||
/**
|
||||
* @brief Manipulates the options for the socket.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @param[in] xSocket The handle of the socket to set the option for.
|
||||
* @param[in] lLevel Not currently used. Should be set to 0.
|
||||
* @param[in] lOptionName See @ref SetSockOptOptions.
|
||||
* @param[in] pvOptionValue A buffer containing the value of the option to set.
|
||||
* @param[in] xOptionLength The length of the buffer pointed to by pvOptionValue.
|
||||
*
|
||||
* \warning SOCKETS_Close() is not safe to be called on the same socket
|
||||
* from multiple threads simultaneously with SOCKETS_Connect(),
|
||||
* SOCKETS_SetSockOpt(), SOCKETS_Shutdown(), SOCKETS_Close().
|
||||
*
|
||||
* @note Socket option support and possible values vary by port. Please see
|
||||
* PORT_SPECIFIC_LINK to check the valid options and limitations of your device.
|
||||
*
|
||||
* - Berkeley Socket Options
|
||||
* - @ref SOCKETS_SO_RCVTIMEO
|
||||
* - Sets the receive timeout
|
||||
* - pvOptionValue (TickType_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
|
||||
* send function should wait before timing out.
|
||||
* - Setting pvOptionValue = 0 causes send to wait forever.
|
||||
* - See PORT_SPECIFIC_LINK for device limitations.
|
||||
* - Non-Standard Options
|
||||
* - @ref SOCKETS_SO_NONBLOCK
|
||||
* - Makes a socket non-blocking.
|
||||
* - Non-blocking connect is not supported - socket option should be
|
||||
* called after connect.
|
||||
* - pvOptionValue is ignored for this option.
|
||||
* - @ref SOCKETS_SO_WAKEUP_CALLBACK
|
||||
* - Set the callback to be called whenever there is data available on
|
||||
* the socket for reading
|
||||
* - This option provides an asynchronous way to handle received data
|
||||
* - pvOptionValue is a pointer to the callback function
|
||||
* - See PORT_SPECIFIC_LINK for device limitations.
|
||||
* - Security Sockets Options
|
||||
* - @ref SOCKETS_SO_REQUIRE_TLS
|
||||
* - Use TLS for all connect, send, and receive on this socket.
|
||||
* - This socket options MUST be set for TLS to be used, even
|
||||
* if other secure socket options are set.
|
||||
* - This socket option should be set before SOCKETS_Connect() is
|
||||
* called.
|
||||
* - pvOptionValue is ignored for this option.
|
||||
* - @ref SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE
|
||||
* - Set the root of trust server certificate for the socket.
|
||||
* - This socket option only takes effect if @ref SOCKETS_SO_REQUIRE_TLS
|
||||
* is also set. If @ref SOCKETS_SO_REQUIRE_TLS is not set,
|
||||
* this option will be ignored.
|
||||
* - pvOptionValue is a pointer to the formatted server certificate.
|
||||
* TODO: Link to description of how to format certificates with \n
|
||||
* - xOptionLength (BaseType_t) is the length of the certificate
|
||||
* in bytes.
|
||||
* - @ref SOCKETS_SO_SERVER_NAME_INDICATION
|
||||
* - Use Server Name Indication (SNI)
|
||||
* - This socket option only takes effect if @ref SOCKETS_SO_REQUIRE_TLS
|
||||
* is also set. If @ref SOCKETS_SO_REQUIRE_TLS is not set,
|
||||
* this option will be ignored.
|
||||
* - pvOptionValue is a pointer to a string containing the hostname
|
||||
* - xOptionLength is the length of the hostname string in bytes.
|
||||
* - @ref SOCKETS_SO_ALPN_PROTOCOLS
|
||||
* - Negotiate an application protocol along with TLS.
|
||||
* - The ALPN list is expressed as an array of NULL-terminated ANSI
|
||||
* strings.
|
||||
* - xOptionLength is the number of items in the array.
|
||||
* - @ref SOCKETS_SO_TCPKEEPALIVE
|
||||
* - Enable or disable the TCP keep-alive functionality.
|
||||
* - pvOptionValue is the value to enable or disable Keepalive.
|
||||
* - @ref SOCKETS_SO_TCPKEEPALIVE_INTERVAL
|
||||
* - Set the time in seconds between individual TCP keep-alive probes.
|
||||
* - pvOptionValue is the time in seconds.
|
||||
* - @ref SOCKETS_SO_TCPKEEPALIVE_COUNT
|
||||
* - Set the maximum number of keep-alive probes TCP should send before
|
||||
* dropping the connection.
|
||||
* - pvOptionValue is the maximum number of keep-alive probes.
|
||||
* - @ref SOCKETS_SO_TCPKEEPALIVE_IDLE_TIME
|
||||
* - Set the time in seconds for which the connection needs to remain idle
|
||||
* before TCP starts sending keep-alive probes.
|
||||
* - pvOptionValue is the time in seconds.
|
||||
*
|
||||
* @return
|
||||
* * On success, 0 is returned.
|
||||
* * If an error occurred, a negative value is returned. @ref SocketsErrors
|
||||
*/
|
||||
/* @[declare_secure_sockets_setsockopt] */
|
||||
int32_t SOCKETS_SetSockOpt( Socket_t xSocket,
|
||||
int32_t lLevel,
|
||||
int32_t lOptionName,
|
||||
const void * pvOptionValue,
|
||||
size_t xOptionLength );
|
||||
/* @[declare_secure_sockets_setsockopt] */
|
||||
|
||||
/**
|
||||
* @brief Resolve a host name using Domain Name Service.
|
||||
*
|
||||
* See the [Berkeley Sockets API]
|
||||
* (https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions)
|
||||
* in wikipedia
|
||||
*
|
||||
* @param[in] pcHostName The host name to resolve.
|
||||
* @return
|
||||
* * The IPv4 address of the specified host.
|
||||
* * If an error has occurred, 0 is returned.
|
||||
*/
|
||||
/* @[declare_secure_sockets_gethostbyname] */
|
||||
uint32_t SOCKETS_GetHostByName( const char * pcHostName );
|
||||
/* @[declare_secure_sockets_gethostbyname] */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert an unsigned thirty-two-bit value from host endianness to network
|
||||
* endianness.
|
||||
*
|
||||
* @param[in] usIn The unsigned thirty-two-bit value to convert.
|
||||
*/
|
||||
#if defined( socketsconfigBYTE_ORDER ) && ( socketsconfigBYTE_ORDER == pdLITTLE_ENDIAN )
|
||||
#define SOCKETS_htonl( ulIn ) ( ( uint32_t ) ( ( ( ulIn & 0xFF ) << 24 ) | ( ( ulIn & 0xFF00 ) << 8 ) | ( ( ulIn & 0xFF0000 ) >> 8 ) | ( ( ulIn & 0xFF000000 ) >> 24 ) ) )
|
||||
#else
|
||||
#define SOCKETS_htonl( usIn ) ( ( uint32_t ) ( usIn ) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Convert an unsigned thirty-two-bit value from network endianness to host
|
||||
* endianness.
|
||||
*
|
||||
* @param[in] usIn The unsigned thirty-two-bit value to convert.
|
||||
*/
|
||||
#define SOCKETS_ntohl( usIn ) SOCKETS_htonl( usIn )
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert an unsigned sixteen-bit value from host endianness to network
|
||||
* endianness.
|
||||
*
|
||||
* @param[in] usIn The unsigned sixteen-bit value to convert.
|
||||
*/
|
||||
|
||||
#if defined( socketsconfigBYTE_ORDER ) && ( socketsconfigBYTE_ORDER == pdLITTLE_ENDIAN )
|
||||
#define SOCKETS_htons( usIn ) ( ( uint16_t ) ( ( ( usIn ) << 8U ) | ( ( usIn ) >> 8U ) ) )
|
||||
#else
|
||||
#define SOCKETS_htons( usIn ) ( ( uint16_t ) ( usIn ) )
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert an unsigned sixteen-bit value from network endianness to host
|
||||
* endianness.
|
||||
*
|
||||
* @param[in] usIn The unsigned sixteen-bit value to convert.
|
||||
*/
|
||||
#define SOCKETS_ntohs( usIn ) SOCKETS_htons( usIn )
|
||||
|
||||
/**
|
||||
* @brief Convert an IP address expressed as four separate numeric octets into a an IP address expressed as a 32-bit number in network byte order
|
||||
* (for example 192, 168, 0, 100)
|
||||
*
|
||||
* @param[in] ucOctet0 0th IP Octet
|
||||
* @param[in] ucOctet1 1st IP Octet
|
||||
* @param[in] ucOctet2 2nd IP Octet
|
||||
* @param[in] ucOctet3 3rd IP Octet
|
||||
*/
|
||||
#if defined( socketsconfigBYTE_ORDER ) && ( socketsconfigBYTE_ORDER == pdLITTLE_ENDIAN )
|
||||
|
||||
#define SOCKETS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
|
||||
( ( ( ( uint32_t ) ( ucOctet3 ) ) << 24UL ) | \
|
||||
( ( ( uint32_t ) ( ucOctet2 ) ) << 16UL ) | \
|
||||
( ( ( uint32_t ) ( ucOctet1 ) ) << 8UL ) | \
|
||||
( ( uint32_t ) ( ucOctet0 ) ) )
|
||||
|
||||
/**
|
||||
* @brief Convert an IP address expressed as a 32-bit number in network byte order to a string in decimal dot notation.
|
||||
* (for example "192.168.0.100")
|
||||
*
|
||||
* @param[in] ulIPAddress An IP address expressed as a 32-bit value in network byte order.
|
||||
* @param[in] pucBuffer A pointer to a buffer into which the IP address will be written in decimal dot notation.
|
||||
*/
|
||||
#define SOCKETS_inet_ntoa( ulIPAddress, pucBuffer ) \
|
||||
sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
|
||||
( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ), \
|
||||
( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
|
||||
( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ), \
|
||||
( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ) )
|
||||
|
||||
#else /* socketsconfigBYTE_ORDER. */
|
||||
|
||||
#define SOCKETS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
|
||||
( ( ( ( uint32_t ) ( ucOctet0 ) ) << 24UL ) | \
|
||||
( ( ( uint32_t ) ( ucOctet1 ) ) << 16UL ) | \
|
||||
( ( ( uint32_t ) ( ucOctet2 ) ) << 8UL ) | \
|
||||
( ( uint32_t ) ( ucOctet3 ) ) )
|
||||
|
||||
/**
|
||||
* @brief Convert an IP address expressed as a 32-bit number in network byte order to a string in decimal dot notation.
|
||||
* (for example "192.168.0.100")
|
||||
*
|
||||
* @param[in] ulIPAddress An IP address expressed as a 32-bit value in network byte order.
|
||||
* @param[in] pucBuffer A pointer to a buffer into which the IP address will be written in decimal dot notation.
|
||||
*/
|
||||
#define SOCKETS_inet_ntoa( ulIPAddress, pucBuffer ) \
|
||||
sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
|
||||
( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ), \
|
||||
( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ), \
|
||||
( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
|
||||
( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ) )
|
||||
|
||||
#endif /* socketsconfigBYTE_ORDER. */
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
* }
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif /* _AWS_SECURE_SOCKETS_H_ */
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* FreeRTOS Secure Sockets V1.3.1
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iot_secure_sockets_config_defaults.h
|
||||
* @brief Ensures that the required sockets configuration options are supplied
|
||||
* and the optional ones are set to sane values if the user does not supply.
|
||||
*/
|
||||
|
||||
#ifndef AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_
|
||||
#define AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_
|
||||
|
||||
/**
|
||||
* @brief Byte order of the target MCU must be defined.
|
||||
*
|
||||
* Valid values are pdLITTLE_ENDIAN and pdBIG_ENDIAN.
|
||||
*/
|
||||
#ifndef socketsconfigBYTE_ORDER
|
||||
#error "socketsconfigBYTE_ORDER must be defined."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default socket send timeout.
|
||||
*
|
||||
* The user can change the send timeout for a socket using the SOCKETS_SetSockOpt API
|
||||
* with the SOCKETS_SO_SNDTIMEO option.
|
||||
*/
|
||||
#ifndef socketsconfigDEFAULT_SEND_TIMEOUT
|
||||
#define socketsconfigDEFAULT_SEND_TIMEOUT ( 10000 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default socket receive timeout.
|
||||
*
|
||||
* The user can change the receive timeout for a socket using the SOCKETS_SetSockOpt API
|
||||
* with the SOCKETS_SO_RCVTIMEO option.
|
||||
*/
|
||||
#ifndef socketsconfigDEFAULT_RECV_TIMEOUT
|
||||
#define socketsconfigDEFAULT_RECV_TIMEOUT ( 10000 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief By default, metrics of secure socket is disabled.
|
||||
*
|
||||
*/
|
||||
#ifndef AWS_IOT_SECURE_SOCKETS_METRICS_ENABLED
|
||||
#define AWS_IOT_SECURE_SOCKETS_METRICS_ENABLED ( 0 )
|
||||
#endif
|
||||
|
||||
#endif /* AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_ */
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* FreeRTOS Secure Sockets V1.3.1
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iot_secure_sockets_config_defaults.h
|
||||
* @brief Ensures that the required sockets configuration options are supplied
|
||||
* and the optional ones are set to sane values if the user does not supply.
|
||||
*/
|
||||
|
||||
#ifndef AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_
|
||||
#define AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_
|
||||
|
||||
/**
|
||||
* @brief Byte order of the target MCU must be defined.
|
||||
*
|
||||
* Valid values are pdLITTLE_ENDIAN and pdBIG_ENDIAN.
|
||||
*/
|
||||
#ifndef socketsconfigBYTE_ORDER
|
||||
#error "socketsconfigBYTE_ORDER must be defined."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default socket send timeout.
|
||||
*
|
||||
* The user can change the send timeout for a socket using the SOCKETS_SetSockOpt API
|
||||
* with the SOCKETS_SO_SNDTIMEO option.
|
||||
*/
|
||||
#ifndef socketsconfigDEFAULT_SEND_TIMEOUT
|
||||
#define socketsconfigDEFAULT_SEND_TIMEOUT ( 10000 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default socket receive timeout.
|
||||
*
|
||||
* The user can change the receive timeout for a socket using the SOCKETS_SetSockOpt API
|
||||
* with the SOCKETS_SO_RCVTIMEO option.
|
||||
*/
|
||||
#ifndef socketsconfigDEFAULT_RECV_TIMEOUT
|
||||
#define socketsconfigDEFAULT_RECV_TIMEOUT ( 10000 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief By default, metrics of secure socket is disabled.
|
||||
*
|
||||
*/
|
||||
#ifndef AWS_IOT_SECURE_SOCKETS_METRICS_ENABLED
|
||||
#define AWS_IOT_SECURE_SOCKETS_METRICS_ENABLED ( 0 )
|
||||
#endif
|
||||
|
||||
#endif /* AWS_INC_SECURE_SOCKETS_CONFIG_DEFAULTS_H_ */
|
||||
|
|
@ -0,0 +1,815 @@
|
|||
/*
|
||||
* FreeRTOS Secure Sockets V1.3.1
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "FreeRTOSIPConfig.h"
|
||||
#include "list.h"
|
||||
#include "semphr.h"
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
#include "iot_secure_sockets.h"
|
||||
#include "iot_tls.h"
|
||||
#include "task.h"
|
||||
#include "core_pkcs11.h"
|
||||
#include "iot_crypto.h"
|
||||
|
||||
/* Internal context structure. */
|
||||
typedef struct SSOCKETContext
|
||||
{
|
||||
Socket_t xSocket;
|
||||
char * pcDestination;
|
||||
void * pvTLSContext;
|
||||
BaseType_t xRequireTLS;
|
||||
BaseType_t xSendFlags;
|
||||
BaseType_t xRecvFlags;
|
||||
char * pcServerCertificate;
|
||||
uint32_t ulServerCertificateLength;
|
||||
char ** ppcAlpnProtocols;
|
||||
uint32_t ulAlpnProtocolsCount;
|
||||
BaseType_t xConnectAttempted;
|
||||
} SSOCKETContext_t, * SSOCKETContextPtr_t;
|
||||
|
||||
/*
|
||||
* Helper routines.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @brief Network send callback.
|
||||
*/
|
||||
static BaseType_t prvNetworkSend( void * pvContext,
|
||||
const unsigned char * pucData,
|
||||
size_t xDataLength )
|
||||
{
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) pvContext; /*lint !e9087 cast used for portability. */
|
||||
|
||||
return FreeRTOS_send( pxContext->xSocket, pucData, xDataLength, pxContext->xSendFlags );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* @brief Network receive callback.
|
||||
*/
|
||||
static BaseType_t prvNetworkRecv( void * pvContext,
|
||||
unsigned char * pucReceiveBuffer,
|
||||
size_t xReceiveLength )
|
||||
{
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) pvContext; /*lint !e9087 cast used for portability. */
|
||||
|
||||
return FreeRTOS_recv( pxContext->xSocket, pucReceiveBuffer, xReceiveLength, pxContext->xRecvFlags );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Interface routines.
|
||||
*/
|
||||
|
||||
int32_t SOCKETS_Close( Socket_t xSocket )
|
||||
{
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
uint32_t ulProtocol;
|
||||
int32_t lReturn;
|
||||
|
||||
if( ( xSocket != SOCKETS_INVALID_SOCKET ) && ( NULL != pxContext ) )
|
||||
{
|
||||
/* Clean-up destination string. */
|
||||
if( NULL != pxContext->pcDestination )
|
||||
{
|
||||
vPortFree( pxContext->pcDestination );
|
||||
}
|
||||
|
||||
/* Clean-up server certificate. */
|
||||
if( NULL != pxContext->pcServerCertificate )
|
||||
{
|
||||
vPortFree( pxContext->pcServerCertificate );
|
||||
}
|
||||
|
||||
/* Clean-up application protocol array. */
|
||||
if( NULL != pxContext->ppcAlpnProtocols )
|
||||
{
|
||||
for( ulProtocol = 0;
|
||||
ulProtocol < pxContext->ulAlpnProtocolsCount;
|
||||
ulProtocol++ )
|
||||
{
|
||||
if( NULL != pxContext->ppcAlpnProtocols[ ulProtocol ] )
|
||||
{
|
||||
vPortFree( pxContext->ppcAlpnProtocols[ ulProtocol ] );
|
||||
}
|
||||
}
|
||||
|
||||
vPortFree( pxContext->ppcAlpnProtocols );
|
||||
}
|
||||
|
||||
/* Clean-up TLS context. */
|
||||
if( pdTRUE == pxContext->xRequireTLS )
|
||||
{
|
||||
TLS_Cleanup( pxContext->pvTLSContext );
|
||||
}
|
||||
|
||||
/* Close the underlying socket handle. */
|
||||
( void ) FreeRTOS_closesocket( pxContext->xSocket );
|
||||
|
||||
/* Free the context. */
|
||||
vPortFree( pxContext );
|
||||
lReturn = SOCKETS_ERROR_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
lReturn = SOCKETS_EINVAL;
|
||||
}
|
||||
|
||||
return lReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int32_t SOCKETS_Connect( Socket_t xSocket,
|
||||
SocketsSockaddr_t * pxAddress,
|
||||
Socklen_t xAddressLength )
|
||||
{
|
||||
int32_t lStatus = SOCKETS_ERROR_NONE;
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
TLSParams_t xTLSParams = { 0 };
|
||||
struct freertos_sockaddr xTempAddress = { 0 };
|
||||
|
||||
if( ( pxContext != ( SSOCKETContextPtr_t ) SOCKETS_INVALID_SOCKET ) && ( pxAddress != NULL ) )
|
||||
{
|
||||
/* A connection was attempted. If this function fails, then the socket is invalid and the user
|
||||
* must call SOCKETS_Close(), on this socket, and SOCKETS_Socket() to get a new socket. */
|
||||
pxContext->xConnectAttempted = pdTRUE;
|
||||
|
||||
/* Connect the wrapped socket. */
|
||||
xTempAddress.sin_addr = pxAddress->ulAddress;
|
||||
xTempAddress.sin_family = pxAddress->ucSocketDomain;
|
||||
xTempAddress.sin_len = ( uint8_t ) sizeof( xTempAddress );
|
||||
xTempAddress.sin_port = pxAddress->usPort;
|
||||
lStatus = FreeRTOS_connect( pxContext->xSocket, &xTempAddress, xAddressLength );
|
||||
|
||||
/* Negotiate TLS if requested. */
|
||||
if( ( SOCKETS_ERROR_NONE == lStatus ) && ( pdTRUE == pxContext->xRequireTLS ) )
|
||||
{
|
||||
xTLSParams.ulSize = sizeof( xTLSParams );
|
||||
xTLSParams.pcDestination = pxContext->pcDestination;
|
||||
xTLSParams.pcServerCertificate = pxContext->pcServerCertificate;
|
||||
xTLSParams.ulServerCertificateLength = pxContext->ulServerCertificateLength;
|
||||
xTLSParams.ppcAlpnProtocols = ( const char ** ) pxContext->ppcAlpnProtocols;
|
||||
xTLSParams.ulAlpnProtocolsCount = pxContext->ulAlpnProtocolsCount;
|
||||
xTLSParams.pvCallerContext = pxContext;
|
||||
xTLSParams.pxNetworkRecv = prvNetworkRecv;
|
||||
xTLSParams.pxNetworkSend = prvNetworkSend;
|
||||
lStatus = TLS_Init( &pxContext->pvTLSContext, &xTLSParams );
|
||||
|
||||
if( SOCKETS_ERROR_NONE == lStatus )
|
||||
{
|
||||
lStatus = TLS_Connect( pxContext->pvTLSContext );
|
||||
|
||||
if( lStatus < 0 )
|
||||
{
|
||||
lStatus = SOCKETS_TLS_HANDSHAKE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lStatus = SOCKETS_SOCKET_ERROR;
|
||||
}
|
||||
|
||||
return lStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
uint32_t SOCKETS_GetHostByName( const char * pcHostName )
|
||||
{
|
||||
return FreeRTOS_gethostbyname( pcHostName );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int32_t SOCKETS_Recv( Socket_t xSocket,
|
||||
void * pvBuffer,
|
||||
size_t xBufferLength,
|
||||
uint32_t ulFlags )
|
||||
{
|
||||
int32_t lStatus = SOCKETS_SOCKET_ERROR;
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
|
||||
if( ( xSocket != SOCKETS_INVALID_SOCKET ) &&
|
||||
( pvBuffer != NULL ) )
|
||||
{
|
||||
pxContext->xRecvFlags = ( BaseType_t ) ulFlags;
|
||||
|
||||
if( pdTRUE == pxContext->xRequireTLS )
|
||||
{
|
||||
/* Receive through TLS pipe, if negotiated. */
|
||||
lStatus = TLS_Recv( pxContext->pvTLSContext, pvBuffer, xBufferLength );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Receive unencrypted. */
|
||||
lStatus = prvNetworkRecv( pxContext, pvBuffer, xBufferLength );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lStatus = SOCKETS_EINVAL;
|
||||
}
|
||||
|
||||
return lStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int32_t SOCKETS_Send( Socket_t xSocket,
|
||||
const void * pvBuffer,
|
||||
size_t xDataLength,
|
||||
uint32_t ulFlags )
|
||||
{
|
||||
int32_t lStatus = SOCKETS_SOCKET_ERROR;
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
|
||||
if( ( xSocket != SOCKETS_INVALID_SOCKET ) &&
|
||||
( pvBuffer != NULL ) )
|
||||
{
|
||||
pxContext->xSendFlags = ( BaseType_t ) ulFlags;
|
||||
|
||||
if( pdTRUE == pxContext->xRequireTLS )
|
||||
{
|
||||
/* Send through TLS pipe, if negotiated. */
|
||||
lStatus = TLS_Send( pxContext->pvTLSContext, pvBuffer, xDataLength );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send unencrypted. */
|
||||
lStatus = prvNetworkSend( pxContext, pvBuffer, xDataLength );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lStatus = SOCKETS_EINVAL;
|
||||
}
|
||||
|
||||
return lStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int32_t SOCKETS_SetSockOpt( Socket_t xSocket,
|
||||
int32_t lLevel,
|
||||
int32_t lOptionName,
|
||||
const void * pvOptionValue,
|
||||
size_t xOptionLength )
|
||||
{
|
||||
int32_t lStatus = SOCKETS_ERROR_NONE;
|
||||
TickType_t xTimeout;
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
char ** ppcAlpnIn = ( char ** ) pvOptionValue;
|
||||
size_t xLength = 0;
|
||||
uint32_t ulProtocol;
|
||||
|
||||
if( ( xSocket != SOCKETS_INVALID_SOCKET ) && ( xSocket != NULL ) )
|
||||
{
|
||||
switch( lOptionName )
|
||||
{
|
||||
case SOCKETS_SO_SERVER_NAME_INDICATION:
|
||||
|
||||
/* Do not set the SNI options if the socket is possibly already connected. */
|
||||
if( pxContext->xConnectAttempted == pdTRUE )
|
||||
{
|
||||
lStatus = SOCKETS_EISCONN;
|
||||
}
|
||||
|
||||
/* Non-NULL destination string indicates that SNI extension should
|
||||
* be used during TLS negotiation. */
|
||||
else if( NULL == ( pxContext->pcDestination =
|
||||
( char * ) pvPortMalloc( 1U + xOptionLength ) ) )
|
||||
{
|
||||
lStatus = SOCKETS_ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( pxContext->pcDestination, pvOptionValue, xOptionLength );
|
||||
pxContext->pcDestination[ xOptionLength ] = '\0';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE:
|
||||
|
||||
/* Do not set the trusted server certificate if the socket is possibly already connected. */
|
||||
if( pxContext->xConnectAttempted == pdTRUE )
|
||||
{
|
||||
lStatus = SOCKETS_EISCONN;
|
||||
}
|
||||
|
||||
/* Non-NULL server certificate field indicates that the default trust
|
||||
* list should not be used. */
|
||||
else if( NULL == ( pxContext->pcServerCertificate =
|
||||
( char * ) pvPortMalloc( xOptionLength ) ) )
|
||||
{
|
||||
lStatus = SOCKETS_ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( pxContext->pcServerCertificate, pvOptionValue, xOptionLength );
|
||||
pxContext->ulServerCertificateLength = xOptionLength;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOCKETS_SO_REQUIRE_TLS:
|
||||
|
||||
/* Do not set the TLS option if the socket is possibly already connected. */
|
||||
if( pxContext->xConnectAttempted == pdTRUE )
|
||||
{
|
||||
lStatus = SOCKETS_EISCONN;
|
||||
}
|
||||
else
|
||||
{
|
||||
pxContext->xRequireTLS = pdTRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOCKETS_SO_ALPN_PROTOCOLS:
|
||||
|
||||
/* Do not set the ALPN option if the socket is already connected. */
|
||||
if( pxContext->xConnectAttempted == pdTRUE )
|
||||
{
|
||||
lStatus = SOCKETS_EISCONN;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Allocate a sufficiently long array of pointers. */
|
||||
pxContext->ulAlpnProtocolsCount = 1 + xOptionLength;
|
||||
|
||||
if( NULL == ( pxContext->ppcAlpnProtocols =
|
||||
( char ** ) pvPortMalloc( pxContext->ulAlpnProtocolsCount * sizeof( char * ) ) ) )
|
||||
{
|
||||
lStatus = SOCKETS_ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Zero out the pointers. */
|
||||
memset( pxContext->ppcAlpnProtocols,
|
||||
0,
|
||||
pxContext->ulAlpnProtocolsCount * sizeof( char * ) );
|
||||
}
|
||||
|
||||
/* Copy each protocol string. */
|
||||
for( ulProtocol = 0;
|
||||
( ulProtocol < pxContext->ulAlpnProtocolsCount - 1 ) &&
|
||||
( pdFREERTOS_ERRNO_NONE == lStatus );
|
||||
ulProtocol++ )
|
||||
{
|
||||
xLength = strlen( ppcAlpnIn[ ulProtocol ] );
|
||||
|
||||
if( NULL == ( pxContext->ppcAlpnProtocols[ ulProtocol ] =
|
||||
( char * ) pvPortMalloc( 1 + xLength ) ) )
|
||||
{
|
||||
lStatus = SOCKETS_ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( pxContext->ppcAlpnProtocols[ ulProtocol ],
|
||||
ppcAlpnIn[ ulProtocol ],
|
||||
xLength );
|
||||
pxContext->ppcAlpnProtocols[ ulProtocol ][ xLength ] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOCKETS_SO_NONBLOCK:
|
||||
xTimeout = 0;
|
||||
|
||||
/* Non-blocking connect is not supported. Socket may be set to nonblocking
|
||||
* only after a connection is made. */
|
||||
if( pdTRUE == pxContext->xConnectAttempted )
|
||||
{
|
||||
lStatus = FreeRTOS_setsockopt( pxContext->xSocket,
|
||||
lLevel,
|
||||
SOCKETS_SO_RCVTIMEO,
|
||||
&xTimeout,
|
||||
sizeof( xTimeout ) );
|
||||
|
||||
if( lStatus == SOCKETS_ERROR_NONE )
|
||||
{
|
||||
lStatus = FreeRTOS_setsockopt( pxContext->xSocket,
|
||||
lLevel,
|
||||
SOCKETS_SO_SNDTIMEO,
|
||||
&xTimeout,
|
||||
sizeof( xTimeout ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lStatus = SOCKETS_EISCONN;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOCKETS_SO_RCVTIMEO:
|
||||
case SOCKETS_SO_SNDTIMEO:
|
||||
/* Comply with Berkeley standard - a 0 timeout is wait forever. */
|
||||
xTimeout = *( ( const TickType_t * ) pvOptionValue ); /*lint !e9087 pvOptionValue passed should be of TickType_t */
|
||||
|
||||
if( xTimeout == 0U )
|
||||
{
|
||||
xTimeout = portMAX_DELAY;
|
||||
}
|
||||
|
||||
lStatus = FreeRTOS_setsockopt( pxContext->xSocket,
|
||||
lLevel,
|
||||
lOptionName,
|
||||
&xTimeout,
|
||||
xOptionLength );
|
||||
break;
|
||||
|
||||
default:
|
||||
lStatus = FreeRTOS_setsockopt( pxContext->xSocket,
|
||||
lLevel,
|
||||
lOptionName,
|
||||
pvOptionValue,
|
||||
xOptionLength );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lStatus = SOCKETS_EINVAL;
|
||||
}
|
||||
|
||||
return lStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int32_t SOCKETS_Shutdown( Socket_t xSocket,
|
||||
uint32_t ulHow )
|
||||
{
|
||||
int32_t lReturn;
|
||||
SSOCKETContextPtr_t pxContext = ( SSOCKETContextPtr_t ) xSocket; /*lint !e9087 cast used for portability. */
|
||||
|
||||
if( ( xSocket != SOCKETS_INVALID_SOCKET ) && ( xSocket != NULL ) )
|
||||
{
|
||||
lReturn = FreeRTOS_shutdown( pxContext->xSocket, ( BaseType_t ) ulHow );
|
||||
}
|
||||
else
|
||||
{
|
||||
lReturn = SOCKETS_EINVAL;
|
||||
}
|
||||
|
||||
return lReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
Socket_t SOCKETS_Socket( int32_t lDomain,
|
||||
int32_t lType,
|
||||
int32_t lProtocol )
|
||||
{
|
||||
SSOCKETContextPtr_t pxContext = NULL;
|
||||
Socket_t xSocket;
|
||||
|
||||
/* Ensure that only supported values are supplied. */
|
||||
configASSERT( lDomain == SOCKETS_AF_INET );
|
||||
configASSERT( lType == SOCKETS_SOCK_STREAM );
|
||||
configASSERT( lProtocol == SOCKETS_IPPROTO_TCP );
|
||||
|
||||
/* Create the wrapped socket. */
|
||||
xSocket = FreeRTOS_socket( lDomain, lType, lProtocol );
|
||||
|
||||
if( xSocket != FREERTOS_INVALID_SOCKET )
|
||||
{
|
||||
/* Allocate the internal context structure. */
|
||||
if( NULL == ( pxContext = pvPortMalloc( sizeof( SSOCKETContext_t ) ) ) )
|
||||
{
|
||||
/* Need to close socket. */
|
||||
( void ) FreeRTOS_closesocket( xSocket );
|
||||
pxContext = ( SSOCKETContextPtr_t ) SOCKETS_INVALID_SOCKET;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( pxContext, 0, sizeof( SSOCKETContext_t ) );
|
||||
pxContext->xSocket = xSocket;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pxContext = ( SSOCKETContextPtr_t ) SOCKETS_INVALID_SOCKET;
|
||||
}
|
||||
|
||||
return ( Socket_t ) pxContext;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t SOCKETS_Init( void )
|
||||
{
|
||||
/* Empty initialization for this port. */
|
||||
return pdPASS;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Create a static PKCS #11 crypto session handle to share across socket
|
||||
* and FreeRTOS+TCP threads. Assume that two or more threads may race to be the
|
||||
* first to initialize the static and handle that case accordingly.
|
||||
*/
|
||||
static CK_RV prvSocketsGetCryptoSession( SemaphoreHandle_t * pxSessionLock,
|
||||
CK_SESSION_HANDLE * pxSession,
|
||||
CK_FUNCTION_LIST_PTR_PTR ppxFunctionList )
|
||||
{
|
||||
CK_RV xResult = CKR_OK;
|
||||
CK_C_GetFunctionList pxCkGetFunctionList = NULL;
|
||||
static CK_SESSION_HANDLE xPkcs11Session = 0;
|
||||
static CK_FUNCTION_LIST_PTR pxPkcs11FunctionList = NULL;
|
||||
static StaticSemaphore_t xStaticSemaphore;
|
||||
static SemaphoreHandle_t xSessionLock = NULL;
|
||||
CK_ULONG ulCount = 0;
|
||||
CK_SLOT_ID * pxSlotIds = NULL;
|
||||
|
||||
/* Check if one-time initialization of the lock is needed.*/
|
||||
portENTER_CRITICAL();
|
||||
|
||||
if( NULL == xSessionLock )
|
||||
{
|
||||
xSessionLock = xSemaphoreCreateMutexStatic( &xStaticSemaphore );
|
||||
}
|
||||
|
||||
*pxSessionLock = xSessionLock;
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Check if one-time initialization of the crypto handle is needed.*/
|
||||
xSemaphoreTake( xSessionLock, portMAX_DELAY );
|
||||
|
||||
if( 0 == xPkcs11Session )
|
||||
{
|
||||
/* One-time initialization. */
|
||||
|
||||
/* Ensure that the PKCS#11 module is initialized. We don't keep the
|
||||
* scheduler stopped here, since we don't want to make assumptions about hardware
|
||||
* requirements for accessing a crypto module. */
|
||||
|
||||
pxCkGetFunctionList = C_GetFunctionList;
|
||||
xResult = pxCkGetFunctionList( &pxPkcs11FunctionList );
|
||||
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = xInitializePkcs11Token();
|
||||
}
|
||||
|
||||
/* Get the crypto token slot count. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_GetSlotList( CK_TRUE,
|
||||
NULL,
|
||||
&ulCount );
|
||||
}
|
||||
|
||||
/* Allocate memory to store the token slots. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
pxSlotIds = ( CK_SLOT_ID * ) pvPortMalloc( sizeof( CK_SLOT_ID ) * ulCount );
|
||||
|
||||
if( NULL == pxSlotIds )
|
||||
{
|
||||
xResult = CKR_HOST_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get all of the available private key slot identities. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_GetSlotList( CK_TRUE,
|
||||
pxSlotIds,
|
||||
&ulCount );
|
||||
}
|
||||
|
||||
/* Start a session with the PKCS#11 module. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_OpenSession( pxSlotIds[ 0 ],
|
||||
CKF_SERIAL_SESSION,
|
||||
NULL,
|
||||
NULL,
|
||||
&xPkcs11Session );
|
||||
}
|
||||
}
|
||||
|
||||
*pxSession = xPkcs11Session;
|
||||
*ppxFunctionList = pxPkcs11FunctionList;
|
||||
xSemaphoreGive( xSessionLock );
|
||||
|
||||
if( NULL != pxSlotIds )
|
||||
{
|
||||
vPortFree( pxSlotIds );
|
||||
}
|
||||
|
||||
return xResult;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*uint32_t ulRand( void ) __attribute__ ((deprecated)) */
|
||||
#if 0
|
||||
|
||||
/* Why is this function between #if 0? Because the function ulRand()
|
||||
* is now reprecated. The function is still shown here for users who
|
||||
* are looking for it.
|
||||
* It is deprecated because a return value of 0 would mean that the
|
||||
* RND module is broken. This was confusing because 0 is also a
|
||||
* possible valid random number. */
|
||||
uint32_t ulRand( void )
|
||||
{
|
||||
uint32_t ulNumber = 0uL;
|
||||
BaseType_t xResult = xApplicationGetRandomNumber( &( ulNumber ) );
|
||||
|
||||
if( xResult == pdFALSE )
|
||||
{
|
||||
ulNumber = 0uL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Function succeeded, a random number will be returned. */
|
||||
}
|
||||
|
||||
return ulNumber;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
CK_RV xResult = 0;
|
||||
SemaphoreHandle_t xSessionLock = NULL;
|
||||
CK_SESSION_HANDLE xPkcs11Session = 0;
|
||||
CK_FUNCTION_LIST_PTR pxPkcs11FunctionList = NULL;
|
||||
uint32_t ulRandomValue = 0;
|
||||
BaseType_t xReturn; /* Return pdTRUE if successful */
|
||||
|
||||
xResult = prvSocketsGetCryptoSession( &xSessionLock,
|
||||
&xPkcs11Session,
|
||||
&pxPkcs11FunctionList );
|
||||
|
||||
if( 0 == xResult )
|
||||
{
|
||||
/* Request a sequence of cryptographically random byte values using
|
||||
* PKCS#11. */
|
||||
xResult = pxPkcs11FunctionList->C_GenerateRandom( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &ulRandomValue,
|
||||
sizeof( ulRandomValue ) );
|
||||
}
|
||||
|
||||
/* Check if any of the API calls failed. */
|
||||
if( 0 == xResult )
|
||||
{
|
||||
xReturn = pdTRUE;
|
||||
*( pulNumber ) = ulRandomValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
*( pulNumber ) = 0uL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Generate a TCP Initial Sequence Number that is reasonably difficult
|
||||
* to predict, per https://tools.ietf.org/html/rfc6528.
|
||||
*/
|
||||
uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
CK_RV xResult = CKR_OK;
|
||||
SemaphoreHandle_t xSessionLock = NULL;
|
||||
CK_SESSION_HANDLE xPkcs11Session = 0;
|
||||
CK_FUNCTION_LIST_PTR pxPkcs11FunctionList = NULL;
|
||||
CK_MECHANISM xMechSha256 = { 0 };
|
||||
uint8_t ucSha256Result[ cryptoSHA256_DIGEST_BYTES ];
|
||||
CK_ULONG ulLength = sizeof( ucSha256Result );
|
||||
uint32_t ulNextSequenceNumber = 0;
|
||||
static uint64_t ullKey;
|
||||
static CK_BBOOL xKeyIsInitialized = CK_FALSE;
|
||||
|
||||
/* Acquire a crypto session handle. */
|
||||
xResult = prvSocketsGetCryptoSession( &xSessionLock,
|
||||
&xPkcs11Session,
|
||||
&pxPkcs11FunctionList );
|
||||
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xSemaphoreTake( xSessionLock, portMAX_DELAY );
|
||||
|
||||
if( CK_FALSE == xKeyIsInitialized )
|
||||
{
|
||||
/* One-time initialization, per boot, of the random seed. */
|
||||
xResult = pxPkcs11FunctionList->C_GenerateRandom( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &ullKey,
|
||||
sizeof( ullKey ) );
|
||||
|
||||
if( xResult == CKR_OK )
|
||||
{
|
||||
xKeyIsInitialized = CK_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
xSemaphoreGive( xSessionLock );
|
||||
}
|
||||
|
||||
/* Lock the shared crypto session. */
|
||||
xSemaphoreTake( xSessionLock, portMAX_DELAY );
|
||||
|
||||
/* Start a hash. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xMechSha256.mechanism = CKM_SHA256;
|
||||
xResult = pxPkcs11FunctionList->C_DigestInit( xPkcs11Session, &xMechSha256 );
|
||||
}
|
||||
|
||||
/* Hash the seed. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &ullKey,
|
||||
sizeof( ullKey ) );
|
||||
}
|
||||
|
||||
/* Hash the source address. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &ulSourceAddress,
|
||||
sizeof( ulSourceAddress ) );
|
||||
}
|
||||
|
||||
/* Hash the source port. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &usSourcePort,
|
||||
sizeof( usSourcePort ) );
|
||||
}
|
||||
|
||||
/* Hash the destination address. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &ulDestinationAddress,
|
||||
sizeof( ulDestinationAddress ) );
|
||||
}
|
||||
|
||||
/* Hash the destination port. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestUpdate( xPkcs11Session,
|
||||
( CK_BYTE_PTR ) &usDestinationPort,
|
||||
sizeof( usDestinationPort ) );
|
||||
}
|
||||
|
||||
/* Get the hash. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
xResult = pxPkcs11FunctionList->C_DigestFinal( xPkcs11Session,
|
||||
ucSha256Result,
|
||||
&ulLength );
|
||||
}
|
||||
|
||||
xSemaphoreGive( xSessionLock );
|
||||
|
||||
/* Use the first four bytes of the hash result as the starting point for
|
||||
* all initial sequence numbers for connections based on the input 4-tuple. */
|
||||
if( CKR_OK == xResult )
|
||||
{
|
||||
memcpy( &ulNextSequenceNumber,
|
||||
ucSha256Result,
|
||||
sizeof( ulNextSequenceNumber ) );
|
||||
|
||||
/* Add the tick count of four-tick intervals. In theory, per the RFC
|
||||
* (see above), this approach still allows server equipment to optimize
|
||||
* handling of connections from the same device that haven't fully timed out. */
|
||||
ulNextSequenceNumber += xTaskGetTickCount() / 4;
|
||||
}
|
||||
|
||||
return ulNextSequenceNumber;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -20,8 +20,12 @@
|
|||
#define RTE_RTOS_FreeRTOS_CONFIG /* RTOS FreeRTOS Config for FreeRTOS API */
|
||||
/* ARM.FreeRTOS::RTOS:Core:Cortex-M:10.5.1 */
|
||||
#define RTE_RTOS_FreeRTOS_CORE /* RTOS FreeRTOS Core */
|
||||
/* ARM.FreeRTOS::RTOS:Event Groups:10.5.1 */
|
||||
#define RTE_RTOS_FreeRTOS_EVENTGROUPS /* RTOS FreeRTOS Event Groups */
|
||||
/* ARM.FreeRTOS::RTOS:Heap:Heap_2:10.5.1 */
|
||||
#define RTE_RTOS_FreeRTOS_HEAP_2 /* RTOS FreeRTOS Heap 2 */
|
||||
/* GigaDevice::Device:GD32F10x_StdPeripherals:ENET:2.0.2 */
|
||||
#define RTE_DEVICE_STDPERIPHERALS_ENET
|
||||
/* GigaDevice::Device:GD32F10x_StdPeripherals:EXTI:2.0.2 */
|
||||
#define RTE_DEVICE_STDPERIPHERALS_EXTI
|
||||
/* GigaDevice::Device:GD32F10x_StdPeripherals:GPIO:2.0.2 */
|
||||
|
|
@ -40,6 +44,8 @@
|
|||
/* Keil.ARM Compiler::Compiler:I/O:STDOUT:User:1.2.0 */
|
||||
#define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */
|
||||
#define RTE_Compiler_IO_STDOUT_User /* Compiler I/O: STDOUT User */
|
||||
/* Keil::CMSIS Driver:Ethernet PHY:DP83848C:6.2.0 */
|
||||
#define RTE_Drivers_PHY_DP83848C /* Driver PHY DP83848C */
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -170,7 +170,7 @@
|
|||
</Mm>
|
||||
</MemoryWindow1>
|
||||
<ScvdPack>
|
||||
<Filename>E:\Arm\Packs\ARM\CMSIS-FreeRTOS\10.5.1\CMSIS\RTOS2\FreeRTOS\FreeRTOS.scvd</Filename>
|
||||
<Filename>C:\Users\User\AppData\Local\Arm\Packs\ARM\CMSIS-FreeRTOS\10.5.1\CMSIS\RTOS2\FreeRTOS\FreeRTOS.scvd</Filename>
|
||||
<Type>ARM.CMSIS-FreeRTOS.10.5.1</Type>
|
||||
<SubType>1</SubType>
|
||||
</ScvdPack>
|
||||
|
|
@ -241,10 +241,298 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>FreeRTOS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\portable\NetworkInterface\Common\phyHandling.c</PathWithFileName>
|
||||
<FilenameWithoutPath>phyHandling.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_IP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_IP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_ARP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_ARP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DHCP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DHCP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DNS.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DNS.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DNS_Cache.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DNS_Cache.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DNS_Callback.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DNS_Callback.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DNS_Networking.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DNS_Networking.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_DNS_Parser.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_DNS_Parser.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_ICMP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_ICMP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_IP_Timers.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_IP_Timers.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_IP_Utils.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_IP_Utils.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_Sockets.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_Sockets.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_Stream_Buffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_Stream_Buffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_IP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_IP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_Reception.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_Reception.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_State_Handling.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_State_Handling.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_Transmission.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_Transmission.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_Utils.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_Utils.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_TCP_WIN.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_TCP_WIN.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_Tiny_TCP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_Tiny_TCP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\FreeRTOS_UDP_IP.c</PathWithFileName>
|
||||
<FilenameWithoutPath>FreeRTOS_UDP_IP.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</PathWithFileName>
|
||||
<FilenameWithoutPath>NetworkInterface.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\FreeRTOS\source\portable\BufferManagement\BufferAllocation_1.c</PathWithFileName>
|
||||
<FilenameWithoutPath>BufferAllocation_1.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
|
@ -255,6 +543,14 @@
|
|||
<RteFlg>1</RteFlg>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>::CMSIS Driver</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
|
|
@ -273,7 +569,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>::FreeRTOS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
|
|
@ -281,7 +577,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>::RTOS</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
|
|
|
|||
|
|
@ -338,10 +338,10 @@
|
|||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>-D DEBUG</MiscControls>
|
||||
<MiscControls>-D DEBUG -Wno-pragma-pack -Wno-macro-redefined</MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
<IncludePath>.\FreeRTOS\source\portable\NetworkInterface\include;.\FreeRTOS\source\include;.\FreeRTOS\source\portable\Compiler\Keil;C:\Users\User\AppData\Local\Arm\Packs\Arm-Packs\PKCS11\1.0.0\include</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
|
@ -394,10 +394,204 @@
|
|||
</Group>
|
||||
<Group>
|
||||
<GroupName>FreeRTOS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>phyHandling.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\portable\NetworkInterface\Common\phyHandling.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_IP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_IP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_ARP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_ARP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DHCP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DHCP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DNS.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DNS.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DNS_Cache.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DNS_Cache.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DNS_Callback.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DNS_Callback.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DNS_Networking.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DNS_Networking.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_DNS_Parser.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_DNS_Parser.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_ICMP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_ICMP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_IP_Timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_IP_Timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_IP_Utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_IP_Utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_Sockets.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_Sockets.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_Stream_Buffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_Stream_Buffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_IP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_IP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_Reception.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_Reception.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_State_Handling.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_State_Handling.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_Transmission.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_Transmission.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_Utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_Utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_TCP_WIN.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_TCP_WIN.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_Tiny_TCP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_Tiny_TCP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>FreeRTOS_UDP_IP.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\FreeRTOS_UDP_IP.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>NetworkInterface.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>BufferAllocation_1.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\FreeRTOS\source\portable\BufferManagement\BufferAllocation_1.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::CMSIS</GroupName>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::CMSIS Driver</GroupName>
|
||||
<GroupOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<GroupArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>2</interw>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<thumb>2</thumb>
|
||||
<SplitLS>2</SplitLS>
|
||||
<SwStkChk>2</SwStkChk>
|
||||
<NoWarn>2</NoWarn>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<useXO>2</useXO>
|
||||
<ClangAsOpt>0</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
</GroupArmAds>
|
||||
</GroupOption>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
</Group>
|
||||
|
|
@ -478,15 +672,148 @@
|
|||
</Group>
|
||||
<Group>
|
||||
<GroupName>::RTOS</GroupName>
|
||||
<GroupOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<GroupArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>2</interw>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<thumb>2</thumb>
|
||||
<SplitLS>2</SplitLS>
|
||||
<SwStkChk>2</SwStkChk>
|
||||
<NoWarn>2</NoWarn>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<useXO>2</useXO>
|
||||
<ClangAsOpt>0</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
</GroupArmAds>
|
||||
</GroupOption>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS-Driver" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="2.7.2">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="CMSIS-FreeRTOS" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="10.5.1">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="CMSIS-NN" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="4.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1" versionMatchMode="fixed"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="FreeRTOS-Plus-TCP" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="corePKCS11" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="GD32F10x_DFP" schemaVersion="1.2" url="https://gd32mcu.com/data/documents/pack/" vendor="GigaDevice" version="2.0.3">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="Keil" version="1.7.2">
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.2.0" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</api>
|
||||
<api Capiversion="2.2.0" Cclass="CMSIS Driver" Cgroup="Ethernet PHY" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</api>
|
||||
<api Capiversion="2.2.0" Cclass="CMSIS Driver" Cgroup="Ethernet" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</api>
|
||||
</apis>
|
||||
<components>
|
||||
<component Cbundle="FreeRTOS" Cclass="RTOS" Cgroup="Config" Cvariant="FreeRTOS" Cvendor="ARM" Cversion="10.5.1" condition="FreeRTOS Config Native">
|
||||
<component Cbundle="FreeRTOS" Cclass="RTOS" Cgroup="Config" Cvariant="FreeRTOS" Cvendor="ARM" Cversion="10.5.1" condition="FreeRTOS Config Native" isTargetSpecific="1">
|
||||
<package name="CMSIS-FreeRTOS" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="10.5.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
|
|
@ -498,40 +825,52 @@
|
|||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="FreeRTOS" Cclass="RTOS" Cgroup="Event Groups" Cvendor="ARM" Cversion="10.5.1" condition="FreeRTOS Event Groups">
|
||||
<package name="CMSIS-FreeRTOS" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="10.5.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="FreeRTOS" Cclass="RTOS" Cgroup="Heap" Cvariant="Heap_2" Cvendor="ARM" Cversion="10.5.1" condition="FreeRTOS Heap">
|
||||
<package name="CMSIS-FreeRTOS" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="10.5.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Capiversion="2.2.0" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" Csub="Custom" Cvendor="ARM" Cversion="1.0.0" custom="1">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Capiversion="2.2.0" Cclass="CMSIS Driver" Cgroup="Ethernet" Csub="Custom" Cvendor="ARM" Cversion="1.0.0" custom="1">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="FreeRTOS" Cgroup="FreeRTOS+ TCP" Csub="Buffer Allocation" Cvariant="Buffer Allocation 1" Cvendor="AWS" Cversion="2.3.2-LTS-Patch-2" condition="freertos_plus_tcp_lts_buffer_allocation_1 Condition">
|
||||
<package name="FreeRTOS-Plus-TCP" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<component Cclass="FreeRTOS" Cgroup="corePKCS11" Csub="Core Library" Cvendor="AWS" Cversion="3.0.1" condition="core_pkcs11_library Condition">
|
||||
<package name="corePKCS11" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo excluded="1" name="Target 1" versionMatchMode=""/>
|
||||
<targetInfo excluded="1" name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="FreeRTOS" Cgroup="FreeRTOS+ TCP" Csub="Compiler Port" Cvariant="Keil" Cvendor="AWS" Cversion="2.3.2-LTS-Patch-2" condition="freertos_plus_tcp_lts_keil_compiler Condition">
|
||||
<package name="FreeRTOS-Plus-TCP" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<component Cclass="FreeRTOS" Cgroup="corePKCS11" Csub="Portable Abstraction Layer" Cvariant="Custom" Cvendor="AWS" Cversion="3.0.1" condition="core_pkcs11_no_port Condition">
|
||||
<package name="corePKCS11" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo excluded="1" name="Target 1" versionMatchMode=""/>
|
||||
<targetInfo excluded="1" name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="FreeRTOS" Cgroup="FreeRTOS+ TCP" Csub="Core Library" Cvendor="AWS" Cversion="2.3.2-LTS-Patch-2" condition="freertos_plus_tcp_lts_library Condition">
|
||||
<package name="FreeRTOS-Plus-TCP" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<component Cclass="FreeRTOS" Cgroup="corePKCS11" Csub="Utilities" Cvendor="AWS" Cversion="3.0.1" condition="core_pkcs11_utilities Condition">
|
||||
<package name="corePKCS11" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo excluded="1" name="Target 1" versionMatchMode=""/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="FreeRTOS" Cgroup="FreeRTOS+ TCP" Csub="Network Interface" Cvariant="STM32Fxx" Cvendor="AWS" Cversion="2.3.2-LTS-Patch-2" condition="freertos_plus_tcp_lts_stm32fxx_network_interface_port Condition">
|
||||
<package name="FreeRTOS-Plus-TCP" schemaVersion="1.7.2" url="https://freertos-cmsis-packs.s3.us-west-2.amazonaws.com/" vendor="AWS" version="4.0.1"/>
|
||||
<targetInfos>
|
||||
<targetInfo excluded="1" name="Target 1" versionMatchMode=""/>
|
||||
<targetInfo excluded="1" name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="Device" Cgroup="EVAL" Csub="GD32F107C" Cvendor="GigaDevice" Cversion="2.0.2" condition="GD32F10x STDPERIPHERALS EVAL">
|
||||
|
|
@ -540,6 +879,12 @@
|
|||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="Device" Cgroup="GD32F10x_StdPeripherals" Csub="ENET" Cvendor="GigaDevice" Cversion="2.0.2" condition="GD32F10x STDPERIPHERALS RCU">
|
||||
<package name="GD32F10x_DFP" schemaVersion="1.2" url="https://gd32mcu.com/data/documents/pack/" vendor="GigaDevice" version="2.0.3"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="Device" Cgroup="GD32F10x_StdPeripherals" Csub="EXTI" Cvendor="GigaDevice" Cversion="2.0.2" condition="GD32F10x STDPERIPHERALS RCU">
|
||||
<package name="GD32F10x_DFP" schemaVersion="1.2" url="https://gd32mcu.com/data/documents/pack/" vendor="GigaDevice" version="2.0.3"/>
|
||||
<targetInfos>
|
||||
|
|
@ -600,6 +945,12 @@
|
|||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Capiversion="2.0.0" Cclass="CMSIS Driver" Cgroup="Ethernet PHY" Csub="DP83848C" Cvendor="Keil" Cversion="6.2.0" condition="CMSIS Core">
|
||||
<package name="CMSIS-Driver" schemaVersion="1.7.7" url="https://www.keil.com/pack/" vendor="ARM" version="2.7.2"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files>
|
||||
<file attr="config" category="source" name="Device\Utilities\gd32f107c_eval.c" version="2.0.2">
|
||||
|
|
@ -616,6 +967,14 @@
|
|||
<package name="GD32F10x_DFP" schemaVersion="1.2" url="https://gd32mcu.com/data/documents/pack/" vendor="GigaDevice" version="2.0.3"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="source" name="Device\Firmware\Peripherals\src\gd32f10x_enet.c" version="2.0.2">
|
||||
<instance index="0">RTE\Device\GD32F107VC\gd32f10x_enet.c</instance>
|
||||
<component Cclass="Device" Cgroup="GD32F10x_StdPeripherals" Csub="ENET" Cvendor="GigaDevice" Cversion="2.0.2" condition="GD32F10x STDPERIPHERALS RCU"/>
|
||||
<package name="GD32F10x_DFP" schemaVersion="1.2" url="https://gd32mcu.com/data/documents/pack/" vendor="GigaDevice" version="2.0.3"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="source" name="Device\Firmware\Peripherals\src\gd32f10x_exti.c" version="2.0.2">
|
||||
<instance index="0">RTE\Device\GD32F107VC\gd32f10x_exti.c</instance>
|
||||
<component Cclass="Device" Cgroup="GD32F10x_StdPeripherals" Csub="EXTI" Cvendor="GigaDevice" Cversion="2.0.2" condition="GD32F10x STDPERIPHERALS RCU"/>
|
||||
|
|
|
|||
5
main.c
5
main.c
|
|
@ -3,6 +3,11 @@
|
|||
#include "gd32f107c_eval.h"
|
||||
#include "gd32f10x_gpio.h"
|
||||
#include "stdio.h"
|
||||
/* System application includes. */
|
||||
/*#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
#include "FreeRTOS_DHCP.h"*/
|
||||
|
||||
#define BUTTON_USER GPIO_PIN_14
|
||||
#define LED2_USER_PORT GPIOC
|
||||
#define LED5_TICK_PORT GPIOE
|
||||
|
|
|
|||
Loading…
Reference in New Issue