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));
tInterface *Interface; //!< Listening Interface
tVFS_Node Node; //!< Server Directory node
int NextID; //!< Name of the next connection
- tSpinlock lConnections; //!< Spinlock for connections
+ tShortSpinlock lConnections; //!< Spinlock for connections
tTCPConnection *Connections; //!< Connections (linked list)
- tTCPConnection *volatile NewConnections;
+ tTCPConnection *volatile NewConnections;
+ tTCPConnection *ConnectionsTail;
};
struct sTCPStoredPacket
{
struct sTCPStoredPacket *Next;
+ size_t Length;
Uint32 Sequence;
Uint8 Data[];
};
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
+ /**
+ * \brief Non-ACKed packets
+ * \note FIFO list
+ * \{
+ */
+ tMutex lQueuedPackets;
tTCPStoredPacket *QueuedPackets; //!< Non-ACKed packets
+ /**
+ * \}
+ */
- tSpinlock lRecievedPackets;
- tTCPStoredPacket *RecievedPackets; //!< Unread Packets
- tTCPStoredPacket *RecievedPacketsTail; //!< Unread Packets (End of list)
+ /**
+ * \brief Unread Packets
+ * \note Ring buffer
+ * \{
+ */
+ tMutex lRecievedPackets;
+ tRingBuffer *RecievedBuffer;
+ /**
+ * \}
+ */
+ /**
+ * \brief Out of sequence packets
+ * \note Sorted list to improve times
+ * \{
+ */
+ tShortSpinlock lFuturePackets; //!< Future packets spinlock
tTCPStoredPacket *FuturePackets; //!< Out of sequence packets
+ /**
+ * \}
+ */
union {
tIPv4 v4;
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