Modules/IPStack - Rework TCP connection closing
[tpg/acess2.git] / KernelLand / Modules / IPStack / tcp.h
index 2247b90..c1ceb65 100644 (file)
@@ -8,6 +8,9 @@
 #include "ipstack.h"
 #include <adt.h>       // tRingBuffer
 #include <timers.h>    // tTimer
+#include <semaphore.h> // tSemaphore
+
+#define        CACHE_FUTURE_PACKETS_IN_BYTES   1       // Use a ring buffer to cache out of order packets?
 
 typedef struct sTCPHeader      tTCPHeader;
 typedef struct sTCPListener    tTCPListener;
@@ -69,6 +72,7 @@ struct sTCPListener
        tInterface      *Interface;     //!< Listening Interface
        tVFS_Node       Node;   //!< Server Directory node
         int    NextID;         //!< Name of the next connection
+       tSemaphore      WaitingConnections;
        tShortSpinlock  lConnections;   //!< Spinlock for connections
        tTCPConnection  *Connections;   //!< Connections (linked list)
        tTCPConnection  *volatile NewConnections;
@@ -106,6 +110,9 @@ enum eTCPConnectionState
 struct sTCPConnection
 {
        struct sTCPConnection   *Next;
+       struct sTCPConnection   *Prev;
+       struct sTCPListener     *Server;
+       
        enum eTCPConnectionState        State;  //!< Connection state (see ::eTCPConnectionState)
        Uint16  LocalPort;      //!< Local port
        Uint16  RemotePort;     //!< Remote port
@@ -149,7 +156,7 @@ struct sTCPConnection
         * \todo Convert this to a ring buffer and a bitmap of valid bytes
         * \{
         */
-       #if CACHE_FUTURE_PACKETS_OR_BYTES == bytes
+       #if CACHE_FUTURE_PACKETS_IN_BYTES
        Uint32  HighestSequenceRcvd;    //!< Highest sequence number (within window) recieved
        Uint8   *FuturePacketData;      //!< Future packet data (indexed by sequence number)
        Uint8   *FuturePacketValidBytes;        //!< Valid byte bitmap (WINDOW_SIZE/8 bytes)

UCC git Repository :: git.ucc.asn.au