Difference between revisions of "Unit IP"
From Ultibo.org
Line 219: | Line 219: | ||
---- | ---- | ||
− | '' | + | |
+ | '''IP header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPHeader = ^TIPHeader;</code> | ||
+ | |||
+ | <code>TIPHeader = 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: 20 Bytes unless IP Options are added | ||
+ | |- | ||
+ | | <code>VersionLength:Byte;</code> | ||
+ | | $45 for IPv4 and 20-byte header | ||
+ | |- | ||
+ | | <code>TOS:Byte;</code> | ||
+ | | throughput type of service | ||
+ | |- | ||
+ | | <code>TotalLength:Word;</code> | ||
+ | | Total Size of the Packet (Max 65535) (Network Order) | ||
+ | |- | ||
+ | | <code>Id:Word;</code> | ||
+ | | Incremented with each Packet (Network Order) | ||
+ | |- | ||
+ | | <code>FragOffset:Word;</code> | ||
+ | | and IP Header Flags DF, MF etc (Network Order) | ||
+ | |- | ||
+ | | <code>TTL:Byte;</code> | ||
+ | | Time to Live Seconds / Hops | ||
+ | |- | ||
+ | | <code>Protocol:Byte;</code> | ||
+ | | IPPROTO_IP, IPPROTO_TCP etc | ||
+ | |- | ||
+ | | <code>Checksum:Word;</code> | ||
+ | | 1s Compliment checksum | ||
+ | |- | ||
+ | | <code>SourceIP:TInAddr;</code> | ||
+ | | Source IP (Network Order) | ||
+ | |- | ||
+ | | <code>DestIP:TInAddr;</code> | ||
+ | | Destination IP (Network Order) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IP timestamp address''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPTimestampAddress = ^TIPTimestampAddress;</code> | ||
+ | |||
+ | <code>TIPTimestampAddress = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Address:TInAddr;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Timestamp:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IP timestamp''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPTimestamp = ^TIPTimestamp;</code> | ||
+ | |||
+ | <code>TIPTimestamp = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Code:Byte;</code> | ||
+ | | IPOPT_TS | ||
+ | |- | ||
+ | | <code>Length:Byte;</code> | ||
+ | | Size of structure (Variable) | ||
+ | |- | ||
+ | | <code>Index:Byte;</code> | ||
+ | | Index of current entry | ||
+ | |- | ||
+ | | <code>FlagsOverflow:Byte;</code> | ||
+ | | Flags (4 Bits) Overflow counter (4 Bits) | ||
+ | |- | ||
+ | | <code>case Integer of</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>0:(Timestamp:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>1:(TimestampAddress:TIPTimestampAddress);</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IP pseudo''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPPseudo = ^TIPPseudo;</code> | ||
+ | |||
+ | <code>TIPPseudo = 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: 12 Bytes (Used by UDP/TCP Checksum) | ||
+ | |- | ||
+ | | <code>SourceIP:TInAddr;</code> | ||
+ | | Source IP Network Order | ||
+ | |- | ||
+ | | <code>DestIP:TInAddr;</code> | ||
+ | | Destination IP Network Order | ||
+ | |- | ||
+ | | <code>Mbz:Byte;</code> | ||
+ | | Must Be Zero | ||
+ | |- | ||
+ | | <code>Protocol:Byte;</code> | ||
+ | | IP Protocol Type IPPROTO_UDP, IPPROTO_TCP etc | ||
+ | |- | ||
+ | | <code>Length:Word;</code> | ||
+ | | Length of UDP/TCP Header and Data | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IP fragment''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPFragment = ^TIPFragment;</code> | ||
+ | |||
+ | <code>TIPFragment = 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: 12 Bytes (Used by Fragment Buffer) | ||
+ | |- | ||
+ | | <code>Offset:Word;</code> | ||
+ | | Offset of this Fragment in the Packet | ||
+ | |- | ||
+ | | <code>Size:Word;</code> | ||
+ | | Size of this Fragment | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Prev:PIPFragment;</code> | ||
+ | | Pointer to Prev Fragment | ||
+ | |- | ||
+ | | <code>Next:PIPFragment;</code> | ||
+ | | Pointer to Next Fragment | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IP packet''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PIPPacket = ^TIPPacket;</code> | ||
+ | |||
+ | <code>TIPPacket = 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: 56 Bytes (Used by Fragment Buffer) | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Packet Lock | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Id:Word;</code> | ||
+ | | IP Id | ||
+ | |- | ||
+ | | <code>Protocol:Word;</code> | ||
+ | | IP Protocol | ||
+ | |- | ||
+ | | <code>Dest:TInAddr;</code> | ||
+ | | IP Dest | ||
+ | |- | ||
+ | | <code>Source:TInAddr;</code> | ||
+ | | IP Source | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | Pointer to Data | ||
+ | |- | ||
+ | | <code>Timeout:Int64;</code> | ||
+ | | Packet Timeout | ||
+ | |- | ||
+ | | <code>Total:Word;</code> | ||
+ | | IP Total Length | ||
+ | |- | ||
+ | | <code>Length:Word;</code> | ||
+ | | IP Header Length | ||
+ | |- | ||
+ | | <code>Received:Word;</code> | ||
+ | | Received Bytes | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>Prev:PIPPacket;</code> | ||
+ | | Pointer to Prev Packet | ||
+ | |- | ||
+ | | <code>Next:PIPPacket;</code> | ||
+ | | Pointer to Next Packet | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>First:PIPFragment;</code> | ||
+ | | Pointer to First Fragment | ||
+ | |- | ||
+ | | <code>Last:PIPFragment;</code> | ||
+ | | Pointer to Last Fragment | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Class definitions === | === Class definitions === |
Revision as of 01:37, 20 January 2017
Return to Unit Reference
Contents
[hide]Description
Ultibo IP (Internet Protocol) unit
To be documented
Constants
[Expand]
IP specific constants
IP_TRANSPORT_NAME*
[Expand]
IP constants
IP_*_SIZE
[Expand]
IP header flags / fragment offset constants
IP_*
[Expand]
IP header option constants
IPOPT_*
[Expand]
IP offset option constants
IPOPT_OFFSET*
[Expand]
IP TS flag option constants
IPOPT_TS_*
[Expand]
IP security flag constants
IPOPT_SECUR_*
[Expand]
IP type of service constants
IPTOS_*
Type definitions
IP header
IP timestamp address
IP timestamp
IP pseudo
IP fragment
IP packet
Class definitions
To be documented
Public variables
None defined
Function declarations
Initialization functions
IP functions
[Expand]
function CheckIP(ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid IP packet
[Expand]
function GetIPHeaderOffset(ABuffer:Pointer):Word;
Description: Return Start of the IP Header (Start of Packet)
[Expand]
function GetIPHeaderLength(ABuffer:Pointer):Word;
Description: Return Size of IP Header (Including Options)
[Expand]
function GetIPOptionsLength(ABuffer:Pointer):Word;
Description: Return Size of IP Options (Header - IP_HEADER_SIZE)
[Expand]
function GetIPDataOffset(ABuffer:Pointer):Word;
Description: Return Start of IP Packet Data (Length of IP Header)
[Expand]
function GetIPDataLength(ABuffer:Pointer):Word;
Description: Return Size of IP Packet Data (IP TotalLength - IP Header)
[Expand]
function ChecksumIPRecv(ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Validate the IP Header and Options Checksum on Receive
[Expand]
function ChecksumIPSend(AHeader,AOptions:Pointer; ALength:Word):Word;
Description: Checksum the IP Header and Options on Send
Return to Unit Reference