Difference between revisions of "Unit IP"
Line 440: | Line 440: | ||
---- | ---- | ||
− | ''To | + | |
+ | '''IP buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <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. | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create(ATransport:TNetworkTransport);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FFirst:PIPPacket;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FLast:PIPPacket;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddFragment(APacket:PIPPacket; AOffset,ASize:Word):PIPFragment;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveFragment(APacket:PIPPacket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushFragments(APacket:PIPPacket);</code> | ||
+ | | | ||
+ | |- | ||
+ | |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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddPacket(AId:Word; AProtocol:Byte; const ASource,ADest:TInAddr; ALock:Boolean):PIPPacket;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemovePacket(APacket:PIPPacket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnlockPacket(APacket:PIPPacket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushPackets(All:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function PutHeader(APacket:PIPPacket; ABuffer:Pointer; ALength:Word):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function PutFragment(APacket:PIPPacket; ABuffer:Pointer; AOffset,ASize,AFlags:Word):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Address:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Netmask:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Gateway:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Network:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Directed:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>ConfigDefault:Word;</code> | ||
+ | | BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK | ||
+ | |- | ||
+ | | <code>ConfigAddress:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigNetmask:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigGateway:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigServer:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Address:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Netmask:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Gateway:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Network:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Directed:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>ConfigDefault:Word;</code> | ||
+ | | BOOTP/DHCP/RARP/STATIC/PSEUDO/LOOPBACK | ||
+ | |- | ||
+ | | <code>ConfigAddress:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigNetmask:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigGateway:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigServer:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FNextIPId:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FNextIPLock:TMutexHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FARP:TARPTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FRARP:TRARPTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FFragments:TIPBuffer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FHosts:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FServs:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FProtos:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FRoutes:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FNetworks:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FAddresses:TNetworkList;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FNameservers:TIPNameservers; (Part of TNetworkList)</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FNameserverLock:TMutexHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FForwarding:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FDefaultTTL:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FAutoRelease:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FragmentHandler(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CheckFragment(ABuffer:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetNextIPId(AIncrement:Boolean):Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetIPNameserver(ACount:LongWord):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetAdapterConfigType(const AName:String):Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAdapterConfigAddress(const AName:String):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAdapterConfigNetmask(const AName:String):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAdapterConfigGateway(const AName:String):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAdapterConfigServer(const AName:String):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function FilterPacket(ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ForwardPacket(AAdapter:TTransportAdapter; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Nameservers:TIPNameservers read FNameservers;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Forwarding:LongWord read FForwarding write FForwarding;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property DefaultTTL:LongWord read FDefaultTTL write FDefaultTTL;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property AutoRelease:Boolean read FAutoRelease write FAutoRelease;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddAdapter(AAdapter:TNetworkAdapter; AConfigType:Word; AAddress,ANetmask,AGateway,AServer:Pointer):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveAdapter(AAdapter:TNetworkAdapter):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddProtocol(AProtocol:Word; APacketHandler:TTransportPacketHandler; AControlHandler:TTransportControlHandler):THandle; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveProtocol(AHandle:THandle; AProtocol:Word):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddFilter(AProtocol:Word; AFilterHandler:TTransportFilterHandler):THandle; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveFilter(AHandle:THandle; AProtocol:Word):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddConfig(AConfigType:Word; AConfigAuto:Boolean; AConfigHandler:TTransportConfigHandler):THandle; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveConfig(AHandle:THandle; AConfigType:Word):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendPacket(ASocket:TTransportSocket; ASource,ADest:Pointer; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendControl(ASource,ADest:Pointer; AProtocol,ACommand,ACode:Word; AAddress,AData:Pointer; ASize:Integer):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SetSockOpt(ASocket:TTransportSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartTransport:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopTransport:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessTransport:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindTransport(AAdapter:TNetworkAdapter):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindTransport(AAdapter:TNetworkAdapter):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddNameserver(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveNameserver(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetHostByName(const AName:String; ALock:Boolean):TIPHostEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetHostByAddress(const AAddress:TInAddr; ALock:Boolean):TIPHostEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetHostByNext(APrevious:TIPHostEntry; ALock,AUnlock:Boolean):TIPHostEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddHost(const AAddress:TInAddr; const AName:String; AType:Word; ALock:Boolean):TIPHostEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveHost(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushHosts(All:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetRouteByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetRouteByNetwork(const ANetwork,AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetRouteByNext(APrevious:TIPRouteEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPRouteEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddRoute(const ANetwork,ANetmask,AGateway,AAddress:TInAddr; AType:Word; ALock:Boolean; AState:LongWord):TIPRouteEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveRoute(const ANetwork,AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushRoutes(All:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetAddressByAddress(const AAddress:TInAddr; ALock:Boolean; AState:LongWord):TIPAddressEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAddressByNext(APrevious:TIPAddressEntry; ALock,AUnlock:Boolean; AState:LongWord):TIPAddressEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter; AType:Word; ALock:Boolean; AState:LongWord):TIPAddressEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveAddress(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushAddresses(All:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetNetworkByName(const AName:String; ALock:Boolean):TIPNetworkEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetNetworkByAddress(const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddNetwork(const AName:String; const ANetwork:TInAddr; ALock:Boolean):TIPNetworkEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveNetwork(const AName:String):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetServByName(const AName,AProtocol:String; ALock:Boolean):TIPServEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetServByPort(APort:Word; const AProtocol:String; ALock:Boolean):TIPServEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddServ(const AName,AProtocol:String; APort:Word; ALock:Boolean):TIPServEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveServ(const AName,AProtocol:String):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetProtoByName(const AName:String; ALock:Boolean):TIPProtoEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetProtoByNumber(ANumber:Word; ALock:Boolean):TIPProtoEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddProto(const AName:String; ANumber:Word; ALock:Boolean):TIPProtoEntry;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveProto(const AName:String):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CompareLocal(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareDefault(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareLoopback(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareDirected(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareBroadcast(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareMulticast(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareAddress(const AAddress1,AAddress2:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompareSubnet(const AAddress,ANetwork,ANetmask:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLocalAddress:TInAddr;</code> | ||
+ | | Host Order | ||
+ | |- | ||
+ | | <code>FRemoteAddress:TInAddr;</code> | ||
+ | | Host Order | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetLocalAddress(const ALocalAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetRemoteAddress(const ARemoteAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property LocalAddress:TInAddr read FLocalAddress write SetLocalAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property RemoteAddress:TInAddr read FRemoteAddress write SetRemoteAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 = ??? | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FMemory:TMemoryStream;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FOptions:Pointer;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FLength:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>procedure SetTOS(ATOS:Byte);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetTTL(ATTL:Byte);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetFlags(AFlags:Word);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetHeader(AHeader:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetMulticastIF(const AMulticastIF:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetMulticastTTL(AMulticastTTL:Byte);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetMulticastLOOP(AMulticastLOOP:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetLength(ALength:Integer);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property TOS:Byte read FTOS write SetTOS;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property TTL:Byte read FTTL write SetTTL;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Flags:Word read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Header:Boolean read FHeader write SetHeader;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property MulticastIF:TInAddr read FMulticastIF write SetMulticastIF;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property MulticastTTL:Byte read FMulticastTTL write SetMulticastTTL;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property MulticastLOOP:Boolean read FMulticastLOOP write SetMulticastLOOP;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Options:Pointer read FOptions;</code> | ||
+ | | IP_OPTIONS | ||
+ | |- | ||
+ | | <code>property Length:Integer read FLength write SetLength;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FAddresses:array[0..MAX_HOST_ALIASES - 1] of TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetAddress:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetAddress(const AAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetAddresses(Index:Integer):TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Address:TInAddr read GetAddress write SetAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Addresses[Index:Integer]:TInAddr read GetAddresses;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function FindAddress(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddAddress(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveAddress(const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FNetmask:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FGateway:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FAddress:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetTOS(ATOS:Byte);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetTTL(ATTL:Byte);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetNetwork(const ANetwork:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetNetmask(const ANetmask:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetGateway(const AGateway:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetAddress(const AAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property TOS:Byte read FTOS write SetTOS;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property TTL:Byte read FTTL write SetTTL;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Network:TInAddr read FNetwork write SetNetwork;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Netmask:TInAddr read FNetmask write SetNetmask;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Gateway:TInAddr read FGateway write SetGateway;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Address:TInAddr read FAddress write SetAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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. | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FAddress:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetAddress(const AAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Address:TInAddr read FAddress write SetAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FNetwork:TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetNetwork(const ANetwork:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Network:TInAddr read FNetwork write SetNetwork;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 04:48, 15 March 2017
Return to Unit Reference
Contents
Description
Ultibo IP (Internet Protocol) unit
To be documented
Constants
IP_TRANSPORT_NAME*
IP_TRANSPORT_NAME = 'IP';
|
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_*
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 |
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 |
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 |
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 |
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;
|
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;
Note | None documented |
---|
IP functions
function CheckIP(ABuffer:Pointer):Boolean;
Buffer | Complete packet without Adapter header |
---|
function GetIPHeaderOffset(ABuffer:Pointer):Word;
Buffer | Complete packet including Transport header |
---|
function GetIPHeaderLength(ABuffer:Pointer):Word;
Buffer | Complete packet including Transport header |
---|
function GetIPOptionsLength(ABuffer:Pointer):Word;
Buffer | Complete packet including Transport header |
---|
function GetIPDataOffset(ABuffer:Pointer):Word;
Buffer | Complete packet including Transport header |
---|
function GetIPDataLength(ABuffer:Pointer):Word;
Buffer | Complete packet including Transport header |
---|
function ChecksumIPRecv(ABuffer:Pointer; AOffset,ALength:Word):Word;
Buffer | Complete packet including Transport header |
---|
function ChecksumIPSend(AHeader,AOptions:Pointer; ALength:Word):Word;
Buffer | Complete packet including Transport header |
---|
Return to Unit Reference