X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FIPStack%2Ftcp.h;h=0e260fcf9b42bc468cfad19305788275f9f8b9ff;hb=17b6125504e385c169193f3c8e29ced340425979;hp=2247b90110f2ec8fcbf96bda96c3e1c616a9aabe;hpb=7ba570fe3cc5418f42decf5b72ac2295cce9e60f;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/IPStack/tcp.h b/KernelLand/Modules/IPStack/tcp.h index 2247b901..0e260fcf 100644 --- a/KernelLand/Modules/IPStack/tcp.h +++ b/KernelLand/Modules/IPStack/tcp.h @@ -8,6 +8,9 @@ #include "ipstack.h" #include // tRingBuffer #include // tTimer +#include // 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; @@ -90,7 +94,7 @@ enum eTCPConnectionState TCP_ST_SYN_SENT, // 1 - SYN sent by local, waiting for SYN-ACK TCP_ST_SYN_RCVD, // 2 - SYN recieved, SYN-ACK sent - TCP_ST_OPEN, // 3 - Connection open + TCP_ST_ESTABLISHED, // 3 - Connection open // Local Close TCP_ST_FIN_WAIT1, // 4 - FIN sent, waiting for reply (ACK or FIN) @@ -98,14 +102,18 @@ enum eTCPConnectionState TCP_ST_CLOSING, // 6 - Waiting for ACK of FIN (FIN sent and recieved) TCP_ST_TIME_WAIT, // 7 - Waiting for timeout after local close // Remote close - TCP_ST_CLOSE_WAIT, // 8 - FIN recieved, waiting for user to close (error set, wait for node close) - TCP_ST_LAST_ACK, // 9 - FIN sent and recieved, waiting for ACK - TCP_ST_FINISHED // 10 - Essentially closed, all packets are invalid + TCP_ST_FORCE_CLOSE, // 8 - RST recieved, waiting for user close + TCP_ST_CLOSE_WAIT, // 9 - FIN recieved, waiting for user to close (error set, wait for node close) + TCP_ST_LAST_ACK, // 10 - FIN sent and recieved, waiting for ACK + TCP_ST_FINISHED // 11 - Essentially closed, all packets are invalid }; 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,14 +157,9 @@ struct sTCPConnection * \todo Convert this to a ring buffer and a bitmap of valid bytes * \{ */ - #if CACHE_FUTURE_PACKETS_OR_BYTES == 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) - #else - tShortSpinlock lFuturePackets; //!< Future packets spinlock - tTCPStoredPacket *FuturePackets; //!< Out of sequence packets - #endif /** * \} */