mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-09-25 21:03:52 +08:00
Merge remote-tracking branch 'upstream/master' into rx700v3dpfpu
This commit is contained in:
@@ -34,3 +34,5 @@ If applicable, add screenshots to help explain your problem.
|
||||
Add any other context about the problem here.
|
||||
e.g. code snippet to reproduce the issue.
|
||||
e.g. stack trace, memory dump, debugger log, and many etc.
|
||||
|
||||
<!-- For general inquiries, please post in [FreeRTOS forum](https://forums.freertos.org) for community support. -->
|
||||
|
||||
@@ -19,3 +19,5 @@ If applicable, please attach screenshot.
|
||||
**Browser**
|
||||
- Browser: [e.g. Chrome]
|
||||
- Version: [e.g. 80.0.3987.132]
|
||||
|
||||
<!-- For general inquiries, please post in [FreeRTOS forum](https://forums.freertos.org) for community support. -->
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
name: General inquiry
|
||||
about: Free form communication.
|
||||
title: "[Inquiry]"
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
We do encourage you to take a look at [FreeRTOS official site](https://www.freertos.org) for general information and [FreeRTOS forum](https://forums.freertos.org) to access our community.
|
||||
|
||||
If still needed, could create a general inquiry report here.
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -96,7 +96,7 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
||||
pxARPHeader = &( pxARPFrame->xARPHeader );
|
||||
|
||||
/* The field ulSenderProtocolAddress is badly aligned, copy byte-by-byte. */
|
||||
( void ) memcpy( &( ulSenderProtocolAddress ), pxARPHeader->ucSenderProtocolAddress, sizeof( ulSenderProtocolAddress ) );
|
||||
( void ) memcpy( ( void * ) ( &( ulSenderProtocolAddress ) ), ( const void * ) ( pxARPHeader->ucSenderProtocolAddress ), sizeof( ulSenderProtocolAddress ) );
|
||||
/* The field ulTargetProtocolAddress is well-aligned, a 32-bits copy. */
|
||||
ulTargetProtocolAddress = pxARPHeader->ulTargetProtocolAddress;
|
||||
|
||||
@@ -135,8 +135,8 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
||||
( void ) memcpy( pxARPHeader->xTargetHardwareAddress.ucBytes, pxARPHeader->xSenderHardwareAddress.ucBytes, sizeof( MACAddress_t ) );
|
||||
pxARPHeader->ulTargetProtocolAddress = ulSenderProtocolAddress;
|
||||
}
|
||||
( void ) memcpy( pxARPHeader->xSenderHardwareAddress.ucBytes, ipLOCAL_MAC_ADDRESS, sizeof( MACAddress_t ) );
|
||||
( void ) memcpy( pxARPHeader->ucSenderProtocolAddress, ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPHeader->ucSenderProtocolAddress ) );
|
||||
( void ) memcpy( ( void * ) ( pxARPHeader->xSenderHardwareAddress.ucBytes ), ( const void * ) ( ipLOCAL_MAC_ADDRESS ), sizeof( MACAddress_t ) );
|
||||
( void ) memcpy( ( void * ) ( pxARPHeader->ucSenderProtocolAddress ), ( const void * ) ( ipLOCAL_IP_ADDRESS_POINTER ), sizeof( pxARPHeader->ucSenderProtocolAddress ) );
|
||||
|
||||
eReturn = eReturnEthernetFrame;
|
||||
}
|
||||
@@ -656,7 +656,7 @@ ARPPacket_t *pxARPPacket;
|
||||
configASSERT( pxNetworkBuffer != NULL );
|
||||
configASSERT( pxNetworkBuffer->xDataLength >= sizeof(ARPPacket_t) );
|
||||
|
||||
pxARPPacket = ipPOINTER_CAST( ARPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxARPPacket = ipCAST_PTR_TO_TYPE_PTR( ARPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* memcpy the const part of the header information into the correct
|
||||
location in the packet. This copies:
|
||||
@@ -669,11 +669,11 @@ ARPPacket_t *pxARPPacket;
|
||||
xARPHeader.usOperation;
|
||||
xARPHeader.xTargetHardwareAddress;
|
||||
*/
|
||||
( void ) memcpy( pxARPPacket, xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
||||
( void ) memcpy( pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes , ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes, ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( ( void * ) pxARPPacket, ( const void * ) xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
||||
( void ) memcpy( ( void * ) ( pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes ) , ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( ( void * ) ( pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes ), ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
|
||||
( void ) memcpy( pxARPPacket->xARPHeader.ucSenderProtocolAddress, ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPPacket->xARPHeader.ucSenderProtocolAddress ) );
|
||||
( void ) memcpy( ( void * ) ( pxARPPacket->xARPHeader.ucSenderProtocolAddress ), ( const void * ) ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPPacket->xARPHeader.ucSenderProtocolAddress ) );
|
||||
pxARPPacket->xARPHeader.ulTargetProtocolAddress = pxNetworkBuffer->ulIPAddress;
|
||||
|
||||
pxNetworkBuffer->xDataLength = sizeof( ARPPacket_t );
|
||||
@@ -693,7 +693,7 @@ BaseType_t xCheckLoopback( NetworkBufferDescriptor_t * const pxDescriptor, BaseT
|
||||
{
|
||||
BaseType_t xResult = pdFALSE;
|
||||
NetworkBufferDescriptor_t * pxUseDescriptor = pxDescriptor;
|
||||
const IPPacket_t *pxIPPacket = ipPOINTER_CAST( IPPacket_t *, pxUseDescriptor->pucEthernetBuffer );
|
||||
const IPPacket_t *pxIPPacket = ipCAST_PTR_TO_TYPE_PTR( IPPacket_t, pxUseDescriptor->pucEthernetBuffer );
|
||||
|
||||
/* This function will check if the target IP-address belongs to this device.
|
||||
* If so, the packet will be passed to the IP-stack, who will answer it.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -154,6 +154,16 @@ struct xDHCPMessage_IPv4
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xDHCPMessage_IPv4 DHCPMessage_IPv4_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DHCPMessage_IPv4_t )
|
||||
{
|
||||
return ( DHCPMessage_IPv4_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( DHCPMessage_IPv4_t )
|
||||
{
|
||||
return ( const DHCPMessage_IPv4_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
/* The UDP socket used for all incoming and outgoing DHCP traffic. */
|
||||
_static Socket_t xDHCPSocket;
|
||||
|
||||
@@ -639,7 +649,7 @@ const uint32_t ulMandatoryOptions = 2UL; /* DHCP server address, and the correct
|
||||
if( lBytes > 0 )
|
||||
{
|
||||
/* Map a DHCP structure onto the received data. */
|
||||
pxDHCPMessage = ipPOINTER_CAST( const DHCPMessage_IPv4_t *, pucUDPPayload );
|
||||
pxDHCPMessage = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( DHCPMessage_IPv4_t, pucUDPPayload );
|
||||
|
||||
/* Sanity check. */
|
||||
if( lBytes < ( int32_t ) sizeof( DHCPMessage_IPv4_t ) )
|
||||
@@ -716,8 +726,8 @@ const uint32_t ulMandatoryOptions = 2UL; /* DHCP server address, and the correct
|
||||
just get it once here and use later. */
|
||||
if( uxLength >= sizeof( ulParameter ) )
|
||||
{
|
||||
( void ) memcpy( &( ulParameter ),
|
||||
&( pucByte[ uxIndex ] ),
|
||||
( void ) memcpy( ( void * ) ( &( ulParameter ) ),
|
||||
( const void * ) ( &( pucByte[ uxIndex ] ) ),
|
||||
( size_t ) sizeof( ulParameter ) );
|
||||
/* 'uxIndex' will be increased at the end of this loop. */
|
||||
}
|
||||
@@ -887,7 +897,7 @@ uint8_t *pucUDPPayloadBuffer;
|
||||
|
||||
/* Leave space for the UPD header. */
|
||||
pucUDPPayloadBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
|
||||
pxDHCPMessage = ipPOINTER_CAST( DHCPMessage_IPv4_t *, pucUDPPayloadBuffer );
|
||||
pxDHCPMessage = ipCAST_PTR_TO_TYPE_PTR( DHCPMessage_IPv4_t, pucUDPPayloadBuffer );
|
||||
|
||||
/* Most fields need to be zero. */
|
||||
( void ) memset( pxDHCPMessage, 0x00, sizeof( DHCPMessage_IPv4_t ) );
|
||||
@@ -921,7 +931,7 @@ uint8_t *pucUDPPayloadBuffer;
|
||||
pucPtr = &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + ( *pxOptionsArraySize - 1U ) ] );
|
||||
pucPtr[ 0U ] = dhcpIPv4_DNS_HOSTNAME_OPTIONS_CODE;
|
||||
pucPtr[ 1U ] = ( uint8_t ) uxNameLength;
|
||||
( void ) memcpy( &( pucPtr[ 2U ] ), pucHostName, uxNameLength );
|
||||
( void ) memcpy( ( void * ) ( &( pucPtr[ 2U ] ) ), ( const void * ) pucHostName, uxNameLength );
|
||||
pucPtr[ 2U + uxNameLength ] = ( uint8_t ) dhcpOPTION_END_BYTE;
|
||||
*pxOptionsArraySize += ( size_t ) ( 2U + uxNameLength );
|
||||
}
|
||||
@@ -962,13 +972,13 @@ size_t uxOptionsLength = sizeof( ucDHCPRequestOptions );
|
||||
&( uxOptionsLength ) );
|
||||
|
||||
/* Copy in the IP address being requested. */
|
||||
( void ) memcpy( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpREQUESTED_IP_ADDRESS_OFFSET ] ),
|
||||
&( EP_DHCPData.ulOfferedIPAddress ),
|
||||
( void ) memcpy( ( void * ) ( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpREQUESTED_IP_ADDRESS_OFFSET ] ) ),
|
||||
( const void * ) ( &( EP_DHCPData.ulOfferedIPAddress ) ),
|
||||
sizeof( EP_DHCPData.ulOfferedIPAddress ) );
|
||||
|
||||
/* Copy in the address of the DHCP server being used. */
|
||||
( void ) memcpy( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpDHCP_SERVER_IP_ADDRESS_OFFSET ] ),
|
||||
&( EP_DHCPData.ulDHCPServerAddress ),
|
||||
( void ) memcpy( ( void * ) ( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpDHCP_SERVER_IP_ADDRESS_OFFSET ] ) ),
|
||||
( const void * ) ( &( EP_DHCPData.ulDHCPServerAddress ) ),
|
||||
sizeof( EP_DHCPData.ulDHCPServerAddress ) );
|
||||
|
||||
FreeRTOS_debug_printf( ( "vDHCPProcess: reply %lxip\n", FreeRTOS_ntohl( EP_DHCPData.ulOfferedIPAddress ) ) );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -250,6 +250,15 @@ struct xDNSMessage
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xDNSMessage DNSMessage_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
||||
{
|
||||
return ( DNSMessage_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
||||
{
|
||||
return ( const DNSMessage_t *) pvArgument;
|
||||
}
|
||||
|
||||
/* A DNS query consists of a header, as described in 'struct xDNSMessage'
|
||||
It is followed by 1 or more queries, each one consisting of a name and a tail,
|
||||
with two fields: type and class
|
||||
@@ -263,6 +272,11 @@ struct xDNSTail
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xDNSTail DNSTail_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSTail_t )
|
||||
{
|
||||
return ( DNSTail_t * ) pvArgument;
|
||||
}
|
||||
|
||||
/* DNS answer record header. */
|
||||
#include "pack_struct_start.h"
|
||||
struct xDNSAnswerRecord
|
||||
@@ -275,6 +289,11 @@ struct xDNSAnswerRecord
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSAnswerRecord_t )
|
||||
{
|
||||
return ( DNSAnswerRecord_t * ) pvArgument;
|
||||
}
|
||||
|
||||
#if( ipconfigUSE_LLMNR == 1 )
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
@@ -291,6 +310,12 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xLLMNRAnswer LLMNRAnswer_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( LLMNRAnswer_t )
|
||||
{
|
||||
return ( LLMNRAnswer_t *)pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#endif /* ipconfigUSE_LLMNR == 1 */
|
||||
|
||||
#if( ipconfigUSE_NBNS == 1 )
|
||||
@@ -326,6 +351,11 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xNBNSAnswer NBNSAnswer_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NBNSAnswer_t )
|
||||
{
|
||||
return ( NBNSAnswer_t *)pvArgument;
|
||||
}
|
||||
|
||||
#endif /* ipconfigUSE_NBNS == 1 */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@@ -353,6 +383,11 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
char pcName[ 1 ];
|
||||
} DNSCallback_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSCallback_t )
|
||||
{
|
||||
return ( DNSCallback_t *)pvArgument;
|
||||
}
|
||||
|
||||
static List_t xCallbackList;
|
||||
|
||||
/* Define FreeRTOS_gethostbyname() as a normal blocking call. */
|
||||
@@ -377,7 +412,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
void vDNSCheckCallBack( void *pvSearchID )
|
||||
{
|
||||
const ListItem_t * pxIterator;
|
||||
const ListItem_t * xEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xCallbackList ) );
|
||||
const ListItem_t * xEnd = listGET_END_MARKER( &xCallbackList );
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
@@ -385,7 +420,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
pxIterator != xEnd;
|
||||
)
|
||||
{
|
||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
/* Move to the next item because we might remove this item */
|
||||
pxIterator = ( const ListItem_t * ) listGET_NEXT( pxIterator );
|
||||
if( ( pvSearchID != NULL ) && ( pvSearchID == pxCallback->pvSearchID ) )
|
||||
@@ -430,7 +465,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
TickType_t uxIdentifier )
|
||||
{
|
||||
size_t lLength = strlen( pcHostName );
|
||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, pvPortMalloc( sizeof( *pxCallback ) + lLength ) );
|
||||
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, pvPortMalloc( sizeof( *pxCallback ) + lLength ) );
|
||||
|
||||
/* Translate from ms to number of clock ticks. */
|
||||
uxTimeout /= portTICK_PERIOD_MS;
|
||||
@@ -448,7 +483,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
pxCallback->pvSearchID = pvSearchID;
|
||||
pxCallback->uxRemaningTime = uxTimeout;
|
||||
vTaskSetTimeOutState( &pxCallback->uxTimeoutState );
|
||||
listSET_LIST_ITEM_OWNER( &( pxCallback->xListItem ), ipPOINTER_CAST( void *, pxCallback ) );
|
||||
listSET_LIST_ITEM_OWNER( &( pxCallback->xListItem ), ( void *) pxCallback );
|
||||
listSET_LIST_ITEM_VALUE( &( pxCallback->xListItem ), uxIdentifier );
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
@@ -467,7 +502,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
{
|
||||
BaseType_t xResult = pdFALSE;
|
||||
const ListItem_t * pxIterator;
|
||||
const ListItem_t * xEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xCallbackList ) );
|
||||
const ListItem_t * xEnd = listGET_END_MARKER( &xCallbackList );
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
@@ -477,7 +512,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||
{
|
||||
if( listGET_LIST_ITEM_VALUE( pxIterator ) == uxIdentifier )
|
||||
{
|
||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
|
||||
pxCallback->pCallbackFunction( pcName, pxCallback->pvSearchID, ulIPAddress );
|
||||
( void ) uxListRemove( &pxCallback->xListItem );
|
||||
@@ -549,8 +584,8 @@ TickType_t uxIdentifier = 0U;
|
||||
else
|
||||
{
|
||||
FreeRTOS_printf( ( "prvPrepareLookup: name is too long ( %lu > %lu )\n",
|
||||
( unsigned long ) xLength,
|
||||
( unsigned long ) ipconfigDNS_CACHE_NAME_LENGTH ) );
|
||||
( uint32_t ) xLength,
|
||||
( uint32_t ) ipconfigDNS_CACHE_NAME_LENGTH ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -709,7 +744,7 @@ TickType_t uxWriteTimeOut_ticks = ipconfigDNS_SEND_BLOCK_TIME_TICKS;
|
||||
if( bHasDot == pdFALSE )
|
||||
{
|
||||
/* Use LLMNR addressing. */
|
||||
( ipPOINTER_CAST( DNSMessage_t *, pucUDPPayloadBuffer ) )->usFlags = 0;
|
||||
( ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucUDPPayloadBuffer ) )->usFlags = 0;
|
||||
xAddress.sin_addr = ipLLMNR_IP_ADDR; /* Is in network byte order. */
|
||||
xAddress.sin_port = ipLLMNR_PORT;
|
||||
xAddress.sin_port = FreeRTOS_ntohs( xAddress.sin_port );
|
||||
@@ -732,7 +767,7 @@ TickType_t uxWriteTimeOut_ticks = ipconfigDNS_SEND_BLOCK_TIME_TICKS;
|
||||
if( lBytes > 0 )
|
||||
{
|
||||
BaseType_t xExpected;
|
||||
const DNSMessage_t *pxDNSMessageHeader = ipPOINTER_CAST( DNSMessage_t *, pucReceiveBuffer );
|
||||
const DNSMessage_t *pxDNSMessageHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( DNSMessage_t, pucReceiveBuffer );
|
||||
|
||||
/* See if the identifiers match. */
|
||||
if( uxIdentifier == ( TickType_t ) pxDNSMessageHeader->usIdentifier )
|
||||
@@ -811,11 +846,11 @@ static const DNSMessage_t xDefaultPartDNSHeader =
|
||||
|
||||
/* Copy in the const part of the header. Intentionally using different
|
||||
* pointers with memcpy() to put the information in to correct place. */
|
||||
( void ) memcpy( pucUDPPayloadBuffer, &( xDefaultPartDNSHeader ), sizeof( xDefaultPartDNSHeader ) );
|
||||
( void ) memcpy( ( void * ) pucUDPPayloadBuffer, ( const void * ) ( &( xDefaultPartDNSHeader ) ), sizeof( xDefaultPartDNSHeader ) );
|
||||
|
||||
/* Write in a unique identifier. Cast the Payload Buffer to DNSMessage_t
|
||||
* to easily access fields of the DNS Message. */
|
||||
pxDNSMessageHeader = ipPOINTER_CAST( DNSMessage_t *, pucUDPPayloadBuffer );
|
||||
pxDNSMessageHeader = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucUDPPayloadBuffer );
|
||||
pxDNSMessageHeader->usIdentifier = ( uint16_t ) uxIdentifier;
|
||||
|
||||
/* Create the resource record at the end of the header. First
|
||||
@@ -856,7 +891,7 @@ static const DNSMessage_t xDefaultPartDNSHeader =
|
||||
|
||||
/* Finish off the record. Cast the record onto DNSTail_t stucture to easily
|
||||
* access the fields of the DNS Message. */
|
||||
pxTail = ipPOINTER_CAST(DNSTail_t *, &( pucByte[ 1 ] ) );
|
||||
pxTail = ipCAST_PTR_TO_TYPE_PTR( DNSTail_t, &( pucByte[ 1 ] ) );
|
||||
|
||||
#if defined( _lint ) || defined( __COVERITY__ )
|
||||
( void ) pxTail;
|
||||
@@ -1051,7 +1086,7 @@ size_t uxPayloadSize;
|
||||
if( uxPayloadSize >= sizeof( DNSMessage_t ) )
|
||||
{
|
||||
pxDNSMessageHeader =
|
||||
ipPOINTER_CAST( DNSMessage_t *, &( pxNetworkBuffer->pucEthernetBuffer [ sizeof( UDPPacket_t ) ] ) );
|
||||
ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* The parameter pdFALSE indicates that the reply was not expected. */
|
||||
( void ) prvParseDNSReply( ( uint8_t * ) pxDNSMessageHeader,
|
||||
@@ -1069,7 +1104,7 @@ size_t uxPayloadSize;
|
||||
|
||||
uint32_t ulNBNSHandlePacket( NetworkBufferDescriptor_t * pxNetworkBuffer )
|
||||
{
|
||||
UDPPacket_t *pxUDPPacket = ipPOINTER_CAST( UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
UDPPacket_t *pxUDPPacket = ipCAST_PTR_TO_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
uint8_t *pucUDPPayloadBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ sizeof( *pxUDPPacket ) ] );
|
||||
|
||||
prvTreatNBNS( pucUDPPayloadBuffer,
|
||||
@@ -1119,7 +1154,7 @@ BaseType_t xReturn = pdTRUE;
|
||||
|
||||
/* Parse the DNS message header. Map the byte stream onto a structure
|
||||
* for easier access. */
|
||||
pxDNSMessageHeader = ipPOINTER_CAST( DNSMessage_t *, pucUDPPayloadBuffer );
|
||||
pxDNSMessageHeader = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucUDPPayloadBuffer );
|
||||
|
||||
/* Introduce a do {} while (0) to allow the use of breaks. */
|
||||
do
|
||||
@@ -1217,10 +1252,16 @@ BaseType_t xReturn = pdTRUE;
|
||||
const uint16_t usCount = ( uint16_t ) ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY;
|
||||
uint16_t usNumARecordsStored = 0;
|
||||
|
||||
for( x = 0U; ( x < pxDNSMessageHeader->usAnswers ) && ( usNumARecordsStored < usCount ); x++ )
|
||||
for( x = 0U; x < pxDNSMessageHeader->usAnswers; x++ )
|
||||
{
|
||||
BaseType_t xDoAccept;
|
||||
|
||||
if( usNumARecordsStored >= usCount )
|
||||
{
|
||||
/* Only count ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY number of records. */
|
||||
break;
|
||||
}
|
||||
|
||||
uxResult = prvSkipNameField( pucByte,
|
||||
uxSourceBytesRemaining );
|
||||
|
||||
@@ -1266,15 +1307,15 @@ BaseType_t xReturn = pdTRUE;
|
||||
/* This is the required record type and is of sufficient size. */
|
||||
/* Mapping pucByte to a DNSAnswerRecord allows easy access of the
|
||||
* fields of the structure. */
|
||||
pxDNSAnswerRecord = ipPOINTER_CAST( DNSAnswerRecord_t *, pucByte );
|
||||
pxDNSAnswerRecord = ipCAST_PTR_TO_TYPE_PTR( DNSAnswerRecord_t, pucByte );
|
||||
|
||||
/* Sanity check the data length of an IPv4 answer. */
|
||||
if( FreeRTOS_ntohs( pxDNSAnswerRecord->usDataLength ) == ( uint16_t ) sizeof( uint32_t ) )
|
||||
{
|
||||
/* Copy the IP address out of the record. Using different pointers
|
||||
* to copy only the portion we want is intentional here. */
|
||||
( void ) memcpy( &( ulIPAddress ),
|
||||
&( pucByte[ sizeof( DNSAnswerRecord_t ) ] ),
|
||||
( void ) memcpy( ( void * ) ( &( ulIPAddress ) ),
|
||||
( const void * ) ( &( pucByte[ sizeof( DNSAnswerRecord_t ) ] ) ),
|
||||
sizeof( uint32_t ) );
|
||||
|
||||
#if( ipconfigDNS_USE_CALLBACKS == 1 )
|
||||
@@ -1319,7 +1360,7 @@ BaseType_t xReturn = pdTRUE;
|
||||
/* It's not an A record, so skip it. Get the header location
|
||||
and then jump over the header. */
|
||||
/* Cast the response to DNSAnswerRecord for easy access to fields of the DNS response. */
|
||||
pxDNSAnswerRecord = ipPOINTER_CAST( DNSAnswerRecord_t *, pucByte );
|
||||
pxDNSAnswerRecord = ipCAST_PTR_TO_TYPE_PTR( DNSAnswerRecord_t, pucByte );
|
||||
|
||||
pucByte = &( pucByte[ sizeof( DNSAnswerRecord_t ) ] );
|
||||
uxSourceBytesRemaining -= sizeof( DNSAnswerRecord_t );
|
||||
@@ -1380,7 +1421,7 @@ BaseType_t xReturn = pdTRUE;
|
||||
|
||||
pucByte = &( pucNewBuffer[ xOffset1 ] );
|
||||
pcRequestedName = ( char * ) &( pucNewBuffer[ xOffset2 ] );
|
||||
pxDNSMessageHeader = ipPOINTER_CAST( DNSMessage_t *, pucNewBuffer );
|
||||
pxDNSMessageHeader = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucNewBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1392,7 +1433,7 @@ BaseType_t xReturn = pdTRUE;
|
||||
/* The test on 'pucNewBuffer' is only to satisfy lint. */
|
||||
if( ( pxNetworkBuffer != NULL ) && ( pucNewBuffer != NULL ) )
|
||||
{
|
||||
pxAnswer = ipPOINTER_CAST( LLMNRAnswer_t *, pucByte );
|
||||
pxAnswer = ipCAST_PTR_TO_TYPE_PTR( LLMNRAnswer_t, pucByte );
|
||||
|
||||
/* We leave 'usIdentifier' and 'usQuestions' untouched */
|
||||
#ifndef _lint
|
||||
@@ -1568,7 +1609,7 @@ BaseType_t xReturn = pdTRUE;
|
||||
/* Should not occur: pucUDPPayloadBuffer is part of a xNetworkBufferDescriptor */
|
||||
if( pxNetworkBuffer != NULL )
|
||||
{
|
||||
pxMessage = ipPOINTER_CAST( DNSMessage_t *, pucUDPPayloadBuffer );
|
||||
pxMessage = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucUDPPayloadBuffer );
|
||||
|
||||
/* As the fields in the structures are not word-aligned, we have to
|
||||
copy the values byte-by-byte using macro's vSetField16() and vSetField32() */
|
||||
@@ -1581,8 +1622,8 @@ BaseType_t xReturn = pdTRUE;
|
||||
#else
|
||||
( void ) pxMessage;
|
||||
#endif
|
||||
|
||||
pxAnswer = ipPOINTER_CAST( NBNSAnswer_t *, &( pucUDPPayloadBuffer[ offsetof( NBNSRequest_t, usType ) ] ) );
|
||||
|
||||
pxAnswer = ipCAST_PTR_TO_TYPE_PTR( NBNSAnswer_t, &( pucUDPPayloadBuffer[ offsetof( NBNSRequest_t, usType ) ] ) );
|
||||
|
||||
#ifndef _lint
|
||||
vSetField16( pxAnswer, NBNSAnswer_t, usType, usType ); /* Type */
|
||||
@@ -1615,7 +1656,7 @@ BaseType_t xReturn;
|
||||
/* This must be the first time this function has been called. Create
|
||||
the socket. */
|
||||
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
|
||||
if( ( xSocket == FREERTOS_INVALID_SOCKET ) || ( xSocket == NULL ) )
|
||||
if( prvSocketValid( xSocket ) != pdTRUE )
|
||||
{
|
||||
/* There was an error, return NULL. */
|
||||
xSocket = NULL;
|
||||
@@ -1652,7 +1693,7 @@ BaseType_t xReturn;
|
||||
UDPHeader_t *pxUDPHeader;
|
||||
size_t uxDataLength;
|
||||
|
||||
pxUDPPacket = ipPOINTER_CAST( UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxUDPPacket = ipCAST_PTR_TO_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxIPHeader = &pxUDPPacket->xIPHeader;
|
||||
pxUDPHeader = &pxUDPPacket->xUDPHeader;
|
||||
/* HT: started using defines like 'ipSIZE_OF_xxx' */
|
||||
@@ -1700,7 +1741,7 @@ BaseType_t xReturn;
|
||||
{
|
||||
BaseType_t x;
|
||||
BaseType_t xFound = pdFALSE;
|
||||
uint32_t ulCurrentTimeSeconds = ( xTaskGetTickCount() / portTICK_PERIOD_MS ) / 1000U;
|
||||
uint32_t ulCurrentTimeSeconds = ( xTaskGetTickCount() / portTICK_PERIOD_MS ) / 1000UL;
|
||||
uint32_t ulIPAddressIndex = 0;
|
||||
static BaseType_t xFreeEntry = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -158,6 +158,16 @@ typedef union _xUnionPtr
|
||||
uint8_t *u8ptr;
|
||||
} xUnionPtr;
|
||||
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||
{
|
||||
return ( NetworkBufferDescriptor_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||
{
|
||||
return ( const NetworkBufferDescriptor_t *) pvArgument;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -362,7 +372,7 @@ struct freertos_sockaddr xAddress;
|
||||
/* Wait until there is something to do. If the following call exits
|
||||
* due to a time out rather than a message being received, set a
|
||||
* 'NoEvent' value. */
|
||||
if ( xQueueReceive( xNetworkEventQueue, ipPOINTER_CAST( void *, &xReceivedEvent ), xNextIPSleep ) == pdFALSE )
|
||||
if ( xQueueReceive( xNetworkEventQueue, ( void *) &xReceivedEvent, xNextIPSleep ) == pdFALSE )
|
||||
{
|
||||
xReceivedEvent.eEventType = eNoEvent;
|
||||
}
|
||||
@@ -395,14 +405,14 @@ struct freertos_sockaddr xAddress;
|
||||
case eNetworkRxEvent:
|
||||
/* The network hardware driver has received a new packet. A
|
||||
pointer to the received buffer is located in the pvData member
|
||||
of the received event structure. */
|
||||
prvHandleEthernetPacket( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ) );
|
||||
of the received event structure. */
|
||||
prvHandleEthernetPacket( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ) );
|
||||
break;
|
||||
|
||||
case eNetworkTxEvent:
|
||||
/* Send a network packet. The ownership will be transferred to
|
||||
the driver, which will release it after delivery. */
|
||||
( void ) xNetworkInterfaceOutput( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ), pdTRUE );
|
||||
( void ) xNetworkInterfaceOutput( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ), pdTRUE );
|
||||
break;
|
||||
|
||||
case eARPTimerEvent :
|
||||
@@ -416,7 +426,7 @@ struct freertos_sockaddr xAddress;
|
||||
usLocalPort. vSocketBind() will actually bind the socket and the
|
||||
API will unblock as soon as the eSOCKET_BOUND event is
|
||||
triggered. */
|
||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData );
|
||||
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData );
|
||||
xAddress.sin_addr = 0U; /* For the moment. */
|
||||
xAddress.sin_port = FreeRTOS_ntohs( pxSocket->usLocalPort );
|
||||
pxSocket->usLocalPort = 0U;
|
||||
@@ -434,14 +444,14 @@ struct freertos_sockaddr xAddress;
|
||||
IP-task to actually close a socket. This is handled in
|
||||
vSocketClose(). As the socket gets closed, there is no way to
|
||||
report back to the API, so the API won't wait for the result */
|
||||
( void ) vSocketClose( ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData ) );
|
||||
( void ) vSocketClose( ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData ) );
|
||||
break;
|
||||
|
||||
case eStackTxEvent :
|
||||
/* The network stack has generated a packet to send. A
|
||||
pointer to the generated buffer is located in the pvData
|
||||
member of the received event structure. */
|
||||
vProcessGeneratedUDPPacket( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ) );
|
||||
vProcessGeneratedUDPPacket( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ) );
|
||||
break;
|
||||
|
||||
case eDHCPEvent:
|
||||
@@ -462,13 +472,13 @@ struct freertos_sockaddr xAddress;
|
||||
{
|
||||
#if( ipconfigSELECT_USES_NOTIFY != 0 )
|
||||
{
|
||||
SocketSelectMessage_t *pxMessage = ipPOINTER_CAST( SocketSelectMessage_t *, xReceivedEvent.pvData );
|
||||
SocketSelectMessage_t *pxMessage = ipCAST_PTR_TO_TYPE_PTR( SocketSelectMessage_t, xReceivedEvent.pvData );
|
||||
vSocketSelect( pxMessage->pxSocketSet );
|
||||
( void ) xTaskNotifyGive( pxMessage->xTaskhandle );
|
||||
}
|
||||
#else
|
||||
{
|
||||
vSocketSelect( ipPOINTER_CAST( SocketSelect_t *, xReceivedEvent.pvData ) );
|
||||
{
|
||||
vSocketSelect( ipCAST_PTR_TO_TYPE_PTR( SocketSelect_t, xReceivedEvent.pvData ) );
|
||||
}
|
||||
#endif /* ( ipconfigSELECT_USES_NOTIFY != 0 ) */
|
||||
}
|
||||
@@ -501,7 +511,7 @@ struct freertos_sockaddr xAddress;
|
||||
received a new connection. */
|
||||
#if( ipconfigUSE_TCP == 1 )
|
||||
{
|
||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData );
|
||||
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData );
|
||||
|
||||
if( xTCPCheckNewClient( pxSocket ) != pdFALSE )
|
||||
{
|
||||
@@ -944,7 +954,7 @@ NetworkBufferDescriptor_t *pxResult;
|
||||
/* The following statement may trigger a:
|
||||
warning: cast increases required alignment of target type [-Wcast-align].
|
||||
It has been confirmed though that the alignment is suitable. */
|
||||
pxResult = * ( ipPOINTER_CAST( NetworkBufferDescriptor_t **, pucBuffer ) );
|
||||
pxResult = * ( ( const NetworkBufferDescriptor_t **) pucBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1153,11 +1163,10 @@ void FreeRTOS_SetAddressConfiguration( const uint32_t *pulIPAddress,
|
||||
}
|
||||
if( ( uxGetNumberOfFreeNetworkBuffers() >= 3U ) && ( uxNumberOfBytesToSend >= 1U ) && ( xEnoughSpace != pdFALSE ) )
|
||||
{
|
||||
pxEthernetHeader = ipPOINTER_CAST( EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxEthernetHeader = ipCAST_PTR_TO_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxEthernetHeader->usFrameType = ipIPv4_FRAME_TYPE;
|
||||
|
||||
|
||||
pxICMPHeader = ipPOINTER_CAST( ICMPHeader_t *, &( pxNetworkBuffer->pucEthernetBuffer[ ipIP_PAYLOAD_OFFSET ] ) );
|
||||
pxICMPHeader = ipCAST_PTR_TO_TYPE_PTR( ICMPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipIP_PAYLOAD_OFFSET ] ) );
|
||||
usSequenceNumber++;
|
||||
|
||||
/* Fill in the basic header information. */
|
||||
@@ -1289,7 +1298,7 @@ eFrameProcessingResult_t eReturn;
|
||||
const EthernetHeader_t *pxEthernetHeader;
|
||||
|
||||
/* Map the buffer onto Ethernet Header struct for easy access to fields. */
|
||||
pxEthernetHeader = ipPOINTER_CAST( const EthernetHeader_t *, pucEthernetBuffer );
|
||||
pxEthernetHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( EthernetHeader_t, pucEthernetBuffer );
|
||||
|
||||
if( memcmp( ipLOCAL_MAC_ADDRESS, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
|
||||
{
|
||||
@@ -1430,7 +1439,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
||||
eReturned = ipCONSIDER_FRAME_FOR_PROCESSING( pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* Map the buffer onto the Ethernet Header struct for easy access to the fields. */
|
||||
pxEthernetHeader = ipPOINTER_CAST( const EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxEthernetHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* The condition "eReturned == eProcessBuffer" must be true. */
|
||||
#if( ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 0 )
|
||||
@@ -1444,7 +1453,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
||||
/* The Ethernet frame contains an ARP packet. */
|
||||
if( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) )
|
||||
{
|
||||
eReturned = eARPProcessPacket( ipPOINTER_CAST( ARPPacket_t *, pxNetworkBuffer->pucEthernetBuffer ) );
|
||||
eReturned = eARPProcessPacket( ipCAST_PTR_TO_TYPE_PTR( ARPPacket_t, pxNetworkBuffer->pucEthernetBuffer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1456,7 +1465,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
||||
/* The Ethernet frame contains an IP packet. */
|
||||
if( pxNetworkBuffer->xDataLength >= sizeof( IPPacket_t ) )
|
||||
{
|
||||
eReturned = prvProcessIPPacket( ipPOINTER_CAST( IPPacket_t *, pxNetworkBuffer->pucEthernetBuffer ), pxNetworkBuffer );
|
||||
eReturned = prvProcessIPPacket( ipCAST_PTR_TO_TYPE_PTR( IPPacket_t, pxNetworkBuffer->pucEthernetBuffer ), pxNetworkBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1643,7 +1652,7 @@ eFrameProcessingResult_t eReturn = eProcessBuffer;
|
||||
const uint16_t *pusChecksum;
|
||||
|
||||
/* pxProtPack will point to the offset were the protocols begin. */
|
||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pxNetworkBuffer->pucEthernetBuffer[ uxHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
pxProtPack = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pxNetworkBuffer->pucEthernetBuffer[ uxHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
pusChecksum = ( const uint16_t * ) ( &( pxProtPack->xUDPPacket.xUDPHeader.usChecksum ) );
|
||||
if( *pusChecksum == ( uint16_t ) 0U )
|
||||
{
|
||||
@@ -1762,7 +1771,7 @@ uint8_t ucProtocol;
|
||||
{
|
||||
/* Map the buffer onto a ICMP-Packet struct to easily access the
|
||||
* fields of ICMP packet. */
|
||||
ICMPPacket_t *pxICMPPacket = ipPOINTER_CAST( ICMPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
ICMPPacket_t *pxICMPPacket = ipCAST_PTR_TO_TYPE_PTR( ICMPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
if( pxIPHeader->ulDestinationIPAddress == *ipLOCAL_IP_ADDRESS_POINTER )
|
||||
{
|
||||
eReturn = prvProcessICMPPacket( pxICMPPacket );
|
||||
@@ -1782,7 +1791,7 @@ uint8_t ucProtocol;
|
||||
|
||||
/* Map the buffer onto a UDP-Packet struct to easily access the
|
||||
* fields of UDP packet. */
|
||||
const UDPPacket_t *pxUDPPacket = ipPOINTER_CAST( const UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
const UDPPacket_t *pxUDPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
uint16_t usLength;
|
||||
|
||||
/* Note the header values required prior to the checksum
|
||||
@@ -1991,7 +2000,7 @@ uint8_t ucProtocol;
|
||||
size_t uxLength;
|
||||
const IPPacket_t * pxIPPacket;
|
||||
UBaseType_t uxIPHeaderLength;
|
||||
ProtocolPacket_t *pxProtPack;
|
||||
const ProtocolPacket_t *pxProtPack;
|
||||
uint8_t ucProtocol;
|
||||
uint16_t usLength;
|
||||
uint16_t ucVersionHeaderLength;
|
||||
@@ -2010,7 +2019,7 @@ uint8_t ucProtocol;
|
||||
|
||||
/* Map the buffer onto a IP-Packet struct to easily access the
|
||||
* fields of the IP packet. */
|
||||
pxIPPacket = ipPOINTER_CAST( const IPPacket_t *, pucEthernetBuffer );
|
||||
pxIPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPPacket_t, pucEthernetBuffer );
|
||||
|
||||
ucVersionHeaderLength = pxIPPacket->xIPHeader.ucVersionHeaderLength;
|
||||
/* Test if the length of the IP-header is between 20 and 60 bytes,
|
||||
@@ -2049,7 +2058,7 @@ uint8_t ucProtocol;
|
||||
of this calculation. */
|
||||
/* Map the Buffer onto the Protocol Packet struct for easy access to the
|
||||
* struct fields. */
|
||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
pxProtPack = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
|
||||
/* Switch on the Layer 3/4 protocol. */
|
||||
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
||||
@@ -2096,6 +2105,11 @@ uint8_t ucProtocol;
|
||||
if( xResult != pdPASS )
|
||||
{
|
||||
FreeRTOS_printf( ( "xCheckSizeFields: location %ld\n", xLocation ) );
|
||||
|
||||
/* If FreeRTOS_printf is not defined, not using xLocation will be a violation of MISRA
|
||||
* rule 2.2 as the value assigned to xLocation will not be used. The below statement uses
|
||||
* the variable without modifying the logic of the source. */
|
||||
( void ) xLocation;
|
||||
}
|
||||
|
||||
return xResult;
|
||||
@@ -2109,7 +2123,7 @@ uint32_t ulLength;
|
||||
uint16_t usChecksum, *pusChecksum;
|
||||
const IPPacket_t * pxIPPacket;
|
||||
UBaseType_t uxIPHeaderLength;
|
||||
ProtocolPacket_t *pxProtPack;
|
||||
const ProtocolPacket_t *pxProtPack;
|
||||
uint8_t ucProtocol;
|
||||
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
|
||||
const char *pcType;
|
||||
@@ -2133,7 +2147,7 @@ BaseType_t location = 0;
|
||||
}
|
||||
|
||||
/* Parse the packet length. */
|
||||
pxIPPacket = ipPOINTER_CAST( const IPPacket_t *, pucEthernetBuffer );
|
||||
pxIPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPPacket_t, pucEthernetBuffer );
|
||||
|
||||
/* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
|
||||
Length field contains the length of the internet header in 32-bit words. */
|
||||
@@ -2165,7 +2179,7 @@ BaseType_t location = 0;
|
||||
and IP headers incorrectly aligned. However, either way, the "third"
|
||||
protocol (Layer 3 or 4) header will be aligned, which is the convenience
|
||||
of this calculation. */
|
||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
pxProtPack = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||
|
||||
/* Switch on the Layer 3/4 protocol. */
|
||||
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
||||
@@ -2301,7 +2315,7 @@ BaseType_t location = 0;
|
||||
/* ICMP/IGMP do not have a pseudo header for CRC-calculation. */
|
||||
usChecksum = ( uint16_t )
|
||||
( ~usGenerateChecksum( 0U,
|
||||
( uint8_t * ) &( pxProtPack->xTCPPacket.xTCPHeader ), ( size_t ) ulLength ) );
|
||||
( const uint8_t * ) &( pxProtPack->xTCPPacket.xTCPHeader ), ( size_t ) ulLength ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2370,6 +2384,11 @@ BaseType_t location = 0;
|
||||
( usChecksum == ipINVALID_LENGTH ) )
|
||||
{
|
||||
FreeRTOS_printf( ( "CRC error: %04x location %ld\n", usChecksum, location ) );
|
||||
|
||||
/* If FreeRTOS_printf is not defined, not using 'location' will be a violation of MISRA
|
||||
* rule 2.2 as the value assigned to 'location' will not be used. The below statement uses
|
||||
* the variable without modifying the logic of the source. */
|
||||
( void ) location;
|
||||
}
|
||||
|
||||
return usChecksum;
|
||||
@@ -2578,11 +2597,11 @@ EthernetHeader_t *pxEthernetHeader;
|
||||
#endif
|
||||
{
|
||||
/* Map the Buffer to Ethernet Header struct for easy access to fields. */
|
||||
pxEthernetHeader = ipPOINTER_CAST( EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxEthernetHeader = ipCAST_PTR_TO_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* Swap source and destination MAC addresses. */
|
||||
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ), &( pxEthernetHeader->xSourceAddress ), sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||
( void ) memcpy( &( pxEthernetHeader->xSourceAddress) , ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( ( void * ) &( pxEthernetHeader->xDestinationAddress ), ( const void * ) ( &( pxEthernetHeader->xSourceAddress ) ), sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||
( void ) memcpy( ( void * ) &( pxEthernetHeader->xSourceAddress) , ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
|
||||
/* Send! */
|
||||
( void ) xNetworkInterfaceOutput( pxNetworkBuffer, xReleaseAfterSend );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -87,7 +87,28 @@ range 1024-65535" excluding those already in use (inbound or outbound). */
|
||||
#define sock80_PERCENT 80U
|
||||
#define sock100_PERCENT 100U
|
||||
|
||||
#if( ipconfigUSE_CALLBACKS != 0 )
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( F_TCP_UDP_Handler_t )
|
||||
{
|
||||
return ( F_TCP_UDP_Handler_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( F_TCP_UDP_Handler_t )
|
||||
{
|
||||
return ( const F_TCP_UDP_Handler_t *) pvArgument;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||
{
|
||||
return ( NetworkBufferDescriptor_t *)pvArgument;
|
||||
}
|
||||
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( StreamBuffer_t )
|
||||
{
|
||||
return ( StreamBuffer_t *)pvArgument;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -280,7 +301,7 @@ FreeRTOS_Socket_t const *pxSocket = NULL;
|
||||
Socket_t FreeRTOS_socket( BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol )
|
||||
{
|
||||
FreeRTOS_Socket_t *pxSocket;
|
||||
size_t uxSocketSize;
|
||||
size_t uxSocketSize = 0;
|
||||
EventGroupHandle_t xEventGroup;
|
||||
Socket_t xReturn;
|
||||
|
||||
@@ -290,11 +311,11 @@ Socket_t xReturn;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allocate the structure that will hold the socket information. The
|
||||
size depends on the type of socket: UDP sockets need less space. A
|
||||
/* Allocate the structure that will hold the socket information. The
|
||||
size depends on the type of socket: UDP sockets need less space. A
|
||||
define 'pvPortMallocSocket' will used to allocate the necessary space.
|
||||
By default it points to the FreeRTOS function 'pvPortMalloc()'. */
|
||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, pvPortMallocSocket( uxSocketSize ) );
|
||||
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, pvPortMallocSocket( uxSocketSize ) );
|
||||
|
||||
if( pxSocket == NULL )
|
||||
{
|
||||
@@ -394,7 +415,7 @@ Socket_t xReturn;
|
||||
{
|
||||
SocketSelect_t *pxSocketSet;
|
||||
|
||||
pxSocketSet = ipPOINTER_CAST( SocketSelect_t *, pvPortMalloc( sizeof( *pxSocketSet ) ) );
|
||||
pxSocketSet = ipCAST_PTR_TO_TYPE_PTR( SocketSelect_t, pvPortMalloc( sizeof( *pxSocketSet ) ) );
|
||||
|
||||
if( pxSocketSet != NULL )
|
||||
{
|
||||
@@ -639,12 +660,14 @@ int32_t FreeRTOS_recvfrom( Socket_t xSocket, void *pvBuffer, size_t uxBufferLeng
|
||||
{
|
||||
BaseType_t lPacketCount;
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
const void *pvCopySource;
|
||||
FreeRTOS_Socket_t const * pxSocket = xSocket;
|
||||
TickType_t xRemainingTime = ( TickType_t ) 0; /* Obsolete assignment, but some compilers output a warning if its not done. */
|
||||
BaseType_t xTimed = pdFALSE;
|
||||
TimeOut_t xTimeOut;
|
||||
int32_t lReturn;
|
||||
EventBits_t xEventBits = ( EventBits_t ) 0;
|
||||
size_t uxPayloadLength;
|
||||
|
||||
if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE )
|
||||
{
|
||||
@@ -733,7 +756,7 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* The owner of the list item is the network buffer. */
|
||||
pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||
pxNetworkBuffer = ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||
|
||||
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
|
||||
{
|
||||
@@ -748,7 +771,8 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
|
||||
calculated at the total packet size minus the headers.
|
||||
The validity of `xDataLength` prvProcessIPPacket has been confirmed
|
||||
in 'prvProcessIPPacket()'. */
|
||||
lReturn = ( int32_t ) ( pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t ) );
|
||||
uxPayloadLength = pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t );
|
||||
lReturn = ( int32_t ) uxPayloadLength;
|
||||
|
||||
if( pxSourceAddress != NULL )
|
||||
{
|
||||
@@ -768,7 +792,8 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
|
||||
|
||||
/* Copy the received data into the provided buffer, then release the
|
||||
network buffer. */
|
||||
( void ) memcpy( pvBuffer, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ), ( size_t )lReturn );
|
||||
pvCopySource = ( const void *) &pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ];
|
||||
( void ) memcpy( pvBuffer, pvCopySource, ( size_t )lReturn );
|
||||
|
||||
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
|
||||
{
|
||||
@@ -806,6 +831,7 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
|
||||
int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t uxTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, socklen_t xDestinationAddressLength )
|
||||
{
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
void *pvCopyDest;
|
||||
IPStackEvent_t xStackTxEvent = { eStackTxEvent, NULL };
|
||||
TimeOut_t xTimeOut;
|
||||
TickType_t xTicksToWait;
|
||||
@@ -862,7 +888,8 @@ const size_t uxPayloadOffset = ( size_t ) ipUDP_PAYLOAD_OFFSET_IPv4;
|
||||
|
||||
if( pxNetworkBuffer != NULL )
|
||||
{
|
||||
( void ) memcpy( &( pxNetworkBuffer->pucEthernetBuffer[ uxPayloadOffset ] ), pvBuffer, uxTotalDataLength );
|
||||
pvCopyDest = ( void * ) &pxNetworkBuffer->pucEthernetBuffer[ uxPayloadOffset ];
|
||||
( void ) memcpy( pvCopyDest, pvBuffer, uxTotalDataLength );
|
||||
|
||||
if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdTRUE )
|
||||
{
|
||||
@@ -876,7 +903,7 @@ const size_t uxPayloadOffset = ( size_t ) ipUDP_PAYLOAD_OFFSET_IPv4;
|
||||
/* When zero copy is used, pvBuffer is a pointer to the
|
||||
payload of a buffer that has already been obtained from the
|
||||
stack. Obtain the network buffer pointer from the buffer. */
|
||||
pxNetworkBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( ( void * ) pvBuffer );
|
||||
pxNetworkBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( pvBuffer );
|
||||
}
|
||||
|
||||
if( pxNetworkBuffer != NULL )
|
||||
@@ -1273,7 +1300,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
{
|
||||
while( listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) > 0U )
|
||||
{
|
||||
pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||
pxNetworkBuffer = ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||
( void ) uxListRemove( &( pxNetworkBuffer->xBufferListItem ) );
|
||||
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
|
||||
}
|
||||
@@ -1317,7 +1344,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
static void prvTCPSetSocketCount( FreeRTOS_Socket_t const * pxSocketToDelete )
|
||||
{
|
||||
const ListItem_t *pxIterator;
|
||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
const ListItem_t *pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
FreeRTOS_Socket_t *pxOtherSocket;
|
||||
uint16_t usLocalPort = pxSocketToDelete->usLocalPort;
|
||||
|
||||
@@ -1325,7 +1352,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
pxOtherSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxOtherSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
if( ( pxOtherSocket->u.xTCP.ucTCPState == ( uint8_t ) eTCP_LISTEN ) &&
|
||||
( pxOtherSocket->usLocalPort == usLocalPort ) &&
|
||||
( pxOtherSocket->u.xTCP.usChildCount != 0U ) )
|
||||
@@ -1409,12 +1436,12 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
{
|
||||
case FREERTOS_SO_RCVTIMEO :
|
||||
/* Receive time out. */
|
||||
pxSocket->xReceiveBlockTime = *( ipPOINTER_CAST( const TickType_t *, pvOptionValue ) );
|
||||
pxSocket->xReceiveBlockTime = *( ( const TickType_t *) pvOptionValue );
|
||||
xReturn = 0;
|
||||
break;
|
||||
|
||||
case FREERTOS_SO_SNDTIMEO :
|
||||
pxSocket->xSendBlockTime = *( ipPOINTER_CAST( const TickType_t *, pvOptionValue ) );
|
||||
pxSocket->xSendBlockTime = *( ( const TickType_t *) pvOptionValue );
|
||||
if( pxSocket->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_UDP )
|
||||
{
|
||||
/* The send time out is capped for the reason stated in the
|
||||
@@ -1498,20 +1525,20 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
{
|
||||
#if ipconfigUSE_TCP == 1
|
||||
case FREERTOS_SO_TCP_CONN_HANDLER:
|
||||
pxSocket->u.xTCP.pxHandleConnected = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPConnected;
|
||||
pxSocket->u.xTCP.pxHandleConnected = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPConnected;
|
||||
break;
|
||||
case FREERTOS_SO_TCP_RECV_HANDLER:
|
||||
pxSocket->u.xTCP.pxHandleReceive = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPReceive;
|
||||
pxSocket->u.xTCP.pxHandleReceive = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPReceive;
|
||||
break;
|
||||
case FREERTOS_SO_TCP_SENT_HANDLER:
|
||||
pxSocket->u.xTCP.pxHandleSent = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPSent;
|
||||
pxSocket->u.xTCP.pxHandleSent = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPSent;
|
||||
break;
|
||||
#endif /* ipconfigUSE_TCP */
|
||||
case FREERTOS_SO_UDP_RECV_HANDLER:
|
||||
pxSocket->u.xUDP.pxHandleReceive = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnUDPReceive;
|
||||
pxSocket->u.xUDP.pxHandleReceive = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnUDPReceive;
|
||||
break;
|
||||
case FREERTOS_SO_UDP_SENT_HANDLER:
|
||||
pxSocket->u.xUDP.pxHandleSent = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnUDPSent;
|
||||
pxSocket->u.xUDP.pxHandleSent = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnUDPSent;
|
||||
break;
|
||||
default:
|
||||
/* Should it throw an error here? */
|
||||
@@ -1640,7 +1667,7 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
{
|
||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||
}
|
||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
||||
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||
{
|
||||
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
|
||||
}
|
||||
@@ -1659,7 +1686,7 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||
}
|
||||
|
||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
||||
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||
{
|
||||
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
|
||||
}
|
||||
@@ -1678,7 +1705,7 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||
}
|
||||
|
||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
||||
if( *( ( const BaseType_t *) pvOptionValue ) != 0 )
|
||||
{
|
||||
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
|
||||
}
|
||||
@@ -1704,7 +1731,7 @@ FreeRTOS_Socket_t *pxSocket;
|
||||
{
|
||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||
}
|
||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
||||
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||
{
|
||||
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
|
||||
}
|
||||
@@ -1803,7 +1830,7 @@ const ListItem_t * pxResult = NULL;
|
||||
if( ( xIPIsNetworkTaskReady() != pdFALSE ) && ( pxList != NULL ) )
|
||||
{
|
||||
const ListItem_t *pxIterator;
|
||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t*, listGET_END_MARKER( pxList ) );
|
||||
const ListItem_t *pxEnd = listGET_END_MARKER( pxList );
|
||||
for( pxIterator = listGET_NEXT( pxEnd );
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
@@ -1835,7 +1862,7 @@ FreeRTOS_Socket_t *pxSocket = NULL;
|
||||
if( pxListItem != NULL )
|
||||
{
|
||||
/* The owner of the list item is the socket itself. */
|
||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxListItem ) );
|
||||
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxListItem ) );
|
||||
configASSERT( pxSocket != NULL );
|
||||
}
|
||||
return pxSocket;
|
||||
@@ -1858,7 +1885,7 @@ const socklen_t uxSize = 16;
|
||||
{
|
||||
uint8_t pucDigits[ sockDIGIT_COUNT ];
|
||||
uint8_t ucValue = pucAddress[ uxNibble ];
|
||||
socklen_t uxSource = sockDIGIT_COUNT - 1;
|
||||
socklen_t uxSource = ( socklen_t ) sockDIGIT_COUNT - ( socklen_t ) 1U;
|
||||
socklen_t uxNeeded;
|
||||
|
||||
for( ;; )
|
||||
@@ -1874,7 +1901,7 @@ const socklen_t uxSize = 16;
|
||||
pucDigits[ 0 ] = ucValue;
|
||||
|
||||
/* Skip leading zeros. */
|
||||
for( uxSource = 0; uxSource < ( socklen_t ) ( sockDIGIT_COUNT - 1 ); uxSource++ )
|
||||
for( uxSource = 0; uxSource < ( ( socklen_t ) sockDIGIT_COUNT - ( socklen_t ) 1U ); uxSource++ )
|
||||
{
|
||||
if( pucDigits[ uxSource ] != 0U )
|
||||
{
|
||||
@@ -1950,6 +1977,7 @@ const char *pcResult;
|
||||
const char *FreeRTOS_inet_ntop4( const void *pvSource, char *pcDestination, socklen_t uxSize )
|
||||
{
|
||||
uint32_t ulIPAddress;
|
||||
void *pvCopyDest;
|
||||
const char *pcReturn;
|
||||
|
||||
if( uxSize < 16U )
|
||||
@@ -1959,7 +1987,8 @@ const char *pcReturn;
|
||||
}
|
||||
else
|
||||
{
|
||||
( void ) memcpy( &( ulIPAddress ), pvSource, sizeof( ulIPAddress ) );
|
||||
pvCopyDest = ( void * ) &ulIPAddress;
|
||||
( void ) memcpy( pvCopyDest, pvSource, sizeof( ulIPAddress ) );
|
||||
( void ) FreeRTOS_inet_ntoa( ulIPAddress, pcDestination );
|
||||
pcReturn = pcDestination;
|
||||
}
|
||||
@@ -1975,6 +2004,7 @@ uint32_t ulReturn = 0UL, ulValue;
|
||||
UBaseType_t uxOctetNumber;
|
||||
BaseType_t xResult = pdPASS;
|
||||
const char *pcIPAddress = pcSource;
|
||||
const void *pvCopySource;
|
||||
|
||||
/* Translate "192.168.2.100" to a 32-bit number, network-endian. */
|
||||
for( uxOctetNumber = 0U; uxOctetNumber < socketMAX_IP_ADDRESS_OCTETS; uxOctetNumber++ )
|
||||
@@ -2055,7 +2085,8 @@ const char *pcIPAddress = pcSource;
|
||||
{
|
||||
ulReturn = 0UL;
|
||||
}
|
||||
( void ) memcpy( pvDestination, &( ulReturn ), sizeof( ulReturn ) );
|
||||
pvCopySource = ( const void * ) &ulReturn;
|
||||
( void ) memcpy( pvDestination, pvCopySource, sizeof( ulReturn ) );
|
||||
|
||||
return xResult;
|
||||
}
|
||||
@@ -3058,7 +3089,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
||||
TickType_t xNow = xTaskGetTickCount();
|
||||
static TickType_t xLastTime = 0U;
|
||||
TickType_t xDelta = xNow - xLastTime;
|
||||
const ListItem_t* pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
const ListItem_t* pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
const ListItem_t *pxIterator = ( const ListItem_t * ) listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
||||
|
||||
xLastTime = xNow;
|
||||
@@ -3070,7 +3101,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
||||
|
||||
while( pxIterator != pxEnd )
|
||||
{
|
||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxIterator = ( ListItem_t * ) listGET_NEXT( pxIterator );
|
||||
|
||||
/* Sockets with 'tmout == 0' do not need any regular attention. */
|
||||
@@ -3142,7 +3173,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
||||
{
|
||||
const ListItem_t *pxIterator;
|
||||
FreeRTOS_Socket_t *pxResult = NULL, *pxListenSocket = NULL;
|
||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
const ListItem_t *pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
|
||||
/* Parameter not yet supported. */
|
||||
( void ) ulLocalIP;
|
||||
@@ -3151,7 +3182,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
FreeRTOS_Socket_t *pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
|
||||
if( pxSocket->usLocalPort == ( uint16_t ) uxLocalPort )
|
||||
{
|
||||
@@ -3245,7 +3276,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
||||
|
||||
uxSize = ( sizeof( *pxBuffer ) + uxLength ) - sizeof( pxBuffer->ucArray );
|
||||
|
||||
pxBuffer = ipPOINTER_CAST( StreamBuffer_t *, pvPortMallocLarge( uxSize ) );
|
||||
pxBuffer = ipCAST_PTR_TO_TYPE_PTR( StreamBuffer_t, pvPortMallocLarge( uxSize ) );
|
||||
|
||||
if( pxBuffer == NULL )
|
||||
{
|
||||
@@ -3701,14 +3732,14 @@ BaseType_t FreeRTOS_udp_rx_size( Socket_t xSocket )
|
||||
}
|
||||
else
|
||||
{
|
||||
const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
const ListItem_t *pxEndUDP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundUDPSocketsList ) );
|
||||
const ListItem_t *pxEndTCP = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
const ListItem_t *pxEndUDP = listGET_END_MARKER( &xBoundUDPSocketsList );
|
||||
FreeRTOS_printf( ( "Prot Port IP-Remote : Port R/T Status Alive tmout Child\n" ) );
|
||||
for( pxIterator = listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
||||
pxIterator != pxEndTCP;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
const FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( const FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
const FreeRTOS_Socket_t *pxSocket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
#if( ipconfigTCP_KEEP_ALIVE == 1 )
|
||||
TickType_t age = xTaskGetTickCount() - pxSocket->u.xTCP.xLastAliveTime;
|
||||
#else
|
||||
@@ -3782,19 +3813,19 @@ BaseType_t FreeRTOS_udp_rx_size( Socket_t xSocket )
|
||||
const ListItem_t *pxEnd;
|
||||
if( xRound == 0 )
|
||||
{
|
||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundUDPSocketsList ) );
|
||||
pxEnd = listGET_END_MARKER( &xBoundUDPSocketsList );
|
||||
}
|
||||
#if ipconfigUSE_TCP == 1
|
||||
else
|
||||
{
|
||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
}
|
||||
#endif /* ipconfigUSE_TCP == 1 */
|
||||
for( pxIterator = listGET_NEXT( pxEnd );
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
FreeRTOS_Socket_t *pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
if( pxSocket->pxSocketSet != pxSocketSet )
|
||||
{
|
||||
/* Socket does not belong to this select group. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -581,7 +581,7 @@ BaseType_t xReady = pdFALSE;
|
||||
static int32_t prvTCPSendPacket( FreeRTOS_Socket_t *pxSocket )
|
||||
{
|
||||
int32_t lResult = 0;
|
||||
UBaseType_t uxOptionsLength;
|
||||
UBaseType_t uxOptionsLength, uxIntermediateResult = 0;
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
|
||||
if( pxSocket->u.xTCP.ucTCPState != ( uint8_t ) eCONNECT_SYN )
|
||||
@@ -618,7 +618,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
now, proceed to send the packet with the SYN flag.
|
||||
prvTCPPrepareConnect() prepares 'xPacket' and returns pdTRUE if
|
||||
the Ethernet address of the peer or the gateway is found. */
|
||||
pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *, &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ ipSIZE_OF_ETH_HEADER + uxHeaderSize ] ) );
|
||||
pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t, &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ ipSIZE_OF_ETH_HEADER + uxHeaderSize ] ) );
|
||||
|
||||
/* About to send a SYN packet. Call prvSetSynAckOptions() to set
|
||||
the proper options: The size of MSS and whether SACK's are
|
||||
@@ -626,7 +626,8 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||
uxOptionsLength = prvSetSynAckOptions( pxSocket, &( pxProtocolHeaders->xTCPHeader ) );
|
||||
|
||||
/* Return the number of bytes to be sent. */
|
||||
lResult = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
lResult = ( int32_t ) uxIntermediateResult;
|
||||
|
||||
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
||||
uxOptionsLength is always a multiple of 4. The complete expression
|
||||
@@ -743,7 +744,7 @@ NetworkBufferDescriptor_t xTempBuffer;
|
||||
#endif
|
||||
{
|
||||
/* Map the ethernet buffer onto a TCPPacket_t struct for easy access to the fields. */
|
||||
pxTCPPacket = ipPOINTER_CAST( TCPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxTCPPacket = ipCAST_PTR_TO_TYPE_PTR( TCPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxIPHeader = &pxTCPPacket->xIPHeader;
|
||||
pxEthernetHeader = &pxTCPPacket->xEthernetHeader;
|
||||
|
||||
@@ -907,12 +908,12 @@ NetworkBufferDescriptor_t xTempBuffer;
|
||||
#endif
|
||||
|
||||
/* Fill in the destination MAC addresses. */
|
||||
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ),
|
||||
&( pxEthernetHeader->xSourceAddress ),
|
||||
( void ) memcpy( ( void * ) ( &( pxEthernetHeader->xDestinationAddress ) ),
|
||||
( const void * ) ( &( pxEthernetHeader->xSourceAddress ) ),
|
||||
sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||
|
||||
/* The source MAC addresses is fixed to 'ipLOCAL_MAC_ADDRESS'. */
|
||||
( void ) memcpy( &( pxEthernetHeader->xSourceAddress ), ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( ( void * ) ( &( pxEthernetHeader->xSourceAddress ) ), ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
|
||||
#if defined( ipconfigETHERNET_MINIMUM_PACKET_BYTES )
|
||||
{
|
||||
@@ -938,7 +939,7 @@ NetworkBufferDescriptor_t xTempBuffer;
|
||||
containing the packet header. */
|
||||
vFlip_16( pxTCPPacket->xTCPHeader.usSourcePort, pxTCPPacket->xTCPHeader.usDestinationPort);
|
||||
pxTCPPacket->xIPHeader.ulSourceIPAddress = pxTCPPacket->xIPHeader.ulDestinationIPAddress;
|
||||
( void ) memcpy( pxEthernetHeader->xSourceAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
( void ) memcpy( ( void * ) ( pxEthernetHeader->xSourceAddress.ucBytes ), ( const void * ) ( pxEthernetHeader->xDestinationAddress.ucBytes ), ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1051,7 +1052,7 @@ uint32_t ulInitialSequenceNumber = 0;
|
||||
/* The MAC-address of the peer (or gateway) has been found,
|
||||
* now prepare the initial TCP packet and some fields in the socket. Map
|
||||
* the buffer onto the TCPPacket_t struct to easily access it's field. */
|
||||
pxTCPPacket = ipPOINTER_CAST( TCPPacket_t *, pxSocket->u.xTCP.xPacket.u.ucLastPacket );
|
||||
pxTCPPacket = ipCAST_PTR_TO_TYPE_PTR( TCPPacket_t, pxSocket->u.xTCP.xPacket.u.ucLastPacket );
|
||||
pxIPHeader = &pxTCPPacket->xIPHeader;
|
||||
|
||||
/* reset the retry counter to zero. */
|
||||
@@ -1066,7 +1067,7 @@ uint32_t ulInitialSequenceNumber = 0;
|
||||
|
||||
/* Write the Ethernet address in Source, because it will be swapped by
|
||||
prvTCPReturnPacket(). */
|
||||
( void ) memcpy( &pxTCPPacket->xEthernetHeader.xSourceAddress, &xEthAddress, sizeof( xEthAddress ) );
|
||||
( void ) memcpy( ( void * ) ( &pxTCPPacket->xEthernetHeader.xSourceAddress ), ( const void * ) ( &xEthAddress ), sizeof( xEthAddress ) );
|
||||
|
||||
/* 'ipIPv4_FRAME_TYPE' is already in network-byte-order. */
|
||||
pxTCPPacket->xEthernetHeader.usFrameType = ipIPv4_FRAME_TYPE;
|
||||
@@ -1145,7 +1146,7 @@ uint32_t ulInitialSequenceNumber = 0;
|
||||
_static void prvCheckOptions( FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer )
|
||||
{
|
||||
size_t uxTCPHeaderOffset = ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer );
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ uxTCPHeaderOffset ] ) );
|
||||
const TCPHeader_t * pxTCPHeader;
|
||||
const uint8_t *pucPtr;
|
||||
@@ -1785,6 +1786,7 @@ uint32_t ulDataGot, ulDistance;
|
||||
TCPWindow_t *pxTCPWindow;
|
||||
NetworkBufferDescriptor_t *pxNewBuffer;
|
||||
int32_t lStreamPos;
|
||||
UBaseType_t uxIntermediateResult = 0;
|
||||
|
||||
if( ( *ppxNetworkBuffer ) != NULL )
|
||||
{
|
||||
@@ -1798,7 +1800,7 @@ int32_t lStreamPos;
|
||||
}
|
||||
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *, &( pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t, &( pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
||||
lDataLen = 0;
|
||||
lStreamPos = 0;
|
||||
@@ -1828,7 +1830,7 @@ int32_t lStreamPos;
|
||||
|
||||
/* Map the byte stream onto ProtocolHeaders_t struct for easy
|
||||
* access to the fields. */
|
||||
pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *, &( pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t, &( pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
|
||||
pucSendData = &( pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength ] );
|
||||
|
||||
@@ -1957,7 +1959,8 @@ int32_t lStreamPos;
|
||||
pxProtocolHeaders->xTCPHeader.ucTCPFlags |= ( uint8_t ) tcpTCP_FLAG_PSH;
|
||||
}
|
||||
|
||||
lDataLen += ipNUMERIC_CAST( int32_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
lDataLen += ( int32_t ) uxIntermediateResult;
|
||||
}
|
||||
|
||||
return lDataLen;
|
||||
@@ -2074,10 +2077,10 @@ int32_t lCount, lLength;
|
||||
static BaseType_t prvTCPHandleFin( FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer )
|
||||
{
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
TCPHeader_t *pxTCPHeader = &( pxProtocolHeaders->xTCPHeader );
|
||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||
uint8_t ucIntermediateResult = 0, ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
BaseType_t xSendLength = 0;
|
||||
uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
||||
@@ -2143,7 +2146,8 @@ uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
||||
|
||||
if( pxTCPHeader->ucTCPFlags != 0U )
|
||||
{
|
||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength );
|
||||
ucIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength;
|
||||
xSendLength = ( BaseType_t ) ucIntermediateResult;
|
||||
}
|
||||
|
||||
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength ) << 2 );
|
||||
@@ -2171,15 +2175,16 @@ uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
||||
static BaseType_t prvCheckRxData( const NetworkBufferDescriptor_t *pxNetworkBuffer, uint8_t **ppucRecvData )
|
||||
{
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ( size_t ) ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
const TCPHeader_t *pxTCPHeader = &( pxProtocolHeaders->xTCPHeader );
|
||||
int32_t lLength, lTCPHeaderLength, lReceiveLength, lUrgentLength;
|
||||
|
||||
/* Map the buffer onto an IPHeader_t struct for easy access to fields. */
|
||||
const IPHeader_t *pxIPHeader = ipPOINTER_CAST( const IPHeader_t *, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
||||
const IPHeader_t *pxIPHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
||||
const size_t xIPHeaderLength = ipSIZE_OF_IPv4_HEADER;
|
||||
uint16_t usLength;
|
||||
uint8_t ucIntermediateResult = 0;
|
||||
|
||||
/* Determine the length and the offset of the user-data sent to this
|
||||
node.
|
||||
@@ -2187,7 +2192,8 @@ uint16_t usLength;
|
||||
The size of the TCP header is given in a multiple of 4-byte words (single
|
||||
byte, needs no ntoh() translation). A shift-right 2: is the same as
|
||||
(offset >> 4) * 4. */
|
||||
lTCPHeaderLength = ipNUMERIC_CAST( BaseType_t, ( pxTCPHeader->ucTCPOffset & tcpVALID_BITS_IN_TCP_OFFSET_BYTE ) >> 2 );
|
||||
ucIntermediateResult = ( pxTCPHeader->ucTCPOffset & tcpVALID_BITS_IN_TCP_OFFSET_BYTE ) >> 2;
|
||||
lTCPHeaderLength = ( int32_t ) ucIntermediateResult;
|
||||
|
||||
/* Let pucRecvData point to the first byte received. */
|
||||
*ppucRecvData = &( pxNetworkBuffer->pucEthernetBuffer[ ( size_t ) ipSIZE_OF_ETH_HEADER + xIPHeaderLength + ( size_t ) lTCPHeaderLength ] );
|
||||
@@ -2246,7 +2252,7 @@ static BaseType_t prvStoreRxData( FreeRTOS_Socket_t *pxSocket, const uint8_t *pu
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer, uint32_t ulReceiveLength )
|
||||
{
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( const ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
const TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
@@ -2324,7 +2330,7 @@ BaseType_t xResult = 0;
|
||||
static UBaseType_t prvSetOptions( FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer )
|
||||
{
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||
const TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
@@ -2344,7 +2350,7 @@ UBaseType_t uxOptionsLength = pxTCPWindow->ucOptionLength;
|
||||
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 1 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber,
|
||||
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 2 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber ) );
|
||||
}
|
||||
( void ) memcpy( pxTCPHeader->ucOptdata, pxTCPWindow->ulOptionsData, ( size_t ) uxOptionsLength );
|
||||
( void ) memcpy( ( void * ) ( pxTCPHeader->ucOptdata ), ( const void * ) ( pxTCPWindow->ulOptionsData ), ( size_t ) uxOptionsLength );
|
||||
|
||||
/* The header length divided by 4, goes into the higher nibble,
|
||||
effectively a shift-left 2. */
|
||||
@@ -2387,13 +2393,14 @@ static BaseType_t prvHandleSynReceived( FreeRTOS_Socket_t *pxSocket, const Netwo
|
||||
uint32_t ulReceiveLength, UBaseType_t uxOptionsLength )
|
||||
{
|
||||
/* Map the ethernet buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber );
|
||||
BaseType_t xSendLength = 0;
|
||||
UBaseType_t uxIntermediateResult = 0;
|
||||
|
||||
/* Either expect a ACK or a SYN+ACK. */
|
||||
uint8_t ucExpect = tcpTCP_FLAG_ACK;
|
||||
@@ -2418,7 +2425,10 @@ BaseType_t xSendLength = 0;
|
||||
pxTCPWindow->rx.ulCurrentSequenceNumber = ulSequenceNumber;
|
||||
|
||||
pxTCPHeader->ucTCPFlags |= tcpTCP_FLAG_RST;
|
||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||
|
||||
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||
}
|
||||
else
|
||||
@@ -2429,7 +2439,7 @@ BaseType_t xSendLength = 0;
|
||||
if( pxSocket->u.xTCP.ucTCPState == ( uint8_t ) eCONNECT_SYN )
|
||||
{
|
||||
/* Map the Last packet onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxLastHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxLastHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
|
||||
/* Clear the SYN flag in lastPacket. */
|
||||
@@ -2472,7 +2482,9 @@ BaseType_t xSendLength = 0;
|
||||
if( ( pxSocket->u.xTCP.ucTCPState == ( EventBits_t ) eCONNECT_SYN ) || ( ulReceiveLength != 0UL ) )
|
||||
{
|
||||
pxTCPHeader->ucTCPFlags = tcpTCP_FLAG_ACK;
|
||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ( size_t ) ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ( size_t ) ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||
}
|
||||
#if( ipconfigUSE_TCP_WIN != 0 )
|
||||
@@ -2507,15 +2519,16 @@ static BaseType_t prvHandleEstablished( FreeRTOS_Socket_t *pxSocket, NetworkBuff
|
||||
uint32_t ulReceiveLength, UBaseType_t uxOptionsLength )
|
||||
{
|
||||
/* Map the buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( ( *ppxNetworkBuffer )->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) ] ) );
|
||||
TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber ), ulCount;
|
||||
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber ), ulCount, ulIntermediateResult = 0;
|
||||
BaseType_t xSendLength = 0, xMayClose = pdFALSE, bRxComplete, bTxDone;
|
||||
int32_t lDistance, lSendResult;
|
||||
uint16_t usWindow;
|
||||
UBaseType_t uxIntermediateResult = 0;
|
||||
|
||||
/* Remember the window size the peer is advertising. */
|
||||
usWindow = FreeRTOS_ntohs( pxTCPHeader->usWindow );
|
||||
@@ -2598,7 +2611,8 @@ uint16_t usWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
lDistance = ipNUMERIC_CAST( int32_t, ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber );
|
||||
ulIntermediateResult = ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber;
|
||||
lDistance = ( int32_t ) ulIntermediateResult;
|
||||
|
||||
if( lDistance > 1 )
|
||||
{
|
||||
@@ -2631,7 +2645,8 @@ uint16_t usWindow;
|
||||
|
||||
if( ulReceiveLength != 0U )
|
||||
{
|
||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||
/* TCP-offsett equals '( ( length / 4 ) << 4 )', resulting in a shift-left 2 */
|
||||
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||
|
||||
@@ -2671,13 +2686,15 @@ static BaseType_t prvSendData( FreeRTOS_Socket_t *pxSocket, NetworkBufferDescrip
|
||||
uint32_t ulReceiveLength, BaseType_t xByteCount )
|
||||
{
|
||||
/* Map the buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( ( *ppxNetworkBuffer )->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( *ppxNetworkBuffer ) ] ) );
|
||||
const TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||
const TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||
/* Find out what window size we may advertised. */
|
||||
int32_t lRxSpace;
|
||||
BaseType_t xSendLength = xByteCount;
|
||||
uint32_t ulRxBufferSpace;
|
||||
|
||||
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||
#if( ipconfigTCP_ACK_EARLIER_PACKET == 0 )
|
||||
const int32_t lMinLength = 0;
|
||||
@@ -2688,7 +2705,9 @@ BaseType_t xSendLength = xByteCount;
|
||||
|
||||
/* Set the time-out field, so that we'll be called by the IP-task in case no
|
||||
next message will be received. */
|
||||
lRxSpace = ipNUMERIC_CAST( int32_t, pxSocket->u.xTCP.ulHighestRxAllowed - pxTCPWindow->rx.ulCurrentSequenceNumber );
|
||||
ulRxBufferSpace = pxSocket->u.xTCP.ulHighestRxAllowed - pxTCPWindow->rx.ulCurrentSequenceNumber;
|
||||
lRxSpace = ( int32_t ) ulRxBufferSpace;
|
||||
|
||||
#if ipconfigUSE_TCP_WIN == 1
|
||||
{
|
||||
|
||||
@@ -2816,7 +2835,7 @@ BaseType_t xSendLength = xByteCount;
|
||||
static BaseType_t prvTCPHandleState( FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer )
|
||||
{
|
||||
/* Map the buffer onto the ProtocolHeader_t struct for easy access to the fields. */
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
|
||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( ( *ppxNetworkBuffer )->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( *ppxNetworkBuffer ) ] ) );
|
||||
TCPHeader_t *pxTCPHeader = &( pxProtocolHeaders->xTCPHeader );
|
||||
BaseType_t xSendLength = 0;
|
||||
@@ -2832,6 +2851,7 @@ uint32_t ulSequenceNumber = FreeRTOS_ntohl (pxTCPHeader->ulSequenceNumber);
|
||||
UBaseType_t uxOptionsLength = 0U;
|
||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||
TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
||||
UBaseType_t uxIntermediateResult = 0;
|
||||
|
||||
/* First get the length and the position of the received data, if any.
|
||||
pucRecvData will point to the first byte of the TCP payload. */
|
||||
@@ -2912,7 +2932,8 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
||||
uxOptionsLength = prvSetSynAckOptions( pxSocket, pxTCPHeader );
|
||||
pxTCPHeader->ucTCPFlags = ( uint8_t ) tcpTCP_FLAG_SYN | ( uint8_t ) tcpTCP_FLAG_ACK;
|
||||
|
||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
||||
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||
|
||||
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
||||
uxOptionsLength is a multiple of 4. The complete expression is:
|
||||
@@ -3001,7 +3022,7 @@ static BaseType_t prvTCPSendSpecialPacketHelper( NetworkBufferDescriptor_t *pxNe
|
||||
#else
|
||||
{
|
||||
/* Map the ethernet buffer onto the TCPPacket_t struct for easy access to the fields. */
|
||||
TCPPacket_t *pxTCPPacket = ipPOINTER_CAST( TCPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
TCPPacket_t *pxTCPPacket = ipCAST_PTR_TO_TYPE_PTR( TCPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
const uint32_t ulSendLength = ( uint32_t )
|
||||
( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER ); /* Plus 0 options. */
|
||||
|
||||
@@ -3065,7 +3086,7 @@ BaseType_t xProcessReceivedTCPPacket( NetworkBufferDescriptor_t *pxDescriptor )
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer = pxDescriptor;
|
||||
|
||||
/* Map the buffer onto a ProtocolHeaders_t struct for easy access to the fields. */
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( const ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
FreeRTOS_Socket_t *pxSocket;
|
||||
uint16_t ucTCPFlags = pxProtocolHeaders->xTCPHeader.ucTCPFlags;
|
||||
@@ -3088,7 +3109,7 @@ const IPHeader_t *pxIPHeader;
|
||||
else
|
||||
{
|
||||
/* Map the ethernet buffer onto the IPHeader_t struct for easy access to the fields. */
|
||||
pxIPHeader = ipPOINTER_CAST( const IPHeader_t *, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
||||
pxIPHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
||||
ulLocalIP = FreeRTOS_htonl( pxIPHeader->ulDestinationIPAddress );
|
||||
ulRemoteIP = FreeRTOS_htonl( pxIPHeader->ulSourceIPAddress );
|
||||
|
||||
@@ -3215,8 +3236,8 @@ const IPHeader_t *pxIPHeader;
|
||||
headers). It might be used later on, whenever data must be sent
|
||||
to the peer. */
|
||||
const size_t lOffset = ipNUMERIC_CAST( size_t, ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) );
|
||||
( void ) memcpy( &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ lOffset ] ),
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ lOffset ] ),
|
||||
( void ) memcpy( ( void * ) ( &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ lOffset ] ) ),
|
||||
( const void * ) ( &( pxNetworkBuffer->pucEthernetBuffer[ lOffset ] ) ),
|
||||
ipSIZE_OF_TCP_HEADER );
|
||||
}
|
||||
}
|
||||
@@ -3296,7 +3317,7 @@ const IPHeader_t *pxIPHeader;
|
||||
static FreeRTOS_Socket_t *prvHandleListen( FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer )
|
||||
{
|
||||
/* Map the ethernet buffer onto a TCPPacket_t struct for easy access to the fields. */
|
||||
const TCPPacket_t * pxTCPPacket = ipPOINTER_CAST( const TCPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
const TCPPacket_t * pxTCPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( TCPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
FreeRTOS_Socket_t *pxReturn = NULL;
|
||||
uint32_t ulInitialSequenceNumber;
|
||||
|
||||
@@ -3363,7 +3384,7 @@ uint32_t ulInitialSequenceNumber;
|
||||
if( ( ulInitialSequenceNumber != 0U ) && ( pxReturn != NULL ) )
|
||||
{
|
||||
/* Map the byte stream onto the ProtocolHeaders_t for easy access to the fields. */
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( const ProtocolHeaders_t *,
|
||||
const ProtocolHeaders_t *pxProtocolHeaders = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( ProtocolHeaders_t,
|
||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||
|
||||
pxReturn->u.xTCP.usRemotePort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usSourcePort );
|
||||
@@ -3380,7 +3401,7 @@ uint32_t ulInitialSequenceNumber;
|
||||
|
||||
/* Make a copy of the header up to the TCP header. It is needed later
|
||||
on, whenever data must be sent to the peer. */
|
||||
( void ) memcpy( pxReturn->u.xTCP.xPacket.u.ucLastPacket, pxNetworkBuffer->pucEthernetBuffer, sizeof( pxReturn->u.xTCP.xPacket.u.ucLastPacket ) );
|
||||
( void ) memcpy( ( void * ) ( pxReturn->u.xTCP.xPacket.u.ucLastPacket ), ( const void * ) ( pxNetworkBuffer->pucEthernetBuffer ), sizeof( pxReturn->u.xTCP.xPacket.u.ucLastPacket ) );
|
||||
}
|
||||
return pxReturn;
|
||||
}
|
||||
@@ -3529,7 +3550,7 @@ TickType_t uxLocalPort = ( TickType_t ) FreeRTOS_htons( pxSocket->usLocalPort );
|
||||
const ListItem_t *pxIterator;
|
||||
FreeRTOS_Socket_t *pxFound;
|
||||
BaseType_t xResult = pdFALSE;
|
||||
const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
||||
const ListItem_t *pxEndTCP = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||
|
||||
/* Here xBoundTCPSocketsList can be accessed safely IP-task is the only one
|
||||
who has access. */
|
||||
@@ -3539,7 +3560,7 @@ const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MAR
|
||||
{
|
||||
if( listGET_LIST_ITEM_VALUE( pxIterator ) == ( configLIST_VOLATILE TickType_t ) uxLocalPort )
|
||||
{
|
||||
pxFound = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxFound = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
if( ( pxFound->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_TCP ) && ( pxFound->u.xTCP.bits.bPassAccept != pdFALSE_UNSIGNED ) )
|
||||
{
|
||||
pxSocket->u.xTCP.pxPeerSocket = pxFound;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -55,6 +55,12 @@
|
||||
#define winSRTT_DECREMENT_CURRENT 7
|
||||
#define winSRTT_CAP_mS 50
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( TCPSegment_t )
|
||||
{
|
||||
return ( TCPSegment_t *)pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||
|
||||
#define xTCPWindowRxNew( pxWindow, ulSequenceNumber, lCount ) xTCPWindowNew( pxWindow, ulSequenceNumber, lCount, pdTRUE )
|
||||
@@ -309,7 +315,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
/* Insert a new list item into pxList, it does not sort the list,
|
||||
but it puts the item just before xListEnd, so it will be the last item
|
||||
returned by listGET_HEAD_ENTRY() */
|
||||
pxNewListItem->pxNext = ipPOINTER_CAST(struct xLIST_ITEM * configLIST_VOLATILE, pxWhere );
|
||||
pxNewListItem->pxNext = ( struct xLIST_ITEM * configLIST_VOLATILE )pxWhere;
|
||||
pxNewListItem->pxPrevious = pxWhere->pxPrevious;
|
||||
pxWhere->pxPrevious->pxNext = pxNewListItem;
|
||||
pxWhere->pxPrevious = pxNewListItem;
|
||||
@@ -330,7 +336,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
/* Allocate space for 'xTCPSegments' and store them in 'xSegmentList'. */
|
||||
|
||||
vListInitialise( &xSegmentList );
|
||||
xTCPSegments = ipPOINTER_CAST( TCPSegment_t *, pvPortMallocLarge( ( size_t ) ipconfigTCP_WIN_SEG_COUNT * sizeof( xTCPSegments[ 0 ] ) ) );
|
||||
xTCPSegments = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, pvPortMallocLarge( ( size_t ) ipconfigTCP_WIN_SEG_COUNT * sizeof( xTCPSegments[ 0 ] ) ) );
|
||||
|
||||
if( xTCPSegments == NULL )
|
||||
{
|
||||
@@ -348,8 +354,8 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
{
|
||||
/* Could call vListInitialiseItem here but all data has been
|
||||
nulled already. Set the owner to a segment descriptor. */
|
||||
listSET_LIST_ITEM_OWNER( &( xTCPSegments[ xIndex ].xSegmentItem ), ipPOINTER_CAST( void *, &( xTCPSegments[ xIndex ] ) ) );
|
||||
listSET_LIST_ITEM_OWNER( &( xTCPSegments[ xIndex ].xQueueItem ), ipPOINTER_CAST( void *, &( xTCPSegments[ xIndex ] ) ) );
|
||||
listSET_LIST_ITEM_OWNER( &( xTCPSegments[ xIndex ].xSegmentItem ),( void * ) &( xTCPSegments[ xIndex ] ) );
|
||||
listSET_LIST_ITEM_OWNER( &( xTCPSegments[ xIndex ].xQueueItem ), ( void * ) &( xTCPSegments[ xIndex ] ) );
|
||||
|
||||
/* And add it to the pool of available segments */
|
||||
vListInsertFifo( &xSegmentList, &( xTCPSegments[xIndex].xSegmentItem ) );
|
||||
@@ -374,13 +380,13 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
|
||||
/* Find a segment with a given sequence number in the list of received
|
||||
segments. */
|
||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &pxWindow->xRxSegments ) );
|
||||
pxEnd = listGET_END_MARKER( &pxWindow->xRxSegments );
|
||||
|
||||
for( pxIterator = listGET_NEXT( pxEnd );
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
|
||||
if( pxSegment->ulSequenceNumber == ulSequenceNumber )
|
||||
{
|
||||
@@ -416,7 +422,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
/* Pop the item at the head of the list. Semaphore protection is
|
||||
not required as only the IP task will call these functions. */
|
||||
pxItem = ( ListItem_t * ) listGET_HEAD_ENTRY( &xSegmentList );
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
|
||||
configASSERT( pxItem != NULL );
|
||||
configASSERT( pxSegment != NULL );
|
||||
@@ -512,7 +518,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
else
|
||||
{
|
||||
pxItem = ( ListItem_t * ) listGET_HEAD_ENTRY( pxList );
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
|
||||
( void ) uxListRemove( pxItem );
|
||||
}
|
||||
@@ -538,7 +544,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
else
|
||||
{
|
||||
pxItem = ( ListItem_t * ) listGET_HEAD_ENTRY( pxList );
|
||||
pxReturn = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
pxReturn = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxItem ) );
|
||||
}
|
||||
|
||||
return pxReturn;
|
||||
@@ -604,7 +610,7 @@ static void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||
{
|
||||
while( listCURRENT_LIST_LENGTH( pxSegments ) > 0U )
|
||||
{
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_OWNER_OF_HEAD_ENTRY( pxSegments ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_OWNER_OF_HEAD_ENTRY( pxSegments ) );
|
||||
vTCPWindowFree( pxSegment );
|
||||
}
|
||||
}
|
||||
@@ -741,7 +747,7 @@ const int32_t l500ms = 500;
|
||||
TCPSegment_t *pxBest = NULL;
|
||||
const ListItem_t *pxIterator;
|
||||
uint32_t ulNextSequenceNumber = ulSequenceNumber + ulLength;
|
||||
const ListItem_t * pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &pxWindow->xRxSegments ) );
|
||||
const ListItem_t * pxEnd = listGET_END_MARKER( &pxWindow->xRxSegments );
|
||||
TCPSegment_t *pxSegment;
|
||||
|
||||
/* A segment has been received with sequence number 'ulSequenceNumber',
|
||||
@@ -757,7 +763,7 @@ const int32_t l500ms = 500;
|
||||
pxIterator != pxEnd;
|
||||
pxIterator = listGET_NEXT( pxIterator ) )
|
||||
{
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
/* And see if there is a segment for which:
|
||||
'ulSequenceNumber' <= 'pxSegment->ulSequenceNumber' < 'ulNextSequenceNumber'
|
||||
If there are more matching segments, the one with the lowest sequence number
|
||||
@@ -795,7 +801,7 @@ const int32_t l500ms = 500;
|
||||
|
||||
int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace )
|
||||
{
|
||||
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber;
|
||||
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber, ulIntermediateResult = 0;
|
||||
int32_t lReturn, lDistance;
|
||||
TCPSegment_t *pxFound;
|
||||
|
||||
@@ -903,9 +909,10 @@ const int32_t l500ms = 500;
|
||||
/* An "out-of-sequence" segment was received, must have missed one.
|
||||
Prepare a SACK (Selective ACK). */
|
||||
ulLast = ulSequenceNumber + ulLength;
|
||||
/* The cast from unsigned long to signed long is on purpose.
|
||||
The macro 'ipNUMERIC_CAST' will prevent PC-lint from complaining. */
|
||||
lDistance = ipNUMERIC_CAST( int32_t, ulLast - ulCurrentSequenceNumber );
|
||||
|
||||
ulIntermediateResult = ulLast - ulCurrentSequenceNumber;
|
||||
/* The cast from unsigned long to signed long is on purpose. */
|
||||
lDistance = ( int32_t ) ulIntermediateResult;
|
||||
|
||||
if( lDistance <= 0 )
|
||||
{
|
||||
@@ -999,7 +1006,8 @@ const int32_t l500ms = 500;
|
||||
|
||||
/* Return a positive value. The packet may be accepted
|
||||
and stored but an earlier packet is still missing. */
|
||||
lReturn = ipNUMERIC_CAST( int32_t, ulSequenceNumber - ulCurrentSequenceNumber );
|
||||
ulIntermediateResult = ulSequenceNumber - ulCurrentSequenceNumber;
|
||||
lReturn = ( int32_t ) ulIntermediateResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1495,7 +1503,7 @@ const int32_t l500ms = 500;
|
||||
uint32_t ulBytesConfirmed = 0U;
|
||||
uint32_t ulSequenceNumber = ulFirst, ulDataLength;
|
||||
const ListItem_t *pxIterator;
|
||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &pxWindow->xTxSegments ) );
|
||||
const ListItem_t *pxEnd = listGET_END_MARKER( &pxWindow->xTxSegments );
|
||||
BaseType_t xDoUnlink;
|
||||
TCPSegment_t *pxSegment;
|
||||
/* An acknowledgement or a selective ACK (SACK) was received. See if some outstanding data
|
||||
@@ -1523,7 +1531,7 @@ const int32_t l500ms = 500;
|
||||
while( ( pxIterator != pxEnd ) && ( xSequenceLessThan( ulSequenceNumber, ulLast ) != 0 ) )
|
||||
{
|
||||
xDoUnlink = pdFALSE;
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
|
||||
/* Move to the next item because the current item might get
|
||||
removed. */
|
||||
@@ -1650,14 +1658,14 @@ const int32_t l500ms = 500;
|
||||
/* A higher Tx block has been acknowledged. Now iterate through the
|
||||
xWaitQueue to find a possible condition for a FAST retransmission. */
|
||||
|
||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &( pxWindow->xWaitQueue ) ) );
|
||||
pxEnd = listGET_END_MARKER( &( pxWindow->xWaitQueue ) );
|
||||
|
||||
pxIterator = listGET_NEXT( pxEnd );
|
||||
|
||||
while( pxIterator != pxEnd )
|
||||
{
|
||||
/* Get the owner, which is a TCP segment. */
|
||||
pxSegment = ipPOINTER_CAST( TCPSegment_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
pxSegment = ipCAST_PTR_TO_TYPE_PTR( TCPSegment_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||
|
||||
/* Hop to the next item before the current gets unlinked. */
|
||||
pxIterator = listGET_NEXT( pxIterator );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -82,7 +82,7 @@ uint32_t ulIPAddress = pxNetworkBuffer->ulIPAddress;
|
||||
size_t uxPayloadSize;
|
||||
|
||||
/* Map the UDP packet onto the start of the frame. */
|
||||
pxUDPPacket = ipPOINTER_CAST( UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
pxUDPPacket = ipCAST_PTR_TO_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
if( pxNetworkBuffer->usPort == ( uint16_t ) ipPACKET_CONTAINS_ICMP_DATA )
|
||||
@@ -154,7 +154,7 @@ size_t uxPayloadSize;
|
||||
*/
|
||||
/* The Ethernet source address is at offset 6. */
|
||||
char *pxUdpSrcAddrOffset = ( char *) ( &( pxNetworkBuffer->pucEthernetBuffer[ sizeof( MACAddress_t ) ] ) );
|
||||
( void ) memcpy( pxUdpSrcAddrOffset, xDefaultPartUDPPacketHeader.ucBytes, sizeof( xDefaultPartUDPPacketHeader ) );
|
||||
( void ) memcpy( ( void * ) pxUdpSrcAddrOffset, ( const void * ) ( xDefaultPartUDPPacketHeader.ucBytes ), sizeof( xDefaultPartUDPPacketHeader ) );
|
||||
|
||||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
if( pxNetworkBuffer->usPort == ( uint16_t ) ipPACKET_CONTAINS_ICMP_DATA )
|
||||
@@ -258,7 +258,7 @@ configASSERT( pxNetworkBuffer != NULL );
|
||||
configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL );
|
||||
|
||||
/* Map the ethernet buffer to the UDPPacket_t struct for easy access to the fields. */
|
||||
const UDPPacket_t *pxUDPPacket = ipPOINTER_CAST( const UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
||||
const UDPPacket_t *pxUDPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||
|
||||
/* Caller must check for minimum packet size. */
|
||||
pxSocket = pxUDPSocketLookup( usPort );
|
||||
|
||||
@@ -1,3 +1,41 @@
|
||||
Changes between V2.2.1 and V2.2.2 releases:
|
||||
+ Updated the source code to adhere to stricter MISRA compliance.
|
||||
|
||||
Changes between V2.0.0 and V2.2.1 releases:
|
||||
+ Improved security by giving users the option to reject UDP packets with a
|
||||
checksum of zero even though the UDP spec allows it.
|
||||
+ Improved robustness by checking packet lengths in software even if the check
|
||||
has already been performed in the hardware.
|
||||
+ Added ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS macro to enable users to
|
||||
drop/accept IP Packets containing IP options (IP options are not supported).
|
||||
+ Modified xDataLength to always mean "total number of bytes" to impart more
|
||||
clarity.
|
||||
+ Replaced the ipconfigRAND32 macro with a function
|
||||
xApplicationGetRandomNumber(). The return value indicates if the randomiser
|
||||
is broken or working properly. Before this, a random value of 0 was treated
|
||||
as invalid, whereas 0 can be a proper random value.
|
||||
+ Made changes in DNS to make asynchronous lookup work.
|
||||
+ Made FreeRTOS_OutputARPRequest() available for application code. Now the
|
||||
application can start an ARP request directly by sending a UDP packet.
|
||||
+ Made Socket_t and SocketSet_t point to a struct in stead of void.
|
||||
+ Corrected the DNSs protocol-checksum calculation length.
|
||||
+ Corrected length-check in usGenerateProtocolChecksum().
|
||||
+ Modified pxGetNetworkBufferWithDescriptor() function to check if a counting
|
||||
semaphore has been created. Earlier when a user tried to get a Network
|
||||
Buffer before the IP-task started, the function could crash.
|
||||
+ Made TCP low-water/high-water limits configurable with a socket option.
|
||||
+ The 'ucFirstOptionByte' was counted twice in earlier releases, subtract 1
|
||||
byte to send the correct amount of bytes.
|
||||
+ Corrected the WIN size reporting to the TCP peer. The WIN size as reported
|
||||
to the TCP peer was sometimes running slightly behind.
|
||||
+ Added a function FreeRTOS_dnsclear() which invalidates the entire DNS cache.
|
||||
+ Added DNS response transaction ID check. The DNS cache shall only be updated
|
||||
when the ID in the reply comes from the device.
|
||||
|
||||
Changes between 180821 and V2.0.0 releases:
|
||||
+ Move the TCP source code from FreeRTOS/FreeRTOS-Labs to FreeRTOS/FreeRTOS
|
||||
repository.
|
||||
|
||||
Changes between 160919 and 180821 releases:
|
||||
|
||||
+ Multiple security improvements and fixes in packet parsing routines, DNS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -313,11 +313,16 @@ BaseType_t FreeRTOS_IsNetworkUp( void );
|
||||
* Socket has had activity, reset the timer so it will not be closed
|
||||
* because of inactivity
|
||||
*/
|
||||
const char *FreeRTOS_GetTCPStateName( UBaseType_t ulState);
|
||||
#if( ( ipconfigHAS_DEBUG_PRINTF != 0 ) || ( ipconfigHAS_PRINTF != 0 ) )
|
||||
const char *FreeRTOS_GetTCPStateName( UBaseType_t ulState);
|
||||
#endif
|
||||
|
||||
/* _HT_ Temporary: show all valid ARP entries
|
||||
*/
|
||||
void FreeRTOS_PrintARPCache( void );
|
||||
#if( ipconfigHAS_PRINTF != 0 ) || ( ipconfigHAS_DEBUG_PRINTF != 0 )
|
||||
void FreeRTOS_PrintARPCache( void );
|
||||
#endif
|
||||
|
||||
void FreeRTOS_ClearARP( void );
|
||||
|
||||
/* Return pdTRUE if the IPv4 address is a multicast address. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -45,6 +45,20 @@ extern "C" {
|
||||
|
||||
#include "event_groups.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Utility macros for marking casts as recognized during */
|
||||
/* static analysis. */
|
||||
/*-----------------------------------------------------------*/
|
||||
#define ipCAST_PTR_TO_TYPE_PTR( TYPE, pointer ) ( vCastPointerTo_##TYPE( ( void * )( pointer ) ) )
|
||||
#define ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( TYPE, pointer ) ( vCastConstPointerTo_##TYPE( ( const void * )( pointer ) ) )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Utility macros for declaring cast utility functions in */
|
||||
/* order to centralize typecasting for static analysis. */
|
||||
/*-----------------------------------------------------------*/
|
||||
#define ipDECL_CAST_PTR_FUNC_FOR_TYPE( TYPE ) TYPE * vCastPointerTo_##TYPE( void * pvArgument )
|
||||
#define ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( TYPE ) const TYPE * vCastConstPointerTo_##TYPE( const void * pvArgument )
|
||||
|
||||
typedef struct xNetworkAddressingParameters
|
||||
{
|
||||
uint32_t ulDefaultIPAddress;
|
||||
@@ -71,6 +85,17 @@ struct xETH_HEADER
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xETH_HEADER EthernetHeader_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( EthernetHeader_t )
|
||||
{
|
||||
return ( EthernetHeader_t *)pvArgument;
|
||||
}
|
||||
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( EthernetHeader_t )
|
||||
{
|
||||
return ( const EthernetHeader_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xARP_HEADER
|
||||
{
|
||||
@@ -104,6 +129,16 @@ struct xIP_HEADER
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xIP_HEADER IPHeader_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( IPHeader_t )
|
||||
{
|
||||
return ( IPHeader_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( IPHeader_t )
|
||||
{
|
||||
return ( const IPHeader_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xICMP_HEADER
|
||||
{
|
||||
@@ -116,6 +151,16 @@ struct xICMP_HEADER
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xICMP_HEADER ICMPHeader_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ICMPHeader_t )
|
||||
{
|
||||
return ( ICMPHeader_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ICMPHeader_t )
|
||||
{
|
||||
return ( const ICMPHeader_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xUDP_HEADER
|
||||
{
|
||||
@@ -160,6 +205,16 @@ struct xARP_PACKET
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xARP_PACKET ARPPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ARPPacket_t )
|
||||
{
|
||||
return ( ARPPacket_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ARPPacket_t )
|
||||
{
|
||||
return ( const ARPPacket_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xIP_PACKET
|
||||
{
|
||||
@@ -169,6 +224,16 @@ struct xIP_PACKET
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xIP_PACKET IPPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( IPPacket_t )
|
||||
{
|
||||
return ( IPPacket_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( IPPacket_t )
|
||||
{
|
||||
return ( const IPPacket_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xICMP_PACKET
|
||||
{
|
||||
@@ -179,6 +244,12 @@ struct xICMP_PACKET
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xICMP_PACKET ICMPPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ICMPPacket_t )
|
||||
{
|
||||
return ( ICMPPacket_t *)pvArgument;
|
||||
}
|
||||
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xUDP_PACKET
|
||||
{
|
||||
@@ -189,6 +260,15 @@ struct xUDP_PACKET
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xUDP_PACKET UDPPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
||||
{
|
||||
return ( UDPPacket_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
||||
{
|
||||
return ( const UDPPacket_t *) pvArgument;
|
||||
}
|
||||
|
||||
#include "pack_struct_start.h"
|
||||
struct xTCP_PACKET
|
||||
{
|
||||
@@ -199,6 +279,17 @@ struct xTCP_PACKET
|
||||
#include "pack_struct_end.h"
|
||||
typedef struct xTCP_PACKET TCPPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( TCPPacket_t )
|
||||
{
|
||||
return ( TCPPacket_t *)pvArgument;
|
||||
}
|
||||
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( TCPPacket_t )
|
||||
{
|
||||
return ( const TCPPacket_t *) pvArgument;
|
||||
}
|
||||
|
||||
|
||||
typedef union XPROT_PACKET
|
||||
{
|
||||
ARPPacket_t xARPPacket;
|
||||
@@ -207,6 +298,15 @@ typedef union XPROT_PACKET
|
||||
ICMPPacket_t xICMPPacket;
|
||||
} ProtocolPacket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ProtocolPacket_t )
|
||||
{
|
||||
return ( ProtocolPacket_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ProtocolPacket_t )
|
||||
{
|
||||
return ( const ProtocolPacket_t *) pvArgument;
|
||||
}
|
||||
|
||||
typedef union xPROT_HEADERS
|
||||
{
|
||||
ICMPHeader_t xICMPHeader;
|
||||
@@ -214,6 +314,15 @@ typedef union xPROT_HEADERS
|
||||
TCPHeader_t xTCPHeader;
|
||||
} ProtocolHeaders_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ProtocolHeaders_t )
|
||||
{
|
||||
return ( ProtocolHeaders_t *)pvArgument;
|
||||
}
|
||||
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ProtocolHeaders_t )
|
||||
{
|
||||
return ( const ProtocolHeaders_t *) pvArgument;
|
||||
}
|
||||
|
||||
/* The maximum UDP payload length. */
|
||||
#define ipMAX_UDP_PAYLOAD_LENGTH ( ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv4_HEADER ) - ipSIZE_OF_UDP_HEADER )
|
||||
@@ -406,13 +515,6 @@ socket events. */
|
||||
#define ARRAY_SIZE(x) ( ( BaseType_t ) ( sizeof( x ) / sizeof( ( x )[ 0 ] ) ) )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A version of FreeRTOS_GetReleaseNetworkBuffer() that can be called from an
|
||||
* interrupt. If a non zero value is returned, then the calling ISR should
|
||||
* perform a context switch before exiting the ISR.
|
||||
*/
|
||||
BaseType_t FreeRTOS_ReleaseFreeNetworkBufferFromISR( void );
|
||||
|
||||
/*
|
||||
* Create a message that contains a command to initialise the network interface.
|
||||
* This is used during initialisation, and at any time the network interface
|
||||
@@ -476,7 +578,9 @@ BaseType_t xIPIsNetworkTaskReady( void );
|
||||
* Actually a user thing, but because xBoundTCPSocketsList, let it do by the
|
||||
* IP-task
|
||||
*/
|
||||
void vTCPNetStat( void );
|
||||
#if( ipconfigHAS_PRINTF != 0 )
|
||||
void vTCPNetStat( void );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* At least one socket needs to check for timeouts
|
||||
@@ -665,6 +769,15 @@ typedef struct xSOCKET
|
||||
} u;
|
||||
} FreeRTOS_Socket_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( FreeRTOS_Socket_t )
|
||||
{
|
||||
return ( FreeRTOS_Socket_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( FreeRTOS_Socket_t )
|
||||
{
|
||||
return ( const FreeRTOS_Socket_t *) pvArgument;
|
||||
}
|
||||
|
||||
#if( ipconfigUSE_TCP == 1 )
|
||||
/*
|
||||
* Lookup a TCP socket, using a multiple matching: both port numbers and
|
||||
@@ -801,6 +914,15 @@ typedef struct xSOCKET_SET
|
||||
EventGroupHandle_t xSelectGroup;
|
||||
} SocketSelect_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( SocketSelect_t )
|
||||
{
|
||||
return ( SocketSelect_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( SocketSelect_t )
|
||||
{
|
||||
return ( const SocketSelect_t *) pvArgument;
|
||||
}
|
||||
|
||||
extern void vSocketSelect( SocketSelect_t *pxSocketSet );
|
||||
|
||||
/* Define the data that must be passed for a 'eSocketSelectEvent'. */
|
||||
@@ -810,6 +932,15 @@ typedef struct xSocketSelectMessage
|
||||
SocketSelect_t *pxSocketSet;
|
||||
} SocketSelectMessage_t;
|
||||
|
||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( SocketSelectMessage_t )
|
||||
{
|
||||
return ( SocketSelectMessage_t *)pvArgument;
|
||||
}
|
||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( SocketSelectMessage_t )
|
||||
{
|
||||
return ( const SocketSelectMessage_t *) pvArgument;
|
||||
}
|
||||
|
||||
#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
|
||||
|
||||
void vIPSetDHCPTimerEnableState( BaseType_t xEnableState );
|
||||
@@ -828,15 +959,3 @@ void vIPNetworkUpCalls( void );
|
||||
|
||||
#endif /* FREERTOS_IP_PRIVATE_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -205,6 +205,12 @@ struct xSOCKET;
|
||||
typedef struct xSOCKET *Socket_t;
|
||||
typedef struct xSOCKET const * ConstSocket_t;
|
||||
|
||||
static portINLINE unsigned int prvSocketValid( Socket_t xSocket )
|
||||
{
|
||||
/* coverity[misra_c_2012_rule_11_4_violation] */
|
||||
return ( ( xSocket != FREERTOS_INVALID_SOCKET ) && ( xSocket != NULL ) );
|
||||
}
|
||||
|
||||
#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
|
||||
/* The SocketSet_t type is the equivalent to the fd_set type used by the
|
||||
Berkeley API. */
|
||||
@@ -417,15 +423,3 @@ void FreeRTOS_netstat( void );
|
||||
|
||||
#endif /* FREERTOS_SOCKETS_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -161,7 +161,8 @@ section macros. */
|
||||
|
||||
BaseType_t xNetworkBuffersInitialise( void )
|
||||
{
|
||||
BaseType_t xReturn, x;
|
||||
BaseType_t xReturn;
|
||||
uint32_t x;
|
||||
|
||||
/* Only initialise the buffers and their associated kernel objects if they
|
||||
have not been initialised before. */
|
||||
@@ -182,7 +183,7 @@ BaseType_t xReturn, x;
|
||||
from the network interface, and different hardware has different
|
||||
requirements. */
|
||||
vNetworkInterfaceAllocateRAMToBuffers( xNetworkBuffers );
|
||||
for( x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
|
||||
for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
|
||||
{
|
||||
/* Initialise and set the owner of the buffer list items. */
|
||||
vListInitialiseItem( &( xNetworkBuffers[ x ].xBufferListItem ) );
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FreeRTOS+TCP V2.2.1
|
||||
* FreeRTOS+TCP V2.2.2
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -95,7 +95,8 @@ static SemaphoreHandle_t xNetworkBufferSemaphore = NULL;
|
||||
|
||||
BaseType_t xNetworkBuffersInitialise( void )
|
||||
{
|
||||
BaseType_t xReturn, x;
|
||||
BaseType_t xReturn;
|
||||
uint32_t x;
|
||||
|
||||
/* Only initialise the buffers and their associated kernel objects if they
|
||||
have not been initialised before. */
|
||||
@@ -126,7 +127,7 @@ BaseType_t xReturn, x;
|
||||
|
||||
/* Initialise all the network buffers. No storage is allocated to
|
||||
the buffers yet. */
|
||||
for( x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
|
||||
for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
|
||||
{
|
||||
/* Initialise and set the owner of the buffer list items. */
|
||||
xNetworkBufferDescriptors[ x ].pucEthernetBuffer = NULL;
|
||||
@@ -248,7 +249,7 @@ size_t uxCount;
|
||||
|
||||
/* Allocate storage of exactly the requested size to the buffer. */
|
||||
configASSERT( pxReturn->pucEthernetBuffer == NULL );
|
||||
if( xRequestedSizeBytes > 0 )
|
||||
if( xRequestedSizeBytes > 0U )
|
||||
{
|
||||
/* Extra space is obtained so a pointer to the network buffer can
|
||||
be stored at the beginning of the buffer. */
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
FreeRTOS+TCP V2.2.1
|
||||
FreeRTOS+TCP V2.2.2
|
||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user