TRARPTransport

From Ultibo.org
Jump to: navigation, search

Return to Unit ARP


Description


To be documented

Class definitions



TRARPTransport = class(TNetworkTransport)

constructor Create(AManager:TTransportManager; const AName:String);  
destructor Destroy; override;  
private
FAddresses:TNetworkList;  
FAddressAdd:TEventHandle;  
FAddressRemove:TEventHandle;  
 
function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;  
 
function SendRARPRequest(AAdapter:TRARPTransportAdapter):Boolean;  
function SendRARPReply(AAdapter:TRARPTransportAdapter; ASource,ATarget:TRARPAddressEntry):Boolean;  
protected
 
public
function AddAdapter(AAdapter:TNetworkAdapter; AConfigType:Word; AAddress,ANetmask,AGateway,AServer:Pointer):Boolean; override;  
function RemoveAdapter(AAdapter:TNetworkAdapter):Boolean; 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 GetAddressByAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter; ALock:Boolean; AState:LongWord):TRARPAddressEntry;  
function GetAddressByHardware(const AHardware:THardwareAddress; AAdapter:TNetworkAdapter; ALock:Boolean; AState:LongWord):TRARPAddressEntry;  
function GetAddressByNext(APrevious:TRARPAddressEntry; ALock,AUnlock:Boolean; AState:LongWord):TRARPAddressEntry;  
function AddAddress(const AAddress:TInAddr; const AHardware:THardwareAddress; AAdapter:TNetworkAdapter; AType:Word; ALock:Boolean; AState:LongWord):TRARPAddressEntry;  
function RemoveAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter):Boolean;  
procedure FlushAddresses(All:Boolean);  
 
function LoadAddress(AAdapter:TNetworkAdapter; const AAddress:TInAddr; const AHardware:THardwareAddress; AType:Word):Boolean;  
function UnloadAddress(AAdapter:TNetworkAdapter; const AAddress:TInAddr):Boolean;  
 
function ResolveHardware(AAdapter:TNetworkAdapter; var AAddress:TInAddr):Boolean;  
 
function CompareDefault(const AAddress:TInAddr):Boolean;  
function CompareAddress(const AAddress1,AAddress2:TInAddr):Boolean;  


Function declarations



constructor TRARPTransport.Create(AManager:TTransportManager; const AName:String);
Description: To be documented
Note None documented


destructor TRARPTransport.Destroy;
Description: To be documented
Note None documented


function TRARPTransport.PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;
Description: Process a packet received by an Adapter
Handle The Handle of the Transport Adapter the packet was received from
Source The source hardware address of the received packet (Set by Adapter)
Dest The destination hardware address of the received packet (Set by Adapter)
Packet The received packet (The complete packet without Adapter header)
Size The size of the received packet in bytes
Broadcast True if the destination address is a broadcast address


function TRARPTransport.SendRARPRequest(AAdapter:TRARPTransportAdapter):Boolean;
Description: Send a RARP request packet
Adapter The transport adapter to send the request on
Note Caller must hold Adapter lock


function TRARPTransport.SendRARPReply(AAdapter:TRARPTransportAdapter; ASource,ATarget:TRARPAddressEntry):Boolean;
Description: Send a RARP reply packet
Adapter The transport adapter to send the reply on
Source The source hardware and IP address to send the reply with
Target The target harware and IP address to send the reply to
Note Caller must hold Adapter lock, Source and Target locks.


function TRARPTransport.AddAdapter(AAdapter:TNetworkAdapter; AConfigType:Word; AAddress,ANetmask,AGateway,AServer:Pointer):Boolean;
Description: Add an adapter to this transport
Adapter The adapter to add
ConfigType The configuration type to use for configuring the adapter (eg CONFIG_TYPE_AUTO)
Address The transport address to use for this adapter (or nil if supplied during configuration)
Netmask The transport netmask to use for this adapter (or nil if supplied during configuration)
Gateway The transport default gateway to use for this adapter (or nil if supplied during configuration)
Server The transport configuration server to use for this adapter (or nil if supplied during configuration)


