Skip to content

Commit

Permalink
Sync with +TCP amazon-FreeRTOS (FreeRTOS#158)
Browse files Browse the repository at this point in the history
* DNS.c commit

* IP.c commit

* Add various source & header files
  • Loading branch information
AniruddhaKanhere authored Jul 23, 2020
1 parent 8e36bee commit e0d6216
Show file tree
Hide file tree
Showing 8 changed files with 756 additions and 617 deletions.
584 changes: 316 additions & 268 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DNS.c

Large diffs are not rendered by default.

691 changes: 358 additions & 333 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ NetworkBufferDescriptor_t xTempBuffer;
usPacketIdentifier++;
pxIPHeader->usFragmentOffset = 0U;

/* Important: tell NIC driver how many bytes must be sent. */
pxNetworkBuffer->xDataLength = ulLen + ipSIZE_OF_ETH_HEADER;

#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 0 )
{
/* calculate the IP header checksum, in case the driver won't do that. */
Expand All @@ -899,9 +902,6 @@ NetworkBufferDescriptor_t xTempBuffer;
}
#endif

/* Important: tell NIC driver how many bytes must be sent. */
pxNetworkBuffer->xDataLength = ulLen + ipSIZE_OF_ETH_HEADER;

/* Fill in the destination MAC addresses. */
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ),
&( pxEthernetHeader->xSourceAddress ),
Expand Down Expand Up @@ -2000,6 +2000,7 @@ int32_t lCount, lLength;

/* A txStream has been created already, see if the socket has new data for
the sliding window.
uxStreamBufferMidSpace() returns the distance between rxHead and rxMid. It
contains new Tx data which has not been passed to the sliding window yet.
The oldest data not-yet-confirmed can be found at rxTail. */
Expand All @@ -2009,6 +2010,7 @@ int32_t lCount, lLength;
{
/* All data between txMid and rxHead will now be passed to the sliding
window manager, so it can start transmitting them.
Hand over the new data to the sliding window handler. It will be
split-up in chunks of 1460 bytes each (or less, depending on
ipconfigTCP_MSS). */
Expand Down Expand Up @@ -2141,6 +2143,7 @@ uint16_t usLength;

/* Determine the length and the offset of the user-data sent to this
node.
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. */
Expand Down Expand Up @@ -2216,6 +2219,7 @@ BaseType_t xResult = 0;
{
/* See if way may accept the data contents and forward it to the socket
owner.
If it can't be "accept"ed it may have to be stored and send a selective
ack (SACK) option to confirm it. In that case, lTCPAddRxdata() will be
called later to store an out-of-order packet (in case lOffset is
Expand Down Expand Up @@ -3504,3 +3508,4 @@ const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MAR
#ifdef FREERTOS_TCP_ENABLE_VERIFICATION
#include "aws_freertos_tcp_verification_access_tcp_define.h"
#endif

6 changes: 3 additions & 3 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_WIN.c
Original file line number Diff line number Diff line change
Expand Up @@ -1910,8 +1910,8 @@ const int32_t l500ms = 500;

#if( ipconfigUSE_TCP_WIN == 0 )

static BaseType_t prvTCPWindowTxHasSpace( TCPWindow_t *pxWindow, uint32_t ulWindowSize );
static BaseType_t prvTCPWindowTxHasSpace( TCPWindow_t *pxWindow, uint32_t ulWindowSize )
static BaseType_t prvTCPWindowTxHasSpace( TCPWindow_t const * pxWindow, uint32_t ulWindowSize );
static BaseType_t prvTCPWindowTxHasSpace( TCPWindow_t const * pxWindow, uint32_t ulWindowSize )
{
BaseType_t xReturn;

Expand All @@ -1934,7 +1934,7 @@ const int32_t l500ms = 500;

BaseType_t xTCPWindowTxHasData( TCPWindow_t const *pxWindow, uint32_t ulWindowSize, TickType_t *pulDelay )
{
TCPSegment_t *pxSegment = &( pxWindow->xTxSegment );
TCPSegment_t const *pxSegment = &( pxWindow->xTxSegment );
BaseType_t xReturn;
TickType_t ulAge, ulMaxAge;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,20 +317,25 @@ from the FreeRTOSIPConfig.h configuration header file. */
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
#endif


#ifndef ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS
#define ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS 1
#endif

#ifndef ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS
#define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS 0
#endif


/* Configuration to control whether packets with IP options,
* received over the network, should be passed up to the
* software stack OR should be dropped.
* If set to 1, the stack accepts IP packets that contain IP options, but does
* not process the options (IP options are not supported).
* If set to 0, the stack will drop IP packets that contain IP options.
*/
#ifndef ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS
#define ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS 1
#endif

/* Configuration to control whether UDP packets with
* checksum value of zero should be passed up the software
* stack OR should be dropped.
* If set to 1, the stack will accept UDP packets that have their checksum
* value set to 0.
* If set to 0, the stack will drop UDP packets that have their checksum value
* set to 0.
*/
#ifndef ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS
#define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS 0
#endif
Expand Down
6 changes: 6 additions & 0 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ BaseType_t FreeRTOS_IsNetworkUp( void );
UBaseType_t uxGetMinimumIPQueueSpace( void );
#endif

#if ( ipconfigHAS_PRINTF != 0 )
extern void vPrintResourceStats( void );
#else
#define vPrintResourceStats() do {} while( ipFALSE_BOOL )
#endif

/*
* Defined in FreeRTOS_Sockets.c
* //_RB_ Don't think this comment is correct. If this is for internal use only it should appear after all the public API functions and not start with FreeRTOS_.
Expand Down
25 changes: 25 additions & 0 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/tcp_dump_packets.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* FreeRTOS+TCP V2.2.1
* 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
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/

/*
* dump_packets.c
* Used in the PC/Win project to dump Ethernet packets, along with some description.
Expand Down
25 changes: 25 additions & 0 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/tcp_mem_stats.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* FreeRTOS+TCP V2.2.1
* 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
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/

/*
* tcp_mem_stats.h
*/
Expand Down

0 comments on commit e0d6216

Please sign in to comment.