More work on TCP, untested and almost complete
[tpg/acess2.git] / Modules / IPStack / tcp.h
index ed517db..93e5c1e 100644 (file)
@@ -9,6 +9,7 @@
 
 typedef struct sTCPHeader      tTCPHeader;
 typedef struct sTCPListener    tTCPListener;
+typedef struct sTCPStoredPacket        tTCPStoredPacket;
 typedef struct sTCPConnection  tTCPConnection;
 
 struct sTCPHeader
@@ -68,7 +69,15 @@ struct sTCPListener
         int    NextID;         //!< Name of the next connection
        tSpinlock       lConnections;   //!< Spinlock for connections
        tTCPConnection  *Connections;   //!< Connections (linked list)
-       volatile tTCPConnection *NewConnections;
+        tTCPConnection *volatile NewConnections;
+};
+
+struct sTCPStoredPacket
+{
+       struct sTCPStoredPacket *Next;
+       size_t  Length;
+       Uint32  Sequence;
+       Uint8   Data[];
 };
 
 struct sTCPConnection
@@ -83,18 +92,39 @@ struct sTCPConnection
         int    NextSequenceSend;       //!< Next sequence value for outbound packets
         int    NextSequenceRcv;        //!< Next expected sequence value for inbound
        
-        int    nQueuedPackets; //!< Number of packets not ACKed
-       struct {
-                int    Sequence;
-               void    *Data;
-       }       *QueuedPackets; //!< Non-ACKed packets
+       /**
+        * \brief Non-ACKed packets
+        * \note FIFO list
+        * \{
+        */
+       tSpinlock       lQueuedPackets;
+       tTCPStoredPacket        *QueuedPackets; //!< Non-ACKed packets
+       /**
+        * \}
+        */
        
+       /**
+        * \brief Unread Packets
+        * \note Double ended list (fifo)
+        * \{
+        */
+       tSpinlock       lRecievedPackets;
+       tTCPStoredPacket        *RecievedPackets;       //!< Unread Packets
+       tTCPStoredPacket        *RecievedPacketsTail;   //!< Unread Packets (End of list)
+       /**
+        * \}
+        */
        
-        int    nFuturePackets; //!< Number of packets recieved that are out of sequence
-       struct {
-                int    SequenceNum;
-               void    *Data;
-       }       **FuturePackets;        //!< Out of sequence packets
+       /**
+        * \brief Out of sequence packets
+        * \note Sorted list to improve times
+        * \{
+        */
+       tSpinlock       lFuturePackets; //!< Future packets spinlock
+       tTCPStoredPacket        *FuturePackets; //!< Out of sequence packets
+       /**
+        * \}
+        */
        
        union {
                tIPv4   v4;

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