Difference between revisions of "Unit TCP"

From Ultibo.org
Jump to: navigation, search
Line 7: Line 7:
 
'''Notes:'''
 
'''Notes:'''
 
   
 
   
'''Segment handling:'''
+
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;
Description: To be documented
Note None documented


TCP functions

function CheckTCP(AFamily:Word; ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid TCP packet
Buffer The complete packet including Transport header


function GetTCPHeaderOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer The complete packet including Transport header


function GetTCPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;
Description: TO be documented
Buffer The complete packet including Transport header


function GetTCPOptionsLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer The complete packet including Transport header


function GetTCPDataOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer The complete packet including Transport header


function GetTCPDataLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer The complete packet including Transport header


function ChecksumTCPRecv(AFamily:Word; APseudo:PIPPseudo; ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Validate the Checksum of TCP Pseudo, Header and Data on Receive
Note None documented


function ChecksumTCPSend(AFamily:Word; APseudo:PIPPseudo; AHeader:PTCPHeader; AOptions,AData:Pointer; AOptionsLength,ADataLength:Word):Word;
Description: Checksum the TCP Pseudo, Header, Options and Data on Send
Note None documented


Return to Unit Reference