Difference between revisions of "Unit IP"
From Ultibo.org
(10 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '' | + | '''Ultibo IP (Internet Protocol) unit''' |
=== Constants === | === Constants === | ||
---- | ---- | ||
− | '' | + | |
+ | <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;">'''IP specific constants''' <code> IP_TRANSPORT_NAME* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>IP_TRANSPORT_NAME = 'IP';</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP size''' <code> IP_*_SIZE </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MIN_IP_PACKET = 20;</code> | ||
+ | | Not Counting Adapter Header | ||
+ | |- | ||
+ | | <code>MAX_IP_PACKET = 65536;</code> | ||
+ | | Not Counting Adapter Header | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>MAX_FRAG_LIFE = 32000;</code> | ||
+ | | Only wait 32 seconds for the rest of the packet | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>IP_HEADER_SIZE = 20;</code> | ||
+ | | SizeOf(TIPHeader); (Does Not Allow for Options) | ||
+ | |- | ||
+ | | <code>IP_OPTIONS_SIZE = 40;</code> | ||
+ | | Maximum Allowed Options | ||
+ | |- | ||
+ | | <code>IP_PSEUDO_SIZE = 12;</code> | ||
+ | | SizeOf(TPseudoHeader); | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>IP_PACKET_SIZE = 56;</code> | ||
+ | | SizeOf(TIPPacket); (Previously 46) | ||
+ | |- | ||
+ | | <code>IP_FRAGMENT_SIZE = 12;</code> | ||
+ | | SizeOf(TIPFragment); | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP header flags/fragment offset''' <code> IP_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>IP_CE = $8000;</code> | ||
+ | | Congestion Experienced | ||
+ | |- | ||
+ | | <code>IP_DF = $4000;</code> | ||
+ | | 1 = Don't Fragment 0 = May Fragment | ||
+ | |- | ||
+ | | <code>IP_MF = $2000;</code> | ||
+ | | 1 = More Fragments 0 = Last Fragment | ||
+ | |- | ||
+ | | <code>IP_OFFMASK = $1FFF;</code> | ||
+ | | Fragment Offset Mask | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP header options''' <code> IPOPT_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>IPOPT_EOL = 0;</code> | ||
+ | | end-of-option list | ||
+ | |- | ||
+ | | <code>IPOPT_NOP = 1;</code> | ||
+ | | no-operation | ||
+ | |- | ||
+ | | <code>IPOPT_RR = 7;</code> | ||
+ | | record packet route | ||
+ | |- | ||
+ | | <code>IPOPT_TS = 68;</code> | ||
+ | | timestamp | ||
+ | |- | ||
+ | | <code>IPOPT_SECURITY = 130;</code> | ||
+ | | provide s,c,h,tcc | ||
+ | |- | ||
+ | | <code>IPOPT_LSRR = 131;</code> | ||
+ | | loose source route | ||
+ | |- | ||
+ | | <code>IPOPT_SATID = 136;</code> | ||
+ | | satnet Id | ||
+ | |- | ||
+ | | <code>IPOPT_SSRR = 137;</code> | ||
+ | | strict source route | ||
+ | |- | ||
+ | | <code>IPOPT_RA = 148;</code> | ||
+ | | router alert | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP offset options''' <code> IPOPT_OFFSET* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Offsets to fields in IP Options other than EOL and NOP | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>IPOPT_OPTVAL = 0;</code> | ||
+ | | option ID | ||
+ | |- | ||
+ | | <code>IPOPT_OLEN = 1;</code> | ||
+ | | option length | ||
+ | |- | ||
+ | | <code>IPOPT_OFFSET = 2;</code> | ||
+ | | offset within option | ||
+ | |- | ||
+ | | <code>IPOPT_MINOFF = 4;</code> | ||
+ | | min value of above | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP TS flag options''' <code> IPOPT_TS_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Flags for IPOPT_TS Flags | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>IPOPT_TS_TSONLY = 0;</code> | ||
+ | | timestamps only | ||
+ | |- | ||
+ | | <code>IPOPT_TS_TSANDADDR = 1;</code> | ||
+ | | timestamps and addresses | ||
+ | |- | ||
+ | | <code>IPOPT_TS_PRESPEC = 3;</code> | ||
+ | | specified modules only | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP security flag''' <code> IPOPT_SECUR_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Flags for IPOPT_SECURITY Flags (Network Order) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_UNCLASS = $0000;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_CONFID = $F135;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_EFTO = $789A;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_MMMM = $BC4D;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_RESTR = $AF13;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_SECRET = $D788;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPOPT_SECUR_TOPSECRET = $6BC5;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">'''IP type of service''' <code> IPTOS_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>IPTOS_LOWDELAY = $10;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>IPTOS_THROUGHPUT = $08;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPTOS_RELIABILITY = $04;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IPTOS_MINCOST = $02;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === | ||
---- | ---- | ||
− | |||
+ | '''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 === | ||
+ | ---- | ||
+ | |||
+ | |||
+ | '''IP specific classes''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPBuffer|<code>TIPBuffer = class(TTransportBufferEx)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransportAdapter|<code>TIPTransportAdapter = class(TTransportAdapter)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransportBinding|<code>TIPTransportBinding = class(TTransportBinding)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransportProtocol|<code>TIPTransportProtocol = class(TTransportProtocol)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransportFilter|<code>TIPTransportFilter = class(TTransportFilter)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransportConfig|<code>TIPTransportConfig = class(TTransportConfig)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPTransport|<code>TIPTransport = class(TNetworkTransport)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPState|<code>TIPState = class(TTransportState)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPOptions|<code>TIPOptions = class(TTransportOptions)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPHostEntry|<code>TIPHostEntry = class(THostEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPRouteEntry|<code>TIPRouteEntry = class(TRouteEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPAddressEntry|<code>TIPAddressEntry = class(TAddressEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPNetworkEntry|<code>TIPNetworkEntry = class(TNetworkEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPServEntry|<code>TIPServEntry = class(TServEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TIPProtoEntry|<code>TIPProtoEntry = class(TProtoEntry)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | ''None defined'' |
=== Function declarations === | === Function declarations === | ||
Line 34: | Line 534: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 49: | Line 549: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet without Adapter header | | Complete packet without Adapter header | ||
|- | |- | ||
Line 61: | Line 561: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 73: | Line 573: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 85: | Line 585: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 97: | Line 597: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 109: | Line 609: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 121: | Line 621: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- | ||
Line 133: | Line 633: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Complete packet including Transport header | | Complete packet including Transport header | ||
|- | |- |
Latest revision as of 05:25, 31 August 2021
Return to Unit Reference
Contents
Description
Ultibo IP (Internet Protocol) unit
Constants
IP specific constants
IP_TRANSPORT_NAME*
IP_TRANSPORT_NAME = 'IP';
|
IP size
IP_*_SIZE
MIN_IP_PACKET = 20;
|
Not Counting Adapter Header |
MAX_IP_PACKET = 65536;
|
Not Counting Adapter Header |
MAX_FRAG_LIFE = 32000;
|
Only wait 32 seconds for the rest of the packet |
IP_HEADER_SIZE = 20;
|
SizeOf(TIPHeader); (Does Not Allow for Options) |
IP_OPTIONS_SIZE = 40;
|
Maximum Allowed Options |
IP_PSEUDO_SIZE = 12;
|
SizeOf(TPseudoHeader); |
IP_PACKET_SIZE = 56;
|
SizeOf(TIPPacket); (Previously 46) |
IP_FRAGMENT_SIZE = 12;
|
SizeOf(TIPFragment); |
IP header flags/fragment offset
IP_*
IP_CE = $8000;
|
Congestion Experienced |
IP_DF = $4000;
|
1 = Don't Fragment 0 = May Fragment |
IP_MF = $2000;
|
1 = More Fragments 0 = Last Fragment |
IP_OFFMASK = $1FFF;
|
Fragment Offset Mask |
IP header options
IPOPT_*
IPOPT_EOL = 0;
|
end-of-option list |
IPOPT_NOP = 1;
|
no-operation |
IPOPT_RR = 7;
|
record packet route |
IPOPT_TS = 68;
|
timestamp |
IPOPT_SECURITY = 130;
|
provide s,c,h,tcc |
IPOPT_LSRR = 131;
|
loose source route |
IPOPT_SATID = 136;
|
satnet Id |
IPOPT_SSRR = 137;
|
strict source route |
IPOPT_RA = 148;
|
router alert |
IP offset options
IPOPT_OFFSET*
Offsets to fields in IP Options other than EOL and NOP | |
IPOPT_OPTVAL = 0;
|
option ID |
IPOPT_OLEN = 1;
|
option length |
IPOPT_OFFSET = 2;
|
offset within option |
IPOPT_MINOFF = 4;
|
min value of above |
IP TS flag options
IPOPT_TS_*
Flags for IPOPT_TS Flags | |
IPOPT_TS_TSONLY = 0;
|
timestamps only |
IPOPT_TS_TSANDADDR = 1;
|
timestamps and addresses |
IPOPT_TS_PRESPEC = 3;
|
specified modules only |
IP security flag
IPOPT_SECUR_*
Flags for IPOPT_SECURITY Flags (Network Order) | |
IPOPT_SECUR_UNCLASS = $0000;
|
|
IPOPT_SECUR_CONFID = $F135;
|
|
IPOPT_SECUR_EFTO = $789A;
|
|
IPOPT_SECUR_MMMM = $BC4D;
|
|
IPOPT_SECUR_RESTR = $AF13;
|
|
IPOPT_SECUR_SECRET = $D788;
|
|
IPOPT_SECUR_TOPSECRET = $6BC5;
|
IP type of service
IPTOS_*
IPTOS_LOWDELAY = $10;
|
|
IPTOS_THROUGHPUT = $08;
|
|
IPTOS_RELIABILITY = $04;
|
|
IPTOS_MINCOST = $02;
|
Type definitions
IP header
PIPHeader = ^TIPHeader;
TIPHeader = packed record
Note: 20 Bytes unless IP Options are added | |
VersionLength:Byte;
|
$45 for IPv4 and 20-byte header |
TOS:Byte;
|
throughput type of service |
TotalLength:Word;
|
Total Size of the Packet (Max 65535) (Network Order) |
Id:Word;
|
Incremented with each Packet (Network Order) |
FragOffset:Word;
|
and IP Header Flags DF, MF etc (Network Order) |
TTL:Byte;
|
Time to Live Seconds/Hops |
Protocol:Byte;
|
IPPROTO_IP, IPPROTO_TCP etc |
Checksum:Word;
|
1s Compliment checksum |
SourceIP:TInAddr;
|
Source IP (Network Order) |
DestIP:TInAddr;
|
Destination IP (Network Order) |
IP timestamp address
PIPTimestampAddress = ^TIPTimestampAddress;
TIPTimestampAddress = packed record
Address:TInAddr;
|
|
Timestamp:LongWord;
|
IP timestamp
PIPTimestamp = ^TIPTimestamp;
TIPTimestamp = packed record
Code:Byte;
|
IPOPT_TS |
Length:Byte;
|
Size of structure (Variable) |
Index:Byte;
|
Index of current entry |
FlagsOverflow:Byte;
|
Flags (4 Bits) Overflow counter (4 Bits) |
case Integer of
|
|
0:(Timestamp:LongWord);
|
|
1:(TimestampAddress:TIPTimestampAddress);
|
IP pseudo
PIPPseudo = ^TIPPseudo;
TIPPseudo = packed record
Note: 12 Bytes (Used by UDP/TCP Checksum) | |
SourceIP:TInAddr;
|
Source IP Network Order |
DestIP:TInAddr;
|
Destination IP Network Order |
Mbz:Byte;
|
Must Be Zero |
Protocol:Byte;
|
IP Protocol Type IPPROTO_UDP, IPPROTO_TCP etc |
Length:Word;
|
Length of UDP/TCP Header and Data |
IP fragment
PIPFragment = ^TIPFragment;
TIPFragment = record
Note: 12 Bytes (Used by Fragment Buffer) | |
Offset:Word;
|
Offset of this Fragment in the Packet |
Size:Word;
|
Size of this Fragment |
Prev:PIPFragment;
|
Pointer to Prev Fragment |
Next:PIPFragment;
|
Pointer to Next Fragment |
IP packet
PIPPacket = ^TIPPacket;
TIPPacket = record
Note: 56 Bytes (Used by Fragment Buffer) | |
Lock:TMutexHandle;
|
Packet Lock |
Id:Word;
|
IP Id |
Protocol:Word;
|
IP Protocol |
Dest:TInAddr;
|
IP Dest |
Source:TInAddr;
|
IP Source |
Data:Pointer;
|
Pointer to Data |
Timeout:Int64;
|
Packet Timeout |
Total:Word;
|
IP Total Length |
Length:Word;
|
IP Header Length |
Received:Word;
|
Received Bytes |
Prev:PIPPacket;
|
Pointer to Prev Packet |
Next:PIPPacket;
|
Pointer to Next Packet |
First:PIPFragment;
|
Pointer to First Fragment |
Last:PIPFragment;
|
Pointer to Last Fragment |
Class definitions
IP specific classes
TIPBuffer = class(TTransportBufferEx)
|
TIPTransportAdapter = class(TTransportAdapter)
|
TIPTransportBinding = class(TTransportBinding)
|
TIPTransportProtocol = class(TTransportProtocol)
|
TIPTransportFilter = class(TTransportFilter)
|
TIPTransportConfig = class(TTransportConfig)
|
TIPTransport = class(TNetworkTransport)
|
TIPState = class(TTransportState)
|
TIPOptions = class(TTransportOptions)
|
TIPHostEntry = class(THostEntry)
|
TIPRouteEntry = class(TRouteEntry)
|
TIPAddressEntry = class(TAddressEntry)
|
TIPNetworkEntry = class(TNetworkEntry)
|
TIPServEntry = class(TServEntry)
|
TIPProtoEntry = class(TProtoEntry)
|
Public variables
None defined
Function declarations
Initialization functions
procedure IPInit;
Description: To be documented
Note | None documented |
---|
IP functions
function CheckIP(ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid IP packet
Buffer | Complete packet without Adapter header |
---|
function GetIPHeaderOffset(ABuffer:Pointer):Word;
Description: Return Start of the IP Header (Start of Packet)
Buffer | Complete packet including Transport header |
---|
function GetIPHeaderLength(ABuffer:Pointer):Word;
Description: Return Size of IP Header (Including Options)
Buffer | Complete packet including Transport header |
---|
function GetIPOptionsLength(ABuffer:Pointer):Word;
Description: Return Size of IP Options (Header - IP_HEADER_SIZE)
Buffer | Complete packet including Transport header |
---|
function GetIPDataOffset(ABuffer:Pointer):Word;
Description: Return Start of IP Packet Data (Length of IP Header)
Buffer | Complete packet including Transport header |
---|
function GetIPDataLength(ABuffer:Pointer):Word;
Description: Return Size of IP Packet Data (IP TotalLength - IP Header)
Buffer | Complete packet including Transport header |
---|
function ChecksumIPRecv(ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Validate the IP Header and Options Checksum on Receive
Buffer | Complete packet including Transport header |
---|
function ChecksumIPSend(AHeader,AOptions:Pointer; ALength:Word):Word;
Description: Checksum the IP Header and Options on Send
Buffer | Complete packet including Transport header |
---|
Return to Unit Reference