Modules/IPStack - Rework TCP connection closing
[tpg/acess2.git] / KernelLand / Modules / IPStack / tcp.h
index 6aa404f..c1ceb65 100644 (file)
@@ -7,6 +7,10 @@
 
 #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;
@@ -68,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;
@@ -105,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
@@ -113,7 +121,11 @@ struct sTCPConnection
        
        Uint32  NextSequenceSend;       //!< Next sequence value for outbound packets
        Uint32  NextSequenceRcv;        //!< Next expected sequence value for inbound
-       
+
+       // Deferred ACK handling
+       Uint32  LastACKSequence;
+       tTimer  *DeferredACKTimer;      
+
        #if 0
        /**
         * \brief Non-ACKed packets
@@ -144,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