Difference between revisions of "Unit TCP"
(19 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Notes: | + | '''Ultibo TCP (Transmission Control Protocol) unit''' |
+ | |||
+ | ''Notes:'' | ||
Segment handling: | Segment handling: | ||
Line 20: | Line 22: | ||
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 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 | + | TCP Sequence numbers are compared using modulo 2^32 arithmetic. The following calculations provide the necessary handling of wraparound etc. |
LT = (A - B) < 0 | LT = (A - B) < 0 | ||
Line 83: | Line 85: | ||
| 65536; TCP Send/Receive Buffer Sizes | | 65536; TCP Send/Receive Buffer Sizes | ||
|- | |- | ||
− | | <code>TCP_WINDOW_SIZE = | + | | <code>TCP_WINDOW_SIZE = 64240;</code> |
− | | | + | | Sliding Window Receive Size (44 x MSS) |
|- | |- | ||
| <code>TCP_INITIAL_WINDOW = 8192;</code> | | <code>TCP_INITIAL_WINDOW = 8192;</code> | ||
Line 91: | Line 93: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | | <code>TCP_WINDOW_TIMEOUT = | + | | <code>TCP_TIMEOUT_OFFSET = 10;</code> |
+ | | How much time offset to allow from the designated value | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>TCP_ADVERT_TIMEOUT = 100;</code> | ||
+ | | Time to wait before sending a window size update after closing the receive window | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>TCP_WINDOW_TIMEOUT = 5000;</code> | ||
| Time to wait before probing small/zero Window | | Time to wait before probing small/zero Window | ||
|- | |- | ||
Line 131: | Line 143: | ||
|- | |- | ||
| <code>TCP_HEADER_SIZE = 20;</code> | | <code>TCP_HEADER_SIZE = 20;</code> | ||
− | | SizeOf(TTCPHeader) | + | | SizeOf(TTCPHeader) Does Not Allow for Options |
|- | |- | ||
| <code>TCP_OPTIONS_SIZE = 40;</code> | | <code>TCP_OPTIONS_SIZE = 40;</code> | ||
Line 138: | Line 150: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | | <code>TCP_SEGMENT_SIZE = | + | | <code>TCP_SEGMENT_SIZE = 68;</code> |
− | | SizeOf(TTCPSegment) | + | | SizeOf(TTCPSegment) Including TSocketTimerItem |
|- | |- | ||
|} | |} | ||
Line 145: | Line 157: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''TCP socket state | + | <div style="font-size: 14px; padding-left: 12px;">'''TCP socket state''' <code> TCP_STATE_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 186: | Line 198: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''TCP header option | + | <div style="font-size: 14px; padding-left: 12px;">'''TCP header option''' <code> TCPOPT_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 230: | Line 242: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''TCP header flag | + | <div style="font-size: 14px; padding-left: 12px;">'''TCP header flag''' <code> TCP_FLAG_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 272: | Line 284: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''TCP port | + | <div style="font-size: 14px; padding-left: 12px;">'''TCP port''' <code> TCP_PORT_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 289: | Line 301: | ||
---- | ---- | ||
− | '' | + | |
+ | '''TCP header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PTCPHeader = ^TTCPHeader;</code> | ||
+ | |||
+ | <code>TTCPHeader = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Some TCP definitions are in the Protocol or IP modules | ||
+ | |- | ||
+ | |colspan="2"|Note: 20 Bytes unless TCP Options are added | ||
+ | |- | ||
+ | | <code>SourcePort:Word;</code> | ||
+ | | Network Order | ||
+ | |- | ||
+ | | <code>DestPort:Word;</code> | ||
+ | | Network Order | ||
+ | |- | ||
+ | | <code>Sequence:LongWord;</code> | ||
+ | | First Sequence number in Data | ||
+ | |- | ||
+ | | <code>Acknowledge:LongWord;</code> | ||
+ | | Next Sequence number expected | ||
+ | |- | ||
+ | | <code>HeaderLength:Byte;</code> | ||
+ | | Number of 32 bit words in Header and Options (Bits 4-7 Reserved) | ||
+ | |- | ||
+ | | <code>Flags:Byte;</code> | ||
+ | | Flags for TCP Control (Bits 1-2 Reserved) | ||
+ | |- | ||
+ | | <code>WindowSize:Word;</code> | ||
+ | | Max 65536 (See WindowScale for higher values) | ||
+ | |- | ||
+ | | <code>Checksum:Word;</code> | ||
+ | | As per standard (Header, Options and Data) | ||
+ | |- | ||
+ | | <code>Urgent:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''TCP segment''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PTCPSegment = ^TTCPSegment;</code> | ||
+ | |||
+ | <code>TTCPSegment = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: 48 Bytes (Used by TCPSendBuffer/TCPRecvBuffer) | ||
+ | |- | ||
+ | | <code>Size:Word;</code> | ||
+ | | Size of Segment Data (Can be zero) | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | Pointer to Data in Buffer (Can be nil) | ||
+ | |- | ||
+ | | <code>FirstSequence:LongWord;</code> | ||
+ | | Start Sequence of Data | ||
+ | |- | ||
+ | | <code>LastSequence:LongWord;</code> | ||
+ | | End Sequence of Data (including Control bits)(actually the Start Sequence of next Segment) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Control:Word;</code> | ||
+ | | Control Bits on this segment (SYN/FIN/URG) (Send/Recv) | ||
+ | |- | ||
+ | | <code>Transferred:WordBool;</code> | ||
+ | | Data has been Transferred to/from Buffer (Send/Recv) | ||
+ | |- | ||
+ | | <code>Acknowledged:WordBool;</code> | ||
+ | | Data has been Acknowledged (Send/Recv) | ||
+ | |- | ||
+ | | <code>SelectiveAck:WordBool;</code> | ||
+ | | Data has been Selective Acknowledged (Send/Recv) | ||
+ | |- | ||
+ | | <code>RoundTripTime:Int64;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Count:Word;</code> | ||
+ | | Transmit Count (Send) | ||
+ | |- | ||
+ | | <code>Timeout:Int64;</code> | ||
+ | | Transmit (Send)/Acknowledge (Recv) Timeout | ||
+ | |- | ||
+ | | <code>Prev:PTCPSegment;</code> | ||
+ | | Pointer to Prev Segment | ||
+ | |- | ||
+ | | <code>Next:PTCPSegment;</code> | ||
+ | | Pointer to Next Segment | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Item:TSocketTimerItem;</code> | ||
+ | | Socket Timer Item for this Segment | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | === Class definitions === | ||
+ | ---- | ||
+ | |||
+ | |||
+ | '''TCP specific classes''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPProtocolTransport|<code>TTCPProtocolTransport = class(TProtocolTransport)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPProtocol|<code>TTCPProtocol = class(TNetworkProtocol)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPSocket|<code>TTCPSocket = class(TProtocolSocket)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPState|<code>TTCPState = class(TProtocolState)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPOptions|<code>TTCPOptions = class(TProtocolOptions)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPSendBuffer|<code>TTCPSendBuffer = class(TSocketBuffer)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TTCPRecvBuffer|<code>TTCPRecvBuffer = class(TSocketBuffer)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | ''None defined'' |
=== Function declarations === | === Function declarations === | ||
Line 307: | Line 467: | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
− | |- | + | |-https://ultibo.org/wiki/Unit_Sockets# |
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 323: | Line 483: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 335: | Line 495: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 343: | Line 503: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function GetTCPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;</pre> | <pre style="border: 0; padding-bottom:0px;">function GetTCPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 359: | Line 519: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 371: | Line 531: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 383: | Line 543: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The complete packet including Transport header | | The complete packet including Transport header | ||
|- | |- | ||
Line 395: | Line 555: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 407: | Line 567: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- |
Latest revision as of 01:38, 30 May 2018
Return to Unit Reference
Contents
Description
Ultibo TCP (Transmission Control Protocol) unit
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 necessary 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
TCP_*
Note: Some TCP definitions are in the Protocol or IP modules | |
TCP_PROTOCOL_NAME = 'TCP';
|
|
TCP_TIMER_INTERVAL = 1;
|
1ms timer interval for TCP |
MIN_TCP_PACKET = 20;
|
Not Counting Adapter and Transport Header |
MAX_TCP_PACKET = 1480;
|
Not Counting Adapter and Transport Header |
TCP_DEFAULT_MSS = 536;
|
Default Segment Size for TCP (576 - TCP - IP) |
TCP_MAX_MSS = 1460;
|
Max Segment Size for TCP (1500 - TCP - IP) |
TCP_MAX_LIFETIME = 120000;
|
Max Segment Lifetime (2 minutes) |
TCP_TIMEOUT = 0;
|
Wait forever on a TCP Read/Write |
TCP_BUFFER_SIZE = 262144;
|
65536; TCP Send/Receive Buffer Sizes |
TCP_WINDOW_SIZE = 64240;
|
Sliding Window Receive Size (44 x MSS) |
TCP_INITIAL_WINDOW = 8192;
|
Initial Window to advertise in SYN packet |
TCP_TIMEOUT_OFFSET = 10;
|
How much time offset to allow from the designated value |
TCP_ADVERT_TIMEOUT = 100;
|
Time to wait before sending a window size update after closing the receive window |
TCP_WINDOW_TIMEOUT = 5000;
|
Time to wait before probing small/zero Window |
TCP_ACK_TIMEOUT = 200;
|
Max Delayed Ack Time |
TCP_CONNECT_COUNT = 3;
|
Number of Connect retries (on RST) before Failure |
TCP_RESTART_TIMEOUT = 400;
|
Timeout between Connect retries (Milliseconds) |
TCP_RETRY_COUNT = 10;
|
Number of Retransmits before Reset |
TCP_RETRY_TIMEOUT:array[1..TCP_RETRY_COUNT] of LongWord = (250,500,1000,2000,4000,8000,15000,30000,60000,120000);
| |
TCP_KEEPALIVE_COUNT = 3;
|
Number of Failed Keepalives before Reset |
TCP_KEEPALIVE_TIMEOUT:array[1..TCP_KEEPALIVE_COUNT] of LongWord = (600000,60000,60000);
| |
TCP_MAX_PORT = 65536;
|
|
TCP_HEADER_SIZE = 20;
|
SizeOf(TTCPHeader) Does Not Allow for Options |
TCP_OPTIONS_SIZE = 40;
|
Maximum Allowed Options |
TCP_SEGMENT_SIZE = 68;
|
SizeOf(TTCPSegment) Including TSocketTimerItem |
TCP_STATE_*
TCP_STATE_LISTEN = 0;
|
listening for connection |
TCP_STATE_SYNSENT = 1;
|
SYN sent, active open |
TCP_STATE_SYNREC = 2;
|
SYN received, SYNACK sent |
TCP_STATE_ESTAB = 3;
|
established |
TCP_STATE_FINWAIT1 = 4;
|
sent FIN |
TCP_STATE_FINWAIT2 = 5;
|
sent FIN, received FINACK |
TCP_STATE_CLOSWAIT = 6;
|
received FIN waiting for close |
TCP_STATE_CLOSING = 7;
|
sent FIN, received FIN (waiting for FINACK) |
TCP_STATE_LASTACK = 8;
|
FIN received, FINACK + FIN sent |
TCP_STATE_TIMEWAIT = 9;
|
dally after sending final FINACK |
TCP_STATE_CLOSED = 10;
|
FINACK received |
TCPOPT_*
TCPOPT_EOL = 0;
|
end-of-option list |
TCPOPT_NOP = 1;
|
no-operation |
TCPOPT_MAXSEG = 2;
|
maximum segment size |
TCPOPT_WINDOW = 3;
|
window scale factor (rfc1072) |
TCPOPT_SACKOK = 4;
|
selective ack ok (rfc1072) |
TCPOPT_SACK = 5;
|
selective ack (rfc1072) |
TCPOPT_ECHO = 6;
|
echo (rfc1072) |
TCPOPT_ECHOREPLY = 7;
|
echo (rfc1072) |
TCPOPT_TIMESTAMP = 8;
|
timestamps (rfc1323) |
TCPOPT_CC = 11;
|
T/TCP CC options (rfc1644) |
TCPOPT_CCNEW = 12;
|
T/TCP CC options (rfc1644) |
TCPOPT_CCECHO = 13;
|
T/TCP CC options (rfc1644) |
TCP_FLAG_*
TCP_FLAG_FIN = $01;
|
|
TCP_FLAG_SYN = $02;
|
|
TCP_FLAG_RST = $04;
|
|
TCP_FLAG_PUSH = $08;
|
|
TCP_FLAG_ACK = $10;
|
|
TCP_FLAG_URG = $20;
|
|
TCP_FLAG_MASK = $3F;
|
|
Van Jacobson's Algorithm; max std. average and std. deviation | |
MAX_VJSA = 80000;
|
|
MAX_VJSD = 20000;
|
|
INIT_VJSA = 220;
|
TCP_PORT_*
TCP_PORT_START = 49152;
|
First dynamic port (Previously 1024) As per IANA assignment |
TCP_PORT_STOP = 65534;
|
Last dynamic port (Previously 5000) Short of IANA assignment to allow for rollover |
Type definitions
TCP header
PTCPHeader = ^TTCPHeader;
TTCPHeader = packed record
Note: Some TCP definitions are in the Protocol or IP modules | |
Note: 20 Bytes unless TCP Options are added | |
SourcePort:Word;
|
Network Order |
DestPort:Word;
|
Network Order |
Sequence:LongWord;
|
First Sequence number in Data |
Acknowledge:LongWord;
|
Next Sequence number expected |
HeaderLength:Byte;
|
Number of 32 bit words in Header and Options (Bits 4-7 Reserved) |
Flags:Byte;
|
Flags for TCP Control (Bits 1-2 Reserved) |
WindowSize:Word;
|
Max 65536 (See WindowScale for higher values) |
Checksum:Word;
|
As per standard (Header, Options and Data) |
Urgent:Word;
|
TCP segment
PTCPSegment = ^TTCPSegment;
TTCPSegment = record
Note: 48 Bytes (Used by TCPSendBuffer/TCPRecvBuffer) | |
Size:Word;
|
Size of Segment Data (Can be zero) |
Data:Pointer;
|
Pointer to Data in Buffer (Can be nil) |
FirstSequence:LongWord;
|
Start Sequence of Data |
LastSequence:LongWord;
|
End Sequence of Data (including Control bits)(actually the Start Sequence of next Segment) |
Control:Word;
|
Control Bits on this segment (SYN/FIN/URG) (Send/Recv) |
Transferred:WordBool;
|
Data has been Transferred to/from Buffer (Send/Recv) |
Acknowledged:WordBool;
|
Data has been Acknowledged (Send/Recv) |
SelectiveAck:WordBool;
|
Data has been Selective Acknowledged (Send/Recv) |
RoundTripTime:Int64;
|
|
Count:Word;
|
Transmit Count (Send) |
Timeout:Int64;
|
Transmit (Send)/Acknowledge (Recv) Timeout |
Prev:PTCPSegment;
|
Pointer to Prev Segment |
Next:PTCPSegment;
|
Pointer to Next Segment |
Item:TSocketTimerItem;
|
Socket Timer Item for this Segment |
Class definitions
TCP specific classes
TTCPProtocolTransport = class(TProtocolTransport)
|
TTCPProtocol = class(TNetworkProtocol)
|
TTCPSocket = class(TProtocolSocket)
|
TTCPState = class(TProtocolState)
|
TTCPOptions = class(TProtocolOptions)
|
TTCPSendBuffer = class(TSocketBuffer)
|
TTCPRecvBuffer = class(TSocketBuffer)
|
Public variables
None defined
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