Difference between revisions of "Unit DHCP"

From Ultibo.org
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo DHCP/BOOTP Protocol client unit'''
+
'''Ultibo DHCP/BOOTP Protocol Client unit'''
 
+
''To be documented''
+
  
 
=== Constants ===
 
=== Constants ===
Line 426: Line 424:
 
|-
 
|-
 
| <code>Opcode:Byte;</code>
 
| <code>Opcode:Byte;</code>
| packet op code / message type
+
| packet op code/message type
 
|-
 
|-
 
| <code>HardwareType:Byte;</code>
 
| <code>HardwareType:Byte;</code>
Line 438: Line 436:
 
|-
 
|-
 
| <code>Identifier:LongWord;</code>
 
| <code>Identifier:LongWord;</code>
| transaction ID, a random number
+
| transaction Id, a random number
 
|-
 
|-
 
| <code>Seconds:Word;</code>
 
| <code>Seconds:Word;</code>
Line 492: Line 490:
 
|-
 
|-
 
| <code>Opcode:Byte;</code>
 
| <code>Opcode:Byte;</code>
| packet op code / message type
+
| packet op code/message type
 
|-
 
|-
 
| <code>HardwareType:Byte;</code>
 
| <code>HardwareType:Byte;</code>
Line 504: Line 502:
 
|-
 
|-
 
| <code>Identifier:LongWord;</code>
 
| <code>Identifier:LongWord;</code>
| transaction ID, a random number
+
| transaction Id, a random number
 
|-
 
|-
 
| <code>Seconds:Word;</code>
 
| <code>Seconds:Word;</code>
Line 571: Line 569:
  
  
'''DHCP configuration transport'''
+
'''DHCP 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>TDHCPConfigTransport = class(TConfigTransport)</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>
+
| [[TDHCPConfigTransport|<code>TDHCPConfigTransport = class(TConfigTransport)</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;"
+
'''DHCP configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TDHCPConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TDHCPConfig|<code>TDHCPConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FARP:TARPTransport;</code>
+
| &nbsp;
+
|-
+
| <code>FUDP:TUDPProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDHCPClientId(AAdapter:TTransportAdapter):TDHCPClientId;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDHCPHeaderSize(AHeader:PDHCPHeader):Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CreateDHCPRequest(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CheckDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function HandleDHCPReply(AHeader:PDHCPHeader; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendDHCPDiscover(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPRequest(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPDecline(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPRelease(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPInform(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPRenew(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPRebind(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDHCPReboot(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvDHCPReply(ASocket:TProtocolSocket; ATransport:TDHCPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function InsertDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; ASize:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDHCPOption(AOption:Byte; AHeader:PDHCPHeader; AValue:Pointer; var ASize:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''BOOTP configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TBOOTPConfigTransport = class(TConfigTransport)</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>
+
| [[TBOOTPConfigTransport|<code>TBOOTPConfigTransport = class(TConfigTransport)</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;"
 
+
'''BOOTP configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TBOOTPConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TBOOTPConfig|<code>TBOOTPConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FARP:TARPTransport;</code>
+
| &nbsp;
+
|-
+
| <code>FUDP:TUDPProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CreateBOOTPRequest(AHeader:PBOOTPHeader; ATransport:TBOOTPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CheckBOOTPReply(AHeader:PBOOTPHeader; ATransport:TBOOTPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function HandleBOOTPReply(AHeader:PBOOTPHeader; ATransport:TBOOTPConfigTransport; AAdapter:TTransportAdapter):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendBOOTPRequest(ASocket:TProtocolSocket; ATransport:TBOOTPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord; ACount:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RecvBOOTPReply(ASocket:TProtocolSocket; ATransport:TBOOTPConfigTransport; AAdapter:TTransportAdapter; AIdentifier:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ExtractBOOTPOption(AOption:Byte; AHeader:PBOOTPHeader; AValue:Pointer; var ASize:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''ARP configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TARPConfigTransport = class(TConfigTransport)</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>
+
| [[TARPConfigTransport|<code>TARPConfigTransport = class(TConfigTransport)</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;"
 
+
'''ARP configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TARPConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TARPConfig|<code>TARPConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FARP:TARPTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''RARP configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TRARPConfigTransport = class(TConfigTransport)</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>
+
| [[TRARPConfigTransport|<code>TRARPConfigTransport = class(TConfigTransport)</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;"
 
+
'''RARP configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TRARPConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TRARPConfig|<code>TRARPConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FRARP:TRARPTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Static configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TStaticConfigTransport = class(TConfigTransport)</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>
+
| [[TStaticConfigTransport|<code>TStaticConfigTransport = class(TConfigTransport)</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;"
+
'''Static configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TStaticConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TStaticConfig|<code>TStaticConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FARP:TARPTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Loopback configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TLoopbackConfigTransport = class(TConfigTransport)</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>
+
| [[TLoopbackConfigTransport|<code>TLoopbackConfigTransport = class(TConfigTransport)</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;"
 
+
'''Loopback configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TLoopbackConfig = class(TNetworkConfig)</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:TProtocolManager);</code>
+
| [[TLoopbackConfig|<code>TLoopbackConfig = class(TNetworkConfig)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>function ConfigHandler(AHandle:THandle; AAdapter:TTransportAdapter; ACommand:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function StartConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
 
 
<br />
 
<br />
  
Line 1,070: Line 646:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">procedure DHCPInit;</pre>
 
<pre style="border: 0; padding-bottom:0px;">procedure DHCPInit;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the DHCP unit and create the Loopback, Static, DHCP, BOOTP, RARP and ARP configuration handlers</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;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Called only during system startup
 
|-
 
|-
 
|}
 
|}

Latest revision as of 05:20, 31 August 2021

Return to Unit Reference


Description


Ultibo DHCP/BOOTP Protocol Client unit

Constants



DHCP specific constants BOOTP_*
BOOTP_DELAY = 1000; (Previously 0)
BOOTP_TIMEOUT = 8000; (Previously 4000) We wait for 8 seconds for a BOOTP reply
BOOTP_RETRIES = 6; (Previously 4) Try the request 6 times
 
BOOTP_MIN_DELAY = 0;  
BOOTP_MAX_DELAY = 10000;  
BOOTP_MIN_TIMEOUT = 500;  
BOOTP_MAX_TIMEOUT = 15000;  
BOOTP_MIN_RETRIES = 1;  
BOOTP_MAX_RETRIES = 100;  
 
DHCP_DELAY = 1000; (Previously 0)
DHCP_TIMEOUT = 8000; (Previously 4000) We wait for 8 seconds for a DHCP reply
DHCP_RETRIES = 6; (Previously 4) Try the request 6 times
 
DHCP_MIN_DELAY = 0;  
DHCP_MAX_DELAY = 10000;  
DHCP_MIN_TIMEOUT = 500;  
DHCP_MAX_TIMEOUT = 15000;  
DHCP_MIN_RETRIES = 1;  
DHCP_MAX_RETRIES = 100;  
 
BOOTP_VENDOR_SIZE = 64; Size of the Vendor area
 
DHCP_OPTIONS_SIZE = 312; Size of the Options area
DHCP_MESSAGE_SIZE = 576; Size of the max message


BOOTP/DHCP request BOOTP_REQUEST*
BOOTP_REQUEST = 1;  
BOOTP_REPLY = 2;  


DHCP message DHCP_*
DHCP_DISCOVER = 1;  
DHCP_OFFER = 2;  
DHCP_REQUEST = 3;  
DHCP_DECLINE = 4;  
DHCP_ACK = 5;  
DHCP_NAK = 6;  
DHCP_RELEASE = 7;  
DHCP_INFORM = 8;  
 
DHCP_RENEWAL_TO = 1;  
DHCP_REBIND_TO = 2;  


BOOTP/DHCP options
PAD_OPT = 0;  
END_OPT = 255;  
SUBNET_MASK = 1;  
TIME_OFFSET = 2;  
ROUTERS_ON_SNET = 3;  
TIME_SRV = 4;  
NAME_SRV = 5;  
DNS_SRV = 6;  
LOG_SRV = 7;  
COOKIE_SRV = 8;  
LPR_SRV = 9;  
IMPRESS_SRV = 10;  
RES_LOCATION_SRV = 11;  
HOST_NAME = 12;  
BOOT_FSIZE = 13;  
MERIT_DUMPFILE = 14;  
DOMAIN_NAME = 15;  
SWAP_SRV = 16;  
ROOT_PATH = 17;  
EXTENTIONS_PATH = 18;  
IP_FORWARDING = 19;  
NON_LOCAL_SRC_ROUTE = 20;  
POLICY_FILTER = 21;  
MAX_DGRAM_REASM_SIZE = 22;  
IP_DEFAULT_TTL = 23;  
PATH_MTU_AGING_TIMEOUT = 24;  
PATH_MTU_PLATEAU_TABLE = 25;  
IF_MTU = 26;  
ALL_SUBNETS_LOCAL = 27;  
BROADCAST_ADDR = 28;  
PERFORM_MASK_DISCOVERY = 29;  
MASK_SUPPLIER = 30;  
PERFORM_ROUTER_DISCOVERY = 31;  
ROUTER_SOLICITATION_ADDR = 32;  
STATIC_ROUTE = 33;  
TRAILER_ENCAPSULATION = 34;  
ARP_CACHE_TIMEOUT = 35;  
ETHERNET_ENCAPSULATION = 36;  
TCP_DEFAULT_TTL = 37;  
TCP_KEEPALIVE_INTERVAL = 38;  
TCP_KEEPALIVE_GARBAGE = 39;  
NIS_DOMAIN_NAME = 40;  
NIS_SRVS = 41;  
NTP_SRVS = 42;  
VENDOR_SPECIFIC_INFO = 43;  
NBIOS_NAME_SRV = 44;  
NBIOS_DGRAM_DIST_SRV = 45;  
NBIOS_NODE_TYPE = 46;  
NBIOS_SCOPE = 47;  
XFONT_SRV = 48;  
XDISPLAY_MANAGER = 49;  
DHCP Options
DHCP_REQUESTED_IP_ADDR = 50;  
DHCP_IP_ADDR_LEASE_TIME = 51;  
DHCP_OPT_OVERLOAD = 52;  
DHCP_MSG_TYPE = 53;  
DHCP_SRV_IDENTIFIER = 54;  
DHCP_PARAM_REQUEST = 55;  
DHCP_MSG = 56;  
DHCP_MAX_MSG_SIZE = 57;  
DHCP_T1_VALUE = 58;  
DHCP_T2_VALUE = 59;  
DHCP_CLASS_ID = 60;  
DHCP_CLIENT_ID = 61;  
DHCP_NIS_DOMAIN_OPT = 64;  
DHCP_NIS_SRV_OPT = 65;  
DHCP_TFTP_SERVER = 66;  
DHCP_BOOT_FILENAME = 67;  
DHCP_MOBIP_HOME_AGENTS = 68;  
DHCP_SMTP_SRVS = 69;  
DHCP_POP3_SRVS = 70;  
DHCP_NNTP_SRVS = 71;  
DHCP_WWW_SRVS = 72;  
DHCP_FINGER_SRVS = 73;  
DHCP_IRC_SRVS = 74;  
DHCP_STREET_TALK_SRVS = 75;  
DHCP_STDA_SRVS = 76;  


DHCP flag DHCP_FLAG_*
DHCP_FLAG_BROADCAST = $8000;  


ARP configuration ARP_CONFIG_*
ARP_CONFIG_START = $C0A86401; 192.168.100.1
ARP_CONFIG_STOP = $C0A864FE; 192.168.100.254


Type definitions



DHCP specific types

PBOOTPHeader = ^TBOOTPHeader;

TBOOTPHeader = packed record

Opcode:Byte; packet op code/message type
HardwareType:Byte; hardware address type, 1 = 10 mb ethernet
HardwareLength:Byte; hardware address len, eg '6' for 10mb eth
Hops:Byte; client sets to zero, optionally used by gateways in cross-gateway booting
Identifier:LongWord; transaction Id, a random number
Seconds:Word; filled in by client, seconds elapsed since client started trying to boot
Reserved:Word;  
ClientIP:TInAddr; client IP address filled in by client if known
YourIP:TInAddr; 'your' (client) IP address filled by server if client doesn't know
ServerIP:TInAddr; server IP address returned in bootreply
GatewayIP:TInAddr; gateway IP address, used in optional cross-gateway booting
ClientHardware:array[0..15] of Byte; client hardware address, filled by client
ClientHardware:THardwareAddress; client hardware address, filled by client
DummyData:array[0..9] of Byte; dummy to fill out remaining bytes of above
ServerName:array[0..63] of Byte; optional server host name, null terminated
FileName:array[0..127] of Byte; boot file name, null terminated string 'generic' name or null in bootrequest, fully qualified directory-path name in bootreply
VendorData:array[0..63] of Byte; optional vendor-specific area
VendorData:array[0..BOOTP_VENDOR_SIZE - 1] of Byte; optional vendor-specific area

DHCP header

PDHCPHeader = ^TDHCPHeader;

TDHCPHeader = packed record

Opcode:Byte; packet op code/message type
HardwareType:Byte; hardware address type, 1 = 10 mb ethernet
HardwareLength:Byte; hardware address len, eg '6' for 10mb eth
Hops:Byte; client sets to zero, optionally used by gateways in cross-gateway booting
Identifier:LongWord; transaction Id, a random number
Seconds:Word; filled in by client, seconds elapsed since client started trying to boot
Flags:Word;  
ClientIP:TInAddr; client IP address filled in by client if known
YourIP:TInAddr; 'your' (client) IP address filled by server if client doesn't know
ServerIP:TInAddr; server IP address returned in bootreply
GatewayIP:TInAddr; gateway IP address, used in optional cross-gateway booting
ClientHardware:array[0..15] of Byte; client hardware address, filled by client
ClientHardware:THardwareAddress; client hardware address, filled by client
DummyData:array[0..9] of Byte; dummy to fill out remaining bytes of above
ServerName:array[0..63] of Byte; optional server host name, null terminated
FileName:array[0..127] of Byte; boot file name, null terminated string 'generic' name or null in bootrequest, fully qualified directory-path name in bootreply
Options:array[0..311] of Byte; DHCP options area (minimum 312 bytes)
Options:array[0..DHCP_OPTIONS_SIZE - 1] of Byte; DHCP options area (minimum 312 bytes)

DHCP client Id

PDHCPClientId = ^TDHCPClientId;

TDHCPClientId = packed record

Tag:Byte;  
Hardware:THardwareAddress;  


Class definitions



DHCP specific classes

TDHCPConfigTransport = class(TConfigTransport)
TDHCPConfig = class(TNetworkConfig)
TBOOTPConfigTransport = class(TConfigTransport)
TBOOTPConfig = class(TNetworkConfig)
TARPConfigTransport = class(TConfigTransport)
TARPConfig = class(TNetworkConfig)
TRARPConfigTransport = class(TConfigTransport)
TRARPConfig = class(TNetworkConfig)
TStaticConfigTransport = class(TConfigTransport)
TStaticConfig = class(TNetworkConfig)
TLoopbackConfigTransport = class(TConfigTransport)
TLoopbackConfig = class(TNetworkConfig)


Public variables


None defined

Function declarations



Initialization functions

procedure DHCPInit;
Description: Initialize the DHCP unit and create the Loopback, Static, DHCP, BOOTP, RARP and ARP configuration handlers
Note Called only during system startup


Return to Unit Reference