xref: /FreeRTOS-Plus-TCP-v4.0.0/source/include/FreeRTOS_IP.h (revision 14b3e241f530bb5beae65cefb3ce93cfa301b803)
1 /*
2  * FreeRTOS+TCP <DEVELOPMENT BRANCH>
3  * Copyright (C) 2022 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * http://aws.amazon.com/freertos
25  * http://www.FreeRTOS.org
26  */
27 
28 #ifndef FREERTOS_IP_H
29 #define FREERTOS_IP_H
30 
31 #include "FreeRTOS.h"
32 #include "task.h"
33 
34 /* Application level configuration options. */
35 #include "FreeRTOSIPConfig.h"
36 #include "FreeRTOSIPConfigDefaults.h"
37 #include "FreeRTOS_IP_Common.h"
38 #include "IPTraceMacroDefaults.h"
39 
40 /* *INDENT-OFF* */
41 #ifdef __cplusplus
42     extern "C" {
43 #endif
44 /* *INDENT-ON* */
45 
46 /* Constants defining the current version of the FreeRTOS+TCP
47  * network stack. */
48 #define ipFR_TCP_VERSION_NUMBER      "V4.0.999"
49 #define ipFR_TCP_VERSION_MAJOR       4
50 #define ipFR_TCP_VERSION_MINOR       0
51 /* Development builds are always version 999. */
52 #define ipFR_TCP_VERSION_BUILD       999
53 /* Using TCP version to support backward compatibility in the Demo files. */
54 #define FREERTOS_PLUS_TCP_VERSION    10
55 
56 /* Some constants defining the sizes of several parts of a packet.
57  * These defines come before including the configuration header files. */
58 
59 /* The size of the Ethernet header is 14, meaning that 802.1Q VLAN tags
60  * are not ( yet ) supported. */
61 #define ipSIZE_OF_ETH_HEADER     14U
62 #define ipSIZE_OF_IGMP_HEADER    8U
63 #define ipSIZE_OF_UDP_HEADER     8U
64 #define ipSIZE_OF_TCP_HEADER     20U
65 
66 
67 /*
68  * Generate a randomized TCP Initial Sequence Number per RFC.
69  * This function must be provided by the application builder.
70  */
71 /* This function is defined generally by the application. */
72 extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
73                                                     uint16_t usSourcePort,
74                                                     uint32_t ulDestinationAddress,
75                                                     uint16_t usDestinationPort );
76 
77 /* The number of octets in the MAC and IP addresses respectively. */
78 #define ipMAC_ADDRESS_LENGTH_BYTES                 ( 6U )
79 #define ipIP_ADDRESS_LENGTH_BYTES                  ( 4U )
80 
81 /* IP protocol definitions. */
82 #define ipPROTOCOL_ICMP                            ( 1U )
83 #define ipPROTOCOL_IGMP                            ( 2U )
84 #define ipPROTOCOL_TCP                             ( 6U )
85 #define ipPROTOCOL_UDP                             ( 17U )
86 
87 /* The character used to fill ICMP echo requests, and therefore also the
88  * character expected to fill ICMP echo replies. */
89 #define ipECHO_DATA_FILL_BYTE                      'x'
90 
91 /* Dimensions the buffers that are filled by received Ethernet frames. */
92 #define ipSIZE_OF_ETH_CRC_BYTES                    ( 4UL )
93 #define ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES    ( 4UL )
94 #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 )
95 
96 
97 /* Space left at the beginning of a network buffer storage area to store a
98  * pointer back to the network buffer.  Should be a multiple of 8 to ensure 8 byte
99  * alignment is maintained on architectures that require it.
100  *
101  * In order to get a 32-bit alignment of network packets, an offset of 2 bytes
102  * would be desirable, as defined by ipconfigPACKET_FILLER_SIZE.  So the malloc'd
103  * buffer will have the following contents:
104  *  uint32_t pointer;   // word-aligned
105  *  uchar_8 filler[6];
106  *  << ETH-header >>    // half-word-aligned
107  *  uchar_8 dest[6];    // start of pucEthernetBuffer
108  *  uchar_8 dest[6];
109  *  uchar16_t type;
110  *  << IP-header >>     // word-aligned
111  *  uint8_t ucVersionHeaderLength;
112  *  etc
113  */
114 
115 #if ( ipconfigBUFFER_PADDING != 0 )
116     #define ipBUFFER_PADDING    ipconfigBUFFER_PADDING
117 #else
118     #define ipBUFFER_PADDING    ( 8U + ipconfigPACKET_FILLER_SIZE )
119 #endif
120 
121 /* The offset of ucTCPFlags within the TCP header. */
122 #define ipTCP_FLAGS_OFFSET      13U
123 
124 /** @brief Returned to indicate a valid checksum. */
125 #define ipCORRECT_CRC           0xffffU
126 
127 /** @brief Returned to indicate incorrect checksum. */
128 #define ipWRONG_CRC             0x0000U
129 
130 /** @brief Returned as the (invalid) checksum when the length of the data being checked
131  * had an invalid length. */
132 #define ipINVALID_LENGTH        0x1234U
133 
134 /** @brief Returned as the (invalid) checksum when the protocol being checked is not
135  * handled.  The value is chosen simply to be easy to spot when debugging. */
136 #define ipUNHANDLED_PROTOCOL    0x4321U
137 
138 /** @brief The maximum time the IP task is allowed to remain in the Blocked state if no
139  * events are posted to the network event queue. */
140 #ifndef ipconfigMAX_IP_TASK_SLEEP_TIME
141     #define ipconfigMAX_IP_TASK_SLEEP_TIME    ( pdMS_TO_TICKS( 10000UL ) )
142 #endif
143 
144 /* Trace macros to aid in debugging, disabled if ipconfigHAS_PRINTF != 1 */
145 #if ( ipconfigHAS_PRINTF == 1 )
146     #define DEBUG_DECLARE_TRACE_VARIABLE( type, var, init )    type var = ( init ) /**< Trace macro to set "type var = init". */
147     #define DEBUG_SET_TRACE_VARIABLE( var, value )             var = ( value )     /**< Trace macro to set var = value. */
148 #else
149     #define DEBUG_DECLARE_TRACE_VARIABLE( type, var, init )                        /**< Empty definition since ipconfigHAS_PRINTF != 1. */
150     #define DEBUG_SET_TRACE_VARIABLE( var, value )                                 /**< Empty definition since ipconfigHAS_PRINTF != 1. */
151 #endif
152 
153 /**
154  * The structure used to store buffers and pass them around the network stack.
155  * Buffers can be in use by the stack, in use by the network interface hardware
156  * driver, or free (not in use).
157  */
158 typedef struct xNETWORK_BUFFER
159 {
160     ListItem_t xBufferListItem;                /**< Used to reference the buffer form the free buffer list or a socket. */
161     IP_Address_t xIPAddress;                   /**< Source or destination IP address, depending on usage scenario. */
162     uint8_t * pucEthernetBuffer;               /**< Pointer to the start of the Ethernet frame. */
163     size_t xDataLength;                        /**< Starts by holding the total Ethernet frame length, then the UDP/TCP payload length. */
164     struct xNetworkInterface * pxInterface;    /**< The interface on which the packet was received. */
165     struct xNetworkEndPoint * pxEndPoint;      /**< The end-point through which this packet shall be sent. */
166     uint16_t usPort;                           /**< Source or destination port, depending on usage scenario. */
167     uint16_t usBoundPort;                      /**< The port to which a transmitting socket is bound. */
168     #if ( ipconfigUSE_LINKED_RX_MESSAGES != 0 )
169         struct xNETWORK_BUFFER * pxNextBuffer; /**< Possible optimisation for expert users - requires network driver support. */
170     #endif
171 
172 #define ul_IPAddress     xIPAddress.xIP_IPv4
173 #define x_IPv6Address    xIPAddress.xIP_IPv6
174 } NetworkBufferDescriptor_t;
175 
176 #include "pack_struct_start.h"
177 
178 /**
179  * MAC address structure.
180  */
181 struct xMAC_ADDRESS
182 {
183     uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ]; /**< Byte array of the MAC address */
184 }
185 #include "pack_struct_end.h"
186 
187 typedef struct xMAC_ADDRESS MACAddress_t;
188 
189 typedef enum eNETWORK_EVENTS
190 {
191     eNetworkUp,  /* The network is configured. */
192     eNetworkDown /* The network connection has been lost. */
193 } eIPCallbackEvent_t;
194 
195 /* MISRA check: some modules refer to this typedef even though
196  * ipconfigSUPPORT_OUTGOING_PINGS is not enabled. */
197 typedef enum ePING_REPLY_STATUS
198 {
199     eSuccess = 0,     /**< A correct reply has been received for an outgoing ping. */
200     eInvalidChecksum, /**< A reply was received for an outgoing ping but the checksum of the reply was incorrect. */
201     eInvalidData      /**< A reply was received to an outgoing ping but the payload of the reply was not correct. */
202 } ePingReplyStatus_t;
203 
204 /**
205  * The software timer struct for various IP functions
206  */
207 typedef struct xIP_TIMER
208 {
209     uint32_t
210         bActive : 1,            /**< This timer is running and must be processed. */
211         bExpired : 1;           /**< Timer has expired and a task must be processed. */
212     TimeOut_t xTimeOut;         /**< The timeout value. */
213     TickType_t ulRemainingTime; /**< The amount of time remaining. */
214     TickType_t ulReloadTime;    /**< The value of reload time. */
215 } IPTimer_t;
216 
217 
218 /* Endian related definitions. */
219 #if ( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
220 
221 /* FreeRTOS_htons / FreeRTOS_htonl: some platforms might have built-in versions
222  * using a single instruction so allow these versions to be overridden. */
223     #ifndef FreeRTOS_htons
224         #define FreeRTOS_htons( usIn )    ( ( uint16_t ) ( ( ( usIn ) << 8U ) | ( ( usIn ) >> 8U ) ) )
225     #endif
226 
227     #ifndef FreeRTOS_htonl
228         #define FreeRTOS_htonl( ulIn )                             \
229     (                                                              \
230         ( uint32_t )                                               \
231         (                                                          \
232             ( ( ( ( uint32_t ) ( ulIn ) ) ) << 24 ) |              \
233             ( ( ( ( uint32_t ) ( ulIn ) ) & 0x0000ff00U ) << 8 ) | \
234             ( ( ( ( uint32_t ) ( ulIn ) ) & 0x00ff0000U ) >> 8 ) | \
235             ( ( ( ( uint32_t ) ( ulIn ) ) ) >> 24 )                \
236         )                                                          \
237     )
238     #endif /* ifndef FreeRTOS_htonl */
239 
240 #else /* ipconfigBYTE_ORDER */
241 
242     #define FreeRTOS_htons( x )    ( ( uint16_t ) ( x ) )
243     #define FreeRTOS_htonl( x )    ( ( uint32_t ) ( x ) )
244 
245 #endif /* ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN */
246 
247 #define FreeRTOS_ntohs( x )    FreeRTOS_htons( x )
248 #define FreeRTOS_ntohl( x )    FreeRTOS_htonl( x )
249 
250 /* Some simple helper functions. */
251 int32_t FreeRTOS_max_int32( int32_t a,
252                             int32_t b );
253 
254 uint32_t FreeRTOS_max_uint32( uint32_t a,
255                               uint32_t b );
256 
257 size_t FreeRTOS_max_size_t( size_t a,
258                             size_t b );
259 
260 int32_t FreeRTOS_min_int32( int32_t a,
261                             int32_t b );
262 
263 uint32_t FreeRTOS_min_uint32( uint32_t a,
264                               uint32_t b );
265 
266 size_t FreeRTOS_min_size_t( size_t a,
267                             size_t b );
268 
269 uint32_t FreeRTOS_round_up( uint32_t a,
270                             uint32_t d );
271 uint32_t FreeRTOS_round_down( uint32_t a,
272                               uint32_t d );
273 
274 #define ipMS_TO_MIN_TICKS( xTimeInMs )    ( ( pdMS_TO_TICKS( ( xTimeInMs ) ) < ( ( TickType_t ) 1U ) ) ? ( ( TickType_t ) 1U ) : pdMS_TO_TICKS( ( xTimeInMs ) ) )
275 
276 /* For backward compatibility. */
277 #define pdMS_TO_MIN_TICKS( xTimeInMs )    ipMS_TO_MIN_TICKS( xTimeInMs )
278 
279 #ifndef pdTRUE_SIGNED
280     #define pdTRUE_SIGNED    pdTRUE
281 #endif /* pdTRUE_SIGNED */
282 
283 #ifndef pdFALSE_SIGNED
284     #define pdFALSE_SIGNED    pdFALSE
285 #endif /* pdFALSE_SIGNED */
286 
287 #ifndef pdTRUE_UNSIGNED
288     #define pdTRUE_UNSIGNED    ( 1U )
289 #endif /* pdTRUE_UNSIGNED */
290 
291 #ifndef pdFALSE_UNSIGNED
292     #define pdFALSE_UNSIGNED    ( 0U )
293 #endif /* pdFALSE_UNSIGNED */
294 
295 #ifndef ipTRUE_BOOL
296     #define ipTRUE_BOOL    ( 1 == 1 )
297 #endif /* ipTRUE_BOOL */
298 
299 #ifndef ipFALSE_BOOL
300     #define ipFALSE_BOOL    ( 1 == 2 )
301 #endif /* ipFALSE_BOOL */
302 
303 /*
304  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
305  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
306  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html
307  */
308 
309 /* FreeRTOS_IPInit_Multi() replaces the earlier FreeRTOS_IPInit().  It assumes
310  * that network interfaces and IP-addresses have been added using the functions
311  * from FreeRTOS_Routing.h. */
312 BaseType_t FreeRTOS_IPInit_Multi( void );
313 
314 struct xNetworkInterface;
315 
316 #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
317 
318 /* Do not call the following function directly. It is there for downward compatibility.
319  * The function FreeRTOS_IPInit() will call it to initialise the interface and end-point
320  * objects.  See the description in FreeRTOS_Routing.h. */
321     struct xNetworkInterface * pxFillInterfaceDescriptor( BaseType_t xEMACIndex,
322                                                           struct xNetworkInterface * pxInterface );
323 
324 /* The following function is only provided to allow backward compatibility
325  * with the earlier version of FreeRTOS+TCP which had a single interface only. */
326     BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
327                                 const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ],
328                                 const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
329                                 const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
330                                 const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
331 
332 /* The following 2 functions also assume that there is only 1 network endpoint/interface.
333  * The new function are called: FreeRTOS_GetEndPointConfiguration() and
334  * FreeRTOS_SetEndPointConfiguration() */
335     void FreeRTOS_GetAddressConfiguration( uint32_t * pulIPAddress,
336                                            uint32_t * pulNetMask,
337                                            uint32_t * pulGatewayAddress,
338                                            uint32_t * pulDNSServerAddress );
339 
340     void FreeRTOS_SetAddressConfiguration( const uint32_t * pulIPAddress,
341                                            const uint32_t * pulNetMask,
342                                            const uint32_t * pulGatewayAddress,
343                                            const uint32_t * pulDNSServerAddress );
344 
345     void * FreeRTOS_GetUDPPayloadBuffer( size_t uxRequestedSizeBytes,
346                                          TickType_t uxBlockTimeTicks );
347 
348 #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */
349 
350 /*
351  * Returns the addresses stored in an end-point structure.
352  * This function already existed in the release with the single-interface.
353  * Only the first parameters is new: an end-point
354  */
355 void FreeRTOS_GetEndPointConfiguration( uint32_t * pulIPAddress,
356                                         uint32_t * pulNetMask,
357                                         uint32_t * pulGatewayAddress,
358                                         uint32_t * pulDNSServerAddress,
359                                         const struct xNetworkEndPoint * pxEndPoint );
360 
361 void FreeRTOS_SetEndPointConfiguration( const uint32_t * pulIPAddress,
362                                         const uint32_t * pulNetMask,
363                                         const uint32_t * pulGatewayAddress,
364                                         const uint32_t * pulDNSServerAddress,
365                                         struct xNetworkEndPoint * pxEndPoint );
366 
367 TaskHandle_t FreeRTOS_GetIPTaskHandle( void );
368 
369 void * FreeRTOS_GetUDPPayloadBuffer_Multi( size_t uxRequestedSizeBytes,
370                                            TickType_t uxBlockTimeTicks,
371                                            uint8_t ucIPType );
372 
373 /* MISRA defining 'FreeRTOS_SendPingRequest' should be dependent on 'ipconfigSUPPORT_OUTGOING_PINGS'.
374  * In order not to break some existing project, define it unconditionally. */
375 BaseType_t FreeRTOS_SendPingRequest( uint32_t ulIPAddress,
376                                      size_t uxNumberOfBytesToSend,
377                                      TickType_t uxBlockTimeTicks );
378 
379 void FreeRTOS_ReleaseUDPPayloadBuffer( void const * pvBuffer );
380 const uint8_t * FreeRTOS_GetMACAddress( void );
381 void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
382 #if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 )
383     /* This function shall be defined by the application. */
384     #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
385         void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );
386     #else
387         void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
388                                                    struct xNetworkEndPoint * pxEndPoint );
389     #endif
390 #endif
391 #if ( ipconfigSUPPORT_OUTGOING_PINGS == 1 )
392     void vApplicationPingReplyHook( ePingReplyStatus_t eStatus,
393                                     uint16_t usIdentifier );
394 #endif
395 
396 /* xARPWaitResolution checks if an IPv4 address is already known. If not
397  * it may send an ARP request and wait for a reply.  This function will
398  * only be called from an application. */
399 BaseType_t xARPWaitResolution( uint32_t ulIPAddress,
400                                TickType_t uxTicksToWait );
401 
402 BaseType_t FreeRTOS_IsNetworkUp( void );
403 
404 #if ( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
405     UBaseType_t uxGetMinimumIPQueueSpace( void );
406 #endif
407 
408 BaseType_t xIsNetworkDownEventPending( void );
409 
410 /*
411  * Defined in FreeRTOS_Sockets.c
412  * //_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_.
413  * Socket has had activity, reset the timer so it will not be closed
414  * because of inactivity
415  */
416 #if ( ( ipconfigHAS_DEBUG_PRINTF != 0 ) || ( ipconfigHAS_PRINTF != 0 ) )
417     const char * FreeRTOS_GetTCPStateName( UBaseType_t ulState );
418 #endif
419 
420 #if ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
421 
422 /* DHCP has an option for clients to register their hostname.  It doesn't
423  * have much use, except that a device can be found in a router along with its
424  * name. If this option is used the callback below must be provided by the
425  * application writer to return a const string, denoting the device's name. */
426 /* Typically this function is defined in a user module. */
427     const char * pcApplicationHostnameHook( void );
428 
429 #endif /* ipconfigDHCP_REGISTER_HOSTNAME */
430 
431 
432 /* This xApplicationGetRandomNumber() will set *pulNumber to a random number,
433  * and return pdTRUE. When the random number generator is broken, it shall return
434  * pdFALSE.
435  * The function is defined in 'iot_secure_sockets.c'.
436  * If that module is not included in the project, the application must provide an
437  * implementation of it.
438  * The macro's ipconfigRAND32() and configRAND32() are not in use anymore. */
439 
440 /* "xApplicationGetRandomNumber" is declared but never defined, because it may
441  * be defined in a user module. */
442 BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber );
443 
444 /** @brief The pointer to buffer with packet waiting for ARP resolution. This variable
445  *  is defined in FreeRTOS_IP.c.
446  *  This pointer is for internal use only. */
447 extern NetworkBufferDescriptor_t * pxARPWaitingNetworkBuffer;
448 
449 /* For backward compatibility define old structure names to the newer equivalent
450  * structure name. */
451 #ifndef ipconfigENABLE_BACKWARD_COMPATIBILITY
452     #define ipconfigENABLE_BACKWARD_COMPATIBILITY    1
453 #endif
454 
455 #if ( ipconfigENABLE_BACKWARD_COMPATIBILITY == 1 )
456     #define xIPStackEvent_t               IPStackEvent_t
457     #define xNetworkBufferDescriptor_t    NetworkBufferDescriptor_t
458     #define xMACAddress_t                 MACAddress_t
459     #define xWinProperties_t              WinProperties_t
460     #define xSocket_t                     Socket_t
461     #define xSocketSet_t                  SocketSet_t
462     #define ipSIZE_OF_IP_HEADER           ipSIZE_OF_IPv4_HEADER
463 
464 /* Since August 2016, the public types and fields below have changed name:
465  * abbreviations TCP/UDP are now written in capitals, and type names now end with "_t". */
466     #define FOnConnected                  FOnConnected_t
467     #define FOnTcpReceive                 FOnTCPReceive_t
468     #define FOnTcpSent                    FOnTCPSent_t
469     #define FOnUdpReceive                 FOnUDPReceive_t
470     #define FOnUdpSent                    FOnUDPSent_t
471 
472     #define pOnTcpConnected               pxOnTCPConnected
473     #define pOnTcpReceive                 pxOnTCPReceive
474     #define pOnTcpSent                    pxOnTCPSent
475     #define pOnUdpReceive                 pxOnUDPReceive
476     #define pOnUdpSent                    pxOnUDPSent
477 
478     #define FOnUdpSent                    FOnUDPSent_t
479     #define FOnTcpSent                    FOnTCPSent_t
480 #endif /* ipconfigENABLE_BACKWARD_COMPATIBILITY */
481 
482 #if ( ipconfigHAS_PRINTF != 0 )
483     extern void vPrintResourceStats( void );
484 #else
485     #define vPrintResourceStats()    do {} while( ipFALSE_BOOL )     /**< ipconfigHAS_PRINTF is not defined. Define vPrintResourceStats to a do-while( 0 ). */
486 #endif
487 
488 #if ( ipconfigUSE_TCP != 0 )
489 
490 /** @brief Set to a non-zero value if one or more TCP message have been processed
491  * within the last round. */
492     extern BaseType_t xProcessedTCPMessage;
493 #endif
494 
495 #include "FreeRTOS_IP_Utils.h" /*TODO can be moved after other 2 includes */
496 
497 
498 #include "FreeRTOS_IPv4.h"
499 
500 #include "FreeRTOS_IPv6.h"
501 
502 /* *INDENT-OFF* */
503 #ifdef __cplusplus
504     } /* extern "C" */
505 #endif
506 /* *INDENT-ON* */
507 
508 #endif /* FREERTOS_IP_H */
509