Difference between revisions of "Unit TCP"
Line 7: | Line 7: | ||
'''Notes:''' | '''Notes:''' | ||
− | + | Segment handling: | |
Send adds new segments to the end of the list only accepts ACKs for whole segments. | Send adds new segments to the end of the list only accepts ACKs for whole segments. | ||
Line 29: | Line 29: | ||
GEQ = (A - B) >= 0 | GEQ = (A - B) >= 0 | ||
+ | |||
See GlobalSock.pas for actual functions that implement this. | See GlobalSock.pas for actual functions that implement this. |
Revision as of 04:34, 18 December 2016
Return to Unit Reference
Description
Notes:
Segment handling:
Send adds new segments to the end of the list only accepts ACKs for whole segments.
Recv adds/inserts segments in correct SEQ order accepts overlapping segments only sends ACKs for whole segments.
Send will coalesce small data writes into larger segments if options allow this.
Recv will store the segments exactly as received.
TCP Send and Recv do not use a block buffer as per UDP etc. Instead the data for each Segment is stored in memory (TCP_MAX_MSS) allocated with the Segment. The Free and Used values still track the amount of data in the buffer but this method allows OOB data to be handled correctly.
TCP Sequence numbers are compared using modulo 2^32 arithmetic. The following calculations provide the neccessary handling of wraparound etc.
LT = (A - B) < 0
LEQ = (A - B) <= 0
GT = (A - B) > 0
GEQ = (A - B) >= 0
See GlobalSock.pas for actual functions that implement this.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
procedure TCPInit;
Note | None documented |
---|
TCP functions
function CheckTCP(AFamily:Word; ABuffer:Pointer):Boolean;
Buffer | The complete packet including Transport header |
---|
function GetTCPHeaderOffset(AFamily:Word; ABuffer:Pointer):Word;
Buffer | The complete packet including Transport header |
---|
function GetTCPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;
Buffer | The complete packet including Transport header |
---|
function GetTCPOptionsLength(AFamily:Word; ABuffer:Pointer):Word;
Buffer | The complete packet including Transport header |
---|
function GetTCPDataOffset(AFamily:Word; ABuffer:Pointer):Word;
Buffer | The complete packet including Transport header |
---|
function GetTCPDataLength(AFamily:Word; ABuffer:Pointer):Word;
Buffer | The complete packet including Transport header |
---|
function ChecksumTCPRecv(AFamily:Word; APseudo:PIPPseudo; ABuffer:Pointer; AOffset,ALength:Word):Word;
Note | None documented |
---|
function ChecksumTCPSend(AFamily:Word; APseudo:PIPPseudo; AHeader:PTCPHeader; AOptions,AData:Pointer; AOptionsLength,ADataLength:Word):Word;
Note | None documented |
---|
Return to Unit Reference