function TRARPTransport.RemoveAdapter(AAdapter:TNetworkAdapter):Boolean;
Description: Remove an adapter from this transport
Adapter The adapter to remove


function TRARPTransport.StartTransport:Boolean;
Description: Start this transport ready for sending and receiving
Note None documented


function TRARPTransport.StopTransport:Boolean;
Description: Stop this transport ready for removal
Note None documented


function TRARPTransport.ProcessTransport:Boolean;
Description: Process periodic tasks for this transport
Note None documented


function TRARPTransport.BindTransport(AAdapter:TNetworkAdapter):Boolean;
Description: Bind this transport to an adapter if appropriate
Adapter The adapter to bind to
Note RARP binds to adapters only on request from other transports (eg IP)


function TRARPTransport.UnbindTransport(AAdapter:TNetworkAdapter):Boolean; 
Description: Unbind this transport from an adapter if appropriate
Adapter The adapter to unbind from
Note RARP unbinds from adapters only on request from other transports (eg IP)


function TRARPTransport.GetAddressByAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter; ALock:Boolean; AState:LongWord):TRARPAddressEntry;
Description: Find the IP address entry in the address cache
Address The IP address to find
Adapter The adapter which the address should be on
Lock If True then lock the found entry before returning


function TRARPTransport.GetAddressByHardware(const AHardware:THardwareAddress; AAdapter:TNetworkAdapter; ALock:Boolean; AState:LongWord):TRARPAddressEntry;
Description: Find the hardware address entry in the address cache
Address The hardware address to find
Adapter The adapter which the address should be on
Lock If True then lock the found entry before returning


function TRARPTransport.GetAddressByNext(APrevious:TRARPAddressEntry; ALock,AUnlock:Boolean; AState:LongWord):TRARPAddressEntry;
Description: To be documented
Note None documented


function TRARPTransport.AddAddress(const AAddress:TInAddr; const AHardware:THardwareAddress; AAdapter:TNetworkAdapter; AType:Word; ALock:Boolean; AState:LongWord):TRARPAddressEntry;
Description: Add an IP and hardware address pair to the address cache
Address The IP address to add
Hardware The hardware address to add
Adapter The adapter the address is on
Type The type of the added entry (eg ADDRESS_TYPE_DYNAMIC)
Lock If True then lock the added entry before returning


function TRARPTransport.RemoveAddress(const AAddress:TInAddr; AAdapter:TNetworkAdapter):Boolean;
Description: Remove an IP and hardware address pair from the address cache
Address The IP address to remove
Adapter The adapter the address is on


procedure TRARPTransport.FlushAddresses(All:Boolean);
Description: Flush addresses from the address cache
All If True flush all addresses, otherwise flush expired addresses.


function TRARPTransport.LoadAddress(AAdapter:TNetworkAdapter; const AAddress:TInAddr; const AHardware:THardwareAddress; AType:Word):Boolean;
Description: Add an IP and hardware address pair to the address cache
Adapter The adapter the address is on
Address The IP address to add
Hardware The hardware address to add
Type The type of the added entry (eg ADDRESS_TYPE_LOCAL)


function TRARPTransport.UnloadAddress(AAdapter:TNetworkAdapter; const AAddress:TInAddr):Boolean;
Description: Remove an IP and hardware address pair from the address cache
Adapter The adapter the address is on
Address The IP address to remove


function TRARPTransport.ResolveHardware(AAdapter:TNetworkAdapter; var AAddress:TInAddr):Boolean;
Description: Resolve the hardware address for the given IP address either from cache or by sending a RARP request
Adapter The adapter to use for resolving the hardware address
Source The source IP address to use for resolving the hardware address
Address The IP address to resolve
Hardware The returned hardware address


function TRARPTransport.CompareDefault(const AAddress:TInAddr):Boolean;
Description: Compare the supplied address with the IP default address
Note None documented


function TRARPTransport.CompareAddress(const AAddress1,AAddress2:TInAddr):Boolean;
Description: Compare the supplied addresses to see if they are the same
Note None documented


Return to Unit Reference