]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h
Sync FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP with the version in GitHub at (23665258ca...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-TCP / include / FreeRTOS_IP_Private.h
index 6af875add79da09a0563e7a2491fa29864cdf5e6..8604abed05a7030da1f59af9c5f9d8b9444337f1 100644 (file)
@@ -1,58 +1,26 @@
 /*\r
- * FreeRTOS+TCP Labs Build 160919 (C) 2016 Real Time Engineers ltd.\r
- * Authors include Hein Tibosch and Richard Barry\r
+ * FreeRTOS+TCP V2.2.0\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
  *\r
- *******************************************************************************\r
- ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
- ***                                                                         ***\r
- ***                                                                         ***\r
- ***   FREERTOS+TCP IS STILL IN THE LAB (mainly because the FTP and HTTP     ***\r
- ***   demos have a dependency on FreeRTOS+FAT, which is only in the Labs    ***\r
- ***   download):                                                            ***\r
- ***                                                                         ***\r
- ***   FreeRTOS+TCP is functional and has been used in commercial products   ***\r
- ***   for some time.  Be aware however that we are still refining its       ***\r
- ***   design, the source code does not yet quite conform to the strict      ***\r
- ***   coding and style standards mandated by Real Time Engineers ltd., and  ***\r
- ***   the documentation and testing is not necessarily complete.            ***\r
- ***                                                                         ***\r
- ***   PLEASE REPORT EXPERIENCES USING THE SUPPORT RESOURCES FOUND ON THE    ***\r
- ***   URL: http://www.FreeRTOS.org/contact  Active early adopters may, at   ***\r
- ***   the sole discretion of Real Time Engineers Ltd., be offered versions  ***\r
- ***   under a license other than that described below.                      ***\r
- ***                                                                         ***\r
- ***                                                                         ***\r
- ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
- *******************************************************************************\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
  *\r
- * FreeRTOS+TCP can be used under two different free open source licenses.  The\r
- * license that applies is dependent on the processor on which FreeRTOS+TCP is\r
- * executed, as follows:\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
  *\r
- * If FreeRTOS+TCP is executed on one of the processors listed under the Special\r
- * License Arrangements heading of the FreeRTOS+TCP license information web\r
- * page, then it can be used under the terms of the FreeRTOS Open Source\r
- * License.  If FreeRTOS+TCP is used on any other processor, then it can be used\r
- * under the terms of the GNU General Public License V2.  Links to the relevant\r
- * licenses follow:\r
- *\r
- * The FreeRTOS+TCP License Information Page: http://www.FreeRTOS.org/tcp_license\r
- * The FreeRTOS Open Source License: http://www.FreeRTOS.org/license\r
- * The GNU General Public License Version 2: http://www.FreeRTOS.org/gpl-2.0.txt\r
- *\r
- * FreeRTOS+TCP is distributed in the hope that it will be useful.  You cannot\r
- * use FreeRTOS+TCP unless you agree that you use the software 'as is'.\r
- * FreeRTOS+TCP is provided WITHOUT ANY WARRANTY; without even the implied\r
- * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
- * implied, expressed, or statutory.\r
- *\r
- * 1 tab == 4 spaces!\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
  *\r
+ * http://aws.amazon.com/freertos\r
  * http://www.FreeRTOS.org\r
- * http://www.FreeRTOS.org/plus\r
- * http://www.FreeRTOS.org/labs\r
- *\r
  */\r
 \r
 #ifndef FREERTOS_IP_PRIVATE_H\r
@@ -276,16 +244,17 @@ typedef enum
        eNoEvent = -1,\r
        eNetworkDownEvent,              /* 0: The network interface has been lost and/or needs [re]connecting. */\r
        eNetworkRxEvent,                /* 1: The network interface has queued a received Ethernet frame. */\r
-       eARPTimerEvent,                 /* 2: The ARP timer expired. */\r
-       eStackTxEvent,                  /* 3: The software stack has queued a packet to transmit. */\r
-       eDHCPEvent,                             /* 4: Process the DHCP state machine. */\r
-       eTCPTimerEvent,                 /* 5: See if any TCP socket needs attention. */\r
-       eTCPAcceptEvent,                /* 6: Client API FreeRTOS_accept() waiting for client connections. */\r
-       eTCPNetStat,                    /* 7: IP-task is asked to produce a netstat listing. */\r
-       eSocketBindEvent,               /* 8: Send a message to the IP-task to bind a socket to a port. */\r
-       eSocketCloseEvent,              /* 9: Send a message to the IP-task to close a socket. */\r
-       eSocketSelectEvent,             /*10: Send a message to the IP-task for select(). */\r
-       eSocketSignalEvent,             /*11: A socket must be signalled. */\r
+       eNetworkTxEvent,                /* 2: Let the IP-task send a network packet. */\r
+       eARPTimerEvent,                 /* 3: The ARP timer expired. */\r
+       eStackTxEvent,                  /* 4: The software stack has queued a packet to transmit. */\r
+       eDHCPEvent,                             /* 5: Process the DHCP state machine. */\r
+       eTCPTimerEvent,                 /* 6: See if any TCP socket needs attention. */\r
+       eTCPAcceptEvent,                /* 7: Client API FreeRTOS_accept() waiting for client connections. */\r
+       eTCPNetStat,                    /* 8: IP-task is asked to produce a netstat listing. */\r
+       eSocketBindEvent,               /* 9: Send a message to the IP-task to bind a socket to a port. */\r
+       eSocketCloseEvent,              /*10: Send a message to the IP-task to close a socket. */\r
+       eSocketSelectEvent,             /*11: Send a message to the IP-task for select(). */\r
+       eSocketSignalEvent,             /*12: A socket must be signalled. */\r
 } eIPEvent_t;\r
 \r
 typedef struct IP_TASK_COMMANDS\r
