summaryrefslogtreecommitdiff
path: root/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include
diff options
context:
space:
mode:
authoryuhzheng <yuhzheng@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2020-02-07 20:14:50 +0000
committeryuhzheng <yuhzheng@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2020-02-07 20:14:50 +0000
commit9bc63c45b54da904224124255fb3556898df6dc5 (patch)
treed393c7c629e6bb5c31b1e8db7d5aea68f4163e23 /FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include
parent17b22d57989c200a8c5cf9118078b0dfc8110bee (diff)
downloadfreertos-9bc63c45b54da904224124255fb3556898df6dc5.tar.gz
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed release candidate.
git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2821 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include')
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOSIPConfigDefaults.h1138
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_ARP.h282
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DHCP.h174
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h274
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h674
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h1654
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h804
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Stream_Buffer.h462
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_IP.h160
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_WIN.h426
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_UDP_IP.h112
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_errno_TCP.h180
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/IPTraceMacroDefaults.h386
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkBufferManagement.h140
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkInterface.h88
15 files changed, 3477 insertions, 3477 deletions
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOSIPConfigDefaults.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOSIPConfigDefaults.h
index 20cdf739f..d23410f5f 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOSIPConfigDefaults.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOSIPConfigDefaults.h
@@ -1,569 +1,569 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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://www.FreeRTOS.org
- * http://aws.amazon.com/freertos
- *
- * 1 tab == 4 spaces!
- */
-
-#ifndef FREERTOS_DEFAULT_IP_CONFIG_H
-#define FREERTOS_DEFAULT_IP_CONFIG_H
-
-/* The error numbers defined in this file will be moved to the core FreeRTOS
-code in future versions of FreeRTOS - at which time the following header file
-will be removed. */
-#include "FreeRTOS_errno_TCP.h"
-
-/* This file provides default values for configuration options that are missing
-from the FreeRTOSIPConfig.h configuration header file. */
-
-
-/* Ensure defined configuration constants are using the most up to date naming. */
-#ifdef tcpconfigIP_TIME_TO_LIVE
- #error now called: ipconfigTCP_TIME_TO_LIVE
-#endif
-
-#ifdef updconfigIP_TIME_TO_LIVE
- #error now called: ipconfigUDP_TIME_TO_LIVE
-#endif
-
-#ifdef ipFILLER_SIZE
- #error now called: ipconfigPACKET_FILLER_SIZE
-#endif
-
-#ifdef dnsMAX_REQUEST_ATTEMPTS
- #error now called: ipconfigDNS_REQUEST_ATTEMPTS
-#endif
-
-#ifdef ipconfigUDP_TASK_PRIORITY
- #error now called: ipconfigIP_TASK_PRIORITY
-#endif
-
-#ifdef ipconfigUDP_TASK_STACK_SIZE_WORDS
- #error now called: ipconfigIP_TASK_STACK_SIZE_WORDS
-#endif
-
-#ifdef ipconfigDRIVER_INCLUDED_RX_IP_FILTERING
- #error now called: ipconfigETHERNET_DRIVER_FILTERS_PACKETS
-#endif
-
-#ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS
- #error now called: ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
-#endif
-
-#ifdef ipconfigUSE_RECEIVE_CONNECT_CALLBACKS
- #error now called: ipconfigUSE_CALLBACKS
-#endif
-
-#ifdef ipconfigNUM_NETWORK_BUFFERS
- #error now called: ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
-#endif
-
-#ifdef ipconfigTCP_HANG_PROT
- #error now called: ipconfigTCP_HANG_PROTECTION
-#endif
-
-#ifdef ipconfigTCP_HANG_PROT_TIME
- #error now called: ipconfigTCP_HANG_PROTECTION_TIME
-#endif
-
-#ifdef FreeRTOS_lprintf
- #error now called: FreeRTOS_debug_printf
-#endif
-
-#if ( ipconfigEVENT_QUEUE_LENGTH < ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) )
- #error The ipconfigEVENT_QUEUE_LENGTH parameter must be at least ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5
-#endif
-
-#if ( ipconfigNETWORK_MTU < 46 )
- #error ipconfigNETWORK_MTU must be at least 46.
-#endif
-
-#ifdef ipconfigBUFFER_ALLOC_FIXED_SIZE
- #error ipconfigBUFFER_ALLOC_FIXED_SIZE was dropped and replaced by a const value, declared in BufferAllocation[12].c
-#endif
-
-#ifdef ipconfigNIC_SEND_PASSES_DMA
- #error now called: ipconfigZERO_COPY_TX_DRIVER
-#endif
-
-#ifdef HAS_TX_CRC_OFFLOADING
- /* _HT_ As these macro names have changed, throw an error
- if they're still defined. */
- #error now called: ipconfigHAS_TX_CRC_OFFLOADING
-#endif
-
-#ifdef HAS_RX_CRC_OFFLOADING
- #error now called: ipconfigHAS_RX_CRC_OFFLOADING
-#endif
-
-#ifdef ipconfigTCP_RX_BUF_LEN
- #error ipconfigTCP_RX_BUF_LEN is now called ipconfigTCP_RX_BUFFER_LENGTH
-#endif
-
-#ifdef ipconfigTCP_TX_BUF_LEN
- #error ipconfigTCP_TX_BUF_LEN is now called ipconfigTCP_TX_BUFFER_LENGTH
-#endif
-
-#ifdef ipconfigDHCP_USES_USER_HOOK
- #error ipconfigDHCP_USES_USER_HOOK and its associated callback have been superceeded - see http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK
-#endif
-
-#ifndef ipconfigUSE_TCP
- #define ipconfigUSE_TCP ( 1 )
-#endif
-
-#if ipconfigUSE_TCP
-
- /* Include support for TCP scaling windows */
- #ifndef ipconfigUSE_TCP_WIN
- #define ipconfigUSE_TCP_WIN ( 1 )
- #endif
-
- #ifndef ipconfigTCP_WIN_SEG_COUNT
- #define ipconfigTCP_WIN_SEG_COUNT ( 256 )
- #endif
-
- #ifndef ipconfigIGNORE_UNKNOWN_PACKETS
- /* When non-zero, TCP will not send RST packets in reply to
- TCP packets which are unknown, or out-of-order. */
- #define ipconfigIGNORE_UNKNOWN_PACKETS ( 0 )
- #endif
-#endif
-
-/*
- * For debuging/logging: check if the port number is used for telnet
- * Some events will not be logged for telnet connections
- * because it would produce logging about the transmission of the logging...
- * This macro will only be used if FreeRTOS_debug_printf() is defined for logging
- */
-#ifndef ipconfigTCP_MAY_LOG_PORT
- #define ipconfigTCP_MAY_LOG_PORT(xPort) ( ( xPort ) != 23u )
-#endif
-
-
-#ifndef ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME
- #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME portMAX_DELAY
-#endif
-
-#ifndef ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME
- #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME portMAX_DELAY
-#endif
-
-
-#ifndef ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS
- #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500u )
-#endif
-
-#ifndef ipconfigDNS_SEND_BLOCK_TIME_TICKS
- #define ipconfigDNS_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500u )
-#endif
-/*
- * FreeRTOS debug logging routine (proposal)
- * The macro will be called in the printf() style. Users can define
- * their own logging routine as:
- *
- * #define FreeRTOS_debug_printf( MSG ) my_printf MSG
- *
- * The FreeRTOS_debug_printf() must be thread-safe but does not have to be
- * interrupt-safe.
- */
-#ifdef ipconfigHAS_DEBUG_PRINTF
- #if( ipconfigHAS_DEBUG_PRINTF == 0 )
- #ifdef FreeRTOS_debug_printf
- #error Do not define FreeRTOS_debug_print if ipconfigHAS_DEBUG_PRINTF is set to 0
- #endif /* ifdef FreeRTOS_debug_printf */
- #endif /* ( ipconfigHAS_DEBUG_PRINTF == 0 ) */
-#endif /* ifdef ipconfigHAS_DEBUG_PRINTF */
-
-#ifndef FreeRTOS_debug_printf
- #define FreeRTOS_debug_printf( MSG ) do{} while(0)
- #define ipconfigHAS_DEBUG_PRINTF 0
-#endif
-
-/*
- * FreeRTOS general logging routine (proposal)
- * Used in some utility functions such as FreeRTOS_netstat() and FreeRTOS_PrintARPCache()
- *
- * #define FreeRTOS_printf( MSG ) my_printf MSG
- *
- * The FreeRTOS_printf() must be thread-safe but does not have to be interrupt-safe
- */
-#ifdef ipconfigHAS_PRINTF
- #if( ipconfigHAS_PRINTF == 0 )
- #ifdef FreeRTOS_printf
- #error Do not define FreeRTOS_print if ipconfigHAS_PRINTF is set to 0
- #endif /* ifdef FreeRTOS_debug_printf */
- #endif /* ( ipconfigHAS_PRINTF == 0 ) */
-#endif /* ifdef ipconfigHAS_PRINTF */
-
-#ifndef FreeRTOS_printf
- #define FreeRTOS_printf( MSG ) do{} while(0)
- #define ipconfigHAS_PRINTF 0
-#endif
-
-/*
- * In cases where a lot of logging is produced, FreeRTOS_flush_logging( )
- * will be called to give the logging module a chance to flush the data
- * An example of this is the netstat command, which produces many lines of logging
- */
-#ifndef FreeRTOS_flush_logging
- #define FreeRTOS_flush_logging( ) do{} while(0)
-#endif
-
-/* Malloc functions. Within most applications of FreeRTOS, the couple
- * pvPortMalloc()/vPortFree() will be used.
- * If there is also SDRAM, the user may decide to use a different memory
- * allocator:
- * MallocLarge is used to allocate large TCP buffers (for Rx/Tx)
- * MallocSocket is used to allocate the space for the sockets
- */
-#ifndef pvPortMallocLarge
- #define pvPortMallocLarge( x ) pvPortMalloc( x )
-#endif
-
-#ifndef vPortFreeLarge
- #define vPortFreeLarge(ptr) vPortFree(ptr)
-#endif
-
-#ifndef pvPortMallocSocket
- #define pvPortMallocSocket( x ) pvPortMalloc( x )
-#endif
-
-#ifndef vPortFreeSocket
- #define vPortFreeSocket(ptr) vPortFree(ptr)
-#endif
-
-/*
- * At several places within the library, random numbers are needed:
- * - DHCP: For creating a DHCP transaction number
- * - TCP: Set the Initial Sequence Number: this is the value of the first outgoing
- * sequence number being used when connecting to a peer.
- * Having a well randomised ISN is important to avoid spoofing
- * - UDP/TCP: for setting the first port number to be used, in case a socket
- * uses a 'random' or anonymous port number
- */
-#ifndef ipconfigRAND32
- #define ipconfigRAND32() rand()
-#endif
-/* --------------------------------------------------------
- * End of: HT Added some macro defaults for the PLUS-UDP project
- * -------------------------------------------------------- */
-
-#ifndef ipconfigUSE_NETWORK_EVENT_HOOK
- #define ipconfigUSE_NETWORK_EVENT_HOOK 0
-#endif
-
-#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
- #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( pdMS_TO_TICKS( 20 ) )
-#endif
-
-#ifndef ipconfigARP_CACHE_ENTRIES
- #define ipconfigARP_CACHE_ENTRIES 10
-#endif
-
-#ifndef ipconfigMAX_ARP_RETRANSMISSIONS
- #define ipconfigMAX_ARP_RETRANSMISSIONS ( 5u )
-#endif
-
-#ifndef ipconfigMAX_ARP_AGE
- #define ipconfigMAX_ARP_AGE 150u
-#endif
-
-#ifndef ipconfigUSE_ARP_REVERSED_LOOKUP
- #define ipconfigUSE_ARP_REVERSED_LOOKUP 0
-#endif
-
-#ifndef ipconfigUSE_ARP_REMOVE_ENTRY
- #define ipconfigUSE_ARP_REMOVE_ENTRY 0
-#endif
-
-#ifndef ipconfigINCLUDE_FULL_INET_ADDR
- #define ipconfigINCLUDE_FULL_INET_ADDR 1
-#endif
-
-#ifndef ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
- #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 45
-#endif
-
-#ifndef ipconfigEVENT_QUEUE_LENGTH
- #define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
-#endif
-
-#ifndef ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND
- #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
-#endif
-
-#ifndef ipconfigUDP_TIME_TO_LIVE
- #define ipconfigUDP_TIME_TO_LIVE 128
-#endif
-
-#ifndef ipconfigTCP_TIME_TO_LIVE
- #define ipconfigTCP_TIME_TO_LIVE 128
-#endif
-
-#ifndef ipconfigUDP_MAX_RX_PACKETS
- /* Make postive to define the maximum number of packets which will be buffered
- * for each UDP socket.
- * Can be overridden with the socket option FREERTOS_SO_UDP_MAX_RX_PACKETS
- */
- #define ipconfigUDP_MAX_RX_PACKETS 0u
-#endif
-
-#ifndef ipconfigUSE_DHCP
- #define ipconfigUSE_DHCP 1
-#endif
-
-#ifndef ipconfigUSE_DHCP_HOOK
- #define ipconfigUSE_DHCP_HOOK 0
-#endif
-
-#ifndef ipconfigDHCP_FALL_BACK_AUTO_IP
- /*
- * Only applicable when DHCP is in use:
- * If no DHCP server responds, use "Auto-IP" : the
- * device will allocate a random LinkLayer IP address.
- */
- #define ipconfigDHCP_FALL_BACK_AUTO_IP ( 0 )
-#endif
-
-#if( ipconfigDHCP_FALL_BACK_AUTO_IP != 0 )
- #define ipconfigARP_USE_CLASH_DETECTION 1
-#endif
-
-#ifndef ipconfigARP_USE_CLASH_DETECTION
- #define ipconfigARP_USE_CLASH_DETECTION 0
-#endif
-
-#ifndef ipconfigNETWORK_MTU
- #define ipconfigNETWORK_MTU 1500
-#endif
-
-#ifndef ipconfigTCP_MSS
- #define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv4_HEADER - ipSIZE_OF_TCP_HEADER )
-#endif
-
-/* Each TCP socket has circular stream buffers for Rx and Tx, which
- * have a fixed maximum size.
- * The defaults for these size are defined here, although
- * they can be overridden at runtime by using the setsockopt() call */
-#ifndef ipconfigTCP_RX_BUFFER_LENGTH
- #define ipconfigTCP_RX_BUFFER_LENGTH ( 4u * ipconfigTCP_MSS ) /* defaults to 5840 bytes */
-#endif
-
-/* Define the size of Tx stream buffer for TCP sockets */
-#ifndef ipconfigTCP_TX_BUFFER_LENGTH
-# define ipconfigTCP_TX_BUFFER_LENGTH ( 4u * ipconfigTCP_MSS ) /* defaults to 5840 bytes */
-#endif
-
-#ifndef ipconfigMAXIMUM_DISCOVER_TX_PERIOD
- #ifdef _WINDOWS_
- #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 999 ) )
- #else
- #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 30000 ) )
- #endif /* _WINDOWS_ */
-#endif /* ipconfigMAXIMUM_DISCOVER_TX_PERIOD */
-
-#if( ipconfigUSE_DNS == 0 )
- /* The DNS module will not be included. */
- #if( ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) )
- /* LLMNR and NBNS depend on DNS because those protocols share a lot of code. */
- #error When either LLMNR or NBNS is used, ipconfigUSE_DNS must be defined
- #endif
-#endif
-
-#ifndef ipconfigUSE_DNS
- #define ipconfigUSE_DNS 1
-#endif
-
-#ifndef ipconfigDNS_REQUEST_ATTEMPTS
- #define ipconfigDNS_REQUEST_ATTEMPTS 5
-#endif
-
-#ifndef ipconfigUSE_DNS_CACHE
- #define ipconfigUSE_DNS_CACHE 0
-#endif
-
-#if( ipconfigUSE_DNS_CACHE != 0 )
- #ifndef ipconfigDNS_CACHE_NAME_LENGTH
- /* Per https://tools.ietf.org/html/rfc1035, 253 is the maximum string length
- of a DNS name. The following default accounts for a null terminator. */
- #define ipconfigDNS_CACHE_NAME_LENGTH 254
- #endif
-
- #ifndef ipconfigDNS_CACHE_ENTRIES
- #define ipconfigDNS_CACHE_ENTRIES 1
- #endif
-#endif /* ipconfigUSE_DNS_CACHE != 0 */
-
-#ifndef ipconfigCHECK_IP_QUEUE_SPACE
- #define ipconfigCHECK_IP_QUEUE_SPACE 0
-#endif
-
-#ifndef ipconfigUSE_LLMNR
- /* Include support for LLMNR: Link-local Multicast Name Resolution (non-Microsoft) */
- #define ipconfigUSE_LLMNR ( 0 )
-#endif
-
-#ifndef ipconfigREPLY_TO_INCOMING_PINGS
- #define ipconfigREPLY_TO_INCOMING_PINGS 1
-#endif
-
-#ifndef ipconfigSUPPORT_OUTGOING_PINGS
- #define ipconfigSUPPORT_OUTGOING_PINGS 0
-#endif
-
-#ifndef ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES
- #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
-#endif
-
-#ifndef ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES
- #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
-#endif
-
-#ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
- #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0
-#else
- #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS configINCLUDE_TRACE_RELATED_CLI_COMMANDS
-#endif
-
-#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM
- #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM ( 0 )
-#endif
-
-#ifndef ipconfigETHERNET_DRIVER_FILTERS_PACKETS
- #define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ( 0 )
-#endif
-
-#ifndef ipconfigWATCHDOG_TIMER
- /* This macro will be called in every loop the IP-task makes. It may be
- replaced by user-code that triggers a watchdog */
- #define ipconfigWATCHDOG_TIMER()
-#endif
-
-#ifndef ipconfigUSE_CALLBACKS
- #define ipconfigUSE_CALLBACKS ( 0 )
-#endif
-
-#if( ipconfigUSE_CALLBACKS != 0 )
- #ifndef ipconfigIS_VALID_PROG_ADDRESS
- /* Replace this macro with a test returning non-zero if the memory pointer to by x
- * is valid memory which can contain executable code
- * In fact this is an extra safety measure: if a handler points to invalid memory,
- * it will not be called
- */
- #define ipconfigIS_VALID_PROG_ADDRESS(x) ( ( x ) != NULL )
- #endif
-#endif
-
-#ifndef ipconfigHAS_INLINE_FUNCTIONS
- #define ipconfigHAS_INLINE_FUNCTIONS ( 1 )
-#endif
-
-#ifndef portINLINE
- #define portINLINE inline
-#endif
-
-#ifndef ipconfigZERO_COPY_TX_DRIVER
- /* When non-zero, the buffers passed to the SEND routine may be passed
- to DMA. As soon as sending is ready, the buffers must be released by
- calling vReleaseNetworkBufferAndDescriptor(), */
- #define ipconfigZERO_COPY_TX_DRIVER ( 0 )
-#endif
-
-#ifndef ipconfigZERO_COPY_RX_DRIVER
- /* This define doesn't mean much to the driver, except that it makes
- sure that pxPacketBuffer_to_NetworkBuffer() will be included. */
- #define ipconfigZERO_COPY_RX_DRIVER ( 0 )
-#endif
-
-#ifndef ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM
- #define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 0
-#endif
-
-#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM
- #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 0
-#endif
-
-#ifndef ipconfigDHCP_REGISTER_HOSTNAME
- #define ipconfigDHCP_REGISTER_HOSTNAME 0
-#endif
-
-#ifndef ipconfigSOCKET_HAS_USER_SEMAPHORE
- #define ipconfigSOCKET_HAS_USER_SEMAPHORE 0
-#endif
-
-#ifndef ipconfigSOCKET_HAS_USER_WAKE_CALLBACK
- #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK 0
-#endif
-
-#ifndef ipconfigSUPPORT_SELECT_FUNCTION
- #define ipconfigSUPPORT_SELECT_FUNCTION 0
-#endif
-
-#ifndef ipconfigTCP_KEEP_ALIVE
- #define ipconfigTCP_KEEP_ALIVE 0
-#endif
-
-#ifndef ipconfigDNS_USE_CALLBACKS
- #define ipconfigDNS_USE_CALLBACKS 0
-#endif
-
-#ifndef ipconfigSUPPORT_SIGNALS
- #define ipconfigSUPPORT_SIGNALS 0
-#endif
-
-#ifndef ipconfigUSE_NBNS
- #define ipconfigUSE_NBNS 0
-#endif
-
-/* As an attack surface reduction for ports that listen for inbound
-connections, hang protection can help reduce the impact of SYN floods. */
-#ifndef ipconfigTCP_HANG_PROTECTION
- #define ipconfigTCP_HANG_PROTECTION 1
-#endif
-
-/* Non-activity timeout is expressed in seconds. */
-#ifndef ipconfigTCP_HANG_PROTECTION_TIME
- #define ipconfigTCP_HANG_PROTECTION_TIME 30
-#endif
-
-#ifndef ipconfigTCP_IP_SANITY
- #define ipconfigTCP_IP_SANITY 0
-#endif
-
-#ifndef ipconfigARP_STORES_REMOTE_ADDRESSES
- #define ipconfigARP_STORES_REMOTE_ADDRESSES 0
-#endif
-
-#ifndef ipconfigBUFFER_PADDING
- /* Expert option: define a value for 'ipBUFFER_PADDING'.
- When 'ipconfigBUFFER_PADDING' equals 0,
- 'ipBUFFER_PADDING' will get a default value of 8 + 2 bytes. */
- #define ipconfigBUFFER_PADDING 0
-#endif
-
-#ifndef ipconfigPACKET_FILLER_SIZE
- #define ipconfigPACKET_FILLER_SIZE 2
-#endif
-
-#endif /* FREERTOS_DEFAULT_IP_CONFIG_H */
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+#ifndef FREERTOS_DEFAULT_IP_CONFIG_H
+#define FREERTOS_DEFAULT_IP_CONFIG_H
+
+/* The error numbers defined in this file will be moved to the core FreeRTOS
+code in future versions of FreeRTOS - at which time the following header file
+will be removed. */
+#include "FreeRTOS_errno_TCP.h"
+
+/* This file provides default values for configuration options that are missing
+from the FreeRTOSIPConfig.h configuration header file. */
+
+
+/* Ensure defined configuration constants are using the most up to date naming. */
+#ifdef tcpconfigIP_TIME_TO_LIVE
+ #error now called: ipconfigTCP_TIME_TO_LIVE
+#endif
+
+#ifdef updconfigIP_TIME_TO_LIVE
+ #error now called: ipconfigUDP_TIME_TO_LIVE
+#endif
+
+#ifdef ipFILLER_SIZE
+ #error now called: ipconfigPACKET_FILLER_SIZE
+#endif
+
+#ifdef dnsMAX_REQUEST_ATTEMPTS
+ #error now called: ipconfigDNS_REQUEST_ATTEMPTS
+#endif
+
+#ifdef ipconfigUDP_TASK_PRIORITY
+ #error now called: ipconfigIP_TASK_PRIORITY
+#endif
+
+#ifdef ipconfigUDP_TASK_STACK_SIZE_WORDS
+ #error now called: ipconfigIP_TASK_STACK_SIZE_WORDS
+#endif
+
+#ifdef ipconfigDRIVER_INCLUDED_RX_IP_FILTERING
+ #error now called: ipconfigETHERNET_DRIVER_FILTERS_PACKETS
+#endif
+
+#ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS
+ #error now called: ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
+#endif
+
+#ifdef ipconfigUSE_RECEIVE_CONNECT_CALLBACKS
+ #error now called: ipconfigUSE_CALLBACKS
+#endif
+
+#ifdef ipconfigNUM_NETWORK_BUFFERS
+ #error now called: ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
+#endif
+
+#ifdef ipconfigTCP_HANG_PROT
+ #error now called: ipconfigTCP_HANG_PROTECTION
+#endif
+
+#ifdef ipconfigTCP_HANG_PROT_TIME
+ #error now called: ipconfigTCP_HANG_PROTECTION_TIME
+#endif
+
+#ifdef FreeRTOS_lprintf
+ #error now called: FreeRTOS_debug_printf
+#endif
+
+#if ( ipconfigEVENT_QUEUE_LENGTH < ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) )
+ #error The ipconfigEVENT_QUEUE_LENGTH parameter must be at least ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5
+#endif
+
+#if ( ipconfigNETWORK_MTU < 46 )
+ #error ipconfigNETWORK_MTU must be at least 46.
+#endif
+
+#ifdef ipconfigBUFFER_ALLOC_FIXED_SIZE
+ #error ipconfigBUFFER_ALLOC_FIXED_SIZE was dropped and replaced by a const value, declared in BufferAllocation[12].c
+#endif
+
+#ifdef ipconfigNIC_SEND_PASSES_DMA
+ #error now called: ipconfigZERO_COPY_TX_DRIVER
+#endif
+
+#ifdef HAS_TX_CRC_OFFLOADING
+ /* _HT_ As these macro names have changed, throw an error
+ if they're still defined. */
+ #error now called: ipconfigHAS_TX_CRC_OFFLOADING
+#endif
+
+#ifdef HAS_RX_CRC_OFFLOADING
+ #error now called: ipconfigHAS_RX_CRC_OFFLOADING
+#endif
+
+#ifdef ipconfigTCP_RX_BUF_LEN
+ #error ipconfigTCP_RX_BUF_LEN is now called ipconfigTCP_RX_BUFFER_LENGTH
+#endif
+
+#ifdef ipconfigTCP_TX_BUF_LEN
+ #error ipconfigTCP_TX_BUF_LEN is now called ipconfigTCP_TX_BUFFER_LENGTH
+#endif
+
+#ifdef ipconfigDHCP_USES_USER_HOOK
+ #error ipconfigDHCP_USES_USER_HOOK and its associated callback have been superceeded - see http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK
+#endif
+
+#ifndef ipconfigUSE_TCP
+ #define ipconfigUSE_TCP ( 1 )
+#endif
+
+#if ipconfigUSE_TCP
+
+ /* Include support for TCP scaling windows */
+ #ifndef ipconfigUSE_TCP_WIN
+ #define ipconfigUSE_TCP_WIN ( 1 )
+ #endif
+
+ #ifndef ipconfigTCP_WIN_SEG_COUNT
+ #define ipconfigTCP_WIN_SEG_COUNT ( 256 )
+ #endif
+
+ #ifndef ipconfigIGNORE_UNKNOWN_PACKETS
+ /* When non-zero, TCP will not send RST packets in reply to
+ TCP packets which are unknown, or out-of-order. */
+ #define ipconfigIGNORE_UNKNOWN_PACKETS ( 0 )
+ #endif
+#endif
+
+/*
+ * For debuging/logging: check if the port number is used for telnet
+ * Some events will not be logged for telnet connections
+ * because it would produce logging about the transmission of the logging...
+ * This macro will only be used if FreeRTOS_debug_printf() is defined for logging
+ */
+#ifndef ipconfigTCP_MAY_LOG_PORT
+ #define ipconfigTCP_MAY_LOG_PORT(xPort) ( ( xPort ) != 23u )
+#endif
+
+
+#ifndef ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME
+ #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME portMAX_DELAY
+#endif
+
+#ifndef ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME
+ #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME portMAX_DELAY
+#endif
+
+
+#ifndef ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS
+ #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500u )
+#endif
+
+#ifndef ipconfigDNS_SEND_BLOCK_TIME_TICKS
+ #define ipconfigDNS_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500u )
+#endif
+/*
+ * FreeRTOS debug logging routine (proposal)
+ * The macro will be called in the printf() style. Users can define
+ * their own logging routine as:
+ *
+ * #define FreeRTOS_debug_printf( MSG ) my_printf MSG
+ *
+ * The FreeRTOS_debug_printf() must be thread-safe but does not have to be
+ * interrupt-safe.
+ */
+#ifdef ipconfigHAS_DEBUG_PRINTF
+ #if( ipconfigHAS_DEBUG_PRINTF == 0 )
+ #ifdef FreeRTOS_debug_printf
+ #error Do not define FreeRTOS_debug_print if ipconfigHAS_DEBUG_PRINTF is set to 0
+ #endif /* ifdef FreeRTOS_debug_printf */
+ #endif /* ( ipconfigHAS_DEBUG_PRINTF == 0 ) */
+#endif /* ifdef ipconfigHAS_DEBUG_PRINTF */
+
+#ifndef FreeRTOS_debug_printf
+ #define FreeRTOS_debug_printf( MSG ) do{} while(0)
+ #define ipconfigHAS_DEBUG_PRINTF 0
+#endif
+
+/*
+ * FreeRTOS general logging routine (proposal)
+ * Used in some utility functions such as FreeRTOS_netstat() and FreeRTOS_PrintARPCache()
+ *
+ * #define FreeRTOS_printf( MSG ) my_printf MSG
+ *
+ * The FreeRTOS_printf() must be thread-safe but does not have to be interrupt-safe
+ */
+#ifdef ipconfigHAS_PRINTF
+ #if( ipconfigHAS_PRINTF == 0 )
+ #ifdef FreeRTOS_printf
+ #error Do not define FreeRTOS_print if ipconfigHAS_PRINTF is set to 0
+ #endif /* ifdef FreeRTOS_debug_printf */
+ #endif /* ( ipconfigHAS_PRINTF == 0 ) */
+#endif /* ifdef ipconfigHAS_PRINTF */
+
+#ifndef FreeRTOS_printf
+ #define FreeRTOS_printf( MSG ) do{} while(0)
+ #define ipconfigHAS_PRINTF 0
+#endif
+
+/*
+ * In cases where a lot of logging is produced, FreeRTOS_flush_logging( )
+ * will be called to give the logging module a chance to flush the data
+ * An example of this is the netstat command, which produces many lines of logging
+ */
+#ifndef FreeRTOS_flush_logging
+ #define FreeRTOS_flush_logging( ) do{} while(0)
+#endif
+
+/* Malloc functions. Within most applications of FreeRTOS, the couple
+ * pvPortMalloc()/vPortFree() will be used.
+ * If there is also SDRAM, the user may decide to use a different memory
+ * allocator:
+ * MallocLarge is used to allocate large TCP buffers (for Rx/Tx)
+ * MallocSocket is used to allocate the space for the sockets
+ */
+#ifndef pvPortMallocLarge
+ #define pvPortMallocLarge( x ) pvPortMalloc( x )
+#endif
+
+#ifndef vPortFreeLarge
+ #define vPortFreeLarge(ptr) vPortFree(ptr)
+#endif
+
+#ifndef pvPortMallocSocket
+ #define pvPortMallocSocket( x ) pvPortMalloc( x )
+#endif
+
+#ifndef vPortFreeSocket
+ #define vPortFreeSocket(ptr) vPortFree(ptr)
+#endif
+
+/*
+ * At several places within the library, random numbers are needed:
+ * - DHCP: For creating a DHCP transaction number
+ * - TCP: Set the Initial Sequence Number: this is the value of the first outgoing
+ * sequence number being used when connecting to a peer.
+ * Having a well randomised ISN is important to avoid spoofing
+ * - UDP/TCP: for setting the first port number to be used, in case a socket
+ * uses a 'random' or anonymous port number
+ */
+#ifndef ipconfigRAND32
+ #define ipconfigRAND32() rand()
+#endif
+/* --------------------------------------------------------
+ * End of: HT Added some macro defaults for the PLUS-UDP project
+ * -------------------------------------------------------- */
+
+#ifndef ipconfigUSE_NETWORK_EVENT_HOOK
+ #define ipconfigUSE_NETWORK_EVENT_HOOK 0
+#endif
+
+#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
+ #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( pdMS_TO_TICKS( 20 ) )
+#endif
+
+#ifndef ipconfigARP_CACHE_ENTRIES
+ #define ipconfigARP_CACHE_ENTRIES 10
+#endif
+
+#ifndef ipconfigMAX_ARP_RETRANSMISSIONS
+ #define ipconfigMAX_ARP_RETRANSMISSIONS ( 5u )
+#endif
+
+#ifndef ipconfigMAX_ARP_AGE
+ #define ipconfigMAX_ARP_AGE 150u
+#endif
+
+#ifndef ipconfigUSE_ARP_REVERSED_LOOKUP
+ #define ipconfigUSE_ARP_REVERSED_LOOKUP 0
+#endif
+
+#ifndef ipconfigUSE_ARP_REMOVE_ENTRY
+ #define ipconfigUSE_ARP_REMOVE_ENTRY 0
+#endif
+
+#ifndef ipconfigINCLUDE_FULL_INET_ADDR
+ #define ipconfigINCLUDE_FULL_INET_ADDR 1
+#endif
+
+#ifndef ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
+ #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 45
+#endif
+
+#ifndef ipconfigEVENT_QUEUE_LENGTH
+ #define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
+#endif
+
+#ifndef ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND
+ #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
+#endif
+
+#ifndef ipconfigUDP_TIME_TO_LIVE
+ #define ipconfigUDP_TIME_TO_LIVE 128
+#endif
+
+#ifndef ipconfigTCP_TIME_TO_LIVE
+ #define ipconfigTCP_TIME_TO_LIVE 128
+#endif
+
+#ifndef ipconfigUDP_MAX_RX_PACKETS
+ /* Make postive to define the maximum number of packets which will be buffered
+ * for each UDP socket.
+ * Can be overridden with the socket option FREERTOS_SO_UDP_MAX_RX_PACKETS
+ */
+ #define ipconfigUDP_MAX_RX_PACKETS 0u
+#endif
+
+#ifndef ipconfigUSE_DHCP
+ #define ipconfigUSE_DHCP 1
+#endif
+
+#ifndef ipconfigUSE_DHCP_HOOK
+ #define ipconfigUSE_DHCP_HOOK 0
+#endif
+
+#ifndef ipconfigDHCP_FALL_BACK_AUTO_IP
+ /*
+ * Only applicable when DHCP is in use:
+ * If no DHCP server responds, use "Auto-IP" : the
+ * device will allocate a random LinkLayer IP address.
+ */
+ #define ipconfigDHCP_FALL_BACK_AUTO_IP ( 0 )
+#endif
+
+#if( ipconfigDHCP_FALL_BACK_AUTO_IP != 0 )
+ #define ipconfigARP_USE_CLASH_DETECTION 1
+#endif
+
+#ifndef ipconfigARP_USE_CLASH_DETECTION
+ #define ipconfigARP_USE_CLASH_DETECTION 0
+#endif
+
+#ifndef ipconfigNETWORK_MTU
+ #define ipconfigNETWORK_MTU 1500
+#endif
+
+#ifndef ipconfigTCP_MSS
+ #define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv4_HEADER - ipSIZE_OF_TCP_HEADER )
+#endif
+
+/* Each TCP socket has circular stream buffers for Rx and Tx, which
+ * have a fixed maximum size.
+ * The defaults for these size are defined here, although
+ * they can be overridden at runtime by using the setsockopt() call */
+#ifndef ipconfigTCP_RX_BUFFER_LENGTH
+ #define ipconfigTCP_RX_BUFFER_LENGTH ( 4u * ipconfigTCP_MSS ) /* defaults to 5840 bytes */
+#endif
+
+/* Define the size of Tx stream buffer for TCP sockets */
+#ifndef ipconfigTCP_TX_BUFFER_LENGTH
+# define ipconfigTCP_TX_BUFFER_LENGTH ( 4u * ipconfigTCP_MSS ) /* defaults to 5840 bytes */
+#endif
+
+#ifndef ipconfigMAXIMUM_DISCOVER_TX_PERIOD
+ #ifdef _WINDOWS_
+ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 999 ) )
+ #else
+ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 30000 ) )
+ #endif /* _WINDOWS_ */
+#endif /* ipconfigMAXIMUM_DISCOVER_TX_PERIOD */
+
+#if( ipconfigUSE_DNS == 0 )
+ /* The DNS module will not be included. */
+ #if( ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) )
+ /* LLMNR and NBNS depend on DNS because those protocols share a lot of code. */
+ #error When either LLMNR or NBNS is used, ipconfigUSE_DNS must be defined
+ #endif
+#endif
+
+#ifndef ipconfigUSE_DNS
+ #define ipconfigUSE_DNS 1
+#endif
+
+#ifndef ipconfigDNS_REQUEST_ATTEMPTS
+ #define ipconfigDNS_REQUEST_ATTEMPTS 5
+#endif
+
+#ifndef ipconfigUSE_DNS_CACHE
+ #define ipconfigUSE_DNS_CACHE 0
+#endif
+
+#if( ipconfigUSE_DNS_CACHE != 0 )
+ #ifndef ipconfigDNS_CACHE_NAME_LENGTH
+ /* Per https://tools.ietf.org/html/rfc1035, 253 is the maximum string length
+ of a DNS name. The following default accounts for a null terminator. */
+ #define ipconfigDNS_CACHE_NAME_LENGTH 254
+ #endif
+
+ #ifndef ipconfigDNS_CACHE_ENTRIES
+ #define ipconfigDNS_CACHE_ENTRIES 1
+ #endif
+#endif /* ipconfigUSE_DNS_CACHE != 0 */
+
+#ifndef ipconfigCHECK_IP_QUEUE_SPACE
+ #define ipconfigCHECK_IP_QUEUE_SPACE 0
+#endif
+
+#ifndef ipconfigUSE_LLMNR
+ /* Include support for LLMNR: Link-local Multicast Name Resolution (non-Microsoft) */
+ #define ipconfigUSE_LLMNR ( 0 )
+#endif
+
+#ifndef ipconfigREPLY_TO_INCOMING_PINGS
+ #define ipconfigREPLY_TO_INCOMING_PINGS 1
+#endif
+
+#ifndef ipconfigSUPPORT_OUTGOING_PINGS
+ #define ipconfigSUPPORT_OUTGOING_PINGS 0
+#endif
+
+#ifndef ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES
+ #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
+#endif
+
+#ifndef ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES
+ #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
+#endif
+
+#ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
+ #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0
+#else
+ #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS configINCLUDE_TRACE_RELATED_CLI_COMMANDS
+#endif
+
+#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM
+ #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM ( 0 )
+#endif
+
+#ifndef ipconfigETHERNET_DRIVER_FILTERS_PACKETS
+ #define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ( 0 )
+#endif
+
+#ifndef ipconfigWATCHDOG_TIMER
+ /* This macro will be called in every loop the IP-task makes. It may be
+ replaced by user-code that triggers a watchdog */
+ #define ipconfigWATCHDOG_TIMER()
+#endif
+
+#ifndef ipconfigUSE_CALLBACKS
+ #define ipconfigUSE_CALLBACKS ( 0 )
+#endif
+
+#if( ipconfigUSE_CALLBACKS != 0 )
+ #ifndef ipconfigIS_VALID_PROG_ADDRESS
+ /* Replace this macro with a test returning non-zero if the memory pointer to by x
+ * is valid memory which can contain executable code
+ * In fact this is an extra safety measure: if a handler points to invalid memory,
+ * it will not be called
+ */
+ #define ipconfigIS_VALID_PROG_ADDRESS(x) ( ( x ) != NULL )
+ #endif
+#endif
+
+#ifndef ipconfigHAS_INLINE_FUNCTIONS
+ #define ipconfigHAS_INLINE_FUNCTIONS ( 1 )
+#endif
+
+#ifndef portINLINE
+ #define portINLINE inline
+#endif
+
+#ifndef ipconfigZERO_COPY_TX_DRIVER
+ /* When non-zero, the buffers passed to the SEND routine may be passed
+ to DMA. As soon as sending is ready, the buffers must be released by
+ calling vReleaseNetworkBufferAndDescriptor(), */
+ #define ipconfigZERO_COPY_TX_DRIVER ( 0 )
+#endif
+
+#ifndef ipconfigZERO_COPY_RX_DRIVER
+ /* This define doesn't mean much to the driver, except that it makes
+ sure that pxPacketBuffer_to_NetworkBuffer() will be included. */
+ #define ipconfigZERO_COPY_RX_DRIVER ( 0 )
+#endif
+
+#ifndef ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM
+ #define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 0
+#endif
+
+#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM
+ #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 0
+#endif
+
+#ifndef ipconfigDHCP_REGISTER_HOSTNAME
+ #define ipconfigDHCP_REGISTER_HOSTNAME 0
+#endif
+
+#ifndef ipconfigSOCKET_HAS_USER_SEMAPHORE
+ #define ipconfigSOCKET_HAS_USER_SEMAPHORE 0
+#endif
+
+#ifndef ipconfigSOCKET_HAS_USER_WAKE_CALLBACK
+ #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK 0
+#endif
+
+#ifndef ipconfigSUPPORT_SELECT_FUNCTION
+ #define ipconfigSUPPORT_SELECT_FUNCTION 0
+#endif
+
+#ifndef ipconfigTCP_KEEP_ALIVE
+ #define ipconfigTCP_KEEP_ALIVE 0
+#endif
+
+#ifndef ipconfigDNS_USE_CALLBACKS
+ #define ipconfigDNS_USE_CALLBACKS 0
+#endif
+
+#ifndef ipconfigSUPPORT_SIGNALS
+ #define ipconfigSUPPORT_SIGNALS 0
+#endif
+
+#ifndef ipconfigUSE_NBNS
+ #define ipconfigUSE_NBNS 0
+#endif
+
+/* As an attack surface reduction for ports that listen for inbound
+connections, hang protection can help reduce the impact of SYN floods. */
+#ifndef ipconfigTCP_HANG_PROTECTION
+ #define ipconfigTCP_HANG_PROTECTION 1
+#endif
+
+/* Non-activity timeout is expressed in seconds. */
+#ifndef ipconfigTCP_HANG_PROTECTION_TIME
+ #define ipconfigTCP_HANG_PROTECTION_TIME 30
+#endif
+
+#ifndef ipconfigTCP_IP_SANITY
+ #define ipconfigTCP_IP_SANITY 0
+#endif
+
+#ifndef ipconfigARP_STORES_REMOTE_ADDRESSES
+ #define ipconfigARP_STORES_REMOTE_ADDRESSES 0
+#endif
+
+#ifndef ipconfigBUFFER_PADDING
+ /* Expert option: define a value for 'ipBUFFER_PADDING'.
+ When 'ipconfigBUFFER_PADDING' equals 0,
+ 'ipBUFFER_PADDING' will get a default value of 8 + 2 bytes. */
+ #define ipconfigBUFFER_PADDING 0
+#endif
+
+#ifndef ipconfigPACKET_FILLER_SIZE
+ #define ipconfigPACKET_FILLER_SIZE 2
+#endif
+
+#endif /* FREERTOS_DEFAULT_IP_CONFIG_H */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_ARP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_ARP.h
index 166bf3a97..363fca425 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_ARP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_ARP.h
@@ -1,141 +1,141 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_ARP_H
-#define FREERTOS_ARP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "FreeRTOSIPConfigDefaults.h"
-#include "IPTraceMacroDefaults.h"
-
-/*-----------------------------------------------------------*/
-/* Miscellaneous structure and definitions. */
-/*-----------------------------------------------------------*/
-
-typedef struct xARP_CACHE_TABLE_ROW
-{
- uint32_t ulIPAddress; /* The IP address of an ARP cache entry. */
- MACAddress_t xMACAddress; /* The MAC address of an ARP cache entry. */
- uint8_t ucAge; /* A value that is periodically decremented but can also be refreshed by active communication. The ARP cache entry is removed if the value reaches zero. */
- uint8_t ucValid; /* pdTRUE: xMACAddress is valid, pdFALSE: waiting for ARP reply */
-} ARPCacheRow_t;
-
-typedef enum
-{
- eARPCacheMiss = 0, /* 0 An ARP table lookup did not find a valid entry. */
- eARPCacheHit, /* 1 An ARP table lookup found a valid entry. */
- eCantSendPacket /* 2 There is no IP address, or an ARP is still in progress, so the packet cannot be sent. */
-} eARPLookupResult_t;
-
-typedef enum
-{
- eNotFragment = 0, /* The IP packet being sent is not part of a fragment. */
- eFirstFragment, /* The IP packet being sent is the first in a set of fragmented packets. */
- eFollowingFragment /* The IP packet being sent is part of a set of fragmented packets. */
-} eIPFragmentStatus_t;
-
-/*
- * If ulIPAddress is already in the ARP cache table then reset the age of the
- * entry back to its maximum value. If ulIPAddress is not already in the ARP
- * cache table then add it - replacing the oldest current entry if there is not
- * a free space available.
- */
-void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress, const uint32_t ulIPAddress );
-
-#if( ipconfigARP_USE_CLASH_DETECTION != 0 )
- /* Becomes non-zero if another device responded to a gratuitos ARP message. */
- extern BaseType_t xARPHadIPClash;
- /* MAC-address of the other device containing the same IP-address. */
- extern MACAddress_t xARPClashMacAddress;
-#endif /* ipconfigARP_USE_CLASH_DETECTION */
-
-#if( ipconfigUSE_ARP_REMOVE_ENTRY != 0 )
-
- /*
- * In some rare cases, it might be useful to remove a ARP cache entry of a
- * known MAC address to make sure it gets refreshed.
- */
- uint32_t ulARPRemoveCacheEntryByMac( const MACAddress_t * pxMACAddress );
-
-#endif /* ipconfigUSE_ARP_REMOVE_ENTRY != 0 */
-
-/*
- * Look for ulIPAddress in the ARP cache. If the IP address exists, copy the
- * associated MAC address into pxMACAddress, refresh the ARP cache entry's
- * age, and return eARPCacheHit. If the IP address does not exist in the ARP
- * cache return eARPCacheMiss. If the packet cannot be sent for any reason
- * (maybe DHCP is still in process, or the addressing needs a gateway but there
- * isn't a gateway defined) then return eCantSendPacket.
- */
-eARPLookupResult_t eARPGetCacheEntry( uint32_t *pulIPAddress, MACAddress_t * const pxMACAddress );
-
-#if( ipconfigUSE_ARP_REVERSED_LOOKUP != 0 )
-
- /* Lookup an IP-address if only the MAC-address is known */
- eARPLookupResult_t eARPGetCacheEntryByMac( MACAddress_t * const pxMACAddress, uint32_t *pulIPAddress );
-
-#endif
-/*
- * Reduce the age count in each entry within the ARP cache. An entry is no
- * longer considered valid and is deleted if its age reaches zero.
- */
-void vARPAgeCache( void );
-
-/*
- * Send out an ARP request for the IP address contained in pxNetworkBuffer, and
- * add an entry into the ARP table that indicates that an ARP reply is
- * outstanding so re-transmissions can be generated.
- */
-void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
-
-/*
- * After DHCP is ready and when changing IP address, force a quick send of our new IP
- * address
- */
-void vARPSendGratuitous( void );
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* FREERTOS_ARP_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_ARP_H
+#define FREERTOS_ARP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "FreeRTOSIPConfigDefaults.h"
+#include "IPTraceMacroDefaults.h"
+
+/*-----------------------------------------------------------*/
+/* Miscellaneous structure and definitions. */
+/*-----------------------------------------------------------*/
+
+typedef struct xARP_CACHE_TABLE_ROW
+{
+ uint32_t ulIPAddress; /* The IP address of an ARP cache entry. */
+ MACAddress_t xMACAddress; /* The MAC address of an ARP cache entry. */
+ uint8_t ucAge; /* A value that is periodically decremented but can also be refreshed by active communication. The ARP cache entry is removed if the value reaches zero. */
+ uint8_t ucValid; /* pdTRUE: xMACAddress is valid, pdFALSE: waiting for ARP reply */
+} ARPCacheRow_t;
+
+typedef enum
+{
+ eARPCacheMiss = 0, /* 0 An ARP table lookup did not find a valid entry. */
+ eARPCacheHit, /* 1 An ARP table lookup found a valid entry. */
+ eCantSendPacket /* 2 There is no IP address, or an ARP is still in progress, so the packet cannot be sent. */
+} eARPLookupResult_t;
+
+typedef enum
+{
+ eNotFragment = 0, /* The IP packet being sent is not part of a fragment. */
+ eFirstFragment, /* The IP packet being sent is the first in a set of fragmented packets. */
+ eFollowingFragment /* The IP packet being sent is part of a set of fragmented packets. */
+} eIPFragmentStatus_t;
+
+/*
+ * If ulIPAddress is already in the ARP cache table then reset the age of the
+ * entry back to its maximum value. If ulIPAddress is not already in the ARP
+ * cache table then add it - replacing the oldest current entry if there is not
+ * a free space available.
+ */
+void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress, const uint32_t ulIPAddress );
+
+#if( ipconfigARP_USE_CLASH_DETECTION != 0 )
+ /* Becomes non-zero if another device responded to a gratuitos ARP message. */
+ extern BaseType_t xARPHadIPClash;
+ /* MAC-address of the other device containing the same IP-address. */
+ extern MACAddress_t xARPClashMacAddress;
+#endif /* ipconfigARP_USE_CLASH_DETECTION */
+
+#if( ipconfigUSE_ARP_REMOVE_ENTRY != 0 )
+
+ /*
+ * In some rare cases, it might be useful to remove a ARP cache entry of a
+ * known MAC address to make sure it gets refreshed.
+ */
+ uint32_t ulARPRemoveCacheEntryByMac( const MACAddress_t * pxMACAddress );
+
+#endif /* ipconfigUSE_ARP_REMOVE_ENTRY != 0 */
+
+/*
+ * Look for ulIPAddress in the ARP cache. If the IP address exists, copy the
+ * associated MAC address into pxMACAddress, refresh the ARP cache entry's
+ * age, and return eARPCacheHit. If the IP address does not exist in the ARP
+ * cache return eARPCacheMiss. If the packet cannot be sent for any reason
+ * (maybe DHCP is still in process, or the addressing needs a gateway but there
+ * isn't a gateway defined) then return eCantSendPacket.
+ */
+eARPLookupResult_t eARPGetCacheEntry( uint32_t *pulIPAddress, MACAddress_t * const pxMACAddress );
+
+#if( ipconfigUSE_ARP_REVERSED_LOOKUP != 0 )
+
+ /* Lookup an IP-address if only the MAC-address is known */
+ eARPLookupResult_t eARPGetCacheEntryByMac( MACAddress_t * const pxMACAddress, uint32_t *pulIPAddress );
+
+#endif
+/*
+ * Reduce the age count in each entry within the ARP cache. An entry is no
+ * longer considered valid and is deleted if its age reaches zero.
+ */
+void vARPAgeCache( void );
+
+/*
+ * Send out an ARP request for the IP address contained in pxNetworkBuffer, and
+ * add an entry into the ARP table that indicates that an ARP reply is
+ * outstanding so re-transmissions can be generated.
+ */
+void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
+
+/*
+ * After DHCP is ready and when changing IP address, force a quick send of our new IP
+ * address
+ */
+void vARPSendGratuitous( void );
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* FREERTOS_ARP_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DHCP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DHCP.h
index 6a6d372b6..a49909eb2 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DHCP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DHCP.h
@@ -1,87 +1,87 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_DHCP_H
-#define FREERTOS_DHCP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "IPTraceMacroDefaults.h"
-
-/* Used in the DHCP callback if ipconfigUSE_DHCP_HOOK is set to 1. */
-typedef enum eDHCP_PHASE
-{
- eDHCPPhasePreDiscover, /* Driver is about to send a DHCP discovery. */
- eDHCPPhasePreRequest, /* Driver is about to request DHCP an IP address. */
-#if( ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP != 0 )
- eDHCPPhasePreLLA, /* Driver is about to try get an LLA address */
-#endif /* ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP */
-} eDHCPCallbackPhase_t;
-
-/* Used in the DHCP callback if ipconfigUSE_DHCP_HOOK is set to 1. */
-typedef enum eDHCP_ANSWERS
-{
- eDHCPContinue, /* Continue the DHCP process */
- eDHCPUseDefaults, /* Stop DHCP and use the static defaults. */
- eDHCPStopNoChanges, /* Stop DHCP and continue with current settings. */
-} eDHCPCallbackAnswer_t;
-
-/*
- * NOT A PUBLIC API FUNCTION.
- */
-void vDHCPProcess( BaseType_t xReset );
-
-/* Internal call: returns true if socket is the current DHCP socket */
-BaseType_t xIsDHCPSocket( Socket_t xSocket );
-
-/* Prototype of the hook (or callback) function that must be provided by the
-application if ipconfigUSE_DHCP_HOOK is set to 1. See the following URL for
-usage information:
-http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK
-*/
-eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, uint32_t ulIPAddress );
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* FREERTOS_DHCP_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_DHCP_H
+#define FREERTOS_DHCP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "IPTraceMacroDefaults.h"
+
+/* Used in the DHCP callback if ipconfigUSE_DHCP_HOOK is set to 1. */
+typedef enum eDHCP_PHASE
+{
+ eDHCPPhasePreDiscover, /* Driver is about to send a DHCP discovery. */
+ eDHCPPhasePreRequest, /* Driver is about to request DHCP an IP address. */
+#if( ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP != 0 )
+ eDHCPPhasePreLLA, /* Driver is about to try get an LLA address */
+#endif /* ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP */
+} eDHCPCallbackPhase_t;
+
+/* Used in the DHCP callback if ipconfigUSE_DHCP_HOOK is set to 1. */
+typedef enum eDHCP_ANSWERS
+{
+ eDHCPContinue, /* Continue the DHCP process */
+ eDHCPUseDefaults, /* Stop DHCP and use the static defaults. */
+ eDHCPStopNoChanges, /* Stop DHCP and continue with current settings. */
+} eDHCPCallbackAnswer_t;
+
+/*
+ * NOT A PUBLIC API FUNCTION.
+ */
+void vDHCPProcess( BaseType_t xReset );
+
+/* Internal call: returns true if socket is the current DHCP socket */
+BaseType_t xIsDHCPSocket( Socket_t xSocket );
+
+/* Prototype of the hook (or callback) function that must be provided by the
+application if ipconfigUSE_DHCP_HOOK is set to 1. See the following URL for
+usage information:
+http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK
+*/
+eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, uint32_t ulIPAddress );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* FREERTOS_DHCP_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
index 449fa514f..0458d7621 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
@@ -1,137 +1,137 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_DNS_H
-#define FREERTOS_DNS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "IPTraceMacroDefaults.h"
-
-
-/* The Link-local Multicast Name Resolution (LLMNR)
- * is included.
- * Note that a special MAC address is required in addition to the NIC's actual
- * MAC address: 01:00:5E:00:00:FC
- *
- * The target IP address will be 224.0.0.252
- */
-#if( ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN )
- #define ipLLMNR_IP_ADDR 0xE00000FC
-#else
- #define ipLLMNR_IP_ADDR 0xFC0000E0
-#endif /* ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN */
-
-#define ipLLMNR_PORT 5355 /* Standard LLMNR port. */
-#define ipDNS_PORT 53 /* Standard DNS port. */
-#define ipDHCP_CLIENT 67
-#define ipDHCP_SERVER 68
-#define ipNBNS_PORT 137 /* NetBIOS Name Service. */
-#define ipNBDGM_PORT 138 /* Datagram Service, not included. */
-
-/*
- * The following function should be provided by the user and return true if it
- * matches the domain name.
- */
-extern BaseType_t xApplicationDNSQueryHook( const char *pcName );
-
-/*
- * LLMNR is very similar to DNS, so is handled by the DNS routines.
- */
-uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer );
-
-#if( ipconfigUSE_LLMNR == 1 )
- extern const MACAddress_t xLLMNR_MacAdress;
-#endif /* ipconfigUSE_LLMNR */
-
-#if( ipconfigUSE_NBNS != 0 )
-
- /*
- * Inspect a NetBIOS Names-Service message. If the name matches with ours
- * (xApplicationDNSQueryHook returns true) an answer will be sent back.
- * Note that LLMNR is a better protocol for name services on a LAN as it is
- * less polluted
- */
- uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer );
-
-#endif /* ipconfigUSE_NBNS */
-
-#if( ipconfigUSE_DNS_CACHE != 0 )
-
- /* Look for the indicated host name in the DNS cache. Returns the IPv4
- address if present, or 0x0 otherwise. */
- uint32_t FreeRTOS_dnslookup( const char *pcHostName );
-
- /* Remove all entries from the DNS cache. */
- void FreeRTOS_dnsclear();
-#endif /* ipconfigUSE_DNS_CACHE != 0 */
-
-#if( ipconfigDNS_USE_CALLBACKS != 0 )
-
- /*
- * Users may define this type of function as a callback.
- * It will be called when a DNS reply is received or when a timeout has been reached.
- */
- typedef void (* FOnDNSEvent ) ( const char * /* pcName */, void * /* pvSearchID */, uint32_t /* ulIPAddress */ );
-
- /*
- * Asynchronous version of gethostbyname()
- * xTimeout is in units of ms.
- */
- uint32_t FreeRTOS_gethostbyname_a( const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t xTimeout );
- void FreeRTOS_gethostbyname_cancel( void *pvSearchID );
-
-#endif
-
-/*
- * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
- * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
- * _TBD_ Add URL
- */
-uint32_t FreeRTOS_gethostbyname( const char *pcHostName );
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* FREERTOS_DNS_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_DNS_H
+#define FREERTOS_DNS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "IPTraceMacroDefaults.h"
+
+
+/* The Link-local Multicast Name Resolution (LLMNR)
+ * is included.
+ * Note that a special MAC address is required in addition to the NIC's actual
+ * MAC address: 01:00:5E:00:00:FC
+ *
+ * The target IP address will be 224.0.0.252
+ */
+#if( ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN )
+ #define ipLLMNR_IP_ADDR 0xE00000FC
+#else
+ #define ipLLMNR_IP_ADDR 0xFC0000E0
+#endif /* ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN */
+
+#define ipLLMNR_PORT 5355 /* Standard LLMNR port. */
+#define ipDNS_PORT 53 /* Standard DNS port. */
+#define ipDHCP_CLIENT 67
+#define ipDHCP_SERVER 68
+#define ipNBNS_PORT 137 /* NetBIOS Name Service. */
+#define ipNBDGM_PORT 138 /* Datagram Service, not included. */
+
+/*
+ * The following function should be provided by the user and return true if it
+ * matches the domain name.
+ */
+extern BaseType_t xApplicationDNSQueryHook( const char *pcName );
+
+/*
+ * LLMNR is very similar to DNS, so is handled by the DNS routines.
+ */
+uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer );
+
+#if( ipconfigUSE_LLMNR == 1 )
+ extern const MACAddress_t xLLMNR_MacAdress;
+#endif /* ipconfigUSE_LLMNR */
+
+#if( ipconfigUSE_NBNS != 0 )
+
+ /*
+ * Inspect a NetBIOS Names-Service message. If the name matches with ours
+ * (xApplicationDNSQueryHook returns true) an answer will be sent back.
+ * Note that LLMNR is a better protocol for name services on a LAN as it is
+ * less polluted
+ */
+ uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer );
+
+#endif /* ipconfigUSE_NBNS */
+
+#if( ipconfigUSE_DNS_CACHE != 0 )
+
+ /* Look for the indicated host name in the DNS cache. Returns the IPv4
+ address if present, or 0x0 otherwise. */
+ uint32_t FreeRTOS_dnslookup( const char *pcHostName );
+
+ /* Remove all entries from the DNS cache. */
+ void FreeRTOS_dnsclear();
+#endif /* ipconfigUSE_DNS_CACHE != 0 */
+
+#if( ipconfigDNS_USE_CALLBACKS != 0 )
+
+ /*
+ * Users may define this type of function as a callback.
+ * It will be called when a DNS reply is received or when a timeout has been reached.
+ */
+ typedef void (* FOnDNSEvent ) ( const char * /* pcName */, void * /* pvSearchID */, uint32_t /* ulIPAddress */ );
+
+ /*
+ * Asynchronous version of gethostbyname()
+ * xTimeout is in units of ms.
+ */
+ uint32_t FreeRTOS_gethostbyname_a( const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t xTimeout );
+ void FreeRTOS_gethostbyname_cancel( void *pvSearchID );
+
+#endif
+
+/*
+ * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
+ * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
+ * _TBD_ Add URL
+ */
+uint32_t FreeRTOS_gethostbyname( const char *pcHostName );
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* FREERTOS_DNS_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h
index 6bfb4ad42..46a215777 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP.h
@@ -1,337 +1,337 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_IP_H
-#define FREERTOS_IP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "FreeRTOSIPConfigDefaults.h"
-#include "IPTraceMacroDefaults.h"
-
-/* Some constants defining the sizes of several parts of a packet */
-#define ipSIZE_OF_ETH_HEADER 14u
-#define ipSIZE_OF_IPv4_HEADER 20u
-#define ipSIZE_OF_IGMP_HEADER 8u
-#define ipSIZE_OF_ICMP_HEADER 8u
-#define ipSIZE_OF_UDP_HEADER 8u
-#define ipSIZE_OF_TCP_HEADER 20u
-
-
-/* The number of octets in the MAC and IP addresses respectively. */
-#define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )
-#define ipIP_ADDRESS_LENGTH_BYTES ( 4 )
-
-/* IP protocol definitions. */
-#define ipPROTOCOL_ICMP ( 1 )
-#define ipPROTOCOL_IGMP ( 2 )
-#define ipPROTOCOL_TCP ( 6 )
-#define ipPROTOCOL_UDP ( 17 )
-
-/* Dimensions the buffers that are filled by received Ethernet frames. */
-#define ipSIZE_OF_ETH_CRC_BYTES ( 4UL )
-#define ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES ( 4UL )
-#define ipTOTAL_ETHERNET_FRAME_SIZE ( ( ( uint32_t ) ipconfigNETWORK_MTU ) + ( ( uint32_t ) ipSIZE_OF_ETH_HEADER ) + ipSIZE_OF_ETH_CRC_BYTES + ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES )
-
-/*_RB_ Comment may need updating. */
-/* Space left at the beginning of a network buffer storage area to store a
-pointer back to the network buffer. Should be a multiple of 8 to ensure 8 byte
-alignment is maintained on architectures that require it.
-
-In order to get a 32-bit alignment of network packets, an offset of 2 bytes
-would be desirable, as defined by ipconfigPACKET_FILLER_SIZE. So the malloc'd
-buffer will have the following contents:
- uint32_t pointer; // word-aligned
- uchar_8 filler[6];
- << ETH-header >> // half-word-aligned
- uchar_8 dest[6]; // start of pucEthernetBuffer
- uchar_8 dest[6];
- uchar16_t type;
- << IP-header >> // word-aligned
- uint8_t ucVersionHeaderLength;
- etc
- */
-#if( ipconfigBUFFER_PADDING != 0 )
- #define ipBUFFER_PADDING ipconfigBUFFER_PADDING
-#else
- #define ipBUFFER_PADDING ( 8u + ipconfigPACKET_FILLER_SIZE )
-#endif
-
-/* The structure used to store buffers and pass them around the network stack.
-Buffers can be in use by the stack, in use by the network interface hardware
-driver, or free (not in use). */
-typedef struct xNETWORK_BUFFER
-{
- ListItem_t xBufferListItem; /* Used to reference the buffer form the free buffer list or a socket. */
- uint32_t ulIPAddress; /* Source or destination IP address, depending on usage scenario. */
- uint8_t *pucEthernetBuffer; /* Pointer to the start of the Ethernet frame. */
- size_t xDataLength; /* Starts by holding the total Ethernet frame length, then the UDP/TCP payload length. */
- uint16_t usPort; /* Source or destination port, depending on usage scenario. */
- uint16_t usBoundPort; /* The port to which a transmitting socket is bound. */
- #if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )
- struct xNETWORK_BUFFER *pxNextBuffer; /* Possible optimisation for expert users - requires network driver support. */
- #endif
-} NetworkBufferDescriptor_t;
-
-#include "pack_struct_start.h"
-struct xMAC_ADDRESS
-{
- uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];
-}
-#include "pack_struct_end.h"
-
-typedef struct xMAC_ADDRESS MACAddress_t;
-
-typedef enum eNETWORK_EVENTS
-{
- eNetworkUp, /* The network is configured. */
- eNetworkDown /* The network connection has been lost. */
-} eIPCallbackEvent_t;
-
-typedef enum ePING_REPLY_STATUS
-{
- eSuccess = 0, /* A correct reply has been received for an outgoing ping. */
- eInvalidChecksum, /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */
- eInvalidData /* A reply was received to an outgoing ping but the payload of the reply was not correct. */
-} ePingReplyStatus_t;
-
-typedef enum eNETWORK_ADDRESS_TYPE
-{
- eNetWorkAddressTypeIPV4,
- eNetWorkAddressTypeIPV6,
- eNetWorkAddressTypeHostName
-} eNetWorkAddressType_t;
-
-/* Endian related definitions. */
-#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
-
- /* FreeRTOS_htons / FreeRTOS_htonl: some platforms might have built-in versions
- using a single instruction so allow these versions to be overridden. */
- #ifndef FreeRTOS_htons
- #define FreeRTOS_htons( usIn ) ( (uint16_t) ( ( ( usIn ) << 8U ) | ( ( usIn ) >> 8U ) ) )
- #endif
-
- #ifndef FreeRTOS_htonl
- #define FreeRTOS_htonl( ulIn ) \
- ( \
- ( uint32_t ) \
- ( \
- ( ( ( ( uint32_t ) ( ulIn ) ) ) << 24 ) | \
- ( ( ( ( uint32_t ) ( ulIn ) ) & 0x0000ff00UL ) << 8 ) | \
- ( ( ( ( uint32_t ) ( ulIn ) ) & 0x00ff0000UL ) >> 8 ) | \
- ( ( ( ( uint32_t ) ( ulIn ) ) ) >> 24 ) \
- ) \
- )
- #endif
-
-#else /* ipconfigBYTE_ORDER */
-
- #define FreeRTOS_htons( x ) ( ( uint16_t ) ( x ) )
- #define FreeRTOS_htonl( x ) ( ( uint32_t ) ( x ) )
-
-#endif /* ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN */
-
-#define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )
-#define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )
-
-#if( ipconfigHAS_INLINE_FUNCTIONS == 1 )
-
- static portINLINE int32_t FreeRTOS_max_int32 (int32_t a, int32_t b);
- static portINLINE uint32_t FreeRTOS_max_uint32 (uint32_t a, uint32_t b);
- static portINLINE int32_t FreeRTOS_min_int32 (int32_t a, int32_t b);
- static portINLINE uint32_t FreeRTOS_min_uint32 (uint32_t a, uint32_t b);
- static portINLINE uint32_t FreeRTOS_round_up (uint32_t a, uint32_t d);
- static portINLINE uint32_t FreeRTOS_round_down (uint32_t a, uint32_t d);
- static portINLINE BaseType_t FreeRTOS_min_BaseType (BaseType_t a, BaseType_t b);
- static portINLINE BaseType_t FreeRTOS_max_BaseType (BaseType_t a, BaseType_t b);
- static portINLINE UBaseType_t FreeRTOS_max_UBaseType (UBaseType_t a, UBaseType_t b);
- static portINLINE UBaseType_t FreeRTOS_min_UBaseType (UBaseType_t a, UBaseType_t b);
-
-
- static portINLINE int32_t FreeRTOS_max_int32 (int32_t a, int32_t b) { return a >= b ? a : b; }
- static portINLINE uint32_t FreeRTOS_max_uint32 (uint32_t a, uint32_t b) { return a >= b ? a : b; }
- static portINLINE int32_t FreeRTOS_min_int32 (int32_t a, int32_t b) { return a <= b ? a : b; }
- static portINLINE uint32_t FreeRTOS_min_uint32 (uint32_t a, uint32_t b) { return a <= b ? a : b; }
- static portINLINE uint32_t FreeRTOS_round_up (uint32_t a, uint32_t d) { return d * ( ( a + d - 1u ) / d ); }
- static portINLINE uint32_t FreeRTOS_round_down (uint32_t a, uint32_t d) { return d * ( a / d ); }
-
- static portINLINE BaseType_t FreeRTOS_max_BaseType (BaseType_t a, BaseType_t b) { return a >= b ? a : b; }
- static portINLINE UBaseType_t FreeRTOS_max_UBaseType (UBaseType_t a, UBaseType_t b) { return a >= b ? a : b; }
- static portINLINE BaseType_t FreeRTOS_min_BaseType (BaseType_t a, BaseType_t b) { return a <= b ? a : b; }
- static portINLINE UBaseType_t FreeRTOS_min_UBaseType (UBaseType_t a, UBaseType_t b) { return a <= b ? a : b; }
-
-#else
-
- #define FreeRTOS_max_int32(a,b) ( ( ( int32_t ) ( a ) ) >= ( ( int32_t ) ( b ) ) ? ( ( int32_t ) ( a ) ) : ( ( int32_t ) ( b ) ) )
- #define FreeRTOS_max_uint32(a,b) ( ( ( uint32_t ) ( a ) ) >= ( ( uint32_t ) ( b ) ) ? ( ( uint32_t ) ( a ) ) : ( ( uint32_t ) ( b ) ) )
-
- #define FreeRTOS_min_int32(a,b) ( ( ( int32_t ) a ) <= ( ( int32_t ) b ) ? ( ( int32_t ) a ) : ( ( int32_t ) b ) )
- #define FreeRTOS_min_uint32(a,b) ( ( ( uint32_t ) a ) <= ( ( uint32_t ) b ) ? ( ( uint32_t ) a ) : ( ( uint32_t ) b ) )
-
- /* Round-up: a = d * ( ( a + d - 1 ) / d ) */
- #define FreeRTOS_round_up(a,d) ( ( ( uint32_t ) ( d ) ) * ( ( ( ( uint32_t ) ( a ) ) + ( ( uint32_t ) ( d ) ) - 1UL ) / ( ( uint32_t ) ( d ) ) ) )
- #define FreeRTOS_round_down(a,d) ( ( ( uint32_t ) ( d ) ) * ( ( ( uint32_t ) ( a ) ) / ( ( uint32_t ) ( d ) ) ) )
-
- #define FreeRTOS_ms_to_tick(ms) ( ( ms * configTICK_RATE_HZ + 500 ) / 1000 )
-
- #define FreeRTOS_max_BaseType(a, b) ( ( ( BaseType_t ) ( a ) ) >= ( ( BaseType_t ) ( b ) ) ? ( ( BaseType_t ) ( a ) ) : ( ( BaseType_t ) ( b ) ) )
- #define FreeRTOS_max_UBaseType(a, b) ( ( ( UBaseType_t ) ( a ) ) >= ( ( UBaseType_t ) ( b ) ) ? ( ( UBaseType_t ) ( a ) ) : ( ( UBaseType_t ) ( b ) ) )
- #define FreeRTOS_min_BaseType(a, b) ( ( ( BaseType_t ) ( a ) ) <= ( ( BaseType_t ) ( b ) ) ? ( ( BaseType_t ) ( a ) ) : ( ( BaseType_t ) ( b ) ) )
- #define FreeRTOS_min_UBaseType(a, b) ( ( ( UBaseType_t ) ( a ) ) <= ( ( UBaseType_t ) ( b ) ) ? ( ( UBaseType_t ) ( a ) ) : ( ( UBaseType_t ) ( b ) ) )
-
-#endif /* ipconfigHAS_INLINE_FUNCTIONS */
-
-#define pdMS_TO_MIN_TICKS( xTimeInMs ) ( pdMS_TO_TICKS( ( xTimeInMs ) ) < ( ( TickType_t ) 1 ) ? ( ( TickType_t ) 1 ) : pdMS_TO_TICKS( ( xTimeInMs ) ) )
-
-#ifndef pdTRUE_SIGNED
- /* Temporary solution: eventually the defines below will appear in 'Source\include\projdefs.h' */
- #define pdTRUE_SIGNED pdTRUE
- #define pdFALSE_SIGNED pdFALSE
- #define pdTRUE_UNSIGNED ( ( UBaseType_t ) 1u )
- #define pdFALSE_UNSIGNED ( ( UBaseType_t ) 0u )
-#endif
-
-/*
- * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
- * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
- * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html
- */
-BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
- const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ],
- const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
- const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
- const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
-
-void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );
-void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );
-void FreeRTOS_SetAddressConfiguration( const uint32_t *pulIPAddress, const uint32_t *pulNetMask, const uint32_t *pulGatewayAddress, const uint32_t *pulDNSServerAddress );
-BaseType_t FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, TickType_t xBlockTimeTicks );
-void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );
-const uint8_t * FreeRTOS_GetMACAddress( void );
-void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES] );
-void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );
-void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );
-uint32_t FreeRTOS_GetIPAddress( void );
-void FreeRTOS_SetIPAddress( uint32_t ulIPAddress );
-void FreeRTOS_SetNetmask( uint32_t ulNetmask );
-void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress );
-uint32_t FreeRTOS_GetGatewayAddress( void );
-uint32_t FreeRTOS_GetDNSServerAddress( void );
-uint32_t FreeRTOS_GetNetmask( void );
-void FreeRTOS_OutputARPRequest( uint32_t ulIPAddress );
-BaseType_t FreeRTOS_IsNetworkUp( void );
-
-#if( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
- UBaseType_t uxGetMinimumIPQueueSpace( void );
-#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_.
- * Socket has had activity, reset the timer so it will not be closed
- * because of inactivity
- */
-const char *FreeRTOS_GetTCPStateName( UBaseType_t ulState);
-
-/* _HT_ Temporary: show all valid ARP entries
- */
-void FreeRTOS_PrintARPCache( void );
-void FreeRTOS_ClearARP( void );
-
-#if( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
-
- /* DHCP has an option for clients to register their hostname. It doesn't
- have much use, except that a device can be found in a router along with its
- name. If this option is used the callback below must be provided by the
- application writer to return a const string, denoting the device's name. */
- const char *pcApplicationHostnameHook( void );
-
-#endif /* ipconfigDHCP_REGISTER_HOSTNAME */
-
-
-/* This xApplicationGetRandomNumber() will set *pulNumber to a random number,
-and return pdTRUE. When the random number generator is broken, it shall return
-pdFALSE.
-The function is defined in 'iot_secure_sockets.c'.
-If that module is not included in the project, the application must provide an
-implementation of it.
-The macro's ipconfigRAND32() and configRAND32() are not in use anymore. */
-BaseType_t xApplicationGetRandomNumber( uint32_t *pulNumber );
-
-/* For backward compatibility define old structure names to the newer equivalent
-structure name. */
-#ifndef ipconfigENABLE_BACKWARD_COMPATIBILITY
- #define ipconfigENABLE_BACKWARD_COMPATIBILITY 1
-#endif
-
-#if( ipconfigENABLE_BACKWARD_COMPATIBILITY == 1 )
- #define xIPStackEvent_t IPStackEvent_t
- #define xNetworkBufferDescriptor_t NetworkBufferDescriptor_t
- #define xMACAddress_t MACAddress_t
- #define xWinProperties_t WinProperties_t
- #define xSocket_t Socket_t
- #define xSocketSet_t SocketSet_t
- #define ipSIZE_OF_IP_HEADER ipSIZE_OF_IPv4_HEADER
-
- /* Since August 2016, the public types and fields below have changed name:
- abbreviations TCP/UDP are now written in capitals, and type names now end with "_t". */
- #define FOnConnected FOnConnected_t
- #define FOnTcpReceive FOnTCPReceive_t
- #define FOnTcpSent FOnTCPSent_t
- #define FOnUdpReceive FOnUDPReceive_t
- #define FOnUdpSent FOnUDPSent_t
-
- #define pOnTcpConnected pxOnTCPConnected
- #define pOnTcpReceive pxOnTCPReceive
- #define pOnTcpSent pxOnTCPSent
- #define pOnUdpReceive pxOnUDPReceive
- #define pOnUdpSent pxOnUDPSent
-
- #define FOnUdpSent FOnUDPSent_t
- #define FOnTcpSent FOnTCPSent_t
-#endif /* ipconfigENABLE_BACKWARD_COMPATIBILITY */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* FREERTOS_IP_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_IP_H
+#define FREERTOS_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "FreeRTOSIPConfigDefaults.h"
+#include "IPTraceMacroDefaults.h"
+
+/* Some constants defining the sizes of several parts of a packet */
+#define ipSIZE_OF_ETH_HEADER 14u
+#define ipSIZE_OF_IPv4_HEADER 20u
+#define ipSIZE_OF_IGMP_HEADER 8u
+#define ipSIZE_OF_ICMP_HEADER 8u
+#define ipSIZE_OF_UDP_HEADER 8u
+#define ipSIZE_OF_TCP_HEADER 20u
+
+
+/* The number of octets in the MAC and IP addresses respectively. */
+#define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )
+#define ipIP_ADDRESS_LENGTH_BYTES ( 4 )
+
+/* IP protocol definitions. */
+#define ipPROTOCOL_ICMP ( 1 )
+#define ipPROTOCOL_IGMP ( 2 )
+#define ipPROTOCOL_TCP ( 6 )
+#define ipPROTOCOL_UDP ( 17 )
+
+/* Dimensions the buffers that are filled by received Ethernet frames. */
+#define ipSIZE_OF_ETH_CRC_BYTES ( 4UL )
+#define ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES ( 4UL )
+#define ipTOTAL_ETHERNET_FRAME_SIZE ( ( ( uint32_t ) ipconfigNETWORK_MTU ) + ( ( uint32_t ) ipSIZE_OF_ETH_HEADER ) + ipSIZE_OF_ETH_CRC_BYTES + ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES )
+
+/*_RB_ Comment may need updating. */
+/* Space left at the beginning of a network buffer storage area to store a
+pointer back to the network buffer. Should be a multiple of 8 to ensure 8 byte
+alignment is maintained on architectures that require it.
+
+In order to get a 32-bit alignment of network packets, an offset of 2 bytes
+would be desirable, as defined by ipconfigPACKET_FILLER_SIZE. So the malloc'd
+buffer will have the following contents:
+ uint32_t pointer; // word-aligned
+ uchar_8 filler[6];
+ << ETH-header >> // half-word-aligned
+ uchar_8 dest[6]; // start of pucEthernetBuffer
+ uchar_8 dest[6];
+ uchar16_t type;
+ << IP-header >> // word-aligned
+ uint8_t ucVersionHeaderLength;
+ etc
+ */
+#if( ipconfigBUFFER_PADDING != 0 )
+ #define ipBUFFER_PADDING ipconfigBUFFER_PADDING
+#else
+ #define ipBUFFER_PADDING ( 8u + ipconfigPACKET_FILLER_SIZE )
+#endif
+
+/* The structure used to store buffers and pass them around the network stack.
+Buffers can be in use by the stack, in use by the network interface hardware
+driver, or free (not in use). */
+typedef struct xNETWORK_BUFFER
+{
+ ListItem_t xBufferListItem; /* Used to reference the buffer form the free buffer list or a socket. */
+ uint32_t ulIPAddress; /* Source or destination IP address, depending on usage scenario. */
+ uint8_t *pucEthernetBuffer; /* Pointer to the start of the Ethernet frame. */
+ size_t xDataLength; /* Starts by holding the total Ethernet frame length, then the UDP/TCP payload length. */
+ uint16_t usPort; /* Source or destination port, depending on usage scenario. */
+ uint16_t usBoundPort; /* The port to which a transmitting socket is bound. */
+ #if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )
+ struct xNETWORK_BUFFER *pxNextBuffer; /* Possible optimisation for expert users - requires network driver support. */
+ #endif
+} NetworkBufferDescriptor_t;
+
+#include "pack_struct_start.h"
+struct xMAC_ADDRESS
+{
+ uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];
+}
+#include "pack_struct_end.h"
+
+typedef struct xMAC_ADDRESS MACAddress_t;
+
+typedef enum eNETWORK_EVENTS
+{
+ eNetworkUp, /* The network is configured. */
+ eNetworkDown /* The network connection has been lost. */
+} eIPCallbackEvent_t;
+
+typedef enum ePING_REPLY_STATUS
+{
+ eSuccess = 0, /* A correct reply has been received for an outgoing ping. */
+ eInvalidChecksum, /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */
+ eInvalidData /* A reply was received to an outgoing ping but the payload of the reply was not correct. */
+} ePingReplyStatus_t;
+
+typedef enum eNETWORK_ADDRESS_TYPE
+{
+ eNetWorkAddressTypeIPV4,
+ eNetWorkAddressTypeIPV6,
+ eNetWorkAddressTypeHostName
+} eNetWorkAddressType_t;
+
+/* Endian related definitions. */
+#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
+
+ /* FreeRTOS_htons / FreeRTOS_htonl: some platforms might have built-in versions
+ using a single instruction so allow these versions to be overridden. */
+ #ifndef FreeRTOS_htons
+ #define FreeRTOS_htons( usIn ) ( (uint16_t) ( ( ( usIn ) << 8U ) | ( ( usIn ) >> 8U ) ) )
+ #endif
+
+ #ifndef FreeRTOS_htonl
+ #define FreeRTOS_htonl( ulIn ) \
+ ( \
+ ( uint32_t ) \
+ ( \
+ ( ( ( ( uint32_t ) ( ulIn ) ) ) << 24 ) | \
+ ( ( ( ( uint32_t ) ( ulIn ) ) & 0x0000ff00UL ) << 8 ) | \
+ ( ( ( ( uint32_t ) ( ulIn ) ) & 0x00ff0000UL ) >> 8 ) | \
+ ( ( ( ( uint32_t ) ( ulIn ) ) ) >> 24 ) \
+ ) \
+ )
+ #endif
+
+#else /* ipconfigBYTE_ORDER */
+
+ #define FreeRTOS_htons( x ) ( ( uint16_t ) ( x ) )
+ #define FreeRTOS_htonl( x ) ( ( uint32_t ) ( x ) )
+
+#endif /* ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN */
+
+#define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )
+#define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )
+
+#if( ipconfigHAS_INLINE_FUNCTIONS == 1 )
+
+ static portINLINE int32_t FreeRTOS_max_int32 (int32_t a, int32_t b);
+ static portINLINE uint32_t FreeRTOS_max_uint32 (uint32_t a, uint32_t b);
+ static portINLINE int32_t FreeRTOS_min_int32 (int32_t a, int32_t b);
+ static portINLINE uint32_t FreeRTOS_min_uint32 (uint32_t a, uint32_t b);
+ static portINLINE uint32_t FreeRTOS_round_up (uint32_t a, uint32_t d);
+ static portINLINE uint32_t FreeRTOS_round_down (uint32_t a, uint32_t d);
+ static portINLINE BaseType_t FreeRTOS_min_BaseType (BaseType_t a, BaseType_t b);
+ static portINLINE BaseType_t FreeRTOS_max_BaseType (BaseType_t a, BaseType_t b);
+ static portINLINE UBaseType_t FreeRTOS_max_UBaseType (UBaseType_t a, UBaseType_t b);
+ static portINLINE UBaseType_t FreeRTOS_min_UBaseType (UBaseType_t a, UBaseType_t b);
+
+
+ static portINLINE int32_t FreeRTOS_max_int32 (int32_t a, int32_t b) { return a >= b ? a : b; }
+ static portINLINE uint32_t FreeRTOS_max_uint32 (uint32_t a, uint32_t b) { return a >= b ? a : b; }
+ static portINLINE int32_t FreeRTOS_min_int32 (int32_t a, int32_t b) { return a <= b ? a : b; }
+ static portINLINE uint32_t FreeRTOS_min_uint32 (uint32_t a, uint32_t b) { return a <= b ? a : b; }
+ static portINLINE uint32_t FreeRTOS_round_up (uint32_t a, uint32_t d) { return d * ( ( a + d - 1u ) / d ); }
+ static portINLINE uint32_t FreeRTOS_round_down (uint32_t a, uint32_t d) { return d * ( a / d ); }
+
+ static portINLINE BaseType_t FreeRTOS_max_BaseType (BaseType_t a, BaseType_t b) { return a >= b ? a : b; }
+ static portINLINE UBaseType_t FreeRTOS_max_UBaseType (UBaseType_t a, UBaseType_t b) { return a >= b ? a : b; }
+ static portINLINE BaseType_t FreeRTOS_min_BaseType (BaseType_t a, BaseType_t b) { return a <= b ? a : b; }
+ static portINLINE UBaseType_t FreeRTOS_min_UBaseType (UBaseType_t a, UBaseType_t b) { return a <= b ? a : b; }
+
+#else
+
+ #define FreeRTOS_max_int32(a,b) ( ( ( int32_t ) ( a ) ) >= ( ( int32_t ) ( b ) ) ? ( ( int32_t ) ( a ) ) : ( ( int32_t ) ( b ) ) )
+ #define FreeRTOS_max_uint32(a,b) ( ( ( uint32_t ) ( a ) ) >= ( ( uint32_t ) ( b ) ) ? ( ( uint32_t ) ( a ) ) : ( ( uint32_t ) ( b ) ) )
+
+ #define FreeRTOS_min_int32(a,b) ( ( ( int32_t ) a ) <= ( ( int32_t ) b ) ? ( ( int32_t ) a ) : ( ( int32_t ) b ) )
+ #define FreeRTOS_min_uint32(a,b) ( ( ( uint32_t ) a ) <= ( ( uint32_t ) b ) ? ( ( uint32_t ) a ) : ( ( uint32_t ) b ) )
+
+ /* Round-up: a = d * ( ( a + d - 1 ) / d ) */
+ #define FreeRTOS_round_up(a,d) ( ( ( uint32_t ) ( d ) ) * ( ( ( ( uint32_t ) ( a ) ) + ( ( uint32_t ) ( d ) ) - 1UL ) / ( ( uint32_t ) ( d ) ) ) )
+ #define FreeRTOS_round_down(a,d) ( ( ( uint32_t ) ( d ) ) * ( ( ( uint32_t ) ( a ) ) / ( ( uint32_t ) ( d ) ) ) )
+
+ #define FreeRTOS_ms_to_tick(ms) ( ( ms * configTICK_RATE_HZ + 500 ) / 1000 )
+
+ #define FreeRTOS_max_BaseType(a, b) ( ( ( BaseType_t ) ( a ) ) >= ( ( BaseType_t ) ( b ) ) ? ( ( BaseType_t ) ( a ) ) : ( ( BaseType_t ) ( b ) ) )
+ #define FreeRTOS_max_UBaseType(a, b) ( ( ( UBaseType_t ) ( a ) ) >= ( ( UBaseType_t ) ( b ) ) ? ( ( UBaseType_t ) ( a ) ) : ( ( UBaseType_t ) ( b ) ) )
+ #define FreeRTOS_min_BaseType(a, b) ( ( ( BaseType_t ) ( a ) ) <= ( ( BaseType_t ) ( b ) ) ? ( ( BaseType_t ) ( a ) ) : ( ( BaseType_t ) ( b ) ) )
+ #define FreeRTOS_min_UBaseType(a, b) ( ( ( UBaseType_t ) ( a ) ) <= ( ( UBaseType_t ) ( b ) ) ? ( ( UBaseType_t ) ( a ) ) : ( ( UBaseType_t ) ( b ) ) )
+
+#endif /* ipconfigHAS_INLINE_FUNCTIONS */
+
+#define pdMS_TO_MIN_TICKS( xTimeInMs ) ( pdMS_TO_TICKS( ( xTimeInMs ) ) < ( ( TickType_t ) 1 ) ? ( ( TickType_t ) 1 ) : pdMS_TO_TICKS( ( xTimeInMs ) ) )
+
+#ifndef pdTRUE_SIGNED
+ /* Temporary solution: eventually the defines below will appear in 'Source\include\projdefs.h' */
+ #define pdTRUE_SIGNED pdTRUE
+ #define pdFALSE_SIGNED pdFALSE
+ #define pdTRUE_UNSIGNED ( ( UBaseType_t ) 1u )
+ #define pdFALSE_UNSIGNED ( ( UBaseType_t ) 0u )
+#endif
+
+/*
+ * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
+ * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
+ * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html
+ */
+BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
+ const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ],
+ const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
+ const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
+ const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
+
+void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );
+void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );
+void FreeRTOS_SetAddressConfiguration( const uint32_t *pulIPAddress, const uint32_t *pulNetMask, const uint32_t *pulGatewayAddress, const uint32_t *pulDNSServerAddress );
+BaseType_t FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, TickType_t xBlockTimeTicks );
+void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );
+const uint8_t * FreeRTOS_GetMACAddress( void );
+void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES] );
+void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );
+void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );
+uint32_t FreeRTOS_GetIPAddress( void );
+void FreeRTOS_SetIPAddress( uint32_t ulIPAddress );
+void FreeRTOS_SetNetmask( uint32_t ulNetmask );
+void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress );
+uint32_t FreeRTOS_GetGatewayAddress( void );
+uint32_t FreeRTOS_GetDNSServerAddress( void );
+uint32_t FreeRTOS_GetNetmask( void );
+void FreeRTOS_OutputARPRequest( uint32_t ulIPAddress );
+BaseType_t FreeRTOS_IsNetworkUp( void );
+
+#if( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
+ UBaseType_t uxGetMinimumIPQueueSpace( void );
+#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_.
+ * Socket has had activity, reset the timer so it will not be closed
+ * because of inactivity
+ */
+const char *FreeRTOS_GetTCPStateName( UBaseType_t ulState);
+
+/* _HT_ Temporary: show all valid ARP entries
+ */
+void FreeRTOS_PrintARPCache( void );
+void FreeRTOS_ClearARP( void );
+
+#if( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
+
+ /* DHCP has an option for clients to register their hostname. It doesn't
+ have much use, except that a device can be found in a router along with its
+ name. If this option is used the callback below must be provided by the
+ application writer to return a const string, denoting the device's name. */
+ const char *pcApplicationHostnameHook( void );
+
+#endif /* ipconfigDHCP_REGISTER_HOSTNAME */
+
+
+/* This xApplicationGetRandomNumber() will set *pulNumber to a random number,
+and return pdTRUE. When the random number generator is broken, it shall return
+pdFALSE.
+The function is defined in 'iot_secure_sockets.c'.
+If that module is not included in the project, the application must provide an
+implementation of it.
+The macro's ipconfigRAND32() and configRAND32() are not in use anymore. */
+BaseType_t xApplicationGetRandomNumber( uint32_t *pulNumber );
+
+/* For backward compatibility define old structure names to the newer equivalent
+structure name. */
+#ifndef ipconfigENABLE_BACKWARD_COMPATIBILITY
+ #define ipconfigENABLE_BACKWARD_COMPATIBILITY 1
+#endif
+
+#if( ipconfigENABLE_BACKWARD_COMPATIBILITY == 1 )
+ #define xIPStackEvent_t IPStackEvent_t
+ #define xNetworkBufferDescriptor_t NetworkBufferDescriptor_t
+ #define xMACAddress_t MACAddress_t
+ #define xWinProperties_t WinProperties_t
+ #define xSocket_t Socket_t
+ #define xSocketSet_t SocketSet_t
+ #define ipSIZE_OF_IP_HEADER ipSIZE_OF_IPv4_HEADER
+
+ /* Since August 2016, the public types and fields below have changed name:
+ abbreviations TCP/UDP are now written in capitals, and type names now end with "_t". */
+ #define FOnConnected FOnConnected_t
+ #define FOnTcpReceive FOnTCPReceive_t
+ #define FOnTcpSent FOnTCPSent_t
+ #define FOnUdpReceive FOnUDPReceive_t
+ #define FOnUdpSent FOnUDPSent_t
+
+ #define pOnTcpConnected pxOnTCPConnected
+ #define pOnTcpReceive pxOnTCPReceive
+ #define pOnTcpSent pxOnTCPSent
+ #define pOnUdpReceive pxOnUDPReceive
+ #define pOnUdpSent pxOnUDPSent
+
+ #define FOnUdpSent FOnUDPSent_t
+ #define FOnTcpSent FOnTCPSent_t
+#endif /* ipconfigENABLE_BACKWARD_COMPATIBILITY */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* FREERTOS_IP_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h
index 8604abed0..0d8c03872 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h
@@ -1,827 +1,827 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_IP_PRIVATE_H
-#define FREERTOS_IP_PRIVATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "FreeRTOSIPConfigDefaults.h"
-#include "FreeRTOS_Sockets.h"
-#include "IPTraceMacroDefaults.h"
-#include "FreeRTOS_Stream_Buffer.h"
-#if( ipconfigUSE_TCP == 1 )
- #include "FreeRTOS_TCP_WIN.h"
- #include "FreeRTOS_TCP_IP.h"
-#endif
-
-#include "event_groups.h"
-
-typedef struct xNetworkAddressingParameters
-{
- uint32_t ulDefaultIPAddress;
- uint32_t ulNetMask;
- uint32_t ulGatewayAddress;
- uint32_t ulDNSServerAddress;
- uint32_t ulBroadcastAddress;
-} NetworkAddressingParameters_t;
-
-extern BaseType_t xTCPWindowLoggingLevel;
-
-/*-----------------------------------------------------------*/
-/* Protocol headers. */
-/*-----------------------------------------------------------*/
-
-#include "pack_struct_start.h"
-struct xETH_HEADER
-{
- MACAddress_t xDestinationAddress; /* 0 + 6 = 6 */
- MACAddress_t xSourceAddress; /* 6 + 6 = 12 */
- uint16_t usFrameType; /* 12 + 2 = 14 */
-}
-#include "pack_struct_end.h"
-typedef struct xETH_HEADER EthernetHeader_t;
-
-#include "pack_struct_start.h"
-struct xARP_HEADER
-{
- uint16_t usHardwareType; /* 0 + 2 = 2 */
- uint16_t usProtocolType; /* 2 + 2 = 4 */
- uint8_t ucHardwareAddressLength; /* 4 + 1 = 5 */
- uint8_t ucProtocolAddressLength; /* 5 + 1 = 6 */
- uint16_t usOperation; /* 6 + 2 = 8 */
- MACAddress_t xSenderHardwareAddress; /* 8 + 6 = 14 */
- uint8_t ucSenderProtocolAddress[ 4 ]; /* 14 + 4 = 18 */
- MACAddress_t xTargetHardwareAddress; /* 18 + 6 = 24 */
- uint32_t ulTargetProtocolAddress; /* 24 + 4 = 28 */
-}
-#include "pack_struct_end.h"
-typedef struct xARP_HEADER ARPHeader_t;
-
-#include "pack_struct_start.h"
-struct xIP_HEADER
-{
- uint8_t ucVersionHeaderLength; /* 0 + 1 = 1 */
- uint8_t ucDifferentiatedServicesCode; /* 1 + 1 = 2 */
- uint16_t usLength; /* 2 + 2 = 4 */
- uint16_t usIdentification; /* 4 + 2 = 6 */
- uint16_t usFragmentOffset; /* 6 + 2 = 8 */
- uint8_t ucTimeToLive; /* 8 + 1 = 9 */
- uint8_t ucProtocol; /* 9 + 1 = 10 */
- uint16_t usHeaderChecksum; /* 10 + 2 = 12 */
- uint32_t ulSourceIPAddress; /* 12 + 4 = 16 */
- uint32_t ulDestinationIPAddress; /* 16 + 4 = 20 */
-}
-#include "pack_struct_end.h"
-typedef struct xIP_HEADER IPHeader_t;
-
-#include "pack_struct_start.h"
-struct xIGMP_HEADER
-{
- uint8_t ucVersionType; /* 0 + 1 = 1 */
- uint8_t ucMaxResponseTime; /* 1 + 1 = 2 */
- uint16_t usChecksum; /* 2 + 2 = 4 */
- uint32_t usGroupAddress; /* 4 + 4 = 8 */
-}
-#include "pack_struct_end.h"
-typedef struct xIGMP_HEADER IGMPHeader_t;
-
-#include "pack_struct_start.h"
-struct xICMP_HEADER
-{
- uint8_t ucTypeOfMessage; /* 0 + 1 = 1 */
- uint8_t ucTypeOfService; /* 1 + 1 = 2 */
- uint16_t usChecksum; /* 2 + 2 = 4 */
- uint16_t usIdentifier; /* 4 + 2 = 6 */
- uint16_t usSequenceNumber; /* 6 + 2 = 8 */
-}
-#include "pack_struct_end.h"
-typedef struct xICMP_HEADER ICMPHeader_t;
-
-#include "pack_struct_start.h"
-struct xUDP_HEADER
-{
- uint16_t usSourcePort; /* 0 + 2 = 2 */
- uint16_t usDestinationPort; /* 2 + 2 = 4 */
- uint16_t usLength; /* 4 + 2 = 6 */
- uint16_t usChecksum; /* 6 + 2 = 8 */
-}
-#include "pack_struct_end.h"
-typedef struct xUDP_HEADER UDPHeader_t;
-
-#include "pack_struct_start.h"
-struct xTCP_HEADER
-{
- uint16_t usSourcePort; /* + 2 = 2 */
- uint16_t usDestinationPort; /* + 2 = 4 */
- uint32_t ulSequenceNumber; /* + 4 = 8 */
- uint32_t ulAckNr; /* + 4 = 12 */
- uint8_t ucTCPOffset; /* + 1 = 13 */
- uint8_t ucTCPFlags; /* + 1 = 14 */
- uint16_t usWindow; /* + 2 = 15 */
- uint16_t usChecksum; /* + 2 = 18 */
- uint16_t usUrgent; /* + 2 = 20 */
-#if ipconfigUSE_TCP == 1
- /* the option data is not a part of the TCP header */
- uint8_t ucOptdata[ipSIZE_TCP_OPTIONS]; /* + 12 = 32 */
-#endif
-}
-#include "pack_struct_end.h"
-typedef struct xTCP_HEADER TCPHeader_t;
-
-#include "pack_struct_start.h"
-struct xPSEUDO_HEADER
-{
- uint32_t ulSourceAddress;
- uint32_t ulDestinationAddress;
- uint8_t ucZeros;
- uint8_t ucProtocol;
- uint16_t usUDPLength;
-}
-#include "pack_struct_end.h"
-typedef struct xPSEUDO_HEADER PseudoHeader_t;
-
-/*-----------------------------------------------------------*/
-/* Nested protocol packets. */
-/*-----------------------------------------------------------*/
-
-#include "pack_struct_start.h"
-struct xARP_PACKET
-{
- EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
- ARPHeader_t xARPHeader; /* 14 + 28 = 42 */
-}
-#include "pack_struct_end.h"
-typedef struct xARP_PACKET ARPPacket_t;
-
-#include "pack_struct_start.h"
-struct xIP_PACKET
-{
- EthernetHeader_t xEthernetHeader;
- IPHeader_t xIPHeader;
-}
-#include "pack_struct_end.h"
-typedef struct xIP_PACKET IPPacket_t;
-
-#include "pack_struct_start.h"
-struct xICMP_PACKET
-{
- EthernetHeader_t xEthernetHeader;
- IPHeader_t xIPHeader;
- ICMPHeader_t xICMPHeader;
-}
-#include "pack_struct_end.h"
-typedef struct xICMP_PACKET ICMPPacket_t;
-
-#include "pack_struct_start.h"
-struct xUDP_PACKET
-{
- EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
- IPHeader_t xIPHeader; /* 14 + 20 = 34 */
- UDPHeader_t xUDPHeader; /* 34 + 8 = 42 */
-}
-#include "pack_struct_end.h"
-typedef struct xUDP_PACKET UDPPacket_t;
-
-#include "pack_struct_start.h"
-struct xTCP_PACKET
-{
- EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
- IPHeader_t xIPHeader; /* 14 + 20 = 34 */
- TCPHeader_t xTCPHeader; /* 34 + 32 = 66 */
-}
-#include "pack_struct_end.h"
-typedef struct xTCP_PACKET TCPPacket_t;
-
-typedef union XPROT_PACKET
-{
- ARPPacket_t xARPPacket;
- TCPPacket_t xTCPPacket;
- UDPPacket_t xUDPPacket;
- ICMPPacket_t xICMPPacket;
-} ProtocolPacket_t;
-
-
-/* The maximum UDP payload length. */
-#define ipMAX_UDP_PAYLOAD_LENGTH ( ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv4_HEADER ) - ipSIZE_OF_UDP_HEADER )
-
-typedef enum
-{
- eReleaseBuffer = 0, /* Processing the frame did not find anything to do - just release the buffer. */
- eProcessBuffer, /* An Ethernet frame has a valid address - continue process its contents. */
- eReturnEthernetFrame, /* The Ethernet frame contains an ARP or ICMP packet that can be returned to its source. */
- eFrameConsumed /* Processing the Ethernet packet contents resulted in the payload being sent to the stack. */
-} eFrameProcessingResult_t;
-
-typedef enum
-{
- eNoEvent = -1,
- eNetworkDownEvent, /* 0: The network interface has been lost and/or needs [re]connecting. */
- eNetworkRxEvent, /* 1: The network interface has queued a received Ethernet frame. */
- eNetworkTxEvent, /* 2: Let the IP-task send a network packet. */
- eARPTimerEvent, /* 3: The ARP timer expired. */
- eStackTxEvent, /* 4: The software stack has queued a packet to transmit. */
- eDHCPEvent, /* 5: Process the DHCP state machine. */
- eTCPTimerEvent, /* 6: See if any TCP socket needs attention. */
- eTCPAcceptEvent, /* 7: Client API FreeRTOS_accept() waiting for client connections. */
- eTCPNetStat, /* 8: IP-task is asked to produce a netstat listing. */
- eSocketBindEvent, /* 9: Send a message to the IP-task to bind a socket to a port. */
- eSocketCloseEvent, /*10: Send a message to the IP-task to close a socket. */
- eSocketSelectEvent, /*11: Send a message to the IP-task for select(). */
- eSocketSignalEvent, /*12: A socket must be signalled. */
-} eIPEvent_t;
-
-typedef struct IP_TASK_COMMANDS
-{
- eIPEvent_t eEventType;
- void *pvData;
-} IPStackEvent_t;
-
-#define ipBROADCAST_IP_ADDRESS 0xffffffffUL
-
-/* Offset into the Ethernet frame that is used to temporarily store information
-on the fragmentation status of the packet being sent. The value is important,
-as it is past the location into which the destination address will get placed. */
-#define ipFRAGMENTATION_PARAMETERS_OFFSET ( 6 )
-#define ipSOCKET_OPTIONS_OFFSET ( 6 )
-
-/* Only used when outgoing fragmentation is being used (FreeRTOSIPConfig.h
-setting. */
-#define ipGET_UDP_PAYLOAD_OFFSET_FOR_FRAGMENT( usFragmentOffset ) ( ( ( usFragmentOffset ) == 0 ) ? ipUDP_PAYLOAD_OFFSET_IPv4 : ipIP_PAYLOAD_OFFSET )
-
-/* The offset into a UDP packet at which the UDP data (payload) starts. */
-#define ipUDP_PAYLOAD_OFFSET_IPv4 ( sizeof( UDPPacket_t ) )
-
-/* The offset into an IP packet into which the IP data (payload) starts. */
-#define ipIP_PAYLOAD_OFFSET ( sizeof( IPPacket_t ) )
-
-#include "pack_struct_start.h"
-struct xUDP_IP_FRAGMENT_PARAMETERS
-{
- uint8_t ucSocketOptions;
- uint8_t ucPadFor16BitAlignment;
- uint16_t usFragmentedPacketOffset;
- uint16_t usFragmentLength;
- uint16_t usPayloadChecksum;
-}
-#include "pack_struct_end.h"
-typedef struct xUDP_IP_FRAGMENT_PARAMETERS IPFragmentParameters_t;
-
-#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
-
- /* Ethernet frame types. */
- #define ipARP_FRAME_TYPE ( 0x0608U )
- #define ipIPv4_FRAME_TYPE ( 0x0008U )
-
- /* ARP related definitions. */
- #define ipARP_PROTOCOL_TYPE ( 0x0008U )
- #define ipARP_HARDWARE_TYPE_ETHERNET ( 0x0100U )
- #define ipARP_REQUEST ( 0x0100U )
- #define ipARP_REPLY ( 0x0200U )
-
-#else
-
- /* Ethernet frame types. */
- #define ipARP_FRAME_TYPE ( 0x0806U )
- #define ipIPv4_FRAME_TYPE ( 0x0800U )
-
- /* ARP related definitions. */
- #define ipARP_PROTOCOL_TYPE ( 0x0800U )
- #define ipARP_HARDWARE_TYPE_ETHERNET ( 0x0001U )
- #define ipARP_REQUEST ( 0x0001 )
- #define ipARP_REPLY ( 0x0002 )
-
-#endif /* ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN */
-
-
-/* For convenience, a MAC address of all zeros and another of all 0xffs are
-defined const for quick reference. */
-extern const MACAddress_t xBroadcastMACAddress; /* all 0xff's */
-extern uint16_t usPacketIdentifier;
-
-/* Define a default UDP packet header (declared in FreeRTOS_UDP_IP.c) */
-typedef union xUDPPacketHeader
-{
- uint8_t ucBytes[24];
- uint32_t ulWords[6];
-} UDPPacketHeader_t;
-extern UDPPacketHeader_t xDefaultPartUDPPacketHeader;
-
-/* Structure that stores the netmask, gateway address and DNS server addresses. */
-extern NetworkAddressingParameters_t xNetworkAddressing;
-
-/* Structure that stores the defaults for netmask, gateway address and DNS.
-These values will be copied to 'xNetworkAddressing' in case DHCP is not used,
-and also in case DHCP does not lead to a confirmed request. */
-extern NetworkAddressingParameters_t xDefaultAddressing;
-
-/* True when BufferAllocation_1.c was included, false for BufferAllocation_2.c */
-extern const BaseType_t xBufferAllocFixedSize;
-
-/* Defined in FreeRTOS_Sockets.c */
-#if ( ipconfigUSE_TCP == 1 )
- extern List_t xBoundTCPSocketsList;
-#endif
-
-/* The local IP address is accessed from within xDefaultPartUDPPacketHeader,
-rather than duplicated in its own variable. */
-#define ipLOCAL_IP_ADDRESS_POINTER ( ( uint32_t * ) &( xDefaultPartUDPPacketHeader.ulWords[ 20u / sizeof(uint32_t) ] ) )
-
-/* The local MAC address is accessed from within xDefaultPartUDPPacketHeader,
-rather than duplicated in its own variable. */
-#define ipLOCAL_MAC_ADDRESS ( &xDefaultPartUDPPacketHeader.ucBytes[0] )
-
-/* ICMP packets are sent using the same function as UDP packets. The port
-number is used to distinguish between the two, as 0 is an invalid UDP port. */
-#define ipPACKET_CONTAINS_ICMP_DATA ( 0 )
-
-/* For now, the lower 8 bits in 'xEventBits' will be reserved for the above
-socket events. */
-#define SOCKET_EVENT_BIT_COUNT 8
-
-#define vSetField16( pxBase, xType, xField, usValue ) \
-{ \
- ( ( uint8_t* )( pxBase ) ) [ offsetof( xType, xField ) + 0 ] = ( uint8_t ) ( ( usValue ) >> 8 ); \
- ( ( uint8_t* )( pxBase ) ) [ offsetof( xType, xField ) + 1 ] = ( uint8_t ) ( ( usValue ) & 0xff ); \
-}
-
-#define vSetField32( pxBase, xType, xField, ulValue ) \
-{ \
- ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 0 ] = ( uint8_t ) ( ( ulValue ) >> 24 ); \
- ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 1 ] = ( uint8_t ) ( ( ( ulValue ) >> 16 ) & 0xff ); \
- ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 2 ] = ( uint8_t ) ( ( ( ulValue ) >> 8 ) & 0xff ); \
- ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 3 ] = ( uint8_t ) ( ( ulValue ) & 0xff ); \
-}
-
-#define vFlip_16( left, right ) \
- do { \
- uint16_t tmp = (left); \
- (left) = (right); \
- (right) = tmp; \
- } while (0)
-
-#define vFlip_32( left, right ) \
- do { \
- uint32_t tmp = (left); \
- (left) = (right); \
- (right) = tmp; \
- } while (0)
-
-#ifndef ARRAY_SIZE
- #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
- * goes down thereafter. The network interface hardware driver is responsible
- * for sending the message that contains the network interface down command/
- * event.
- *
- * Only use the FreeRTOS_NetworkDownFromISR() version if the function is to be
- * called from an interrupt service routine. If FreeRTOS_NetworkDownFromISR()
- * returns a non-zero value then a context switch should be performed ebfore
- * the interrupt is exited.
- */
-void FreeRTOS_NetworkDown( void );
-BaseType_t FreeRTOS_NetworkDownFromISR( void );
-
-/*
- * Processes incoming ARP packets.
- */
-eFrameProcessingResult_t eARPProcessPacket( ARPPacket_t * const pxARPFrame );
-
-/*
- * Inspect an Ethernet frame to see if it contains data that the stack needs to
- * process. eProcessBuffer is returned if the frame should be processed by the
- * stack. eReleaseBuffer is returned if the frame should be discarded.
- */
-eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucEthernetBuffer );
-
-/*
- * Return the checksum generated over xDataLengthBytes from pucNextData.
- */
-uint16_t usGenerateChecksum( uint32_t ulSum, const uint8_t * pucNextData, size_t uxDataLengthBytes );
-
-/* Socket related private functions. */
-
-/*
- * The caller must ensure that pxNetworkBuffer->xDataLength is the UDP packet
- * payload size (excluding packet headers) and that the packet in pucEthernetBuffer
- * is at least the size of UDPPacket_t.
- */
-BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort );
-
-/*
- * Initialize the socket list data structures for TCP and UDP.
- */
-BaseType_t vNetworkSocketsInit( void );
-
-/*
- * Returns pdTRUE if the IP task has been created and is initialised. Otherwise
- * returns pdFALSE.
- */
-BaseType_t xIPIsNetworkTaskReady( void );
-
-#if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
- struct xSOCKET;
- typedef void (*SocketWakeupCallback_t)( struct xSOCKET * pxSocket );
-#endif
-
-#if( ipconfigUSE_TCP == 1 )
-
- /*
- * Actually a user thing, but because xBoundTCPSocketsList, let it do by the
- * IP-task
- */
- void vTCPNetStat( void );
-
- /*
- * At least one socket needs to check for timeouts
- */
- TickType_t xTCPTimerCheck( BaseType_t xWillSleep );
-
- /* Every TCP socket has a buffer space just big enough to store
- the last TCP header received.
- As a reference of this field may be passed to DMA, force the
- alignment to 8 bytes. */
- typedef union
- {
- struct
- {
- /* Increase the alignment of this union by adding a 64-bit variable. */
- uint64_t ullAlignmentWord;
- } a;
- struct
- {
- /* The next field only serves to give 'ucLastPacket' a correct
- alignment of 8 + 2. See comments in FreeRTOS_IP.h */
- uint8_t ucFillPacket[ ipconfigPACKET_FILLER_SIZE ];
- uint8_t ucLastPacket[ sizeof( TCPPacket_t ) ];
- } u;
- } LastTCPPacket_t;
-
- /*
- * Note that the values of all short and long integers in these structs
- * are being stored in the native-endian way
- * Translation should take place when accessing any structure which defines
- * network packets, such as IPHeader_t and TCPHeader_t
- */
- typedef struct TCPSOCKET
- {
- uint32_t ulRemoteIP; /* IP address of remote machine */
- uint16_t usRemotePort; /* Port on remote machine */
- struct {
- /* Most compilers do like bit-flags */
- uint32_t
- bMssChange : 1, /* This socket has seen a change in MSS */
- bPassAccept : 1, /* when true, this socket may be returned in a call to accept() */
- bPassQueued : 1, /* when true, this socket is an orphan until it gets connected
- * Why an orphan? Because it may not be returned in a accept() call until it
- * gets the state eESTABLISHED */
- bReuseSocket : 1, /* When a listening socket gets a connection, do not create a new instance but keep on using it */
- bCloseAfterSend : 1,/* As soon as the last byte has been transmitted, finalise the connection
- * Useful in e.g. FTP connections, where the last data bytes are sent along with the FIN flag */
- bUserShutdown : 1, /* User requesting a graceful shutdown */
- bCloseRequested : 1,/* Request to finalise the connection */
- bLowWater : 1, /* high-water level has been reached. Cleared as soon as 'rx-count < lo-water' */
- bWinChange : 1, /* The value of bLowWater has changed, must send a window update */
- bSendKeepAlive : 1, /* When this flag is true, a TCP keep-alive message must be send */
- bWaitKeepAlive : 1, /* When this flag is true, a TCP keep-alive reply is expected */
- bConnPrepared : 1, /* Connecting socket: Message has been prepared */
- #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
- bConnPassed : 1, /* Connecting socket: Socket has been passed in a successful select() */
- #endif /* ipconfigSUPPORT_SELECT_FUNCTION */
- bFinAccepted : 1, /* This socket has received (or sent) a FIN and accepted it */
- bFinSent : 1, /* We've sent out a FIN */
- bFinRecv : 1, /* We've received a FIN from our peer */
- bFinAcked : 1, /* Our FIN packet has been acked */
- bFinLast : 1, /* The last ACK (after FIN and FIN+ACK) has been sent or will be sent by the peer */
- bRxStopped : 1, /* Application asked to temporarily stop reception */
- bMallocError : 1, /* There was an error allocating a stream */
- bWinScaling : 1; /* A TCP-Window Scaling option was offered and accepted in the SYN phase. */
- } bits;
- uint32_t ulHighestRxAllowed;
- /* The highest sequence number that we can receive at any moment */
- uint16_t usTimeout; /* Time (in ticks) after which this socket needs attention */
- uint16_t usCurMSS; /* Current Maximum Segment Size */
- uint16_t usInitMSS; /* Initial maximum segment Size */
- uint16_t usChildCount; /* In case of a listening socket: number of connections on this port number */
- uint16_t usBacklog; /* In case of a listening socket: maximum number of concurrent connections on this port number */
- uint8_t ucRepCount; /* Send repeat count, for retransmissions
- * This counter is separate from the xmitCount in the
- * TCP win segments */
- uint8_t ucTCPState; /* TCP state: see eTCP_STATE */
- struct xSOCKET *pxPeerSocket; /* for server socket: child, for child socket: parent */
- #if( ipconfigTCP_KEEP_ALIVE == 1 )
- uint8_t ucKeepRepCount;
- TickType_t xLastAliveTime;
- #endif /* ipconfigTCP_KEEP_ALIVE */
- #if( ipconfigTCP_HANG_PROTECTION == 1 )
- TickType_t xLastActTime;
- #endif /* ipconfigTCP_HANG_PROTECTION */
- size_t uxLittleSpace;
- size_t uxEnoughSpace;
- size_t uxRxStreamSize;
- size_t uxTxStreamSize;
- StreamBuffer_t *rxStream;
- StreamBuffer_t *txStream;
- #if( ipconfigUSE_TCP_WIN == 1 )
- NetworkBufferDescriptor_t *pxAckMessage;
- #endif /* ipconfigUSE_TCP_WIN */
- /* Buffer space to store the last TCP header received. */
- LastTCPPacket_t xPacket;
- uint8_t tcpflags; /* TCP flags */
- #if( ipconfigUSE_TCP_WIN != 0 )
- uint8_t ucMyWinScaleFactor;
- uint8_t ucPeerWinScaleFactor;
- #endif
- #if( ipconfigUSE_CALLBACKS == 1 )
- FOnTCPReceive_t pxHandleReceive; /*
- * In case of a TCP socket:
- * typedef void (* FOnTCPReceive_t) (Socket_t xSocket, void *pData, size_t xLength );
- */
- FOnTCPSent_t pxHandleSent;
- FOnConnected_t pxHandleConnected; /* Actually type: typedef void (* FOnConnected_t) (Socket_t xSocket, BaseType_t ulConnected ); */
- #endif /* ipconfigUSE_CALLBACKS */
- uint32_t ulWindowSize; /* Current Window size advertised by peer */
- size_t uxRxWinSize; /* Fixed value: size of the TCP reception window */
- size_t uxTxWinSize; /* Fixed value: size of the TCP transmit window */
-
- TCPWindow_t xTCPWindow;
- } IPTCPSocket_t;
-
-#endif /* ipconfigUSE_TCP */
-
-typedef struct UDPSOCKET
-{
- List_t xWaitingPacketsList; /* Incoming packets */
- #if( ipconfigUDP_MAX_RX_PACKETS > 0 )
- UBaseType_t uxMaxPackets; /* Protection: limits the number of packets buffered per socket */
- #endif /* ipconfigUDP_MAX_RX_PACKETS */
- #if( ipconfigUSE_CALLBACKS == 1 )
- FOnUDPReceive_t pxHandleReceive; /*
- * In case of a UDP socket:
- * typedef void (* FOnUDPReceive_t) (Socket_t xSocket, void *pData, size_t xLength, struct freertos_sockaddr *pxAddr );
- */
- FOnUDPSent_t pxHandleSent;
- #endif /* ipconfigUSE_CALLBACKS */
-} IPUDPSocket_t;
-
-typedef enum eSOCKET_EVENT {
- eSOCKET_RECEIVE = 0x0001,
- eSOCKET_SEND = 0x0002,
- eSOCKET_ACCEPT = 0x0004,
- eSOCKET_CONNECT = 0x0008,
- eSOCKET_BOUND = 0x0010,
- eSOCKET_CLOSED = 0x0020,
- eSOCKET_INTR = 0x0040,
- eSOCKET_ALL = 0x007F,
-} eSocketEvent_t;
-
-typedef struct xSOCKET
-{
- EventBits_t xEventBits;
- EventGroupHandle_t xEventGroup;
-
- ListItem_t xBoundSocketListItem; /* Used to reference the socket from a bound sockets list. */
- TickType_t xReceiveBlockTime; /* if recv[to] is called while no data is available, wait this amount of time. Unit in clock-ticks */
- TickType_t xSendBlockTime; /* if send[to] is called while there is not enough space to send, wait this amount of time. Unit in clock-ticks */
-
- uint16_t usLocalPort; /* Local port on this machine */
- uint8_t ucSocketOptions;
- uint8_t ucProtocol; /* choice of FREERTOS_IPPROTO_UDP/TCP */
- #if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )
- SemaphoreHandle_t pxUserSemaphore;
- #endif /* ipconfigSOCKET_HAS_USER_SEMAPHORE */
- #if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
- SocketWakeupCallback_t pxUserWakeCallback;
- #endif /* ipconfigSOCKET_HAS_USER_WAKE_CALLBACK */
-
- #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
- struct xSOCKET_SET *pxSocketSet;
- /* User may indicate which bits are interesting for this socket. */
- EventBits_t xSelectBits;
- /* These bits indicate the events which have actually occurred.
- They are maintained by the IP-task */
- EventBits_t xSocketBits;
- #endif /* ipconfigSUPPORT_SELECT_FUNCTION */
- /* TCP/UDP specific fields: */
- /* Before accessing any member of this structure, it should be confirmed */
- /* that the protocol corresponds with the type of structure */
-
- union
- {
- IPUDPSocket_t xUDP;
- #if( ipconfigUSE_TCP == 1 )
- IPTCPSocket_t xTCP;
- /* Make sure that xTCP is 8-bytes aligned by
- declaring a 64-bit variable in the same union */
- uint64_t ullTCPAlignment;
- #endif /* ipconfigUSE_TCP */
- } u;
-} FreeRTOS_Socket_t;
-
-#if( ipconfigUSE_TCP == 1 )
- /*
- * Lookup a TCP socket, using a multiple matching: both port numbers and
- * return IP address.
- */
- FreeRTOS_Socket_t *pxTCPSocketLookup( uint32_t ulLocalIP, UBaseType_t uxLocalPort, uint32_t ulRemoteIP, UBaseType_t uxRemotePort );
-
-#endif /* ipconfigUSE_TCP */
-
-/*
- * Look up a local socket by finding a match with the local port.
- */
-FreeRTOS_Socket_t *pxUDPSocketLookup( UBaseType_t uxLocalPort );
-
-/*
- * Called when the application has generated a UDP packet to send.
- */
-void vProcessGeneratedUDPPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
-
-/*
- * Calculate the upper-layer checksum
- * Works both for UDP, ICMP and TCP packages
- * bOut = true: checksum will be set in outgoing packets
- * bOut = false: checksum will be calculated for incoming packets
- * returning 0xffff means: checksum was correct
- */
-uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket );
-
-/*
- * An Ethernet frame has been updated (maybe it was an ARP request or a PING
- * request?) and is to be sent back to its source.
- */
-void vReturnEthernetFrame( NetworkBufferDescriptor_t * pxNetworkBuffer, BaseType_t xReleaseAfterSend );
-
-/*
- * The internal version of bind()
- * If 'ulInternal' is true, it is called by the driver
- * The TCP driver needs to bind a socket at the moment a listening socket
- * creates a new connected socket
- */
-BaseType_t vSocketBind( FreeRTOS_Socket_t *pxSocket, struct freertos_sockaddr * pxAddress, size_t uxAddressLength, BaseType_t xInternal );
-
-/*
- * Internal function to add streaming data to a TCP socket. If ulIn == true,
- * data will be added to the rxStream, otherwise to the tXStream. Normally data
- * will be written with ulOffset == 0, meaning: at the end of the FIFO. When
- * packet come in out-of-order, an offset will be used to put it in front and
- * the head will not change yet.
- */
-int32_t lTCPAddRxdata(FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount);
-
-/*
- * Currently called for any important event.
- */
-void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket );
-
-/*
- * Some helping function, their meaning should be clear
- */
-static portINLINE uint32_t ulChar2u32 (const uint8_t *apChr);
-static portINLINE uint32_t ulChar2u32 (const uint8_t *apChr)
-{
- return ( ( ( uint32_t )apChr[0] ) << 24) |
- ( ( ( uint32_t )apChr[1] ) << 16) |
- ( ( ( uint32_t )apChr[2] ) << 8) |
- ( ( ( uint32_t )apChr[3] ) );
-}
-
-static portINLINE uint16_t usChar2u16 (const uint8_t *apChr);
-static portINLINE uint16_t usChar2u16 (const uint8_t *apChr)
-{
- return ( uint16_t )
- ( ( ( ( uint32_t )apChr[0] ) << 8) |
- ( ( ( uint32_t )apChr[1] ) ) );
-}
-
-/* Check a single socket for retransmissions and timeouts */
-BaseType_t xTCPSocketCheck( FreeRTOS_Socket_t *pxSocket );
-
-BaseType_t xTCPCheckNewClient( FreeRTOS_Socket_t *pxSocket );
-
-/* Defined in FreeRTOS_Sockets.c
- * Close a socket
- */
-void *vSocketClose( FreeRTOS_Socket_t *pxSocket );
-
-/*
- * Send the event eEvent to the IP task event queue, using a block time of
- * zero. Return pdPASS if the message was sent successfully, otherwise return
- * pdFALSE.
-*/
-BaseType_t xSendEventToIPTask( eIPEvent_t eEvent );
-
-/*
- * The same as above, but a struct as a parameter, containing:
- * eIPEvent_t eEventType;
- * void *pvData;
- */
-BaseType_t xSendEventStructToIPTask( const IPStackEvent_t *pxEvent, TickType_t xTimeout );
-
-/*
- * Returns a pointer to the original NetworkBuffer from a pointer to a UDP
- * payload buffer.
- */
-NetworkBufferDescriptor_t *pxUDPPayloadBuffer_to_NetworkBuffer( void *pvBuffer );
-
-#if( ipconfigZERO_COPY_TX_DRIVER != 0 )
- /*
- * For the case where the network driver passes a buffer directly to a DMA
- * descriptor, this function can be used to translate a 'network buffer' to
- * a 'network buffer descriptor'.
- */
- NetworkBufferDescriptor_t *pxPacketBuffer_to_NetworkBuffer( const void *pvBuffer );
-#endif
-
-/*
- * Internal: Sets a new state for a TCP socket and performs the necessary
- * actions like calling a OnConnected handler to notify the socket owner.
- */
-#if( ipconfigUSE_TCP == 1 )
- void vTCPStateChange( FreeRTOS_Socket_t *pxSocket, enum eTCP_STATE eTCPState );
-#endif /* ipconfigUSE_TCP */
-
-/*_RB_ Should this be part of the public API? */
-void FreeRTOS_netstat( void );
-
-/* Returns pdTRUE is this function is called from the IP-task */
-BaseType_t xIsCallingFromIPTask( void );
-
-#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
-
-typedef struct xSOCKET_SET
-{
- EventGroupHandle_t xSelectGroup;
- BaseType_t bApiCalled; /* True if the API was calling the private vSocketSelect */
- FreeRTOS_Socket_t *pxSocket;
-} SocketSelect_t;
-
-extern void vSocketSelect( SocketSelect_t *pxSocketSelect );
-
-#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
-
-void vIPSetDHCPTimerEnableState( BaseType_t xEnableState );
-void vIPReloadDHCPTimer( uint32_t ulLeaseTime );
-#if( ipconfigDNS_USE_CALLBACKS != 0 )
- void vIPReloadDNSTimer( uint32_t ulCheckTime );
- void vIPSetDnsTimerEnableState( BaseType_t xEnableState );
-#endif
-
-/* Send the network-up event and start the ARP timer. */
-void vIPNetworkUpCalls( void );
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* FREERTOS_IP_PRIVATE_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_IP_PRIVATE_H
+#define FREERTOS_IP_PRIVATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "FreeRTOSIPConfigDefaults.h"
+#include "FreeRTOS_Sockets.h"
+#include "IPTraceMacroDefaults.h"
+#include "FreeRTOS_Stream_Buffer.h"
+#if( ipconfigUSE_TCP == 1 )
+ #include "FreeRTOS_TCP_WIN.h"
+ #include "FreeRTOS_TCP_IP.h"
+#endif
+
+#include "event_groups.h"
+
+typedef struct xNetworkAddressingParameters
+{
+ uint32_t ulDefaultIPAddress;
+ uint32_t ulNetMask;
+ uint32_t ulGatewayAddress;
+ uint32_t ulDNSServerAddress;
+ uint32_t ulBroadcastAddress;
+} NetworkAddressingParameters_t;
+
+extern BaseType_t xTCPWindowLoggingLevel;
+
+/*-----------------------------------------------------------*/
+/* Protocol headers. */
+/*-----------------------------------------------------------*/
+
+#include "pack_struct_start.h"
+struct xETH_HEADER
+{
+ MACAddress_t xDestinationAddress; /* 0 + 6 = 6 */
+ MACAddress_t xSourceAddress; /* 6 + 6 = 12 */
+ uint16_t usFrameType; /* 12 + 2 = 14 */
+}
+#include "pack_struct_end.h"
+typedef struct xETH_HEADER EthernetHeader_t;
+
+#include "pack_struct_start.h"
+struct xARP_HEADER
+{
+ uint16_t usHardwareType; /* 0 + 2 = 2 */
+ uint16_t usProtocolType; /* 2 + 2 = 4 */
+ uint8_t ucHardwareAddressLength; /* 4 + 1 = 5 */
+ uint8_t ucProtocolAddressLength; /* 5 + 1 = 6 */
+ uint16_t usOperation; /* 6 + 2 = 8 */
+ MACAddress_t xSenderHardwareAddress; /* 8 + 6 = 14 */
+ uint8_t ucSenderProtocolAddress[ 4 ]; /* 14 + 4 = 18 */
+ MACAddress_t xTargetHardwareAddress; /* 18 + 6 = 24 */
+ uint32_t ulTargetProtocolAddress; /* 24 + 4 = 28 */
+}
+#include "pack_struct_end.h"
+typedef struct xARP_HEADER ARPHeader_t;
+
+#include "pack_struct_start.h"
+struct xIP_HEADER
+{
+ uint8_t ucVersionHeaderLength; /* 0 + 1 = 1 */
+ uint8_t ucDifferentiatedServicesCode; /* 1 + 1 = 2 */
+ uint16_t usLength; /* 2 + 2 = 4 */
+ uint16_t usIdentification; /* 4 + 2 = 6 */
+ uint16_t usFragmentOffset; /* 6 + 2 = 8 */
+ uint8_t ucTimeToLive; /* 8 + 1 = 9 */
+ uint8_t ucProtocol; /* 9 + 1 = 10 */
+ uint16_t usHeaderChecksum; /* 10 + 2 = 12 */
+ uint32_t ulSourceIPAddress; /* 12 + 4 = 16 */
+ uint32_t ulDestinationIPAddress; /* 16 + 4 = 20 */
+}
+#include "pack_struct_end.h"
+typedef struct xIP_HEADER IPHeader_t;
+
+#include "pack_struct_start.h"
+struct xIGMP_HEADER
+{
+ uint8_t ucVersionType; /* 0 + 1 = 1 */
+ uint8_t ucMaxResponseTime; /* 1 + 1 = 2 */
+ uint16_t usChecksum; /* 2 + 2 = 4 */
+ uint32_t usGroupAddress; /* 4 + 4 = 8 */
+}
+#include "pack_struct_end.h"
+typedef struct xIGMP_HEADER IGMPHeader_t;
+
+#include "pack_struct_start.h"
+struct xICMP_HEADER
+{
+ uint8_t ucTypeOfMessage; /* 0 + 1 = 1 */
+ uint8_t ucTypeOfService; /* 1 + 1 = 2 */
+ uint16_t usChecksum; /* 2 + 2 = 4 */
+ uint16_t usIdentifier; /* 4 + 2 = 6 */
+ uint16_t usSequenceNumber; /* 6 + 2 = 8 */
+}
+#include "pack_struct_end.h"
+typedef struct xICMP_HEADER ICMPHeader_t;
+
+#include "pack_struct_start.h"
+struct xUDP_HEADER
+{
+ uint16_t usSourcePort; /* 0 + 2 = 2 */
+ uint16_t usDestinationPort; /* 2 + 2 = 4 */
+ uint16_t usLength; /* 4 + 2 = 6 */
+ uint16_t usChecksum; /* 6 + 2 = 8 */
+}
+#include "pack_struct_end.h"
+typedef struct xUDP_HEADER UDPHeader_t;
+
+#include "pack_struct_start.h"
+struct xTCP_HEADER
+{
+ uint16_t usSourcePort; /* + 2 = 2 */
+ uint16_t usDestinationPort; /* + 2 = 4 */
+ uint32_t ulSequenceNumber; /* + 4 = 8 */
+ uint32_t ulAckNr; /* + 4 = 12 */
+ uint8_t ucTCPOffset; /* + 1 = 13 */
+ uint8_t ucTCPFlags; /* + 1 = 14 */
+ uint16_t usWindow; /* + 2 = 15 */
+ uint16_t usChecksum; /* + 2 = 18 */
+ uint16_t usUrgent; /* + 2 = 20 */
+#if ipconfigUSE_TCP == 1
+ /* the option data is not a part of the TCP header */
+ uint8_t ucOptdata[ipSIZE_TCP_OPTIONS]; /* + 12 = 32 */
+#endif
+}
+#include "pack_struct_end.h"
+typedef struct xTCP_HEADER TCPHeader_t;
+
+#include "pack_struct_start.h"
+struct xPSEUDO_HEADER
+{
+ uint32_t ulSourceAddress;
+ uint32_t ulDestinationAddress;
+ uint8_t ucZeros;
+ uint8_t ucProtocol;
+ uint16_t usUDPLength;
+}
+#include "pack_struct_end.h"
+typedef struct xPSEUDO_HEADER PseudoHeader_t;
+
+/*-----------------------------------------------------------*/
+/* Nested protocol packets. */
+/*-----------------------------------------------------------*/
+
+#include "pack_struct_start.h"
+struct xARP_PACKET
+{
+ EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
+ ARPHeader_t xARPHeader; /* 14 + 28 = 42 */
+}
+#include "pack_struct_end.h"
+typedef struct xARP_PACKET ARPPacket_t;
+
+#include "pack_struct_start.h"
+struct xIP_PACKET
+{
+ EthernetHeader_t xEthernetHeader;
+ IPHeader_t xIPHeader;
+}
+#include "pack_struct_end.h"
+typedef struct xIP_PACKET IPPacket_t;
+
+#include "pack_struct_start.h"
+struct xICMP_PACKET
+{
+ EthernetHeader_t xEthernetHeader;
+ IPHeader_t xIPHeader;
+ ICMPHeader_t xICMPHeader;
+}
+#include "pack_struct_end.h"
+typedef struct xICMP_PACKET ICMPPacket_t;
+
+#include "pack_struct_start.h"
+struct xUDP_PACKET
+{
+ EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
+ IPHeader_t xIPHeader; /* 14 + 20 = 34 */
+ UDPHeader_t xUDPHeader; /* 34 + 8 = 42 */
+}
+#include "pack_struct_end.h"
+typedef struct xUDP_PACKET UDPPacket_t;
+
+#include "pack_struct_start.h"
+struct xTCP_PACKET
+{
+ EthernetHeader_t xEthernetHeader; /* 0 + 14 = 14 */
+ IPHeader_t xIPHeader; /* 14 + 20 = 34 */
+ TCPHeader_t xTCPHeader; /* 34 + 32 = 66 */
+}
+#include "pack_struct_end.h"
+typedef struct xTCP_PACKET TCPPacket_t;
+
+typedef union XPROT_PACKET
+{
+ ARPPacket_t xARPPacket;
+ TCPPacket_t xTCPPacket;
+ UDPPacket_t xUDPPacket;
+ ICMPPacket_t xICMPPacket;
+} ProtocolPacket_t;
+
+
+/* The maximum UDP payload length. */
+#define ipMAX_UDP_PAYLOAD_LENGTH ( ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv4_HEADER ) - ipSIZE_OF_UDP_HEADER )
+
+typedef enum
+{
+ eReleaseBuffer = 0, /* Processing the frame did not find anything to do - just release the buffer. */
+ eProcessBuffer, /* An Ethernet frame has a valid address - continue process its contents. */
+ eReturnEthernetFrame, /* The Ethernet frame contains an ARP or ICMP packet that can be returned to its source. */
+ eFrameConsumed /* Processing the Ethernet packet contents resulted in the payload being sent to the stack. */
+} eFrameProcessingResult_t;
+
+typedef enum
+{
+ eNoEvent = -1,
+ eNetworkDownEvent, /* 0: The network interface has been lost and/or needs [re]connecting. */
+ eNetworkRxEvent, /* 1: The network interface has queued a received Ethernet frame. */
+ eNetworkTxEvent, /* 2: Let the IP-task send a network packet. */
+ eARPTimerEvent, /* 3: The ARP timer expired. */
+ eStackTxEvent, /* 4: The software stack has queued a packet to transmit. */
+ eDHCPEvent, /* 5: Process the DHCP state machine. */
+ eTCPTimerEvent, /* 6: See if any TCP socket needs attention. */
+ eTCPAcceptEvent, /* 7: Client API FreeRTOS_accept() waiting for client connections. */
+ eTCPNetStat, /* 8: IP-task is asked to produce a netstat listing. */
+ eSocketBindEvent, /* 9: Send a message to the IP-task to bind a socket to a port. */
+ eSocketCloseEvent, /*10: Send a message to the IP-task to close a socket. */
+ eSocketSelectEvent, /*11: Send a message to the IP-task for select(). */
+ eSocketSignalEvent, /*12: A socket must be signalled. */
+} eIPEvent_t;
+
+typedef struct IP_TASK_COMMANDS
+{
+ eIPEvent_t eEventType;
+ void *pvData;
+} IPStackEvent_t;
+
+#define ipBROADCAST_IP_ADDRESS 0xffffffffUL
+
+/* Offset into the Ethernet frame that is used to temporarily store information
+on the fragmentation status of the packet being sent. The value is important,
+as it is past the location into which the destination address will get placed. */
+#define ipFRAGMENTATION_PARAMETERS_OFFSET ( 6 )
+#define ipSOCKET_OPTIONS_OFFSET ( 6 )
+
+/* Only used when outgoing fragmentation is being used (FreeRTOSIPConfig.h
+setting. */
+#define ipGET_UDP_PAYLOAD_OFFSET_FOR_FRAGMENT( usFragmentOffset ) ( ( ( usFragmentOffset ) == 0 ) ? ipUDP_PAYLOAD_OFFSET_IPv4 : ipIP_PAYLOAD_OFFSET )
+
+/* The offset into a UDP packet at which the UDP data (payload) starts. */
+#define ipUDP_PAYLOAD_OFFSET_IPv4 ( sizeof( UDPPacket_t ) )
+
+/* The offset into an IP packet into which the IP data (payload) starts. */
+#define ipIP_PAYLOAD_OFFSET ( sizeof( IPPacket_t ) )
+
+#include "pack_struct_start.h"
+struct xUDP_IP_FRAGMENT_PARAMETERS
+{
+ uint8_t ucSocketOptions;
+ uint8_t ucPadFor16BitAlignment;
+ uint16_t usFragmentedPacketOffset;
+ uint16_t usFragmentLength;
+ uint16_t usPayloadChecksum;
+}
+#include "pack_struct_end.h"
+typedef struct xUDP_IP_FRAGMENT_PARAMETERS IPFragmentParameters_t;
+
+#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
+
+ /* Ethernet frame types. */
+ #define ipARP_FRAME_TYPE ( 0x0608U )
+ #define ipIPv4_FRAME_TYPE ( 0x0008U )
+
+ /* ARP related definitions. */
+ #define ipARP_PROTOCOL_TYPE ( 0x0008U )
+ #define ipARP_HARDWARE_TYPE_ETHERNET ( 0x0100U )
+ #define ipARP_REQUEST ( 0x0100U )
+ #define ipARP_REPLY ( 0x0200U )
+
+#else
+
+ /* Ethernet frame types. */
+ #define ipARP_FRAME_TYPE ( 0x0806U )
+ #define ipIPv4_FRAME_TYPE ( 0x0800U )
+
+ /* ARP related definitions. */
+ #define ipARP_PROTOCOL_TYPE ( 0x0800U )
+ #define ipARP_HARDWARE_TYPE_ETHERNET ( 0x0001U )
+ #define ipARP_REQUEST ( 0x0001 )
+ #define ipARP_REPLY ( 0x0002 )
+
+#endif /* ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN */
+
+
+/* For convenience, a MAC address of all zeros and another of all 0xffs are
+defined const for quick reference. */
+extern const MACAddress_t xBroadcastMACAddress; /* all 0xff's */
+extern uint16_t usPacketIdentifier;
+
+/* Define a default UDP packet header (declared in FreeRTOS_UDP_IP.c) */
+typedef union xUDPPacketHeader
+{
+ uint8_t ucBytes[24];
+ uint32_t ulWords[6];
+} UDPPacketHeader_t;
+extern UDPPacketHeader_t xDefaultPartUDPPacketHeader;
+
+/* Structure that stores the netmask, gateway address and DNS server addresses. */
+extern NetworkAddressingParameters_t xNetworkAddressing;
+
+/* Structure that stores the defaults for netmask, gateway address and DNS.
+These values will be copied to 'xNetworkAddressing' in case DHCP is not used,
+and also in case DHCP does not lead to a confirmed request. */
+extern NetworkAddressingParameters_t xDefaultAddressing;
+
+/* True when BufferAllocation_1.c was included, false for BufferAllocation_2.c */
+extern const BaseType_t xBufferAllocFixedSize;
+
+/* Defined in FreeRTOS_Sockets.c */
+#if ( ipconfigUSE_TCP == 1 )
+ extern List_t xBoundTCPSocketsList;
+#endif
+
+/* The local IP address is accessed from within xDefaultPartUDPPacketHeader,
+rather than duplicated in its own variable. */
+#define ipLOCAL_IP_ADDRESS_POINTER ( ( uint32_t * ) &( xDefaultPartUDPPacketHeader.ulWords[ 20u / sizeof(uint32_t) ] ) )
+
+/* The local MAC address is accessed from within xDefaultPartUDPPacketHeader,
+rather than duplicated in its own variable. */
+#define ipLOCAL_MAC_ADDRESS ( &xDefaultPartUDPPacketHeader.ucBytes[0] )
+
+/* ICMP packets are sent using the same function as UDP packets. The port
+number is used to distinguish between the two, as 0 is an invalid UDP port. */
+#define ipPACKET_CONTAINS_ICMP_DATA ( 0 )
+
+/* For now, the lower 8 bits in 'xEventBits' will be reserved for the above
+socket events. */
+#define SOCKET_EVENT_BIT_COUNT 8
+
+#define vSetField16( pxBase, xType, xField, usValue ) \
+{ \
+ ( ( uint8_t* )( pxBase ) ) [ offsetof( xType, xField ) + 0 ] = ( uint8_t ) ( ( usValue ) >> 8 ); \
+ ( ( uint8_t* )( pxBase ) ) [ offsetof( xType, xField ) + 1 ] = ( uint8_t ) ( ( usValue ) & 0xff ); \
+}
+
+#define vSetField32( pxBase, xType, xField, ulValue ) \
+{ \
+ ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 0 ] = ( uint8_t ) ( ( ulValue ) >> 24 ); \
+ ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 1 ] = ( uint8_t ) ( ( ( ulValue ) >> 16 ) & 0xff ); \
+ ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 2 ] = ( uint8_t ) ( ( ( ulValue ) >> 8 ) & 0xff ); \
+ ( (uint8_t*)( pxBase ) ) [ offsetof( xType, xField ) + 3 ] = ( uint8_t ) ( ( ulValue ) & 0xff ); \
+}
+
+#define vFlip_16( left, right ) \
+ do { \
+ uint16_t tmp = (left); \
+ (left) = (right); \
+ (right) = tmp; \
+ } while (0)
+
+#define vFlip_32( left, right ) \
+ do { \
+ uint32_t tmp = (left); \
+ (left) = (right); \
+ (right) = tmp; \
+ } while (0)
+
+#ifndef ARRAY_SIZE
+ #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
+ * goes down thereafter. The network interface hardware driver is responsible
+ * for sending the message that contains the network interface down command/
+ * event.
+ *
+ * Only use the FreeRTOS_NetworkDownFromISR() version if the function is to be
+ * called from an interrupt service routine. If FreeRTOS_NetworkDownFromISR()
+ * returns a non-zero value then a context switch should be performed ebfore
+ * the interrupt is exited.
+ */
+void FreeRTOS_NetworkDown( void );
+BaseType_t FreeRTOS_NetworkDownFromISR( void );
+
+/*
+ * Processes incoming ARP packets.
+ */
+eFrameProcessingResult_t eARPProcessPacket( ARPPacket_t * const pxARPFrame );
+
+/*
+ * Inspect an Ethernet frame to see if it contains data that the stack needs to
+ * process. eProcessBuffer is returned if the frame should be processed by the
+ * stack. eReleaseBuffer is returned if the frame should be discarded.
+ */
+eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucEthernetBuffer );
+
+/*
+ * Return the checksum generated over xDataLengthBytes from pucNextData.
+ */
+uint16_t usGenerateChecksum( uint32_t ulSum, const uint8_t * pucNextData, size_t uxDataLengthBytes );
+
+/* Socket related private functions. */
+
+/*
+ * The caller must ensure that pxNetworkBuffer->xDataLength is the UDP packet
+ * payload size (excluding packet headers) and that the packet in pucEthernetBuffer
+ * is at least the size of UDPPacket_t.
+ */
+BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort );
+
+/*
+ * Initialize the socket list data structures for TCP and UDP.
+ */
+BaseType_t vNetworkSocketsInit( void );
+
+/*
+ * Returns pdTRUE if the IP task has been created and is initialised. Otherwise
+ * returns pdFALSE.
+ */
+BaseType_t xIPIsNetworkTaskReady( void );
+
+#if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
+ struct xSOCKET;
+ typedef void (*SocketWakeupCallback_t)( struct xSOCKET * pxSocket );
+#endif
+
+#if( ipconfigUSE_TCP == 1 )
+
+ /*
+ * Actually a user thing, but because xBoundTCPSocketsList, let it do by the
+ * IP-task
+ */
+ void vTCPNetStat( void );
+
+ /*
+ * At least one socket needs to check for timeouts
+ */
+ TickType_t xTCPTimerCheck( BaseType_t xWillSleep );
+
+ /* Every TCP socket has a buffer space just big enough to store
+ the last TCP header received.
+ As a reference of this field may be passed to DMA, force the
+ alignment to 8 bytes. */
+ typedef union
+ {
+ struct
+ {
+ /* Increase the alignment of this union by adding a 64-bit variable. */
+ uint64_t ullAlignmentWord;
+ } a;
+ struct
+ {
+ /* The next field only serves to give 'ucLastPacket' a correct
+ alignment of 8 + 2. See comments in FreeRTOS_IP.h */
+ uint8_t ucFillPacket[ ipconfigPACKET_FILLER_SIZE ];
+ uint8_t ucLastPacket[ sizeof( TCPPacket_t ) ];
+ } u;
+ } LastTCPPacket_t;
+
+ /*
+ * Note that the values of all short and long integers in these structs
+ * are being stored in the native-endian way
+ * Translation should take place when accessing any structure which defines
+ * network packets, such as IPHeader_t and TCPHeader_t
+ */
+ typedef struct TCPSOCKET
+ {
+ uint32_t ulRemoteIP; /* IP address of remote machine */
+ uint16_t usRemotePort; /* Port on remote machine */
+ struct {
+ /* Most compilers do like bit-flags */
+ uint32_t
+ bMssChange : 1, /* This socket has seen a change in MSS */
+ bPassAccept : 1, /* when true, this socket may be returned in a call to accept() */
+ bPassQueued : 1, /* when true, this socket is an orphan until it gets connected
+ * Why an orphan? Because it may not be returned in a accept() call until it
+ * gets the state eESTABLISHED */
+ bReuseSocket : 1, /* When a listening socket gets a connection, do not create a new instance but keep on using it */
+ bCloseAfterSend : 1,/* As soon as the last byte has been transmitted, finalise the connection
+ * Useful in e.g. FTP connections, where the last data bytes are sent along with the FIN flag */
+ bUserShutdown : 1, /* User requesting a graceful shutdown */
+ bCloseRequested : 1,/* Request to finalise the connection */
+ bLowWater : 1, /* high-water level has been reached. Cleared as soon as 'rx-count < lo-water' */
+ bWinChange : 1, /* The value of bLowWater has changed, must send a window update */
+ bSendKeepAlive : 1, /* When this flag is true, a TCP keep-alive message must be send */
+ bWaitKeepAlive : 1, /* When this flag is true, a TCP keep-alive reply is expected */
+ bConnPrepared : 1, /* Connecting socket: Message has been prepared */
+ #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
+ bConnPassed : 1, /* Connecting socket: Socket has been passed in a successful select() */
+ #endif /* ipconfigSUPPORT_SELECT_FUNCTION */
+ bFinAccepted : 1, /* This socket has received (or sent) a FIN and accepted it */
+ bFinSent : 1, /* We've sent out a FIN */
+ bFinRecv : 1, /* We've received a FIN from our peer */
+ bFinAcked : 1, /* Our FIN packet has been acked */
+ bFinLast : 1, /* The last ACK (after FIN and FIN+ACK) has been sent or will be sent by the peer */
+ bRxStopped : 1, /* Application asked to temporarily stop reception */
+ bMallocError : 1, /* There was an error allocating a stream */
+ bWinScaling : 1; /* A TCP-Window Scaling option was offered and accepted in the SYN phase. */
+ } bits;
+ uint32_t ulHighestRxAllowed;
+ /* The highest sequence number that we can receive at any moment */
+ uint16_t usTimeout; /* Time (in ticks) after which this socket needs attention */
+ uint16_t usCurMSS; /* Current Maximum Segment Size */
+ uint16_t usInitMSS; /* Initial maximum segment Size */
+ uint16_t usChildCount; /* In case of a listening socket: number of connections on this port number */
+ uint16_t usBacklog; /* In case of a listening socket: maximum number of concurrent connections on this port number */
+ uint8_t ucRepCount; /* Send repeat count, for retransmissions
+ * This counter is separate from the xmitCount in the
+ * TCP win segments */
+ uint8_t ucTCPState; /* TCP state: see eTCP_STATE */
+ struct xSOCKET *pxPeerSocket; /* for server socket: child, for child socket: parent */
+ #if( ipconfigTCP_KEEP_ALIVE == 1 )
+ uint8_t ucKeepRepCount;
+ TickType_t xLastAliveTime;
+ #endif /* ipconfigTCP_KEEP_ALIVE */
+ #if( ipconfigTCP_HANG_PROTECTION == 1 )
+ TickType_t xLastActTime;
+ #endif /* ipconfigTCP_HANG_PROTECTION */
+ size_t uxLittleSpace;
+ size_t uxEnoughSpace;
+ size_t uxRxStreamSize;
+ size_t uxTxStreamSize;
+ StreamBuffer_t *rxStream;
+ StreamBuffer_t *txStream;
+ #if( ipconfigUSE_TCP_WIN == 1 )
+ NetworkBufferDescriptor_t *pxAckMessage;
+ #endif /* ipconfigUSE_TCP_WIN */
+ /* Buffer space to store the last TCP header received. */
+ LastTCPPacket_t xPacket;
+ uint8_t tcpflags; /* TCP flags */
+ #if( ipconfigUSE_TCP_WIN != 0 )
+ uint8_t ucMyWinScaleFactor;
+ uint8_t ucPeerWinScaleFactor;
+ #endif
+ #if( ipconfigUSE_CALLBACKS == 1 )
+ FOnTCPReceive_t pxHandleReceive; /*
+ * In case of a TCP socket:
+ * typedef void (* FOnTCPReceive_t) (Socket_t xSocket, void *pData, size_t xLength );
+ */
+ FOnTCPSent_t pxHandleSent;
+ FOnConnected_t pxHandleConnected; /* Actually type: typedef void (* FOnConnected_t) (Socket_t xSocket, BaseType_t ulConnected ); */
+ #endif /* ipconfigUSE_CALLBACKS */
+ uint32_t ulWindowSize; /* Current Window size advertised by peer */
+ size_t uxRxWinSize; /* Fixed value: size of the TCP reception window */
+ size_t uxTxWinSize; /* Fixed value: size of the TCP transmit window */
+
+ TCPWindow_t xTCPWindow;
+ } IPTCPSocket_t;
+
+#endif /* ipconfigUSE_TCP */
+
+typedef struct UDPSOCKET
+{
+ List_t xWaitingPacketsList; /* Incoming packets */
+ #if( ipconfigUDP_MAX_RX_PACKETS > 0 )
+ UBaseType_t uxMaxPackets; /* Protection: limits the number of packets buffered per socket */
+ #endif /* ipconfigUDP_MAX_RX_PACKETS */
+ #if( ipconfigUSE_CALLBACKS == 1 )
+ FOnUDPReceive_t pxHandleReceive; /*
+ * In case of a UDP socket:
+ * typedef void (* FOnUDPReceive_t) (Socket_t xSocket, void *pData, size_t xLength, struct freertos_sockaddr *pxAddr );
+ */
+ FOnUDPSent_t pxHandleSent;
+ #endif /* ipconfigUSE_CALLBACKS */
+} IPUDPSocket_t;
+
+typedef enum eSOCKET_EVENT {
+ eSOCKET_RECEIVE = 0x0001,
+ eSOCKET_SEND = 0x0002,
+ eSOCKET_ACCEPT = 0x0004,
+ eSOCKET_CONNECT = 0x0008,
+ eSOCKET_BOUND = 0x0010,
+ eSOCKET_CLOSED = 0x0020,
+ eSOCKET_INTR = 0x0040,
+ eSOCKET_ALL = 0x007F,
+} eSocketEvent_t;
+
+typedef struct xSOCKET
+{
+ EventBits_t xEventBits;
+ EventGroupHandle_t xEventGroup;
+
+ ListItem_t xBoundSocketListItem; /* Used to reference the socket from a bound sockets list. */
+ TickType_t xReceiveBlockTime; /* if recv[to] is called while no data is available, wait this amount of time. Unit in clock-ticks */
+ TickType_t xSendBlockTime; /* if send[to] is called while there is not enough space to send, wait this amount of time. Unit in clock-ticks */
+
+ uint16_t usLocalPort; /* Local port on this machine */
+ uint8_t ucSocketOptions;
+ uint8_t ucProtocol; /* choice of FREERTOS_IPPROTO_UDP/TCP */
+ #if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )
+ SemaphoreHandle_t pxUserSemaphore;
+ #endif /* ipconfigSOCKET_HAS_USER_SEMAPHORE */
+ #if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
+ SocketWakeupCallback_t pxUserWakeCallback;
+ #endif /* ipconfigSOCKET_HAS_USER_WAKE_CALLBACK */
+
+ #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
+ struct xSOCKET_SET *pxSocketSet;
+ /* User may indicate which bits are interesting for this socket. */
+ EventBits_t xSelectBits;
+ /* These bits indicate the events which have actually occurred.
+ They are maintained by the IP-task */
+ EventBits_t xSocketBits;
+ #endif /* ipconfigSUPPORT_SELECT_FUNCTION */
+ /* TCP/UDP specific fields: */
+ /* Before accessing any member of this structure, it should be confirmed */
+ /* that the protocol corresponds with the type of structure */
+
+ union
+ {
+ IPUDPSocket_t xUDP;
+ #if( ipconfigUSE_TCP == 1 )
+ IPTCPSocket_t xTCP;
+ /* Make sure that xTCP is 8-bytes aligned by
+ declaring a 64-bit variable in the same union */
+ uint64_t ullTCPAlignment;
+ #endif /* ipconfigUSE_TCP */
+ } u;
+} FreeRTOS_Socket_t;
+
+#if( ipconfigUSE_TCP == 1 )
+ /*
+ * Lookup a TCP socket, using a multiple matching: both port numbers and
+ * return IP address.
+ */
+ FreeRTOS_Socket_t *pxTCPSocketLookup( uint32_t ulLocalIP, UBaseType_t uxLocalPort, uint32_t ulRemoteIP, UBaseType_t uxRemotePort );
+
+#endif /* ipconfigUSE_TCP */
+
+/*
+ * Look up a local socket by finding a match with the local port.
+ */
+FreeRTOS_Socket_t *pxUDPSocketLookup( UBaseType_t uxLocalPort );
+
+/*
+ * Called when the application has generated a UDP packet to send.
+ */
+void vProcessGeneratedUDPPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
+
+/*
+ * Calculate the upper-layer checksum
+ * Works both for UDP, ICMP and TCP packages
+ * bOut = true: checksum will be set in outgoing packets
+ * bOut = false: checksum will be calculated for incoming packets
+ * returning 0xffff means: checksum was correct
+ */
+uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket );
+
+/*
+ * An Ethernet frame has been updated (maybe it was an ARP request or a PING
+ * request?) and is to be sent back to its source.
+ */
+void vReturnEthernetFrame( NetworkBufferDescriptor_t * pxNetworkBuffer, BaseType_t xReleaseAfterSend );
+
+/*
+ * The internal version of bind()
+ * If 'ulInternal' is true, it is called by the driver
+ * The TCP driver needs to bind a socket at the moment a listening socket
+ * creates a new connected socket
+ */
+BaseType_t vSocketBind( FreeRTOS_Socket_t *pxSocket, struct freertos_sockaddr * pxAddress, size_t uxAddressLength, BaseType_t xInternal );
+
+/*
+ * Internal function to add streaming data to a TCP socket. If ulIn == true,
+ * data will be added to the rxStream, otherwise to the tXStream. Normally data
+ * will be written with ulOffset == 0, meaning: at the end of the FIFO. When
+ * packet come in out-of-order, an offset will be used to put it in front and
+ * the head will not change yet.
+ */
+int32_t lTCPAddRxdata(FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount);
+
+/*
+ * Currently called for any important event.
+ */
+void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket );
+
+/*
+ * Some helping function, their meaning should be clear
+ */
+static portINLINE uint32_t ulChar2u32 (const uint8_t *apChr);
+static portINLINE uint32_t ulChar2u32 (const uint8_t *apChr)
+{
+ return ( ( ( uint32_t )apChr[0] ) << 24) |
+ ( ( ( uint32_t )apChr[1] ) << 16) |
+ ( ( ( uint32_t )apChr[2] ) << 8) |
+ ( ( ( uint32_t )apChr[3] ) );
+}
+
+static portINLINE uint16_t usChar2u16 (const uint8_t *apChr);
+static portINLINE uint16_t usChar2u16 (const uint8_t *apChr)
+{
+ return ( uint16_t )
+ ( ( ( ( uint32_t )apChr[0] ) << 8) |
+ ( ( ( uint32_t )apChr[1] ) ) );
+}
+
+/* Check a single socket for retransmissions and timeouts */
+BaseType_t xTCPSocketCheck( FreeRTOS_Socket_t *pxSocket );
+
+BaseType_t xTCPCheckNewClient( FreeRTOS_Socket_t *pxSocket );
+
+/* Defined in FreeRTOS_Sockets.c
+ * Close a socket
+ */
+void *vSocketClose( FreeRTOS_Socket_t *pxSocket );
+
+/*
+ * Send the event eEvent to the IP task event queue, using a block time of
+ * zero. Return pdPASS if the message was sent successfully, otherwise return
+ * pdFALSE.
+*/
+BaseType_t xSendEventToIPTask( eIPEvent_t eEvent );
+
+/*
+ * The same as above, but a struct as a parameter, containing:
+ * eIPEvent_t eEventType;
+ * void *pvData;
+ */
+BaseType_t xSendEventStructToIPTask( const IPStackEvent_t *pxEvent, TickType_t xTimeout );
+
+/*
+ * Returns a pointer to the original NetworkBuffer from a pointer to a UDP
+ * payload buffer.
+ */
+NetworkBufferDescriptor_t *pxUDPPayloadBuffer_to_NetworkBuffer( void *pvBuffer );
+
+#if( ipconfigZERO_COPY_TX_DRIVER != 0 )
+ /*
+ * For the case where the network driver passes a buffer directly to a DMA
+ * descriptor, this function can be used to translate a 'network buffer' to
+ * a 'network buffer descriptor'.
+ */
+ NetworkBufferDescriptor_t *pxPacketBuffer_to_NetworkBuffer( const void *pvBuffer );
+#endif
+
+/*
+ * Internal: Sets a new state for a TCP socket and performs the necessary
+ * actions like calling a OnConnected handler to notify the socket owner.
+ */
+#if( ipconfigUSE_TCP == 1 )
+ void vTCPStateChange( FreeRTOS_Socket_t *pxSocket, enum eTCP_STATE eTCPState );
+#endif /* ipconfigUSE_TCP */
+
+/*_RB_ Should this be part of the public API? */
+void FreeRTOS_netstat( void );
+
+/* Returns pdTRUE is this function is called from the IP-task */
+BaseType_t xIsCallingFromIPTask( void );
+
+#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
+
+typedef struct xSOCKET_SET
+{
+ EventGroupHandle_t xSelectGroup;
+ BaseType_t bApiCalled; /* True if the API was calling the private vSocketSelect */
+ FreeRTOS_Socket_t *pxSocket;
+} SocketSelect_t;
+
+extern void vSocketSelect( SocketSelect_t *pxSocketSelect );
+
+#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
+
+void vIPSetDHCPTimerEnableState( BaseType_t xEnableState );
+void vIPReloadDHCPTimer( uint32_t ulLeaseTime );
+#if( ipconfigDNS_USE_CALLBACKS != 0 )
+ void vIPReloadDNSTimer( uint32_t ulCheckTime );
+ void vIPSetDnsTimerEnableState( BaseType_t xEnableState );
+#endif
+
+/* Send the network-up event and start the ARP timer. */
+void vIPNetworkUpCalls( void );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* FREERTOS_IP_PRIVATE_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h
index 88d3bba65..926ccebbd 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h
@@ -1,402 +1,402 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_SOCKETS_H
-#define FREERTOS_SOCKETS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Standard includes. */
-#include <string.h>
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-
-#ifndef FREERTOS_IP_CONFIG_H
- #error FreeRTOSIPConfig.h has not been included yet
-#endif
-
-/* Event bit definitions are required by the select functions. */
-#include "event_groups.h"
-
-#ifndef INC_FREERTOS_H
- #error FreeRTOS.h must be included before FreeRTOS_Sockets.h.
-#endif
-
-#ifndef INC_TASK_H
- #ifndef TASK_H /* For compatibility with older FreeRTOS versions. */
- #error The FreeRTOS header file task.h must be included before FreeRTOS_Sockets.h.
- #endif
-#endif
-
-/* Assigned to an Socket_t variable when the socket is not valid, probably
-because it could not be created. */
-#define FREERTOS_INVALID_SOCKET ( ( Socket_t ) ~0U )
-
-/* API function error values. As errno is supported, the FreeRTOS sockets
-functions return error codes rather than just a pass or fail indication. */
-/* HT: Extended the number of error codes, gave them positive values and if possible
-the corresponding found in errno.h
-In case of an error, API's will still return negative numbers, e.g.
- return -pdFREERTOS_ERRNO_EWOULDBLOCK;
-in case an operation would block */
-
-/* The following defines are obsolete, please use -pdFREERTOS_ERRNO_Exxx */
-
-#define FREERTOS_SOCKET_ERROR ( -1 )
-#define FREERTOS_EWOULDBLOCK ( - pdFREERTOS_ERRNO_EWOULDBLOCK )
-#define FREERTOS_EINVAL ( - pdFREERTOS_ERRNO_EINVAL )
-#define FREERTOS_EADDRNOTAVAIL ( - pdFREERTOS_ERRNO_EADDRNOTAVAIL )
-#define FREERTOS_EADDRINUSE ( - pdFREERTOS_ERRNO_EADDRINUSE )
-#define FREERTOS_ENOBUFS ( - pdFREERTOS_ERRNO_ENOBUFS )
-#define FREERTOS_ENOPROTOOPT ( - pdFREERTOS_ERRNO_ENOPROTOOPT )
-#define FREERTOS_ECLOSED ( - pdFREERTOS_ERRNO_ENOTCONN )
-
-/* Values for the parameters to FreeRTOS_socket(), inline with the Berkeley
-standard. See the documentation of FreeRTOS_socket() for more information. */
-#define FREERTOS_AF_INET ( 2 )
-#define FREERTOS_AF_INET6 ( 10 )
-#define FREERTOS_SOCK_DGRAM ( 2 )
-#define FREERTOS_IPPROTO_UDP ( 17 )
-
-#define FREERTOS_SOCK_STREAM ( 1 )
-#define FREERTOS_IPPROTO_TCP ( 6 )
-/* IP packet of type "Any local network"
- * can be used in stead of TCP for testing with sockets in raw mode
- */
-#define FREERTOS_IPPROTO_USR_LAN ( 63 )
-
-/* A bit value that can be passed into the FreeRTOS_sendto() function as part of
-the flags parameter. Setting the FREERTOS_ZERO_COPY in the flags parameter
-indicates that the zero copy interface is being used. See the documentation for
-FreeRTOS_sockets() for more information. */
-#define FREERTOS_ZERO_COPY ( 1 )
-
-/* Values that can be passed in the option name parameter of calls to
-FreeRTOS_setsockopt(). */
-#define FREERTOS_SO_RCVTIMEO ( 0 ) /* Used to set the receive time out. */
-#define FREERTOS_SO_SNDTIMEO ( 1 ) /* Used to set the send time out. */
-#define FREERTOS_SO_UDPCKSUM_OUT ( 2 ) /* Used to turn the use of the UDP checksum by a socket on or off. This also doubles as part of an 8-bit bitwise socket option. */
-#if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )
- #define FREERTOS_SO_SET_SEMAPHORE ( 3 ) /* Used to set a user's semaphore */
-#endif
-#define FREERTOS_SO_SNDBUF ( 4 ) /* Set the size of the send buffer (TCP only) */
-#define FREERTOS_SO_RCVBUF ( 5 ) /* Set the size of the receive buffer (TCP only) */
-
-#if ipconfigUSE_CALLBACKS == 1
- #define FREERTOS_SO_TCP_CONN_HANDLER ( 6 ) /* Install a callback for (dis) connection events. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
- #define FREERTOS_SO_TCP_RECV_HANDLER ( 7 ) /* Install a callback for receiving TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
- #define FREERTOS_SO_TCP_SENT_HANDLER ( 8 ) /* Install a callback for sending TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
- #define FREERTOS_SO_UDP_RECV_HANDLER ( 9 ) /* Install a callback for receiving UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
- #define FREERTOS_SO_UDP_SENT_HANDLER ( 10 ) /* Install a callback for sending UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
-#endif /* ipconfigUSE_CALLBACKS */
-
-#define FREERTOS_SO_REUSE_LISTEN_SOCKET ( 11 ) /* When a listening socket gets connected, do not create a new one but re-use it */
-#define FREERTOS_SO_CLOSE_AFTER_SEND ( 12 ) /* As soon as the last byte has been transmitted, finalise the connection */
-#define FREERTOS_SO_WIN_PROPERTIES ( 13 ) /* Set all buffer and window properties in one call, parameter is pointer to WinProperties_t */
-#define FREERTOS_SO_SET_FULL_SIZE ( 14 ) /* Refuse to send packets smaller than MSS */
-
-#define FREERTOS_SO_STOP_RX ( 15 ) /* Temporarily hold up reception, used by streaming client */
-
-#if( ipconfigUDP_MAX_RX_PACKETS > 0 )
- #define FREERTOS_SO_UDP_MAX_RX_PACKETS ( 16 ) /* This option helps to limit the maximum number of packets a UDP socket will buffer */
-#endif
-
-#if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
- #define FREERTOS_SO_WAKEUP_CALLBACK ( 17 )
-#endif
-
-#define FREERTOS_SO_SET_LOW_HIGH_WATER ( 18 )
-
-#define FREERTOS_NOT_LAST_IN_FRAGMENTED_PACKET ( 0x80 ) /* For internal use only, but also part of an 8-bit bitwise value. */
-#define FREERTOS_FRAGMENTED_PACKET ( 0x40 ) /* For internal use only, but also part of an 8-bit bitwise value. */
-
-/* Values for flag for FreeRTOS_shutdown(). */
-#define FREERTOS_SHUT_RD ( 0 ) /* Not really at this moment, just for compatibility of the interface */
-#define FREERTOS_SHUT_WR ( 1 )
-#define FREERTOS_SHUT_RDWR ( 2 )
-
-/* Values for flag for FreeRTOS_recv(). */
-#define FREERTOS_MSG_OOB ( 2 ) /* process out-of-band data */
-#define FREERTOS_MSG_PEEK ( 4 ) /* peek at incoming message */
-#define FREERTOS_MSG_DONTROUTE ( 8 ) /* send without using routing tables */
-#define FREERTOS_MSG_DONTWAIT ( 16 ) /* Can be used with recvfrom(), sendto(), recv(), and send(). */
-
-typedef struct xWIN_PROPS {
- /* Properties of the Tx buffer and Tx window */
- int32_t lTxBufSize; /* Unit: bytes */
- int32_t lTxWinSize; /* Unit: MSS */
-
- /* Properties of the Rx buffer and Rx window */
- int32_t lRxBufSize; /* Unit: bytes */
- int32_t lRxWinSize; /* Unit: MSS */
-} WinProperties_t;
-
-typedef struct xLOW_HIGH_WATER {
- /* Structure to pass for the 'FREERTOS_SO_SET_LOW_HIGH_WATER' option */
- size_t uxLittleSpace; /* Send a STOP when buffer space drops below X bytes */
- size_t uxEnoughSpace; /* Send a GO when buffer space grows above X bytes */
-} LowHighWater_t;
-
-/* For compatibility with the expected Berkeley sockets naming. */
-#define socklen_t uint32_t
-
-/* For this limited implementation, only two members are required in the
-Berkeley style sockaddr structure. */
-struct freertos_sockaddr
-{
- /* _HT_ On 32- and 64-bit architectures, the addition of the two uint8_t
- fields doesn't make the structure bigger, due to alignment.
- The fields are inserted as a preparation for IPv6. */
-
- /* sin_len and sin_family not used in the IPv4-only release. */
- uint8_t sin_len; /* length of this structure. */
- uint8_t sin_family; /* FREERTOS_AF_INET. */
- uint16_t sin_port;
- uint32_t sin_addr;
-};
-
-#if ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN
-
- #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
- ( ( ( ( uint32_t ) ( ucOctet3 ) ) << 24UL ) | \
- ( ( ( uint32_t ) ( ucOctet2 ) ) << 16UL ) | \
- ( ( ( uint32_t ) ( ucOctet1 ) ) << 8UL ) | \
- ( ( uint32_t ) ( ucOctet0 ) ) )
-
- #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer ) \
- sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
- ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ), \
- ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
- ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\
- ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ) )
-
-#else /* ipconfigBYTE_ORDER */
-
- #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
- ( ( ( ( uint32_t ) ( ucOctet0 ) ) << 24UL ) | \
- ( ( ( uint32_t ) ( ucOctet1 ) ) << 16UL ) | \
- ( ( ( uint32_t ) ( ucOctet2 ) ) << 8UL ) | \
- ( ( uint32_t ) ( ucOctet3 ) ) )
-
- #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer ) \
- sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
- ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ), \
- ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\
- ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
- ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ) )
-
-#endif /* ipconfigBYTE_ORDER */
-
-/* The socket type itself. */
-struct xSOCKET;
-typedef struct xSOCKET *Socket_t;
-
-/* The SocketSet_t type is the equivalent to the fd_set type used by the
-Berkeley API. */
-struct xSOCKET_SET;
-typedef struct xSOCKET_SET *SocketSet_t;
-
-/**
- * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
- * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
- * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html
- */
-Socket_t FreeRTOS_socket( BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol );
-int32_t FreeRTOS_recvfrom( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags, struct freertos_sockaddr *pxSourceAddress, socklen_t *pxSourceAddressLength );
-int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t xTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, socklen_t xDestinationAddressLength );
-BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );
-
-/* function to get the local address and IP port */
-size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );
-
-/* Made available when ipconfigETHERNET_DRIVER_FILTERS_PACKETS is set to 1. */
-BaseType_t xPortHasUDPSocket( uint16_t usPortNr );
-
-#if ipconfigUSE_TCP == 1
-
-BaseType_t FreeRTOS_connect( Socket_t xClientSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );
-BaseType_t FreeRTOS_listen( Socket_t xSocket, BaseType_t xBacklog );
-BaseType_t FreeRTOS_recv( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags );
-BaseType_t FreeRTOS_send( Socket_t xSocket, const void *pvBuffer, size_t uxDataLength, BaseType_t xFlags );
-Socket_t FreeRTOS_accept( Socket_t xServerSocket, struct freertos_sockaddr *pxAddress, socklen_t *pxAddressLength );
-BaseType_t FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow);
-
-#if( ipconfigSUPPORT_SIGNALS != 0 )
- /* Send a signal to the task which is waiting for a given socket. */
- BaseType_t FreeRTOS_SignalSocket( Socket_t xSocket );
-
- /* Send a signal to the task which reads from this socket (FromISR
- version). */
- BaseType_t FreeRTOS_SignalSocketFromISR( Socket_t xSocket, BaseType_t *pxHigherPriorityTaskWoken );
-#endif /* ipconfigSUPPORT_SIGNALS */
-
-/* Return the remote address and IP port. */
-BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );
-
-/* returns pdTRUE if TCP socket is connected */
-BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket );
-
-/* returns the actual size of MSS being used */
-BaseType_t FreeRTOS_mss( Socket_t xSocket );
-
-/* for internal use only: return the connection status */
-BaseType_t FreeRTOS_connstatus( Socket_t xSocket );
-
-/* Returns the number of bytes that may be added to txStream */
-BaseType_t FreeRTOS_maywrite( Socket_t xSocket );
-
-/*
- * Two helper functions, mostly for testing
- * rx_size returns the number of bytes available in the Rx buffer
- * tx_space returns the free space in the Tx buffer
- */
-BaseType_t FreeRTOS_rx_size( Socket_t xSocket );
-BaseType_t FreeRTOS_tx_space( Socket_t xSocket );
-BaseType_t FreeRTOS_tx_size( Socket_t xSocket );
-
-/* Returns the number of outstanding bytes in txStream. */
-/* The function FreeRTOS_outstanding() was already implemented
-FreeRTOS_tx_size(). */
-#define FreeRTOS_outstanding( xSocket ) FreeRTOS_tx_size( xSocket )
-
-/* Returns the number of bytes in the socket's rxStream. */
-/* The function FreeRTOS_recvcount() was already implemented
-FreeRTOS_rx_size(). */
-#define FreeRTOS_recvcount( xSocket ) FreeRTOS_rx_size( xSocket )
-
-/*
- * For advanced applications only:
- * Get a direct pointer to the circular transmit buffer.
- * '*pxLength' will contain the number of bytes that may be written.
- */
-uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength );
-
-#endif /* ipconfigUSE_TCP */
-
-/*
- * Connect / disconnect handler for a TCP socket
- * For example:
- * static void vMyConnectHandler (Socket_t xSocket, BaseType_t ulConnected)
- * {
- * }
- * F_TCP_UDP_Handler_t xHnd = { vMyConnectHandler };
- * FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_CONN_HANDLER, ( void * ) &xHnd, sizeof( xHnd ) );
- */
-
-typedef void (* FOnConnected_t )( Socket_t /* xSocket */, BaseType_t /* ulConnected */ );
-
-/*
- * Reception handler for a TCP socket
- * A user-proved function will be called on reception of a message
- * If the handler returns a positive number, the messages will not be stored
- * For example:
- * static BaseType_t xOnTCPReceive( Socket_t xSocket, void * pData, size_t xLength )
- * {
- * // handle the message
- * return 1;
- * }
- * F_TCP_UDP_Handler_t xHand = { xOnTCPReceive };
- * FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_RECV_HANDLER, ( void * ) &xHand, sizeof( xHand ) );
- */
-typedef BaseType_t (* FOnTCPReceive_t )( Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */ );
-typedef void (* FOnTCPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );
-
-/*
- * Reception handler for a UDP socket
- * A user-proved function will be called on reception of a message
- * If the handler returns a positive number, the messages will not be stored
- */
-typedef BaseType_t (* FOnUDPReceive_t ) (Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */,
- const struct freertos_sockaddr * /* pxFrom */, const struct freertos_sockaddr * /* pxDest */ );
-typedef void (* FOnUDPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );
-
-
-typedef union xTCP_UDP_HANDLER
-{
- FOnConnected_t pxOnTCPConnected; /* FREERTOS_SO_TCP_CONN_HANDLER */
- FOnTCPReceive_t pxOnTCPReceive; /* FREERTOS_SO_TCP_RECV_HANDLER */
- FOnTCPSent_t pxOnTCPSent; /* FREERTOS_SO_TCP_SENT_HANDLER */
- FOnUDPReceive_t pxOnUDPReceive; /* FREERTOS_SO_UDP_RECV_HANDLER */
- FOnUDPSent_t pxOnUDPSent; /* FREERTOS_SO_UDP_SENT_HANDLER */
-} F_TCP_UDP_Handler_t;
-
-BaseType_t FreeRTOS_setsockopt( Socket_t xSocket, int32_t lLevel, int32_t lOptionName, const void *pvOptionValue, size_t xOptionLength );
-BaseType_t FreeRTOS_closesocket( Socket_t xSocket );
-uint32_t FreeRTOS_gethostbyname( const char *pcHostName );
-uint32_t FreeRTOS_inet_addr( const char * pcIPAddress );
-
-/*
- * For the web server: borrow the circular Rx buffer for inspection
- * HTML driver wants to see if a sequence of 13/10/13/10 is available
- */
-const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket );
-
-void FreeRTOS_netstat( void );
-
-#if ipconfigSUPPORT_SELECT_FUNCTION == 1
-
- /* For FD_SET and FD_CLR, a combination of the following bits can be used: */
-
- typedef enum eSELECT_EVENT {
- eSELECT_READ = 0x0001,
- eSELECT_WRITE = 0x0002,
- eSELECT_EXCEPT = 0x0004,
- eSELECT_INTR = 0x0008,
- eSELECT_ALL = 0x000F,
- /* Reserved for internal use: */
- eSELECT_CALL_IP = 0x0010,
- /* end */
- } eSelectEvent_t;
-
- SocketSet_t FreeRTOS_CreateSocketSet( void );
- void FreeRTOS_DeleteSocketSet( SocketSet_t xSocketSet );
- void FreeRTOS_FD_SET( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToSet );
- void FreeRTOS_FD_CLR( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToClear );
- EventBits_t FreeRTOS_FD_ISSET( Socket_t xSocket, SocketSet_t xSocketSet );
- BaseType_t FreeRTOS_select( SocketSet_t xSocketSet, TickType_t xBlockTimeTicks );
-
-#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* FREERTOS_SOCKETS_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_SOCKETS_H
+#define FREERTOS_SOCKETS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Standard includes. */
+#include <string.h>
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+
+#ifndef FREERTOS_IP_CONFIG_H
+ #error FreeRTOSIPConfig.h has not been included yet
+#endif
+
+/* Event bit definitions are required by the select functions. */
+#include "event_groups.h"
+
+#ifndef INC_FREERTOS_H
+ #error FreeRTOS.h must be included before FreeRTOS_Sockets.h.
+#endif
+
+#ifndef INC_TASK_H
+ #ifndef TASK_H /* For compatibility with older FreeRTOS versions. */
+ #error The FreeRTOS header file task.h must be included before FreeRTOS_Sockets.h.
+ #endif
+#endif
+
+/* Assigned to an Socket_t variable when the socket is not valid, probably
+because it could not be created. */
+#define FREERTOS_INVALID_SOCKET ( ( Socket_t ) ~0U )
+
+/* API function error values. As errno is supported, the FreeRTOS sockets
+functions return error codes rather than just a pass or fail indication. */
+/* HT: Extended the number of error codes, gave them positive values and if possible
+the corresponding found in errno.h
+In case of an error, API's will still return negative numbers, e.g.
+ return -pdFREERTOS_ERRNO_EWOULDBLOCK;
+in case an operation would block */
+
+/* The following defines are obsolete, please use -pdFREERTOS_ERRNO_Exxx */
+
+#define FREERTOS_SOCKET_ERROR ( -1 )
+#define FREERTOS_EWOULDBLOCK ( - pdFREERTOS_ERRNO_EWOULDBLOCK )
+#define FREERTOS_EINVAL ( - pdFREERTOS_ERRNO_EINVAL )
+#define FREERTOS_EADDRNOTAVAIL ( - pdFREERTOS_ERRNO_EADDRNOTAVAIL )
+#define FREERTOS_EADDRINUSE ( - pdFREERTOS_ERRNO_EADDRINUSE )
+#define FREERTOS_ENOBUFS ( - pdFREERTOS_ERRNO_ENOBUFS )
+#define FREERTOS_ENOPROTOOPT ( - pdFREERTOS_ERRNO_ENOPROTOOPT )
+#define FREERTOS_ECLOSED ( - pdFREERTOS_ERRNO_ENOTCONN )
+
+/* Values for the parameters to FreeRTOS_socket(), inline with the Berkeley
+standard. See the documentation of FreeRTOS_socket() for more information. */
+#define FREERTOS_AF_INET ( 2 )
+#define FREERTOS_AF_INET6 ( 10 )
+#define FREERTOS_SOCK_DGRAM ( 2 )
+#define FREERTOS_IPPROTO_UDP ( 17 )
+
+#define FREERTOS_SOCK_STREAM ( 1 )
+#define FREERTOS_IPPROTO_TCP ( 6 )
+/* IP packet of type "Any local network"
+ * can be used in stead of TCP for testing with sockets in raw mode
+ */
+#define FREERTOS_IPPROTO_USR_LAN ( 63 )
+
+/* A bit value that can be passed into the FreeRTOS_sendto() function as part of
+the flags parameter. Setting the FREERTOS_ZERO_COPY in the flags parameter
+indicates that the zero copy interface is being used. See the documentation for
+FreeRTOS_sockets() for more information. */
+#define FREERTOS_ZERO_COPY ( 1 )
+
+/* Values that can be passed in the option name parameter of calls to
+FreeRTOS_setsockopt(). */
+#define FREERTOS_SO_RCVTIMEO ( 0 ) /* Used to set the receive time out. */
+#define FREERTOS_SO_SNDTIMEO ( 1 ) /* Used to set the send time out. */
+#define FREERTOS_SO_UDPCKSUM_OUT ( 2 ) /* Used to turn the use of the UDP checksum by a socket on or off. This also doubles as part of an 8-bit bitwise socket option. */
+#if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )
+ #define FREERTOS_SO_SET_SEMAPHORE ( 3 ) /* Used to set a user's semaphore */
+#endif
+#define FREERTOS_SO_SNDBUF ( 4 ) /* Set the size of the send buffer (TCP only) */
+#define FREERTOS_SO_RCVBUF ( 5 ) /* Set the size of the receive buffer (TCP only) */
+
+#if ipconfigUSE_CALLBACKS == 1
+ #define FREERTOS_SO_TCP_CONN_HANDLER ( 6 ) /* Install a callback for (dis) connection events. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
+ #define FREERTOS_SO_TCP_RECV_HANDLER ( 7 ) /* Install a callback for receiving TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
+ #define FREERTOS_SO_TCP_SENT_HANDLER ( 8 ) /* Install a callback for sending TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
+ #define FREERTOS_SO_UDP_RECV_HANDLER ( 9 ) /* Install a callback for receiving UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
+ #define FREERTOS_SO_UDP_SENT_HANDLER ( 10 ) /* Install a callback for sending UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */
+#endif /* ipconfigUSE_CALLBACKS */
+
+#define FREERTOS_SO_REUSE_LISTEN_SOCKET ( 11 ) /* When a listening socket gets connected, do not create a new one but re-use it */
+#define FREERTOS_SO_CLOSE_AFTER_SEND ( 12 ) /* As soon as the last byte has been transmitted, finalise the connection */
+#define FREERTOS_SO_WIN_PROPERTIES ( 13 ) /* Set all buffer and window properties in one call, parameter is pointer to WinProperties_t */
+#define FREERTOS_SO_SET_FULL_SIZE ( 14 ) /* Refuse to send packets smaller than MSS */
+
+#define FREERTOS_SO_STOP_RX ( 15 ) /* Temporarily hold up reception, used by streaming client */
+
+#if( ipconfigUDP_MAX_RX_PACKETS > 0 )
+ #define FREERTOS_SO_UDP_MAX_RX_PACKETS ( 16 ) /* This option helps to limit the maximum number of packets a UDP socket will buffer */
+#endif
+
+#if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )
+ #define FREERTOS_SO_WAKEUP_CALLBACK ( 17 )
+#endif
+
+#define FREERTOS_SO_SET_LOW_HIGH_WATER ( 18 )
+
+#define FREERTOS_NOT_LAST_IN_FRAGMENTED_PACKET ( 0x80 ) /* For internal use only, but also part of an 8-bit bitwise value. */
+#define FREERTOS_FRAGMENTED_PACKET ( 0x40 ) /* For internal use only, but also part of an 8-bit bitwise value. */
+
+/* Values for flag for FreeRTOS_shutdown(). */
+#define FREERTOS_SHUT_RD ( 0 ) /* Not really at this moment, just for compatibility of the interface */
+#define FREERTOS_SHUT_WR ( 1 )
+#define FREERTOS_SHUT_RDWR ( 2 )
+
+/* Values for flag for FreeRTOS_recv(). */
+#define FREERTOS_MSG_OOB ( 2 ) /* process out-of-band data */
+#define FREERTOS_MSG_PEEK ( 4 ) /* peek at incoming message */
+#define FREERTOS_MSG_DONTROUTE ( 8 ) /* send without using routing tables */
+#define FREERTOS_MSG_DONTWAIT ( 16 ) /* Can be used with recvfrom(), sendto(), recv(), and send(). */
+
+typedef struct xWIN_PROPS {
+ /* Properties of the Tx buffer and Tx window */
+ int32_t lTxBufSize; /* Unit: bytes */
+ int32_t lTxWinSize; /* Unit: MSS */
+
+ /* Properties of the Rx buffer and Rx window */
+ int32_t lRxBufSize; /* Unit: bytes */
+ int32_t lRxWinSize; /* Unit: MSS */
+} WinProperties_t;
+
+typedef struct xLOW_HIGH_WATER {
+ /* Structure to pass for the 'FREERTOS_SO_SET_LOW_HIGH_WATER' option */
+ size_t uxLittleSpace; /* Send a STOP when buffer space drops below X bytes */
+ size_t uxEnoughSpace; /* Send a GO when buffer space grows above X bytes */
+} LowHighWater_t;
+
+/* For compatibility with the expected Berkeley sockets naming. */
+#define socklen_t uint32_t
+
+/* For this limited implementation, only two members are required in the
+Berkeley style sockaddr structure. */
+struct freertos_sockaddr
+{
+ /* _HT_ On 32- and 64-bit architectures, the addition of the two uint8_t
+ fields doesn't make the structure bigger, due to alignment.
+ The fields are inserted as a preparation for IPv6. */
+
+ /* sin_len and sin_family not used in the IPv4-only release. */
+ uint8_t sin_len; /* length of this structure. */
+ uint8_t sin_family; /* FREERTOS_AF_INET. */
+ uint16_t sin_port;
+ uint32_t sin_addr;
+};
+
+#if ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN
+
+ #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
+ ( ( ( ( uint32_t ) ( ucOctet3 ) ) << 24UL ) | \
+ ( ( ( uint32_t ) ( ucOctet2 ) ) << 16UL ) | \
+ ( ( ( uint32_t ) ( ucOctet1 ) ) << 8UL ) | \
+ ( ( uint32_t ) ( ucOctet0 ) ) )
+
+ #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer ) \
+ sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
+ ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ), \
+ ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
+ ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\
+ ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ) )
+
+#else /* ipconfigBYTE_ORDER */
+
+ #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 ) \
+ ( ( ( ( uint32_t ) ( ucOctet0 ) ) << 24UL ) | \
+ ( ( ( uint32_t ) ( ucOctet1 ) ) << 16UL ) | \
+ ( ( ( uint32_t ) ( ucOctet2 ) ) << 8UL ) | \
+ ( ( uint32_t ) ( ucOctet3 ) ) )
+
+ #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer ) \
+ sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u", \
+ ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ), \
+ ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\
+ ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \
+ ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ) )
+
+#endif /* ipconfigBYTE_ORDER */
+
+/* The socket type itself. */
+struct xSOCKET;
+typedef struct xSOCKET *Socket_t;
+
+/* The SocketSet_t type is the equivalent to the fd_set type used by the
+Berkeley API. */
+struct xSOCKET_SET;
+typedef struct xSOCKET_SET *SocketSet_t;
+
+/**
+ * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
+ * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
+ * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html
+ */
+Socket_t FreeRTOS_socket( BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol );
+int32_t FreeRTOS_recvfrom( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags, struct freertos_sockaddr *pxSourceAddress, socklen_t *pxSourceAddressLength );
+int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t xTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, socklen_t xDestinationAddressLength );
+BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );
+
+/* function to get the local address and IP port */
+size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );
+
+/* Made available when ipconfigETHERNET_DRIVER_FILTERS_PACKETS is set to 1. */
+BaseType_t xPortHasUDPSocket( uint16_t usPortNr );
+
+#if ipconfigUSE_TCP == 1
+
+BaseType_t FreeRTOS_connect( Socket_t xClientSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );
+BaseType_t FreeRTOS_listen( Socket_t xSocket, BaseType_t xBacklog );
+BaseType_t FreeRTOS_recv( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags );
+BaseType_t FreeRTOS_send( Socket_t xSocket, const void *pvBuffer, size_t uxDataLength, BaseType_t xFlags );
+Socket_t FreeRTOS_accept( Socket_t xServerSocket, struct freertos_sockaddr *pxAddress, socklen_t *pxAddressLength );
+BaseType_t FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow);
+
+#if( ipconfigSUPPORT_SIGNALS != 0 )
+ /* Send a signal to the task which is waiting for a given socket. */
+ BaseType_t FreeRTOS_SignalSocket( Socket_t xSocket );
+
+ /* Send a signal to the task which reads from this socket (FromISR
+ version). */
+ BaseType_t FreeRTOS_SignalSocketFromISR( Socket_t xSocket, BaseType_t *pxHigherPriorityTaskWoken );
+#endif /* ipconfigSUPPORT_SIGNALS */
+
+/* Return the remote address and IP port. */
+BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );
+
+/* returns pdTRUE if TCP socket is connected */
+BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket );
+
+/* returns the actual size of MSS being used */
+BaseType_t FreeRTOS_mss( Socket_t xSocket );
+
+/* for internal use only: return the connection status */
+BaseType_t FreeRTOS_connstatus( Socket_t xSocket );
+
+/* Returns the number of bytes that may be added to txStream */
+BaseType_t FreeRTOS_maywrite( Socket_t xSocket );
+
+/*
+ * Two helper functions, mostly for testing
+ * rx_size returns the number of bytes available in the Rx buffer
+ * tx_space returns the free space in the Tx buffer
+ */
+BaseType_t FreeRTOS_rx_size( Socket_t xSocket );
+BaseType_t FreeRTOS_tx_space( Socket_t xSocket );
+BaseType_t FreeRTOS_tx_size( Socket_t xSocket );
+
+/* Returns the number of outstanding bytes in txStream. */
+/* The function FreeRTOS_outstanding() was already implemented
+FreeRTOS_tx_size(). */
+#define FreeRTOS_outstanding( xSocket ) FreeRTOS_tx_size( xSocket )
+
+/* Returns the number of bytes in the socket's rxStream. */
+/* The function FreeRTOS_recvcount() was already implemented
+FreeRTOS_rx_size(). */
+#define FreeRTOS_recvcount( xSocket ) FreeRTOS_rx_size( xSocket )
+
+/*
+ * For advanced applications only:
+ * Get a direct pointer to the circular transmit buffer.
+ * '*pxLength' will contain the number of bytes that may be written.
+ */
+uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength );
+
+#endif /* ipconfigUSE_TCP */
+
+/*
+ * Connect / disconnect handler for a TCP socket
+ * For example:
+ * static void vMyConnectHandler (Socket_t xSocket, BaseType_t ulConnected)
+ * {
+ * }
+ * F_TCP_UDP_Handler_t xHnd = { vMyConnectHandler };
+ * FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_CONN_HANDLER, ( void * ) &xHnd, sizeof( xHnd ) );
+ */
+
+typedef void (* FOnConnected_t )( Socket_t /* xSocket */, BaseType_t /* ulConnected */ );
+
+/*
+ * Reception handler for a TCP socket
+ * A user-proved function will be called on reception of a message
+ * If the handler returns a positive number, the messages will not be stored
+ * For example:
+ * static BaseType_t xOnTCPReceive( Socket_t xSocket, void * pData, size_t xLength )
+ * {
+ * // handle the message
+ * return 1;
+ * }
+ * F_TCP_UDP_Handler_t xHand = { xOnTCPReceive };
+ * FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_RECV_HANDLER, ( void * ) &xHand, sizeof( xHand ) );
+ */
+typedef BaseType_t (* FOnTCPReceive_t )( Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */ );
+typedef void (* FOnTCPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );
+
+/*
+ * Reception handler for a UDP socket
+ * A user-proved function will be called on reception of a message
+ * If the handler returns a positive number, the messages will not be stored
+ */
+typedef BaseType_t (* FOnUDPReceive_t ) (Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */,
+ const struct freertos_sockaddr * /* pxFrom */, const struct freertos_sockaddr * /* pxDest */ );
+typedef void (* FOnUDPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );
+
+
+typedef union xTCP_UDP_HANDLER
+{
+ FOnConnected_t pxOnTCPConnected; /* FREERTOS_SO_TCP_CONN_HANDLER */
+ FOnTCPReceive_t pxOnTCPReceive; /* FREERTOS_SO_TCP_RECV_HANDLER */
+ FOnTCPSent_t pxOnTCPSent; /* FREERTOS_SO_TCP_SENT_HANDLER */
+ FOnUDPReceive_t pxOnUDPReceive; /* FREERTOS_SO_UDP_RECV_HANDLER */
+ FOnUDPSent_t pxOnUDPSent; /* FREERTOS_SO_UDP_SENT_HANDLER */
+} F_TCP_UDP_Handler_t;
+
+BaseType_t FreeRTOS_setsockopt( Socket_t xSocket, int32_t lLevel, int32_t lOptionName, const void *pvOptionValue, size_t xOptionLength );
+BaseType_t FreeRTOS_closesocket( Socket_t xSocket );
+uint32_t FreeRTOS_gethostbyname( const char *pcHostName );
+uint32_t FreeRTOS_inet_addr( const char * pcIPAddress );
+
+/*
+ * For the web server: borrow the circular Rx buffer for inspection
+ * HTML driver wants to see if a sequence of 13/10/13/10 is available
+ */
+const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket );
+
+void FreeRTOS_netstat( void );
+
+#if ipconfigSUPPORT_SELECT_FUNCTION == 1
+
+ /* For FD_SET and FD_CLR, a combination of the following bits can be used: */
+
+ typedef enum eSELECT_EVENT {
+ eSELECT_READ = 0x0001,
+ eSELECT_WRITE = 0x0002,
+ eSELECT_EXCEPT = 0x0004,
+ eSELECT_INTR = 0x0008,
+ eSELECT_ALL = 0x000F,
+ /* Reserved for internal use: */
+ eSELECT_CALL_IP = 0x0010,
+ /* end */
+ } eSelectEvent_t;
+
+ SocketSet_t FreeRTOS_CreateSocketSet( void );
+ void FreeRTOS_DeleteSocketSet( SocketSet_t xSocketSet );
+ void FreeRTOS_FD_SET( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToSet );
+ void FreeRTOS_FD_CLR( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToClear );
+ EventBits_t FreeRTOS_FD_ISSET( Socket_t xSocket, SocketSet_t xSocketSet );
+ BaseType_t FreeRTOS_select( SocketSet_t xSocketSet, TickType_t xBlockTimeTicks );
+
+#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* FREERTOS_SOCKETS_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Stream_Buffer.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Stream_Buffer.h
index 95bbbdf0a..9698227c6 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Stream_Buffer.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Stream_Buffer.h
@@ -1,231 +1,231 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://aws.amazon.com/freertos
- * http://www.FreeRTOS.org
- */
-
-/*
- * FreeRTOS_Stream_Buffer.h
- *
- * A cicular character buffer
- * An implementation of a circular buffer without a length field
- * If LENGTH defines the size of the buffer, a maximum of (LENGT-1) bytes can be stored
- * In order to add or read data from the buffer, memcpy() will be called at most 2 times
- */
-
-#ifndef FREERTOS_STREAM_BUFFER_H
-#define FREERTOS_STREAM_BUFFER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct xSTREAM_BUFFER {
- volatile size_t uxTail; /* next item to read */
- volatile size_t uxMid; /* iterator within the valid items */
- volatile size_t uxHead; /* next position store a new item */
- volatile size_t uxFront; /* iterator within the free space */
- size_t LENGTH; /* const value: number of reserved elements */
- uint8_t ucArray[ sizeof( size_t ) ];
-} StreamBuffer_t;
-
-static portINLINE void vStreamBufferClear( StreamBuffer_t *pxBuffer );
-static portINLINE void vStreamBufferClear( StreamBuffer_t *pxBuffer )
-{
- /* Make the circular buffer empty */
- pxBuffer->uxHead = 0u;
- pxBuffer->uxTail = 0u;
- pxBuffer->uxFront = 0u;
- pxBuffer->uxMid = 0u;
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferSpace( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper );
-static portINLINE size_t uxStreamBufferSpace( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper )
-{
-/* Returns the space between uxLower and uxUpper, which equals to the distance minus 1 */
-size_t uxCount;
-
- uxCount = pxBuffer->LENGTH + uxUpper - uxLower - 1u;
- if( uxCount >= pxBuffer->LENGTH )
- {
- uxCount -= pxBuffer->LENGTH;
- }
-
- return uxCount;
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferDistance( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper );
-static portINLINE size_t uxStreamBufferDistance( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper )
-{
-/* Returns the distance between uxLower and uxUpper */
-size_t uxCount;
-
- uxCount = pxBuffer->LENGTH + uxUpper - uxLower;
- if ( uxCount >= pxBuffer->LENGTH )
- {
- uxCount -= pxBuffer->LENGTH;
- }
-
- return uxCount;
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferGetSpace( const StreamBuffer_t *pxBuffer );
-static portINLINE size_t uxStreamBufferGetSpace( const StreamBuffer_t *pxBuffer )
-{
-/* Returns the number of items which can still be added to uxHead
-before hitting on uxTail */
-size_t uxHead = pxBuffer->uxHead;
-size_t uxTail = pxBuffer->uxTail;
-
- return uxStreamBufferSpace( pxBuffer, uxHead, uxTail );
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferFrontSpace( const StreamBuffer_t *pxBuffer );
-static portINLINE size_t uxStreamBufferFrontSpace( const StreamBuffer_t *pxBuffer )
-{
-/* Distance between uxFront and uxTail
-or the number of items which can still be added to uxFront,
-before hitting on uxTail */
-
-size_t uxFront = pxBuffer->uxFront;
-size_t uxTail = pxBuffer->uxTail;
-
- return uxStreamBufferSpace( pxBuffer, uxFront, uxTail );
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferGetSize( const StreamBuffer_t *pxBuffer );
-static portINLINE size_t uxStreamBufferGetSize( const StreamBuffer_t *pxBuffer )
-{
-/* Returns the number of items which can be read from uxTail
-before reaching uxHead */
-size_t uxHead = pxBuffer->uxHead;
-size_t uxTail = pxBuffer->uxTail;
-
- return uxStreamBufferDistance( pxBuffer, uxTail, uxHead );
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferMidSpace( const StreamBuffer_t *pxBuffer );
-static portINLINE size_t uxStreamBufferMidSpace( const StreamBuffer_t *pxBuffer )
-{
-/* Returns the distance between uxHead and uxMid */
-size_t uxHead = pxBuffer->uxHead;
-size_t uxMid = pxBuffer->uxMid;
-
- return uxStreamBufferDistance( pxBuffer, uxMid, uxHead );
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE void vStreamBufferMoveMid( StreamBuffer_t *pxBuffer, size_t uxCount );
-static portINLINE void vStreamBufferMoveMid( StreamBuffer_t *pxBuffer, size_t uxCount )
-{
-/* Increment uxMid, but no further than uxHead */
-size_t uxSize = uxStreamBufferMidSpace( pxBuffer );
-
- if( uxCount > uxSize )
- {
- uxCount = uxSize;
- }
- pxBuffer->uxMid += uxCount;
- if( pxBuffer->uxMid >= pxBuffer->LENGTH )
- {
- pxBuffer->uxMid -= pxBuffer->LENGTH;
- }
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE BaseType_t xStreamBufferLessThenEqual( const StreamBuffer_t *pxBuffer, const size_t uxLeft, const size_t uxRight );
-static portINLINE BaseType_t xStreamBufferLessThenEqual( const StreamBuffer_t *pxBuffer, const size_t uxLeft, const size_t uxRight )
-{
-BaseType_t xReturn;
-size_t uxTail = pxBuffer->uxTail;
-
- /* Returns true if ( uxLeft < uxRight ) */
- if( ( uxLeft < uxTail ) ^ ( uxRight < uxTail ) )
- {
- if( uxRight < uxTail )
- {
- xReturn = pdTRUE;
- }
- else
- {
- xReturn = pdFALSE;
- }
- }
- else
- {
- if( uxLeft <= uxRight )
- {
- xReturn = pdTRUE;
- }
- else
- {
- xReturn = pdFALSE;
- }
- }
- return xReturn;
-}
-/*-----------------------------------------------------------*/
-
-static portINLINE size_t uxStreamBufferGetPtr( StreamBuffer_t *pxBuffer, uint8_t **ppucData );
-static portINLINE size_t uxStreamBufferGetPtr( StreamBuffer_t *pxBuffer, uint8_t **ppucData )
-{
-size_t uxNextTail = pxBuffer->uxTail;
-size_t uxSize = uxStreamBufferGetSize( pxBuffer );
-
- *ppucData = pxBuffer->ucArray + uxNextTail;
-
- return FreeRTOS_min_uint32( uxSize, pxBuffer->LENGTH - uxNextTail );
-}
-
-/*
- * Add bytes to a stream buffer.
- *
- * pxBuffer - The buffer to which the bytes will be added.
- * uxOffset - If uxOffset > 0, data will be written at an offset from uxHead
- * while uxHead will not be moved yet.
- * pucData - A pointer to the data to be added.
- * uxCount - The number of bytes to add.
- */
-size_t uxStreamBufferAdd( StreamBuffer_t *pxBuffer, size_t uxOffset, const uint8_t *pucData, size_t uxCount );
-
-/*
- * Read bytes from a stream buffer.
- *
- * pxBuffer - The buffer from which the bytes will be read.
- * uxOffset - Can be used to read data located at a certain offset from 'uxTail'.
- * pucData - A pointer to the buffer into which data will be read.
- * uxMaxCount - The number of bytes to read.
- * xPeek - If set to pdTRUE the data will remain in the buffer.
- */
-size_t uxStreamBufferGet( StreamBuffer_t *pxBuffer, size_t uxOffset, uint8_t *pucData, size_t uxMaxCount, BaseType_t xPeek );
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* !defined( FREERTOS_STREAM_BUFFER_H ) */
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://aws.amazon.com/freertos
+ * http://www.FreeRTOS.org
+ */
+
+/*
+ * FreeRTOS_Stream_Buffer.h
+ *
+ * A cicular character buffer
+ * An implementation of a circular buffer without a length field
+ * If LENGTH defines the size of the buffer, a maximum of (LENGT-1) bytes can be stored
+ * In order to add or read data from the buffer, memcpy() will be called at most 2 times
+ */
+
+#ifndef FREERTOS_STREAM_BUFFER_H
+#define FREERTOS_STREAM_BUFFER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct xSTREAM_BUFFER {
+ volatile size_t uxTail; /* next item to read */
+ volatile size_t uxMid; /* iterator within the valid items */
+ volatile size_t uxHead; /* next position store a new item */
+ volatile size_t uxFront; /* iterator within the free space */
+ size_t LENGTH; /* const value: number of reserved elements */
+ uint8_t ucArray[ sizeof( size_t ) ];
+} StreamBuffer_t;
+
+static portINLINE void vStreamBufferClear( StreamBuffer_t *pxBuffer );
+static portINLINE void vStreamBufferClear( StreamBuffer_t *pxBuffer )
+{
+ /* Make the circular buffer empty */
+ pxBuffer->uxHead = 0u;
+ pxBuffer->uxTail = 0u;
+ pxBuffer->uxFront = 0u;
+ pxBuffer->uxMid = 0u;
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferSpace( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper );
+static portINLINE size_t uxStreamBufferSpace( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper )
+{
+/* Returns the space between uxLower and uxUpper, which equals to the distance minus 1 */
+size_t uxCount;
+
+ uxCount = pxBuffer->LENGTH + uxUpper - uxLower - 1u;
+ if( uxCount >= pxBuffer->LENGTH )
+ {
+ uxCount -= pxBuffer->LENGTH;
+ }
+
+ return uxCount;
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferDistance( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper );
+static portINLINE size_t uxStreamBufferDistance( const StreamBuffer_t *pxBuffer, const size_t uxLower, const size_t uxUpper )
+{
+/* Returns the distance between uxLower and uxUpper */
+size_t uxCount;
+
+ uxCount = pxBuffer->LENGTH + uxUpper - uxLower;
+ if ( uxCount >= pxBuffer->LENGTH )
+ {
+ uxCount -= pxBuffer->LENGTH;
+ }
+
+ return uxCount;
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferGetSpace( const StreamBuffer_t *pxBuffer );
+static portINLINE size_t uxStreamBufferGetSpace( const StreamBuffer_t *pxBuffer )
+{
+/* Returns the number of items which can still be added to uxHead
+before hitting on uxTail */
+size_t uxHead = pxBuffer->uxHead;
+size_t uxTail = pxBuffer->uxTail;
+
+ return uxStreamBufferSpace( pxBuffer, uxHead, uxTail );
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferFrontSpace( const StreamBuffer_t *pxBuffer );
+static portINLINE size_t uxStreamBufferFrontSpace( const StreamBuffer_t *pxBuffer )
+{
+/* Distance between uxFront and uxTail
+or the number of items which can still be added to uxFront,
+before hitting on uxTail */
+
+size_t uxFront = pxBuffer->uxFront;
+size_t uxTail = pxBuffer->uxTail;
+
+ return uxStreamBufferSpace( pxBuffer, uxFront, uxTail );
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferGetSize( const StreamBuffer_t *pxBuffer );
+static portINLINE size_t uxStreamBufferGetSize( const StreamBuffer_t *pxBuffer )
+{
+/* Returns the number of items which can be read from uxTail
+before reaching uxHead */
+size_t uxHead = pxBuffer->uxHead;
+size_t uxTail = pxBuffer->uxTail;
+
+ return uxStreamBufferDistance( pxBuffer, uxTail, uxHead );
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferMidSpace( const StreamBuffer_t *pxBuffer );
+static portINLINE size_t uxStreamBufferMidSpace( const StreamBuffer_t *pxBuffer )
+{
+/* Returns the distance between uxHead and uxMid */
+size_t uxHead = pxBuffer->uxHead;
+size_t uxMid = pxBuffer->uxMid;
+
+ return uxStreamBufferDistance( pxBuffer, uxMid, uxHead );
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE void vStreamBufferMoveMid( StreamBuffer_t *pxBuffer, size_t uxCount );
+static portINLINE void vStreamBufferMoveMid( StreamBuffer_t *pxBuffer, size_t uxCount )
+{
+/* Increment uxMid, but no further than uxHead */
+size_t uxSize = uxStreamBufferMidSpace( pxBuffer );
+
+ if( uxCount > uxSize )
+ {
+ uxCount = uxSize;
+ }
+ pxBuffer->uxMid += uxCount;
+ if( pxBuffer->uxMid >= pxBuffer->LENGTH )
+ {
+ pxBuffer->uxMid -= pxBuffer->LENGTH;
+ }
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE BaseType_t xStreamBufferLessThenEqual( const StreamBuffer_t *pxBuffer, const size_t uxLeft, const size_t uxRight );
+static portINLINE BaseType_t xStreamBufferLessThenEqual( const StreamBuffer_t *pxBuffer, const size_t uxLeft, const size_t uxRight )
+{
+BaseType_t xReturn;
+size_t uxTail = pxBuffer->uxTail;
+
+ /* Returns true if ( uxLeft < uxRight ) */
+ if( ( uxLeft < uxTail ) ^ ( uxRight < uxTail ) )
+ {
+ if( uxRight < uxTail )
+ {
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ else
+ {
+ if( uxLeft <= uxRight )
+ {
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ return xReturn;
+}
+/*-----------------------------------------------------------*/
+
+static portINLINE size_t uxStreamBufferGetPtr( StreamBuffer_t *pxBuffer, uint8_t **ppucData );
+static portINLINE size_t uxStreamBufferGetPtr( StreamBuffer_t *pxBuffer, uint8_t **ppucData )
+{
+size_t uxNextTail = pxBuffer->uxTail;
+size_t uxSize = uxStreamBufferGetSize( pxBuffer );
+
+ *ppucData = pxBuffer->ucArray + uxNextTail;
+
+ return FreeRTOS_min_uint32( uxSize, pxBuffer->LENGTH - uxNextTail );
+}
+
+/*
+ * Add bytes to a stream buffer.
+ *
+ * pxBuffer - The buffer to which the bytes will be added.
+ * uxOffset - If uxOffset > 0, data will be written at an offset from uxHead
+ * while uxHead will not be moved yet.
+ * pucData - A pointer to the data to be added.
+ * uxCount - The number of bytes to add.
+ */
+size_t uxStreamBufferAdd( StreamBuffer_t *pxBuffer, size_t uxOffset, const uint8_t *pucData, size_t uxCount );
+
+/*
+ * Read bytes from a stream buffer.
+ *
+ * pxBuffer - The buffer from which the bytes will be read.
+ * uxOffset - Can be used to read data located at a certain offset from 'uxTail'.
+ * pucData - A pointer to the buffer into which data will be read.
+ * uxMaxCount - The number of bytes to read.
+ * xPeek - If set to pdTRUE the data will remain in the buffer.
+ */
+size_t uxStreamBufferGet( StreamBuffer_t *pxBuffer, size_t uxOffset, uint8_t *pucData, size_t uxMaxCount, BaseType_t xPeek );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !defined( FREERTOS_STREAM_BUFFER_H ) */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_IP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_IP.h
index 76738c460..e26edf653 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_IP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_IP.h
@@ -1,80 +1,80 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_TCP_IP_H
-#define FREERTOS_TCP_IP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-BaseType_t xProcessReceivedTCPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer );
-
-typedef enum eTCP_STATE {
- /* Comments about the TCP states are borrowed from the very useful
- * Wiki page:
- * http://en.wikipedia.org/wiki/Transmission_Control_Protocol */
- eCLOSED = 0u, /* 0 (server + client) no connection state at all. */
- eTCP_LISTEN, /* 1 (server) waiting for a connection request
- from any remote TCP and port. */
- eCONNECT_SYN, /* 2 (client) internal state: socket wants to send
- a connect */
- eSYN_FIRST, /* 3 (server) Just created, must ACK the SYN request. */
- eSYN_RECEIVED, /* 4 (server) waiting for a confirming connection request
- acknowledgement after having both received and sent a connection request. */
- eESTABLISHED, /* 5 (server + client) an open connection, data received can be
- delivered to the user. The normal state for the data transfer phase of the connection. */
- eFIN_WAIT_1, /* 6 (server + client) waiting for a connection termination request from the remote TCP,
- or an acknowledgement of the connection termination request previously sent. */
- eFIN_WAIT_2, /* 7 (server + client) waiting for a connection termination request from the remote TCP. */
- eCLOSE_WAIT, /* 8 (server + client) waiting for a connection termination request from the local user. */
- eCLOSING, /* (server + client) waiting for a connection termination request acknowledgement from the remote TCP. */
- eLAST_ACK, /* 9 (server + client) waiting for an acknowledgement of the connection termination request
- previously sent to the remote TCP
- (which includes an acknowledgement of its connection termination request). */
- eTIME_WAIT, /* 10 (either server or client) waiting for enough time to pass to be sure the remote TCP received the
- acknowledgement of its connection termination request. [According to RFC 793 a connection can
- stay in TIME-WAIT for a maximum of four minutes known as a MSL (maximum segment lifetime).] */
-} eIPTCPState_t;
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* FREERTOS_TCP_IP_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_TCP_IP_H
+#define FREERTOS_TCP_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+BaseType_t xProcessReceivedTCPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer );
+
+typedef enum eTCP_STATE {
+ /* Comments about the TCP states are borrowed from the very useful
+ * Wiki page:
+ * http://en.wikipedia.org/wiki/Transmission_Control_Protocol */
+ eCLOSED = 0u, /* 0 (server + client) no connection state at all. */
+ eTCP_LISTEN, /* 1 (server) waiting for a connection request
+ from any remote TCP and port. */
+ eCONNECT_SYN, /* 2 (client) internal state: socket wants to send
+ a connect */
+ eSYN_FIRST, /* 3 (server) Just created, must ACK the SYN request. */
+ eSYN_RECEIVED, /* 4 (server) waiting for a confirming connection request
+ acknowledgement after having both received and sent a connection request. */
+ eESTABLISHED, /* 5 (server + client) an open connection, data received can be
+ delivered to the user. The normal state for the data transfer phase of the connection. */
+ eFIN_WAIT_1, /* 6 (server + client) waiting for a connection termination request from the remote TCP,
+ or an acknowledgement of the connection termination request previously sent. */
+ eFIN_WAIT_2, /* 7 (server + client) waiting for a connection termination request from the remote TCP. */
+ eCLOSE_WAIT, /* 8 (server + client) waiting for a connection termination request from the local user. */
+ eCLOSING, /* (server + client) waiting for a connection termination request acknowledgement from the remote TCP. */
+ eLAST_ACK, /* 9 (server + client) waiting for an acknowledgement of the connection termination request
+ previously sent to the remote TCP
+ (which includes an acknowledgement of its connection termination request). */
+ eTIME_WAIT, /* 10 (either server or client) waiting for enough time to pass to be sure the remote TCP received the
+ acknowledgement of its connection termination request. [According to RFC 793 a connection can
+ stay in TIME-WAIT for a maximum of four minutes known as a MSL (maximum segment lifetime).] */
+} eIPTCPState_t;
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* FREERTOS_TCP_IP_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_WIN.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_WIN.h
index 9532fd159..1cb7eebc0 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_WIN.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_TCP_WIN.h
@@ -1,213 +1,213 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://aws.amazon.com/freertos
- * http://www.FreeRTOS.org
- */
-
-/*
- * FreeRTOS_TCP_WIN.c
- * Module which handles the TCP windowing schemes for FreeRTOS-PLUS-TCP
- */
-
-#ifndef FREERTOS_TCP_WIN_H
-#define FREERTOS_TCP_WIN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern BaseType_t xTCPWindowLoggingLevel;
-
-typedef struct xTCPTimer
-{
- uint32_t ulBorn;
-} TCPTimer_t;
-
-typedef struct xTCP_SEGMENT
-{
- uint32_t ulSequenceNumber; /* The sequence number of the first byte in this packet */
- int32_t lMaxLength; /* Maximum space, number of bytes which can be stored in this segment */
- int32_t lDataLength; /* Actual number of bytes */
- int32_t lStreamPos; /* reference to the [t|r]xStream of the socket */
- TCPTimer_t xTransmitTimer; /* saves a timestamp at the moment this segment gets transmitted (TX only) */
- union
- {
- struct
- {
- uint32_t
- ucTransmitCount : 8,/* Number of times the segment has been transmitted, used to calculate the RTT */
- ucDupAckCount : 8, /* Counts the number of times that a higher segment was ACK'd. After 3 times a Fast Retransmission takes place */
- bOutstanding : 1, /* It the peer's turn, we're just waiting for an ACK */
- bAcked : 1, /* This segment has been acknowledged */
- bIsForRx : 1; /* pdTRUE if segment is used for reception */
- } bits;
- uint32_t ulFlags;
- } u;
-#if( ipconfigUSE_TCP_WIN != 0 )
- struct xLIST_ITEM xQueueItem; /* TX only: segments can be linked in one of three queues: xPriorityQueue, xTxQueue, and xWaitQueue */
- struct xLIST_ITEM xListItem; /* With this item the segment can be connected to a list, depending on who is owning it */
-#endif
-} TCPSegment_t;
-
-typedef struct xTCP_WINSIZE
-{
- uint32_t ulRxWindowLength;
- uint32_t ulTxWindowLength;
-} TCPWinSize_t;
-
-/*
- * If TCP time-stamps are being used, they will occupy 12 bytes in
- * each packet, and thus the message space will become smaller
- */
-/* Keep this as a multiple of 4 */
-#if( ipconfigUSE_TCP_WIN == 1 )
- #define ipSIZE_TCP_OPTIONS 16u
-#else
- #define ipSIZE_TCP_OPTIONS 12u
-#endif
-
-/*
- * Every TCP connection owns a TCP window for the administration of all packets
- * It owns two sets of segment descriptors, incoming and outgoing
- */
-typedef struct xTCP_WINDOW
-{
- union
- {
- struct
- {
- uint32_t
- bHasInit : 1, /* The window structure has been initialised */
- bSendFullSize : 1, /* May only send packets with a size equal to MSS (for optimisation) */
- bTimeStamps : 1; /* Socket is supposed to use TCP time-stamps. This depends on the */
- } bits; /* party which opens the connection */
- uint32_t ulFlags;
- } u;
- TCPWinSize_t xSize;
- struct
- {
- uint32_t ulFirstSequenceNumber; /* Logging & debug: the first segment received/sent in this connection
- * for Tx: initial send sequence number (ISS)
- * for Rx: initial receive sequence number (IRS) */
- uint32_t ulCurrentSequenceNumber;/* Tx/Rx: the oldest sequence number not yet confirmed, also SND.UNA / RCV.NXT
- * In other words: the sequence number of the left side of the sliding window */
- uint32_t ulFINSequenceNumber; /* The sequence number which carried the FIN flag */
- uint32_t ulHighestSequenceNumber;/* Sequence number of the right-most byte + 1 */
- } rx, tx;
- uint32_t ulOurSequenceNumber; /* The SEQ number we're sending out */
- uint32_t ulUserDataLength; /* Number of bytes in Rx buffer which may be passed to the user, after having received a 'missing packet' */
- uint32_t ulNextTxSequenceNumber; /* The sequence number given to the next byte to be added for transmission */
- int32_t lSRTT; /* Smoothed Round Trip Time, it may increment quickly and it decrements slower */
- uint8_t ucOptionLength; /* Number of valid bytes in ulOptionsData[] */
-#if( ipconfigUSE_TCP_WIN == 1 )
- List_t xPriorityQueue; /* Priority queue: segments which must be sent immediately */
- List_t xTxQueue; /* Transmit queue: segments queued for transmission */
- List_t xWaitQueue; /* Waiting queue: outstanding segments */
- TCPSegment_t *pxHeadSegment; /* points to a segment which has not been transmitted and it's size is still growing (user data being added) */
- uint32_t ulOptionsData[ipSIZE_TCP_OPTIONS/sizeof(uint32_t)]; /* Contains the options we send out */
- List_t xTxSegments; /* A linked list of all transmission segments, sorted on sequence number */
- List_t xRxSegments; /* A linked list of reception segments, order depends on sequence of arrival */
-#else
- /* For tiny TCP, there is only 1 outstanding TX segment */
- TCPSegment_t xTxSegment; /* Priority queue */
-#endif
- uint16_t usOurPortNumber; /* Mostly for debugging/logging: our TCP port number */
- uint16_t usPeerPortNumber; /* debugging/logging: the peer's TCP port number */
- uint16_t usMSS; /* Current accepted MSS */
- uint16_t usMSSInit; /* MSS as configured by the socket owner */
-} TCPWindow_t;
-
-
-/*=============================================================================
- *
- * Creation and destruction
- *
- *=============================================================================*/
-
-/* Create and initialize a window */
-void vTCPWindowCreate( TCPWindow_t *pxWindow, uint32_t ulRxWindowLength,
- uint32_t ulTxWindowLength, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
-
-/* Destroy a window (always returns NULL)
- * It will free some resources: a collection of segments */
-void vTCPWindowDestroy( TCPWindow_t *pxWindow );
-
-/* Initialize a window */
-void vTCPWindowInit( TCPWindow_t *pxWindow, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
-
-/* Clean up allocated segments. Should only be called when FreeRTOS+TCP will no longer be used. */
-void vTCPSegmentCleanup( void );
-
-/*=============================================================================
- *
- * Rx functions
- *
- *=============================================================================*/
-
-/* if true may be passed directly to user (segment expected and window is empty)
- * But pxWindow->ackno should always be used to set "BUF->ackno" */
-int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace );
-
-/* When lTCPWindowRxCheck returned false, please call store for this unexpected data */
-BaseType_t xTCPWindowRxStore( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength );
-
-/* This function will be called as soon as a FIN is received. It will return true
- * if there are no 'open' reception segments */
-BaseType_t xTCPWindowRxEmpty( TCPWindow_t *pxWindow );
-
-/* _HT_ Temporary function for testing/debugging
- * Not used at this moment */
-void vTCPWinShowSegments( TCPWindow_t *pxWindow, BaseType_t bForRx );
-
-/*=============================================================================
- *
- * Tx functions
- *
- *=============================================================================*/
-
-/* Adds data to the Tx-window */
-int32_t lTCPWindowTxAdd( TCPWindow_t *pxWindow, uint32_t ulLength, int32_t lPosition, int32_t lMax );
-
-/* Check data to be sent and calculate the time period we may sleep */
-BaseType_t xTCPWindowTxHasData( TCPWindow_t *pxWindow, uint32_t ulWindowSize, TickType_t *pulDelay );
-
-/* See if anything is left to be sent
- * Function will be called when a FIN has been received. Only when the TX window is clean,
- * it will return pdTRUE */
-BaseType_t xTCPWindowTxDone( TCPWindow_t *pxWindow );
-
-/* Fetches data to be sent.
- * apPos will point to a location with the circular data buffer: txStream */
-uint32_t ulTCPWindowTxGet( TCPWindow_t *pxWindow, uint32_t ulWindowSize, int32_t *plPosition );
-
-/* Receive a normal ACK */
-uint32_t ulTCPWindowTxAck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber );
-
-/* Receive a SACK option */
-uint32_t ulTCPWindowTxSack( TCPWindow_t *pxWindow, uint32_t ulFirst, uint32_t ulLast );
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* FREERTOS_TCP_WIN_H */
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://aws.amazon.com/freertos
+ * http://www.FreeRTOS.org
+ */
+
+/*
+ * FreeRTOS_TCP_WIN.c
+ * Module which handles the TCP windowing schemes for FreeRTOS-PLUS-TCP
+ */
+
+#ifndef FREERTOS_TCP_WIN_H
+#define FREERTOS_TCP_WIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern BaseType_t xTCPWindowLoggingLevel;
+
+typedef struct xTCPTimer
+{
+ uint32_t ulBorn;
+} TCPTimer_t;
+
+typedef struct xTCP_SEGMENT
+{
+ uint32_t ulSequenceNumber; /* The sequence number of the first byte in this packet */
+ int32_t lMaxLength; /* Maximum space, number of bytes which can be stored in this segment */
+ int32_t lDataLength; /* Actual number of bytes */
+ int32_t lStreamPos; /* reference to the [t|r]xStream of the socket */
+ TCPTimer_t xTransmitTimer; /* saves a timestamp at the moment this segment gets transmitted (TX only) */
+ union
+ {
+ struct
+ {
+ uint32_t
+ ucTransmitCount : 8,/* Number of times the segment has been transmitted, used to calculate the RTT */
+ ucDupAckCount : 8, /* Counts the number of times that a higher segment was ACK'd. After 3 times a Fast Retransmission takes place */
+ bOutstanding : 1, /* It the peer's turn, we're just waiting for an ACK */
+ bAcked : 1, /* This segment has been acknowledged */
+ bIsForRx : 1; /* pdTRUE if segment is used for reception */
+ } bits;
+ uint32_t ulFlags;
+ } u;
+#if( ipconfigUSE_TCP_WIN != 0 )
+ struct xLIST_ITEM xQueueItem; /* TX only: segments can be linked in one of three queues: xPriorityQueue, xTxQueue, and xWaitQueue */
+ struct xLIST_ITEM xListItem; /* With this item the segment can be connected to a list, depending on who is owning it */
+#endif
+} TCPSegment_t;
+
+typedef struct xTCP_WINSIZE
+{
+ uint32_t ulRxWindowLength;
+ uint32_t ulTxWindowLength;
+} TCPWinSize_t;
+
+/*
+ * If TCP time-stamps are being used, they will occupy 12 bytes in
+ * each packet, and thus the message space will become smaller
+ */
+/* Keep this as a multiple of 4 */
+#if( ipconfigUSE_TCP_WIN == 1 )
+ #define ipSIZE_TCP_OPTIONS 16u
+#else
+ #define ipSIZE_TCP_OPTIONS 12u
+#endif
+
+/*
+ * Every TCP connection owns a TCP window for the administration of all packets
+ * It owns two sets of segment descriptors, incoming and outgoing
+ */
+typedef struct xTCP_WINDOW
+{
+ union
+ {
+ struct
+ {
+ uint32_t
+ bHasInit : 1, /* The window structure has been initialised */
+ bSendFullSize : 1, /* May only send packets with a size equal to MSS (for optimisation) */
+ bTimeStamps : 1; /* Socket is supposed to use TCP time-stamps. This depends on the */
+ } bits; /* party which opens the connection */
+ uint32_t ulFlags;
+ } u;
+ TCPWinSize_t xSize;
+ struct
+ {
+ uint32_t ulFirstSequenceNumber; /* Logging & debug: the first segment received/sent in this connection
+ * for Tx: initial send sequence number (ISS)
+ * for Rx: initial receive sequence number (IRS) */
+ uint32_t ulCurrentSequenceNumber;/* Tx/Rx: the oldest sequence number not yet confirmed, also SND.UNA / RCV.NXT
+ * In other words: the sequence number of the left side of the sliding window */
+ uint32_t ulFINSequenceNumber; /* The sequence number which carried the FIN flag */
+ uint32_t ulHighestSequenceNumber;/* Sequence number of the right-most byte + 1 */
+ } rx, tx;
+ uint32_t ulOurSequenceNumber; /* The SEQ number we're sending out */
+ uint32_t ulUserDataLength; /* Number of bytes in Rx buffer which may be passed to the user, after having received a 'missing packet' */
+ uint32_t ulNextTxSequenceNumber; /* The sequence number given to the next byte to be added for transmission */
+ int32_t lSRTT; /* Smoothed Round Trip Time, it may increment quickly and it decrements slower */
+ uint8_t ucOptionLength; /* Number of valid bytes in ulOptionsData[] */
+#if( ipconfigUSE_TCP_WIN == 1 )
+ List_t xPriorityQueue; /* Priority queue: segments which must be sent immediately */
+ List_t xTxQueue; /* Transmit queue: segments queued for transmission */
+ List_t xWaitQueue; /* Waiting queue: outstanding segments */
+ TCPSegment_t *pxHeadSegment; /* points to a segment which has not been transmitted and it's size is still growing (user data being added) */
+ uint32_t ulOptionsData[ipSIZE_TCP_OPTIONS/sizeof(uint32_t)]; /* Contains the options we send out */
+ List_t xTxSegments; /* A linked list of all transmission segments, sorted on sequence number */
+ List_t xRxSegments; /* A linked list of reception segments, order depends on sequence of arrival */
+#else
+ /* For tiny TCP, there is only 1 outstanding TX segment */
+ TCPSegment_t xTxSegment; /* Priority queue */
+#endif
+ uint16_t usOurPortNumber; /* Mostly for debugging/logging: our TCP port number */
+ uint16_t usPeerPortNumber; /* debugging/logging: the peer's TCP port number */
+ uint16_t usMSS; /* Current accepted MSS */
+ uint16_t usMSSInit; /* MSS as configured by the socket owner */
+} TCPWindow_t;
+
+
+/*=============================================================================
+ *
+ * Creation and destruction
+ *
+ *=============================================================================*/
+
+/* Create and initialize a window */
+void vTCPWindowCreate( TCPWindow_t *pxWindow, uint32_t ulRxWindowLength,
+ uint32_t ulTxWindowLength, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
+
+/* Destroy a window (always returns NULL)
+ * It will free some resources: a collection of segments */
+void vTCPWindowDestroy( TCPWindow_t *pxWindow );
+
+/* Initialize a window */
+void vTCPWindowInit( TCPWindow_t *pxWindow, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
+
+/* Clean up allocated segments. Should only be called when FreeRTOS+TCP will no longer be used. */
+void vTCPSegmentCleanup( void );
+
+/*=============================================================================
+ *
+ * Rx functions
+ *
+ *=============================================================================*/
+
+/* if true may be passed directly to user (segment expected and window is empty)
+ * But pxWindow->ackno should always be used to set "BUF->ackno" */
+int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace );
+
+/* When lTCPWindowRxCheck returned false, please call store for this unexpected data */
+BaseType_t xTCPWindowRxStore( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength );
+
+/* This function will be called as soon as a FIN is received. It will return true
+ * if there are no 'open' reception segments */
+BaseType_t xTCPWindowRxEmpty( TCPWindow_t *pxWindow );
+
+/* _HT_ Temporary function for testing/debugging
+ * Not used at this moment */
+void vTCPWinShowSegments( TCPWindow_t *pxWindow, BaseType_t bForRx );
+
+/*=============================================================================
+ *
+ * Tx functions
+ *
+ *=============================================================================*/
+
+/* Adds data to the Tx-window */
+int32_t lTCPWindowTxAdd( TCPWindow_t *pxWindow, uint32_t ulLength, int32_t lPosition, int32_t lMax );
+
+/* Check data to be sent and calculate the time period we may sleep */
+BaseType_t xTCPWindowTxHasData( TCPWindow_t *pxWindow, uint32_t ulWindowSize, TickType_t *pulDelay );
+
+/* See if anything is left to be sent
+ * Function will be called when a FIN has been received. Only when the TX window is clean,
+ * it will return pdTRUE */
+BaseType_t xTCPWindowTxDone( TCPWindow_t *pxWindow );
+
+/* Fetches data to be sent.
+ * apPos will point to a location with the circular data buffer: txStream */
+uint32_t ulTCPWindowTxGet( TCPWindow_t *pxWindow, uint32_t ulWindowSize, int32_t *plPosition );
+
+/* Receive a normal ACK */
+uint32_t ulTCPWindowTxAck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber );
+
+/* Receive a SACK option */
+uint32_t ulTCPWindowTxSack( TCPWindow_t *pxWindow, uint32_t ulFirst, uint32_t ulLast );
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* FREERTOS_TCP_WIN_H */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_UDP_IP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_UDP_IP.h
index a7463fcee..cb3dd3556 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_UDP_IP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_UDP_IP.h
@@ -1,56 +1,56 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_UDP_IP_H
-#define FREERTOS_UDP_IP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Application level configuration options. */
-#include "FreeRTOSIPConfig.h"
-#include "FreeRTOSIPConfigDefaults.h"
-#include "IPTraceMacroDefaults.h"
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* FREERTOS_UDP_IP_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_UDP_IP_H
+#define FREERTOS_UDP_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Application level configuration options. */
+#include "FreeRTOSIPConfig.h"
+#include "FreeRTOSIPConfigDefaults.h"
+#include "IPTraceMacroDefaults.h"
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* FREERTOS_UDP_IP_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_errno_TCP.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_errno_TCP.h
index 534f5261d..0253a200d 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_errno_TCP.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_errno_TCP.h
@@ -1,90 +1,90 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef FREERTOS_ERRNO_TCP
-#define FREERTOS_ERRNO_TCP
-
-/* The following definitions will be included in the core FreeRTOS code in
-future versions of FreeRTOS - hence the 'pd' (ProjDefs) prefix - at which time
-this file will be removed. */
-
-/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
-itself. */
-
-/* For future compatibility (see comment above), check the definitions have not
-already been made. */
-#ifndef pdFREERTOS_ERRNO_NONE
- #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
- #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
- #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
- #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
- #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
- #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
- #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
- #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
- #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
- #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
- #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
- #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
- #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
- #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
- #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
- #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
- #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
- #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
- #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
- #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
- #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
- #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
- #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
- #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
- #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
- #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
- #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
- #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
- #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
- #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
- #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
- #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
- #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
- #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
- #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
- #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
- #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
- #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
- #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
- #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
-
- /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
- itself. */
- #define pdFREERTOS_LITTLE_ENDIAN 0
- #define pdFREERTOS_BIG_ENDIAN 1
-
-#endif /* pdFREERTOS_ERRNO_NONE */
-
-#endif /* FREERTOS_ERRNO_TCP */
-
-
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef FREERTOS_ERRNO_TCP
+#define FREERTOS_ERRNO_TCP
+
+/* The following definitions will be included in the core FreeRTOS code in
+future versions of FreeRTOS - hence the 'pd' (ProjDefs) prefix - at which time
+this file will be removed. */
+
+/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
+itself. */
+
+/* For future compatibility (see comment above), check the definitions have not
+already been made. */
+#ifndef pdFREERTOS_ERRNO_NONE
+ #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
+ #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
+ #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
+ #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
+ #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
+ #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
+ #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
+ #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
+ #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
+ #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
+ #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
+ #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
+ #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
+ #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
+ #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
+ #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
+ #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
+ #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
+ #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
+ #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
+ #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
+ #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
+ #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
+ #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
+ #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
+ #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
+ #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
+ #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+ #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
+ #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
+ #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
+ #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
+ #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
+ #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
+ #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
+ #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
+ #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
+ #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
+ #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
+ #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
+
+ /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
+ itself. */
+ #define pdFREERTOS_LITTLE_ENDIAN 0
+ #define pdFREERTOS_BIG_ENDIAN 1
+
+#endif /* pdFREERTOS_ERRNO_NONE */
+
+#endif /* FREERTOS_ERRNO_TCP */
+
+
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/IPTraceMacroDefaults.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/IPTraceMacroDefaults.h
index 316e18f56..0af7189dd 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/IPTraceMacroDefaults.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/IPTraceMacroDefaults.h
@@ -1,193 +1,193 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-/* This file provides default (empty) implementations for any IP trace macros
-that are not defined by the user. See
-http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Trace.html */
-
-#ifndef UDP_TRACE_MACRO_DEFAULTS_H
-#define UDP_TRACE_MACRO_DEFAULTS_H
-
-#ifndef iptraceNETWORK_DOWN
- #define iptraceNETWORK_DOWN()
-#endif
-
-#ifndef iptraceNETWORK_BUFFER_RELEASED
- #define iptraceNETWORK_BUFFER_RELEASED( pxBufferAddress )
-#endif
-
-#ifndef iptraceNETWORK_BUFFER_OBTAINED
- #define iptraceNETWORK_BUFFER_OBTAINED( pxBufferAddress )
-#endif
-
-#ifndef iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR
- #define iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR( pxBufferAddress )
-#endif
-
-#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER
- #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER()
-#endif
-
-#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR
- #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR()
-#endif
-
-#ifndef iptraceCREATING_ARP_REQUEST
- #define iptraceCREATING_ARP_REQUEST( ulIPAddress )
-#endif
-
-#ifndef iptraceARP_TABLE_ENTRY_WILL_EXPIRE
- #define iptraceARP_TABLE_ENTRY_WILL_EXPIRE( ulIPAddress )
-#endif
-
-#ifndef iptraceARP_TABLE_ENTRY_EXPIRED
- #define iptraceARP_TABLE_ENTRY_EXPIRED( ulIPAddress )
-#endif
-
-#ifndef iptraceARP_TABLE_ENTRY_CREATED
- #define iptraceARP_TABLE_ENTRY_CREATED( ulIPAddress, ucMACAddress )
-#endif
-
-#ifndef iptraceSENDING_UDP_PACKET
- #define iptraceSENDING_UDP_PACKET( ulIPAddress )
-#endif
-
-#ifndef iptracePACKET_DROPPED_TO_GENERATE_ARP
- #define iptracePACKET_DROPPED_TO_GENERATE_ARP( ulIPAddress )
-#endif
-
-#ifndef iptraceICMP_PACKET_RECEIVED
- #define iptraceICMP_PACKET_RECEIVED()
-#endif
-
-#ifndef iptraceSENDING_PING_REPLY
- #define iptraceSENDING_PING_REPLY( ulIPAddress )
-#endif
-
-#ifndef traceARP_PACKET_RECEIVED
- #define traceARP_PACKET_RECEIVED()
-#endif
-
-#ifndef iptracePROCESSING_RECEIVED_ARP_REPLY
- #define iptracePROCESSING_RECEIVED_ARP_REPLY( ulIPAddress )
-#endif
-
-#ifndef iptraceSENDING_ARP_REPLY
- #define iptraceSENDING_ARP_REPLY( ulIPAddress )
-#endif
-
-#ifndef iptraceFAILED_TO_CREATE_SOCKET
- #define iptraceFAILED_TO_CREATE_SOCKET()
-#endif
-
-#ifndef iptraceFAILED_TO_CREATE_EVENT_GROUP
- #define iptraceFAILED_TO_CREATE_EVENT_GROUP()
-#endif
-
-#ifndef iptraceRECVFROM_DISCARDING_BYTES
- #define iptraceRECVFROM_DISCARDING_BYTES( xNumberOfBytesDiscarded )
-#endif
-
-#ifndef iptraceETHERNET_RX_EVENT_LOST
- #define iptraceETHERNET_RX_EVENT_LOST()
-#endif
-
-#ifndef iptraceSTACK_TX_EVENT_LOST
- #define iptraceSTACK_TX_EVENT_LOST( xEvent )
-#endif
-
-#ifndef iptraceNETWORK_EVENT_RECEIVED
- #define iptraceNETWORK_EVENT_RECEIVED( eEvent )
-#endif
-
-#ifndef iptraceBIND_FAILED
- #define iptraceBIND_FAILED( xSocket, usPort )
-#endif
-
-#ifndef iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS
- #define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ulIPAddress )
-#endif
-
-#ifndef iptraceSENDING_DHCP_DISCOVER
- #define iptraceSENDING_DHCP_DISCOVER()
-#endif
-
-#ifndef iptraceSENDING_DHCP_REQUEST
- #define iptraceSENDING_DHCP_REQUEST()
-#endif
-
-#ifndef iptraceDHCP_SUCCEDEED
- #define iptraceDHCP_SUCCEDEED( address )
-#endif
-
-#ifndef iptraceNETWORK_INTERFACE_TRANSMIT
- #define iptraceNETWORK_INTERFACE_TRANSMIT()
-#endif
-
-#ifndef iptraceNETWORK_INTERFACE_RECEIVE
- #define iptraceNETWORK_INTERFACE_RECEIVE()
-#endif
-
-#ifndef iptraceSENDING_DNS_REQUEST
- #define iptraceSENDING_DNS_REQUEST()
-#endif
-
-#ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR
- #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR()
-#endif
-
-#ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS
- #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0
-#endif
-
-#ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP
- #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket )
-#endif
-
-#ifndef pvPortMallocSocket
- #define pvPortMallocSocket(xSize) pvPortMalloc( ( xSize ) )
-#endif
-
-#ifndef iptraceRECVFROM_TIMEOUT
- #define iptraceRECVFROM_TIMEOUT()
-#endif
-
-#ifndef iptraceRECVFROM_INTERRUPTED
- #define iptraceRECVFROM_INTERRUPTED()
-#endif
-
-#ifndef iptraceNO_BUFFER_FOR_SENDTO
- #define iptraceNO_BUFFER_FOR_SENDTO()
-#endif
-
-#ifndef iptraceSENDTO_SOCKET_NOT_BOUND
- #define iptraceSENDTO_SOCKET_NOT_BOUND()
-#endif
-
-#ifndef iptraceSENDTO_DATA_TOO_LONG
- #define iptraceSENDTO_DATA_TOO_LONG()
-#endif
-
-#endif /* UDP_TRACE_MACRO_DEFAULTS_H */
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+/* This file provides default (empty) implementations for any IP trace macros
+that are not defined by the user. See
+http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Trace.html */
+
+#ifndef UDP_TRACE_MACRO_DEFAULTS_H
+#define UDP_TRACE_MACRO_DEFAULTS_H
+
+#ifndef iptraceNETWORK_DOWN
+ #define iptraceNETWORK_DOWN()
+#endif
+
+#ifndef iptraceNETWORK_BUFFER_RELEASED
+ #define iptraceNETWORK_BUFFER_RELEASED( pxBufferAddress )
+#endif
+
+#ifndef iptraceNETWORK_BUFFER_OBTAINED
+ #define iptraceNETWORK_BUFFER_OBTAINED( pxBufferAddress )
+#endif
+
+#ifndef iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR
+ #define iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR( pxBufferAddress )
+#endif
+
+#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER
+ #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER()
+#endif
+
+#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR
+ #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR()
+#endif
+
+#ifndef iptraceCREATING_ARP_REQUEST
+ #define iptraceCREATING_ARP_REQUEST( ulIPAddress )
+#endif
+
+#ifndef iptraceARP_TABLE_ENTRY_WILL_EXPIRE
+ #define iptraceARP_TABLE_ENTRY_WILL_EXPIRE( ulIPAddress )
+#endif
+
+#ifndef iptraceARP_TABLE_ENTRY_EXPIRED
+ #define iptraceARP_TABLE_ENTRY_EXPIRED( ulIPAddress )
+#endif
+
+#ifndef iptraceARP_TABLE_ENTRY_CREATED
+ #define iptraceARP_TABLE_ENTRY_CREATED( ulIPAddress, ucMACAddress )
+#endif
+
+#ifndef iptraceSENDING_UDP_PACKET
+ #define iptraceSENDING_UDP_PACKET( ulIPAddress )
+#endif
+
+#ifndef iptracePACKET_DROPPED_TO_GENERATE_ARP
+ #define iptracePACKET_DROPPED_TO_GENERATE_ARP( ulIPAddress )
+#endif
+
+#ifndef iptraceICMP_PACKET_RECEIVED
+ #define iptraceICMP_PACKET_RECEIVED()
+#endif
+
+#ifndef iptraceSENDING_PING_REPLY
+ #define iptraceSENDING_PING_REPLY( ulIPAddress )
+#endif
+
+#ifndef traceARP_PACKET_RECEIVED
+ #define traceARP_PACKET_RECEIVED()
+#endif
+
+#ifndef iptracePROCESSING_RECEIVED_ARP_REPLY
+ #define iptracePROCESSING_RECEIVED_ARP_REPLY( ulIPAddress )
+#endif
+
+#ifndef iptraceSENDING_ARP_REPLY
+ #define iptraceSENDING_ARP_REPLY( ulIPAddress )
+#endif
+
+#ifndef iptraceFAILED_TO_CREATE_SOCKET
+ #define iptraceFAILED_TO_CREATE_SOCKET()
+#endif
+
+#ifndef iptraceFAILED_TO_CREATE_EVENT_GROUP
+ #define iptraceFAILED_TO_CREATE_EVENT_GROUP()
+#endif
+
+#ifndef iptraceRECVFROM_DISCARDING_BYTES
+ #define iptraceRECVFROM_DISCARDING_BYTES( xNumberOfBytesDiscarded )
+#endif
+
+#ifndef iptraceETHERNET_RX_EVENT_LOST
+ #define iptraceETHERNET_RX_EVENT_LOST()
+#endif
+
+#ifndef iptraceSTACK_TX_EVENT_LOST
+ #define iptraceSTACK_TX_EVENT_LOST( xEvent )
+#endif
+
+#ifndef iptraceNETWORK_EVENT_RECEIVED
+ #define iptraceNETWORK_EVENT_RECEIVED( eEvent )
+#endif
+
+#ifndef iptraceBIND_FAILED
+ #define iptraceBIND_FAILED( xSocket, usPort )
+#endif
+
+#ifndef iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS
+ #define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ulIPAddress )
+#endif
+
+#ifndef iptraceSENDING_DHCP_DISCOVER
+ #define iptraceSENDING_DHCP_DISCOVER()
+#endif
+
+#ifndef iptraceSENDING_DHCP_REQUEST
+ #define iptraceSENDING_DHCP_REQUEST()
+#endif
+
+#ifndef iptraceDHCP_SUCCEDEED
+ #define iptraceDHCP_SUCCEDEED( address )
+#endif
+
+#ifndef iptraceNETWORK_INTERFACE_TRANSMIT
+ #define iptraceNETWORK_INTERFACE_TRANSMIT()
+#endif
+
+#ifndef iptraceNETWORK_INTERFACE_RECEIVE
+ #define iptraceNETWORK_INTERFACE_RECEIVE()
+#endif
+
+#ifndef iptraceSENDING_DNS_REQUEST
+ #define iptraceSENDING_DNS_REQUEST()
+#endif
+
+#ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR
+ #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR()
+#endif
+
+#ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS
+ #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0
+#endif
+
+#ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP
+ #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket )
+#endif
+
+#ifndef pvPortMallocSocket
+ #define pvPortMallocSocket(xSize) pvPortMalloc( ( xSize ) )
+#endif
+
+#ifndef iptraceRECVFROM_TIMEOUT
+ #define iptraceRECVFROM_TIMEOUT()
+#endif
+
+#ifndef iptraceRECVFROM_INTERRUPTED
+ #define iptraceRECVFROM_INTERRUPTED()
+#endif
+
+#ifndef iptraceNO_BUFFER_FOR_SENDTO
+ #define iptraceNO_BUFFER_FOR_SENDTO()
+#endif
+
+#ifndef iptraceSENDTO_SOCKET_NOT_BOUND
+ #define iptraceSENDTO_SOCKET_NOT_BOUND()
+#endif
+
+#ifndef iptraceSENDTO_DATA_TOO_LONG
+ #define iptraceSENDTO_DATA_TOO_LONG()
+#endif
+
+#endif /* UDP_TRACE_MACRO_DEFAULTS_H */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkBufferManagement.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkBufferManagement.h
index 0fcde3439..d57e607ac 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkBufferManagement.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkBufferManagement.h
@@ -1,70 +1,70 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef NETWORK_BUFFER_MANAGEMENT_H
-#define NETWORK_BUFFER_MANAGEMENT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* NOTE PUBLIC API FUNCTIONS. */
-BaseType_t xNetworkBuffersInitialise( void );
-NetworkBufferDescriptor_t *pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );
-NetworkBufferDescriptor_t *pxNetworkBufferGetFromISR( size_t xRequestedSizeBytes );
-void vReleaseNetworkBufferAndDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer );
-BaseType_t vNetworkBufferReleaseFromISR( NetworkBufferDescriptor_t * const pxNetworkBuffer );
-uint8_t *pucGetNetworkBuffer( size_t *pxRequestedSizeBytes );
-void vReleaseNetworkBuffer( uint8_t *pucEthernetBuffer );
-
-/* Get the current number of free network buffers. */
-UBaseType_t uxGetNumberOfFreeNetworkBuffers( void );
-
-/* Get the lowest number of free network buffers. */
-UBaseType_t uxGetMinimumFreeNetworkBuffers( void );
-
-/* Copy a network buffer into a bigger buffer. */
-NetworkBufferDescriptor_t *pxDuplicateNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer,
- size_t uxNewLength);
-
-/* Increase the size of a Network Buffer.
-In case BufferAllocation_2.c is used, the new space must be allocated. */
-NetworkBufferDescriptor_t *pxResizeNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * pxNetworkBuffer,
- size_t xNewSizeBytes );
-
-#if ipconfigTCP_IP_SANITY
- /*
- * Check if an address is a valid pointer to a network descriptor
- * by looking it up in the array of network descriptors
- */
- UBaseType_t bIsValidNetworkDescriptor (const NetworkBufferDescriptor_t * pxDesc);
- BaseType_t prvIsFreeBuffer( const NetworkBufferDescriptor_t *pxDescr );
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* NETWORK_BUFFER_MANAGEMENT_H */
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef NETWORK_BUFFER_MANAGEMENT_H
+#define NETWORK_BUFFER_MANAGEMENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* NOTE PUBLIC API FUNCTIONS. */
+BaseType_t xNetworkBuffersInitialise( void );
+NetworkBufferDescriptor_t *pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );
+NetworkBufferDescriptor_t *pxNetworkBufferGetFromISR( size_t xRequestedSizeBytes );
+void vReleaseNetworkBufferAndDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer );
+BaseType_t vNetworkBufferReleaseFromISR( NetworkBufferDescriptor_t * const pxNetworkBuffer );
+uint8_t *pucGetNetworkBuffer( size_t *pxRequestedSizeBytes );
+void vReleaseNetworkBuffer( uint8_t *pucEthernetBuffer );
+
+/* Get the current number of free network buffers. */
+UBaseType_t uxGetNumberOfFreeNetworkBuffers( void );
+
+/* Get the lowest number of free network buffers. */
+UBaseType_t uxGetMinimumFreeNetworkBuffers( void );
+
+/* Copy a network buffer into a bigger buffer. */
+NetworkBufferDescriptor_t *pxDuplicateNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer,
+ size_t uxNewLength);
+
+/* Increase the size of a Network Buffer.
+In case BufferAllocation_2.c is used, the new space must be allocated. */
+NetworkBufferDescriptor_t *pxResizeNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * pxNetworkBuffer,
+ size_t xNewSizeBytes );
+
+#if ipconfigTCP_IP_SANITY
+ /*
+ * Check if an address is a valid pointer to a network descriptor
+ * by looking it up in the array of network descriptors
+ */
+ UBaseType_t bIsValidNetworkDescriptor (const NetworkBufferDescriptor_t * pxDesc);
+ BaseType_t prvIsFreeBuffer( const NetworkBufferDescriptor_t *pxDescr );
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* NETWORK_BUFFER_MANAGEMENT_H */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkInterface.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkInterface.h
index c3d3fb4bc..8f1fb3219 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkInterface.h
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/NetworkInterface.h
@@ -1,44 +1,44 @@
-/*
- * FreeRTOS+TCP V2.2.0
- * 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
- * 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
- */
-
-#ifndef NETWORK_INTERFACE_H
-#define NETWORK_INTERFACE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* NOTE PUBLIC API FUNCTIONS. */
-BaseType_t xNetworkInterfaceInitialise( void );
-BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, BaseType_t xReleaseAfterSend );
-void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] );
-BaseType_t xGetPhyLinkStatus( void );
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* NETWORK_INTERFACE_H */
-
+/*
+ * FreeRTOS+TCP V2.2.0
+ * 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
+ * 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
+ */
+
+#ifndef NETWORK_INTERFACE_H
+#define NETWORK_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* NOTE PUBLIC API FUNCTIONS. */
+BaseType_t xNetworkInterfaceInitialise( void );
+BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, BaseType_t xReleaseAfterSend );
+void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] );
+BaseType_t xGetPhyLinkStatus( void );
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* NETWORK_INTERFACE_H */
+