Difference between revisions of "Unit IP"

From Ultibo.org
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
'''Ultibo IP (Internet Protocol) unit'''
 
'''Ultibo IP (Internet Protocol) unit'''
 
''To be documented''
 
  
 
=== Constants ===
 
=== Constants ===
Line 63: Line 61:
 
<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;">'''IP header flags / fragment offset''' <code> IP_* </code></div>
+
<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;">
 
<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 106: Line 104:
 
|-
 
|-
 
| <code>IPOPT_SATID = 136;</code>
 
| <code>IPOPT_SATID = 136;</code>
| satnet id
+
| satnet Id
 
|-
 
|-
 
| <code>IPOPT_SSRR = 137;</code>
 
| <code>IPOPT_SSRR = 137;</code>
Line 247: Line 245:
 
|-
 
|-
 
| <code>TTL:Byte;</code>
 
| <code>TTL:Byte;</code>
| Time to Live Seconds / Hops
+
| Time to Live Seconds/Hops
 
|-
 
|-
 
| <code>Protocol:Byte;</code>
 
| <code>Protocol:Byte;</code>
Line 441: Line 439:
  
  
'''IP buffer'''
+
'''IP specific classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TIPBuffer = class(TTransportBufferEx)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Different to Socket Buffer.
+
| [[TIPBuffer|<code>TIPBuffer = class(TTransportBufferEx)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create(ATransport:TNetworkTransport);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFirst:PIPPacket;</code>
+
| &nbsp;
+
|-
+
| <code>FLast:PIPPacket;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;</code>
+
| &nbsp;
+
|-
+
| <code>function AddFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveFragment(APacket:PIPPacket):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushFragments(APacket:PIPPacket);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function GetPacket(AId:Word; AProtocol:Byte; const ASource,ADest:TInAddr; ALock:Boolean):PIPPacket;</code>
+
| &nbsp;
+
|-
+
| <code>function AddPacket(AId:Word; AProtocol:Byte; const ASource,ADest:TInAddr; ALock:Boolean):PIPPacket;</code>
+
| &nbsp;
+
|-
+
| <code>function RemovePacket(APacket:PIPPacket):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function UnlockPacket(APacket:PIPPacket):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushPackets(All:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function PutHeader(APacket:PIPPacket; ABuffer:Pointer; ALength:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function PutFragment(APacket:PIPPacket; ABuffer:Pointer; AOffset,ASize,AFlags:Word):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport adapter'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransportAdapter = class(TTransportAdapter)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPTransportAdapter|<code>TIPTransportAdapter = class(TTransportAdapter)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Address:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Netmask:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Gateway:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Network:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Directed:TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Server:TInAddr;</code>
+
| DHCP Server
+
|-
+
| <code>LeaseTime:LongWord;</code>
+
| DHCP Lease Time
+
|-
+
| <code>RetryTime:Int64;</code>
+
| DHCP Retry Time
+
|-
+
| <code>ExpiryTime:Int64;</code>
+
| DHCP Expiry Time
+
|-
+
| <code>RenewalTime:Int64;</code>
+
| DHCP Renewal Time
+
|-
+
| <code>RebindingTime:Int64;</code>
+
| DHCP Rebinding Time
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>ConfigDefault:Word;</code>
+
| BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK
+
|-
+
| <code>ConfigAddress:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigNetmask:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigGateway:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigServer:TInAddr;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport binding'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransportBinding = class(TTransportBinding)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPTransportBinding|<code>TIPTransportBinding = class(TTransportBinding)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Address:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Netmask:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Gateway:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Network:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>Directed:TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Server:TInAddr;</code>
+
| DHCP Server
+
|-
+
| <code>LeaseTime:LongWord;</code>
+
| DHCP Lease Time
+
|-
+
| <code>RetryTime:Int64;</code>
+
| DHCP Retry Time
+
|-
+
| <code>ExpiryTime:Int64;</code>
+
| DHCP Expiry Time
+
|-
+
| <code>RenewalTime:Int64;</code>
+
| DHCP Renewal Time
+
|-
+
| <code>RebindingTime:Int64;</code>
+
| DHCP Rebinding Time
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>ConfigDefault:Word;</code>
+
| BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK
+
|-
+
| <code>ConfigAddress:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigNetmask:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigGateway:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigServer:TInAddr;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport protocol'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransportProtocol = class(TTransportProtocol)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TIPTransportProtocol|<code>TIPTransportProtocol = class(TTransportProtocol)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport filter'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransportFilter = class(TTransportFilter)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TIPTransportFilter|<code>TIPTransportFilter = class(TTransportFilter)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransportConfig = class(TTransportConfig)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TIPTransportConfig|<code>TIPTransportConfig = class(TTransportConfig)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPTransport = class(TNetworkTransport)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(AManager:TTransportManager; const AName:String);</code>
+
| [[TIPTransport|<code>TIPTransport = class(TNetworkTransport)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FNextIPId:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FNextIPLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FARP:TARPTransport;</code>
+
| &nbsp;
+
|-
+
| <code>FRARP:TRARPTransport;</code>
+
| &nbsp;
+
|-
+
| <code>FFragments:TIPBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FHosts:TNetworkList;</code>
+
| &nbsp;
+
|-
+
| <code>FServs:TNetworkList;</code>
+
| &nbsp;
+
|-
+
| <code>FProtos:TNetworkList;</code>
+
| &nbsp;
+
|-
+
| <code>FRoutes:TNetworkList;</code>
+
| &nbsp;
+
|-
+
| <code>FNetworks:TNetworkList;</code>
+
| &nbsp;
+
|-
+
| <code>FAddresses:TNetworkList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FNameservers:TIPNameservers;</code>
+
| (Part of TNetworkList)
+
|-
+
| <code>FNameserverLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FForwarding:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FDefaultTTL:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FAutoRelease:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function FragmentHandler(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CheckFragment(ABuffer:Pointer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetNextIPId(AIncrement:Boolean):Word;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetIPNameserver(ACount:LongWord):TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetAdapterConfigType(const AName:String):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetAdapterConfigAddress(const AName:String):TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>function GetAdapterConfigNetmask(const AName:String):TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>function GetAdapterConfigGateway(const AName:String):TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>function GetAdapterConfigServer(const AName:String):TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function FilterPacket(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ForwardPacket(AAdapter:TTransportAdapter; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Nameservers:TIPNameservers read FNameservers;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Forwarding:LongWord read FForwarding write FForwarding;</code>
+
| &nbsp;
+
|-
+
| <code>property DefaultTTL:LongWord read FDefaultTTL write FDefaultTTL;</code>
+
| &nbsp;
+
|-
+
| <code>property AutoRelease:Boolean read FAutoRelease write FAutoRelease;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddAdapter(AAdapter:TNetworkAdapter; AConfigType:Word; AAddress,ANetmask,AGateway,AServer:Pointer):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveAdapter(AAdapter:TNetworkAdapter):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddProtocol(AProtocol:Word; APacketHandler:TTransportPacketHandler; AControlHandler:TTransportControlHandler):THandle; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveProtocol(AHandle:THandle; AProtocol:Word):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddFilter(AProtocol:Word; AFilterHandler:TTransportFilterHandler):THandle; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveFilter(AHandle:THandle; AProtocol:Word):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddConfig(AConfigType:Word; AConfigAuto:Boolean; AConfigHandler:TTransportConfigHandler):THandle; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveConfig(AHandle:THandle; AConfigType:Word):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendPacket(ASocket:TTransportSocket; ASource,ADest:Pointer; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function SendControl(ASource,ADest:Pointer; AProtocol,ACommand,ACode:Word; AAddress,AData:Pointer; ASize:Integer):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function SetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartTransport:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopTransport:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessTransport:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindTransport(AAdapter:TNetworkAdapter):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindTransport(AAdapter:TNetworkAdapter):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddNameserver(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveNameserver(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetHostByName(const AName:String; ALock:Boolean):TIPHostEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHostByAddress(const AAddress:TInAddr; ALock:Boolean):TIPHostEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHostByNext(APrevious:TIPHostEntry; ALock,AUnlock:Boolean):TIPHostEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddHost(const AAddress:TInAddr; const AName:String; AType:Word; ALock:Boolean):TIPHostEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveHost(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushHosts(All:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetRouteByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetRouteByNetwork(const ANetwork,AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetRouteByNext(APrevious:TIPRouteEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPRouteEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddRoute(const ANetwork,ANetmask,AGateway,AAddress:TInAddr; AType:Word; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveRoute(const ANetwork,AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushRoutes(All:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetAddressByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPAddressEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetAddressByNext(APrevious:TIPAddressEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPAddressEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter; AType:Word; ALock:Boolean; AState:LongWord):TIPAddressEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveAddress(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushAddresses(All:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetNetworkByName(const AName:String; ALock:Boolean):TIPNetworkEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetNetworkByAddress(const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddNetwork(const AName:String; const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveNetwork(const AName:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetServByName(const AName,AProtocol:String; ALock:Boolean):TIPServEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetServByPort(APort:Word; const AProtocol:String; ALock:Boolean):TIPServEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddServ(const AName,AProtocol:String; APort:Word; ALock:Boolean):TIPServEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveServ(const AName,AProtocol:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetProtoByName(const AName:String; ALock:Boolean):TIPProtoEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtoByNumber(ANumber:Word; ALock:Boolean):TIPProtoEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function AddProto(const AName:String; ANumber:Word; ALock:Boolean):TIPProtoEntry;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveProto(const AName:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CompareLocal(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareDefault(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareLoopback(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareDirected(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareBroadcast(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareMulticast(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareAddress(const AAddress1,AAddress2:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CompareSubnet(const AAddress,ANetwork,ANetmask:TInAddr):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP state'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPState = class(TTransportState)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPState|<code>TIPState = class(TTransportState)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLocalAddress:TInAddr;</code>
+
| Host Order
+
|-
+
| <code>FRemoteAddress:TInAddr;</code>
+
| Host Order
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetLocalAddress(const ALocalAddress:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteAddress(const ARemoteAddress:TInAddr);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property LocalAddress:TInAddr read FLocalAddress write SetLocalAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteAddress:TInAddr read FRemoteAddress write SetRemoteAddress;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP options'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPOptions = class(TTransportOptions)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: For Get/Set Options Level = IP_PROTO Option = ???
+
| [[TIPOptions|<code>TIPOptions = class(TTransportOptions)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FMemory:TMemoryStream;</code>
+
| &nbsp;
+
|-
+
| <code>FOptions:Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>FLength:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FTOS:Byte;</code>
+
| IPTOS_LOWDELAY etc
+
|-
+
| <code>FTTL:Byte;</code>
+
| Time To Live
+
|-
+
| <code>FFlags:Word;</code>
+
| IP_DF etc
+
|-
+
| <code>FHeader:Boolean;</code>
+
| IP_HDRINCL
+
|-
+
| <code>FMulticastIF:TInAddr;</code>
+
| IP_MULTICAST_IF
+
|-
+
| <code>FMulticastTTL:Byte;</code>
+
| IP_MULTICAST_TTL
+
|-
+
| <code>FMulticastLOOP:Boolean;</code>
+
| IP_MULTICAST_LOOP
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetTOS(ATOS:Byte);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetTTL(ATTL:Byte);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetFlags(AFlags:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetHeader(AHeader:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMulticastIF(const AMulticastIF:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMulticastTTL(AMulticastTTL:Byte);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMulticastLOOP(AMulticastLOOP:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetLength(ALength:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property TOS:Byte read FTOS write SetTOS;</code>
+
| &nbsp;
+
|-
+
| <code>property TTL:Byte read FTTL write SetTTL;</code>
+
| &nbsp;
+
|-
+
| <code>property Flags:Word read FFlags write SetFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Header:Boolean read FHeader write SetHeader;</code>
+
| &nbsp;
+
|-
+
| <code>property MulticastIF:TInAddr read FMulticastIF write SetMulticastIF;</code>
+
| &nbsp;
+
|-
+
| <code>property MulticastTTL:Byte read FMulticastTTL write SetMulticastTTL;</code>
+
| &nbsp;
+
|-
+
| <code>property MulticastLOOP:Boolean read FMulticastLOOP write SetMulticastLOOP;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Options:Pointer read FOptions;</code>
+
| IP_OPTIONS
+
|-
+
| <code>property Length:Integer read FLength write SetLength;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP host entry'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPHostEntry = class(THostEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPHostEntry|<code>TIPHostEntry = class(THostEntry)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FAddresses:array[0..MAX_HOST_ALIASES - 1] of TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetAddress:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAddress(const AAddress:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>function GetAddresses(Index:Integer):TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Address:TInAddr read GetAddress write SetAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property Addresses[Index:Integer]:TInAddr read GetAddresses;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindAddress(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddAddress(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveAddress(const AAddress:TInAddr):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP route entry'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPRouteEntry = class(TRouteEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPRouteEntry|<code>TIPRouteEntry = class(TRouteEntry)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FTOS:Byte;</code>
+
| Default TOS for this Route
+
|-
+
| <code>FTTL:Byte;</code>
+
| Default TTL for this Route
+
|-
+
| <code>FNetwork:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>FNetmask:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>FGateway:TInAddr;</code>
+
| &nbsp;
+
|-
+
| <code>FAddress:TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetTOS(ATOS:Byte);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetTTL(ATTL:Byte);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetNetwork(const ANetwork:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetNetmask(const ANetmask:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetGateway(const AGateway:TInAddr);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAddress(const AAddress:TInAddr);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property TOS:Byte read FTOS write SetTOS;</code>
+
| &nbsp;
+
|-
+
| <code>property TTL:Byte read FTTL write SetTTL;</code>
+
| &nbsp;
+
|-
+
| <code>property Network:TInAddr read FNetwork write SetNetwork;</code>
+
| &nbsp;
+
|-
+
| <code>property Netmask:TInAddr read FNetmask write SetNetmask;</code>
+
| &nbsp;
+
|-
+
| <code>property Gateway:TInAddr read FGateway write SetGateway;</code>
+
| &nbsp;
+
|-
+
| <code>property Address:TInAddr read FAddress write SetAddress;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP address entry'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPAddressEntry = class(TAddressEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Used for secondary addresses.
+
| [[TIPAddressEntry|<code>TIPAddressEntry = class(TAddressEntry)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FAddress:TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetAddress(const AAddress:TInAddr);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Address:TInAddr read FAddress write SetAddress;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP network entry'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPNetworkEntry = class(TNetworkEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPNetworkEntry|<code>TIPNetworkEntry = class(TNetworkEntry)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FNetwork:TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetNetwork(const ANetwork:TInAddr);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Network:TInAddr read FNetwork write SetNetwork;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''IP service entry''' 
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPServEntry = class(TServEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPServEntry|<code>TIPServEntry = class(TServEntry)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
+
'''IP protocol entry'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TIPProtoEntry = class(TProtoEntry)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TIPProtoEntry|<code>TIPProtoEntry = class(TProtoEntry)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
 
 
<br />
 
<br />
 
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
Line 1,442: Line 534:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,457: Line 549:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet without Adapter header
 
| Complete packet without Adapter header
 
|-
 
|-
Line 1,469: Line 561:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,481: Line 573:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,493: Line 585:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,505: Line 597:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,517: Line 609:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,529: Line 621:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-
Line 1,541: Line 633:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Complete packet including Transport header
 
| Complete packet including Transport header
 
|-
 
|-

Latest revision as of 05:25, 31 August 2021

Return to Unit Reference


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