X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Ftcp.h;h=492e035fe1834fce2f3a4d77e2e7347e213bc918;hb=1529dadb6c2170bf9899fbde46d06a3d9a392b52;hp=ed517db8e1d311c85ade0c5a825ce4b077006f20;hpb=720eb9f95dd3272e980095cf24ee21fb9250adb3;p=tpg%2Facess2.git diff --git a/Modules/IPStack/tcp.h b/Modules/IPStack/tcp.h index ed517db8..492e035f 100644 --- a/Modules/IPStack/tcp.h +++ b/Modules/IPStack/tcp.h @@ -9,6 +9,7 @@ typedef struct sTCPHeader tTCPHeader; typedef struct sTCPListener tTCPListener; +typedef struct sTCPStoredPacket tTCPStoredPacket; typedef struct sTCPConnection tTCPConnection; struct sTCPHeader @@ -18,7 +19,7 @@ struct sTCPHeader Uint32 SequenceNumber; Uint32 AcknowlegementNumber; #if 0 - struct { + struct { // Lowest to highest unsigned Reserved: 4; unsigned DataOffset: 4; // Size of the header in 32-bit words } __attribute__ ((packed)); @@ -68,7 +69,16 @@ 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; + tTCPConnection *ConnectionsTail; +}; + +struct sTCPStoredPacket +{ + struct sTCPStoredPacket *Next; + size_t Length; + Uint32 Sequence; + Uint8 Data[]; }; struct sTCPConnection @@ -80,21 +90,41 @@ struct sTCPConnection tInterface *Interface; //!< Listening Interface tVFS_Node Node; //!< Node - int NextSequenceSend; //!< Next sequence value for outbound packets - int NextSequenceRcv; //!< Next expected sequence value for inbound + Uint32 NextSequenceSend; //!< Next sequence value for outbound packets + Uint32 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 Ring buffer + * \{ + */ + tSpinlock lRecievedPackets; + tRingBuffer *RecievedBuffer; + /** + * \} + */ - 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; @@ -106,8 +136,11 @@ struct sTCPConnection enum eTCPConnectionState { TCP_ST_CLOSED, + TCP_ST_SYN_SENT, TCP_ST_HALFOPEN, - TCP_ST_OPEN + TCP_ST_OPEN, + TCP_ST_FIN_SENT, + TCP_ST_FINISHED }; #endif