TDHCPConfig

From Ultibo.org
Jump to: navigation, search

Return to Unit DHCP


Description


To be documented

Class definitions



TDHCPConfig = class(TNetworkConfig)

constructor Create(AManager:TProtocolManager);  
destructor Destroy; override;  
private
FARP:TARPTransport;  
FUDP:TUDPProtocol;  
 
function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;  
 
function GetDHCPClientId(AAdapter:TTransportAdapter):TDHCPClientId;  
 
function GetDHCPHeaderSize(AHeader:PDHCPHeader):Integer;  
 
function CreateDHCPRequest(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function CheckDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord):Boolean;  
function HandleDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; ACommand:Word):Boolean;  
 
function SendDHCPDiscover(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPRequest(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPDecline(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPRelease(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPInform(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPRenew(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPRebind(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
function SendDHCPReboot(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;  
 
function RecvDHCPReply(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACommand:Word):Boolean;  
 
function InsertDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; ASize:Integer):Boolean;  
function ExtractDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; var ASize:Integer):Boolean;  
protected
 
public
function AddTransport(ATransport:TNetworkTransport):Boolean; override;  
function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;  
 
function StartConfig:Boolean; override;  
function StopConfig:Boolean; override;  
function ProcessConfig:Boolean; override;  
 
function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; override;  


Function declarations



constructor TDHCPConfig.Create(AManager:TProtocolManager);
Description: To be documented
Note None documented


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


function TDHCPConfig.ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;
Description: Process a network config request from a Transport
Handle The Handle of the Config Transport the request is from
Adapter The transport adapter to perform configuration on
Command The configuration command to perform
Note DHCP Handler is structured slightly different to others to account for the multiple types of requests it services

Caller must hold the Adapter lock


function TDHCPConfig.GetDHCPClientId(AAdapter:TTransportAdapter):TDHCPClientId;
Description: Client Id is just Hardware address prefixed by 01
Note Caller must hold the Adapter lock


function TDHCPConfig.GetDHCPHeaderSize(AHeader:PDHCPHeader):Integer;
Description: Return size of Header and any Options it contains
Note None documented


function TDHCPConfig.CreateDHCPRequest(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note The first four octets of the 'options' field of the DHCP message contain the (decimal) values 99, 130, 83 and 99, respectively.

This is the same magic cookie as is defined in RFC 1497 [17]
Caller must hold the Transport and Adapter locks


function TDHCPConfig.CheckDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord):Boolean;
Description: To be documented
Note The first four octets of the 'options' field of the DHCP message contain the (decimal) values 99, 130, 83 and 99, respectively.

This is the same magic cookie as is defined in RFC 1497 [17]
Caller must hold the Transport and Adapter locks


function TDHCPConfig.HandleDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; ACommand:Word):Boolean;
Description: To be documented
Note Caller must hold the Transport and Adapter locks


function TDHCPConfig.SendDHCPDiscover(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Discover uses Broadcast send and ciaddr zero

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPRequest(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Request uses Broadcast send and ciaddr zero

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPDecline(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Decline uses Broadcast send and ciaddr zero

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPRelease(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Release uses Unicast send and ciaddr filled in

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPInform(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Inform uses Broadcast send and ciaddr filled in

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPRenew(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Renew actually uses Request with Unicast send and ciaddr filled in

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPRebind(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Rebind actually uses Request with Broadcast send and ciaddr filled in

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.SendDHCPReboot(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;
Description: To be documented
Note Reboot actually uses Request with Broadcast send and ciaddr zero

Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.RecvDHCPReply(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACommand:Word):Boolean;
Description: To be documented
Note Caller must hold the Socket, Transport and Adapter locks.


function TDHCPConfig.InsertDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; ASize:Integer):Boolean;
Description: To be documented
Note The first four octets of the 'options' field of the DHCP message contain the (decimal) values 99, 130, 83 and 99, respectively.

This is the same magic cookie as is defined in RFC 1497 [17]


function TDHCPConfig.ExtractDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; var ASize:Integer):Boolean;
Description: To be documented
Note The first four octets of the 'options' field of the DHCP message contain the (decimal) values 99, 130, 83 and 99, respectively.

This is the same magic cookie as is defined in RFC 1497 [17]


function TDHCPConfig.AddTransport(ATransport:TNetworkTransport):Boolean;
Description: Add a transport to this config
Transport The transport to add


function TDHCPConfig.RemoveTransport(ATransport:TNetworkTransport):Boolean;
Description: Remove a transport from this config
Transport The transport to remove


function TDHCPConfig.StartConfig:Boolean;
Description: Start this config ready for use
Note None documented


function TDHCPConfig.StopConfig:Boolean;
Description: Stop this config ready for removal
Note None documented


function TDHCPConfig.ProcessConfig:Boolean;
Description: Process periodic tasks for this config
Note None documented


function TDHCPConfig.SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean;
Description: Set Delay, Retry and Timeout for this config
Note None documented


Return to Unit Reference