@@ -468,8 +437,18 @@ eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucE
 uint16_t usGenerateChecksum( uint32_t ulSum, const uint8_t * pucNextData, size_t uxDataLengthBytes );\r
 \r
 /* Socket related private functions. */\r
+\r
+/* \r
+ * The caller must ensure that pxNetworkBuffer->xDataLength is the UDP packet \r
+ * payload size (excluding packet headers) and that the packet in pucEthernetBuffer \r
+ * is at least the size of UDPPacket_t. \r
+ */\r
 BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort );\r
-void vNetworkSocketsInit( void );\r
+\r
+/*\r
+ * Initialize the socket list data structures for TCP and UDP. \r
+ */\r
+BaseType_t vNetworkSocketsInit( void );\r
 \r
 /*\r
  * Returns pdTRUE if the IP task has been created and is initialised.  Otherwise\r
@@ -477,6 +456,11 @@ void vNetworkSocketsInit( void );
  */\r
 BaseType_t xIPIsNetworkTaskReady( void );\r
 \r
+#if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )\r
+       struct xSOCKET;\r
+       typedef void (*SocketWakeupCallback_t)( struct xSOCKET * pxSocket );\r
+#endif\r
+\r
 #if( ipconfigUSE_TCP == 1 )\r
 \r
        /*\r
@@ -561,7 +545,7 @@ BaseType_t xIPIsNetworkTaskReady( void );
                                                                 * This counter is separate from the xmitCount in the\r
                                                                 * TCP win segments */\r
                uint8_t ucTCPState;             /* TCP state: see eTCP_STATE */\r
-               struct XSOCKET *pxPeerSocket;   /* for server socket: child, for child socket: parent */\r
+               struct xSOCKET *pxPeerSocket;   /* for server socket: child, for child socket: parent */\r
                #if( ipconfigTCP_KEEP_ALIVE == 1 )\r
                        uint8_t ucKeepRepCount;\r
                        TickType_t xLastAliveTime;\r
@@ -594,7 +578,6 @@ BaseType_t xIPIsNetworkTaskReady( void );
                        FOnConnected_t pxHandleConnected;       /* Actually type: typedef void (* FOnConnected_t) (Socket_t xSocket, BaseType_t ulConnected ); */\r
                #endif /* ipconfigUSE_CALLBACKS */\r
                uint32_t ulWindowSize;          /* Current Window size advertised by peer */\r
-               uint32_t ulRxCurWinSize;        /* Constantly changing: this is the current size available for data reception */\r
                size_t uxRxWinSize;     /* Fixed value: size of the TCP reception window */\r
                size_t uxTxWinSize;     /* Fixed value: size of the TCP transmit window */\r
 \r
@@ -629,7 +612,7 @@ typedef enum eSOCKET_EVENT {
        eSOCKET_ALL             = 0x007F,\r
 } eSocketEvent_t;\r
 \r
-typedef struct XSOCKET\r
+typedef struct xSOCKET\r
 {\r
        EventBits_t xEventBits;\r
        EventGroupHandle_t xEventGroup;\r
@@ -644,6 +627,10 @@ typedef struct XSOCKET
        #if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )\r
                SemaphoreHandle_t pxUserSemaphore;\r
        #endif /* ipconfigSOCKET_HAS_USER_SEMAPHORE */\r
+       #if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )\r
+               SocketWakeupCallback_t pxUserWakeCallback;\r
+       #endif /* ipconfigSOCKET_HAS_USER_WAKE_CALLBACK */\r
+\r
        #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )\r
                struct xSOCKET_SET *pxSocketSet;\r
                /* User may indicate which bits are interesting for this socket. */\r
@@ -694,7 +681,7 @@ void vProcessGeneratedUDPPacket( NetworkBufferDescriptor_t * const pxNetworkBuff
  * bOut = false: checksum will be calculated for incoming packets\r
  *     returning 0xffff means: checksum was correct\r
  */\r
-uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, BaseType_t xOutgoingPacket );\r
+uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket );\r
 \r
 /*\r
  * An Ethernet frame has been updated (maybe it was an ARP request or a PING\r
@@ -717,7 +704,7 @@ BaseType_t vSocketBind( FreeRTOS_Socket_t *pxSocket, struct freertos_sockaddr *
  * packet come in out-of-order, an offset will be used to put it in front and\r
  * the head will not change yet.\r
  */\r
-int32_t lTCPAddRxdata( FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount );\r
+int32_t lTCPAddRxdata(FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount);\r
 \r
 /*\r
  * Currently called for any important event.\r