Difference between revisions of "Unit IP"

From Ultibo.org
Jump to: navigation, search
Line 1,442: Line 1,442:
 
{| 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 1,457:
 
{| 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 1,469:
 
{| 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 1,481:
 
{| 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 1,493:
 
{| 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 1,505:
 
{| 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 1,517:
 
{| 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 1,529:
 
{| 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 1,541:
 
{| 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
 
|-
 
|-

Revision as of 01:12, 24 April 2018

Return to Unit Reference


Description


Ultibo IP (Internet Protocol) unit

To be documented

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 buffer

TIPBuffer = class(TTransportBufferEx)

Note: Different to Socket Buffer.
 
constructor Create(ATransport:TNetworkTransport);  
destructor Destroy; override;  
private
FFirst:PIPPacket;  
FLast:PIPPacket;  
 
function GetFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;  
function AddFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;  
function RemoveFragment(APacket:PIPPacket):Boolean;  
procedure FlushFragments(APacket:PIPPacket);  
public
function GetPacket(AId:Word; AProtocol:Byte; const ASource,ADest:TInAddr; ALock:Boolean):PIPPacket;  
function AddPacket(AId:Word; AProtocol:Byte; const ASource,ADest:TInAddr; ALock:Boolean):PIPPacket;  
function RemovePacket(APacket:PIPPacket):Boolean;  
function UnlockPacket(APacket:PIPPacket):Boolean;  
procedure FlushPackets(All:Boolean);  
 
function PutHeader(APacket:PIPPacket; ABuffer:Pointer; ALength:Word):Boolean;  
function PutFragment(APacket:PIPPacket; ABuffer:Pointer; AOffset,ASize,AFlags:Word):Boolean;  

IP transport adapter

TIPTransportAdapter = class(TTransportAdapter)

constructor Create;  
public
Address:TInAddr;  
Netmask:TInAddr;  
Gateway:TInAddr;  
Network:TInAddr;  
Directed:TInAddr;  
 
Server:TInAddr; DHCP Server
LeaseTime:LongWord; DHCP Lease Time
RetryTime:Int64; DHCP Retry Time
ExpiryTime:Int64; DHCP Expiry Time
RenewalTime:Int64; DHCP Renewal Time
RebindingTime:Int64; DHCP Rebinding Time
 
ConfigDefault:Word; BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK
ConfigAddress:TInAddr;  
ConfigNetmask:TInAddr;  
ConfigGateway:TInAddr;  
ConfigServer:TInAddr;  

IP transport binding

TIPTransportBinding = class(TTransportBinding)

constructor Create;  
public
Address:TInAddr;  
Netmask:TInAddr;  
Gateway:TInAddr;  
Network:TInAddr;  
Directed:TInAddr;  
 
Server:TInAddr; DHCP Server
LeaseTime:LongWord; DHCP Lease Time
RetryTime:Int64; DHCP Retry Time
ExpiryTime:Int64; DHCP Expiry Time
RenewalTime:Int64; DHCP Renewal Time
RebindingTime:Int64; DHCP Rebinding Time
 
ConfigDefault:Word; BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK
ConfigAddress:TInAddr;  
ConfigNetmask:TInAddr;  
ConfigGateway:TInAddr;  
ConfigServer:TInAddr;  

IP transport protocol

TIPTransportProtocol = class(TTransportProtocol)

private
 
public
 

IP transport filter

TIPTransportFilter = class(TTransportFilter)

private
 
public
 

IP transport configuration

TIPTransportConfig = class(TTransportConfig)

private
 
public
 

IP transport

TIPTransport = class(TNetworkTransport)

constructor Create(AManager:TTransportManager; const AName:String);  
destructor Destroy; override;  
private
FNextIPId:Word;  
FNextIPLock:TMutexHandle;  
 
FARP:TARPTransport;  
FRARP:TRARPTransport;  
FFragments:TIPBuffer;  
 
FHosts:TNetworkList;  
FServs:TNetworkList;  
FProtos:TNetworkList;  
FRoutes:TNetworkList;  
FNetworks:TNetworkList;  
FAddresses:TNetworkList;  
 
FNameservers:TIPNameservers; (Part of TNetworkList)
FNameserverLock:TMutexHandle;  
 
FForwarding:LongWord;  
FDefaultTTL:LongWord;  
FAutoRelease:Boolean;  
 
function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;  
function FragmentHandler(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;  
 
function CheckFragment(ABuffer:Pointer):Boolean;  
 
function GetNextIPId(AIncrement:Boolean):Word;  
 
function GetIPNameserver(ACount:LongWord):TInAddr;  
 
function GetAdapterConfigType(const AName:String):Word;  
function GetAdapterConfigAddress(const AName:String):TInAddr;  
function GetAdapterConfigNetmask(const AName:String):TInAddr;  
function GetAdapterConfigGateway(const AName:String):TInAddr;  
function GetAdapterConfigServer(const AName:String):TInAddr;  
protected
function FilterPacket(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;  
function ForwardPacket(AAdapter:TTransportAdapter; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;  
public
property Nameservers:TIPNameservers read FNameservers;  
 
property Forwarding:LongWord read FForwarding write FForwarding;  
property DefaultTTL:LongWord read FDefaultTTL write FDefaultTTL;  
property AutoRelease:Boolean read FAutoRelease write FAutoRelease;  
 
function AddAdapter(AAdapter:TNetworkAdapter; AConfigType:Word; AAddress,ANetmask,AGateway,AServer:Pointer):Boolean; override;  
function RemoveAdapter(AAdapter:TNetworkAdapter):Boolean; override;  
 
function AddProtocol(AProtocol:Word; APacketHandler:TTransportPacketHandler; AControlHandler:TTransportControlHandler):THandle; override;  
function RemoveProtocol(AHandle:THandle; AProtocol:Word):Boolean; override;  
 
function AddFilter(AProtocol:Word; AFilterHandler:TTransportFilterHandler):THandle; override;  
function RemoveFilter(AHandle:THandle; AProtocol:Word):Boolean; override;  
 
function AddConfig(AConfigType:Word; AConfigAuto:Boolean; AConfigHandler:TTransportConfigHandler):THandle; override;  
function RemoveConfig(AHandle:THandle; AConfigType:Word):Boolean; override;  
 
function SendPacket(ASocket:TTransportSocket; ASource,ADest:Pointer; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;  
function SendControl(ASource,ADest:Pointer; AProtocol,ACommand,ACode:Word; AAddress,AData:Pointer; ASize:Integer):Boolean; override;  
 
function GetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;  
function SetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;  
 
function StartTransport:Boolean; override;  
function StopTransport:Boolean; override;  
function ProcessTransport:Boolean; override;  
 
function BindTransport(AAdapter:TNetworkAdapter):Boolean; override;  
function UnbindTransport(AAdapter:TNetworkAdapter):Boolean; override;  
 
function AddNameserver(const AAddress:TInAddr):Boolean;  
function RemoveNameserver(const AAddress:TInAddr):Boolean;  
 
function GetHostByName(const AName:String; ALock:Boolean):TIPHostEntry;  
function GetHostByAddress(const AAddress:TInAddr; ALock:Boolean):TIPHostEntry;  
function GetHostByNext(APrevious:TIPHostEntry; ALock,AUnlock:Boolean):TIPHostEntry;  
function AddHost(const AAddress:TInAddr; const AName:String; AType:Word; ALock:Boolean):TIPHostEntry;  
function RemoveHost(const AAddress:TInAddr):Boolean;  
procedure FlushHosts(All:Boolean);  
 
function GetRouteByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;  
function GetRouteByNetwork(const ANetwork,AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;  
function GetRouteByNext(APrevious:TIPRouteEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPRouteEntry;  
function AddRoute(const ANetwork,ANetmask,AGateway,AAddress:TInAddr; AType:Word; ALock:Boolean; AState:LongWord):TIPRouteEntry;  
function RemoveRoute(const ANetwork,AAddress:TInAddr):Boolean;  
procedure FlushRoutes(All:Boolean);  
 
function GetAddressByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPAddressEntry;  
function GetAddressByNext(APrevious:TIPAddressEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPAddressEntry;  
function AddAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter; AType:Word; ALock:Boolean; AState:LongWord):TIPAddressEntry;  
function RemoveAddress(const AAddress:TInAddr):Boolean;  
procedure FlushAddresses(All:Boolean);  
 
function GetNetworkByName(const AName:String; ALock:Boolean):TIPNetworkEntry;  
function GetNetworkByAddress(const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;  
function AddNetwork(const AName:String; const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;  
function RemoveNetwork(const AName:String):Boolean;  
 
function GetServByName(const AName,AProtocol:String; ALock:Boolean):TIPServEntry;  
function GetServByPort(APort:Word; const AProtocol:String; ALock:Boolean):TIPServEntry;  
function AddServ(const AName,AProtocol:String; APort:Word; ALock:Boolean):TIPServEntry;  
function RemoveServ(const AName,AProtocol:String):Boolean;  
 
function GetProtoByName(const AName:String; ALock:Boolean):TIPProtoEntry;  
function GetProtoByNumber(ANumber:Word; ALock:Boolean):TIPProtoEntry;  
function AddProto(const AName:String; ANumber:Word; ALock:Boolean):TIPProtoEntry;  
function RemoveProto(const AName:String):Boolean;  
 
function CompareLocal(const AAddress:TInAddr):Boolean;  
function CompareDefault(const AAddress:TInAddr):Boolean;  
function CompareLoopback(const AAddress:TInAddr):Boolean;  
function CompareDirected(const AAddress:TInAddr):Boolean;  
function CompareBroadcast(const AAddress:TInAddr):Boolean;  
function CompareMulticast(const AAddress:TInAddr):Boolean;  
function CompareAddress(const AAddress1,AAddress2:TInAddr):Boolean;  
function CompareSubnet(const AAddress,ANetwork,ANetmask:TInAddr):Boolean;  

IP state

TIPState = class(TTransportState)

constructor Create;  
private
FLocalAddress:TInAddr; Host Order
FRemoteAddress:TInAddr; Host Order
 
procedure SetLocalAddress(const ALocalAddress:TInAddr);  
procedure SetRemoteAddress(const ARemoteAddress:TInAddr);  
public
property LocalAddress:TInAddr read FLocalAddress write SetLocalAddress;  
property RemoteAddress:TInAddr read FRemoteAddress write SetRemoteAddress;  

IP options

TIPOptions = class(TTransportOptions)

Note: For Get/Set Options Level = IP_PROTO Option = ???
 
constructor Create;  
destructor Destroy; override;  
private
FMemory:TMemoryStream;  
FOptions:Pointer;  
FLength:Integer;  
 
FTOS:Byte; IPTOS_LOWDELAY etc
FTTL:Byte; Time To Live
FFlags:Word; IP_DF etc
FHeader:Boolean; IP_HDRINCL
FMulticastIF:TInAddr; IP_MULTICAST_IF
FMulticastTTL:Byte; IP_MULTICAST_TTL
FMulticastLOOP:Boolean; IP_MULTICAST_LOOP
 
procedure SetTOS(ATOS:Byte);  
procedure SetTTL(ATTL:Byte);  
procedure SetFlags(AFlags:Word);  
procedure SetHeader(AHeader:Boolean);  
procedure SetMulticastIF(const AMulticastIF:TInAddr);  
procedure SetMulticastTTL(AMulticastTTL:Byte);  
procedure SetMulticastLOOP(AMulticastLOOP:Boolean);  
 
procedure SetLength(ALength:Integer);  
public
property TOS:Byte read FTOS write SetTOS;  
property TTL:Byte read FTTL write SetTTL;  
property Flags:Word read FFlags write SetFlags;  
property Header:Boolean read FHeader write SetHeader;  
property MulticastIF:TInAddr read FMulticastIF write SetMulticastIF;  
property MulticastTTL:Byte read FMulticastTTL write SetMulticastTTL;  
property MulticastLOOP:Boolean read FMulticastLOOP write SetMulticastLOOP;  
 
property Options:Pointer read FOptions; IP_OPTIONS
property Length:Integer read FLength write SetLength;  

IP host entry

TIPHostEntry = class(THostEntry)

constructor Create;  
private
FAddresses:array[0..MAX_HOST_ALIASES - 1] of TInAddr;  
 
function GetAddress:TInAddr;  
procedure SetAddress(const AAddress:TInAddr);  
function GetAddresses(Index:Integer):TInAddr;  
public
property Address:TInAddr read GetAddress write SetAddress;  
property Addresses[Index:Integer]:TInAddr read GetAddresses;  
 
function FindAddress(const AAddress:TInAddr):Boolean;  
 
function AddAddress(const AAddress:TInAddr):Boolean;  
function RemoveAddress(const AAddress:TInAddr):Boolean;  

IP route entry

TIPRouteEntry = class(TRouteEntry)

constructor Create;  
private
FTOS:Byte; Default TOS for this Route
FTTL:Byte; Default TTL for this Route
FNetwork:TInAddr;  
FNetmask:TInAddr;  
FGateway:TInAddr;  
FAddress:TInAddr;  
 
procedure SetTOS(ATOS:Byte);  
procedure SetTTL(ATTL:Byte);  
procedure SetNetwork(const ANetwork:TInAddr);  
procedure SetNetmask(const ANetmask:TInAddr);  
procedure SetGateway(const AGateway:TInAddr);  
procedure SetAddress(const AAddress:TInAddr);  
public
property TOS:Byte read FTOS write SetTOS;  
property TTL:Byte read FTTL write SetTTL;  
property Network:TInAddr read FNetwork write SetNetwork;  
property Netmask:TInAddr read FNetmask write SetNetmask;  
property Gateway:TInAddr read FGateway write SetGateway;  
property Address:TInAddr read FAddress write SetAddress;  

IP address entry

TIPAddressEntry = class(TAddressEntry)

Note: Used for secondary addresses.
 
constructor Create;  
private
FAddress:TInAddr;  
 
procedure SetAddress(const AAddress:TInAddr);  
public
property Address:TInAddr read FAddress write SetAddress;  

IP network entry

TIPNetworkEntry = class(TNetworkEntry)

constructor Create;  
private
FNetwork:TInAddr;  
 
procedure SetNetwork(const ANetwork:TInAddr);  
public
property Network:TInAddr read FNetwork write SetNetwork;  

IP service entry

TIPServEntry = class(TServEntry)

constructor Create;  
private
 
public
 

IP protocol entry

TIPProtoEntry = class(TProtoEntry)

constructor Create;  
private
 
public
 


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