Difference between revisions of "Unit ARP"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(14 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo ARP (Address Resolution Protocol) unit'''
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ARP specific constants''' <code> ARP_TRANSPORT_*, RARP_TRANSPORT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ARP_TRANSPORT_NAME = 'ARP';</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>RARP_TRANSPORT_NAME = 'RARP';</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br /> 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ARP and RARP constants''' <code> MIN_*, MAX_*, ARP_*, RARP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MIN_ARP_PACKET = 46;</code>
 +
| Not Counting Adapter Header
 +
|-
 +
| <code>MAX_ARP_PACKET = 46;</code>
 +
| Not Counting Adapter Header
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ARP_TIMEOUT = 1000;</code>
 +
| We wait for 1 second approx for reply
 +
|-
 +
| <code>ARP_RETRIES = 4;</code>
 +
| We try the request 4 times
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>RARP_TIMEOUT = 4000;</code>
 +
| We wait for 4 seconds for a RARP reply
 +
|-
 +
| <code>RARP_RETRIES = 4;</code>
 +
| We try the request 4 times
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ARP_HEADER_SIZE  = 46;</code>
 +
| SizeOf(TARPHeader);
 +
|-
 +
| <code>RARP_HEADER_SIZE = 46;</code>
 +
| SizeOf(TRARPHeader);
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ARP and RARP messages''' <code> ARP_*, RARP_*, INARP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ARP_REQUEST = $0001;</code>
 +
| ARP/RARP op codes, Request
 +
|-
 +
| <code>ARP_REPLY = $0002;</code>
 +
| ARP/RARP op codes, Reply
 +
|-
 +
| <code>RARP_REQUEST = $0003;</code>
 +
| &nbsp;
 +
|-
 +
| <code>RARP_REPLY = $0004;</code>
 +
| &nbsp;
 +
|-
 +
| <code>INARP_REQUEST = $0008;</code>
 +
| Inverse ARP see RFC 1293
 +
|-
 +
| <code>INARP_REPLY = $0009;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''ARP specific types'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARPHeader = ^TARPHeader;</code>
 +
 
 +
<code>TARPHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 46 Bytes
 +
|-
 +
| <code>HardwareType:Word;</code>
 +
| Hardware address space (Network Order)
 +
|-
 +
| <code>ProtocolType:Word;</code>
 +
| Protocol address space (Network Order)
 +
|-
 +
| <code>HardwareLength:Byte;</code>
 +
| Byte length of hardware address
 +
|-
 +
| <code>ProtocolLength:Byte;</code>
 +
| Byte length of each protocol address
 +
|-
 +
| <code>Opcode:Word;</code>
 +
| Op code (eg ARP_REQUEST or ARP_REPLY) (Network Order)
 +
|-
 +
| <code>SourceHardware:THardwareAddress;</code>
 +
| Source hardware address (of sender)
 +
|-
 +
| <code>SourceIP:TInAddr;</code>
 +
| Source protocol address (of sender) (Network Order)
 +
|-
 +
| <code>TargetHardware:THardwareAddress;</code>
 +
| Target hardware address (if known)
 +
|-
 +
| <code>TargetIP:TInAddr;</code>
 +
| Target protocol address (Network Order)
 +
|-
 +
| <code>Reserved:array[0..17] of Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''RARP specific types'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PRARPHeader = ^TRARPHeader;</code>
 +
 
 +
<code>TRARPHeader = TARPHeader;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 46 Bytes
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
=== Class definitions ===
 +
----
 +
 
 +
 
 +
'''ARP specific classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TARPTransportAdapter|<code>TARPTransportAdapter = class(TTransportAdapter)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TARPTransport|<code>TARPTransport = class(TNetworkTransport)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TARPAddressEntry|<code>TARPAddressEntry = class(TAddressEntry)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TRARPTransportAdapter|<code>TRARPTransportAdapter = class(TTransportAdapter)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TRARPTransport|<code>TRARPTransport = class(TNetworkTransport)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TRARPAddressEntry|<code>TRARPAddressEntry = class(TAddressEntry)</code>]]
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<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 ARPInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''ARP functions'''
 +
 +
<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;">function CheckARP(ABuffer:Pointer):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Verify that the packet is a valid ARP packet</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Buffer
 +
| Buffer points to the complete packet without Adapter header
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function CheckRARP(ABuffer:Pointer):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Verify that the packet is a valid RARP packet</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Buffer
 +
| Buffer points to the complete packet without Adapter header
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 05:20, 31 August 2021

Return to Unit Reference


Description


Ultibo ARP (Address Resolution Protocol) unit

Constants



ARP specific constants ARP_TRANSPORT_*, RARP_TRANSPORT_*
ARP_TRANSPORT_NAME = 'ARP';  
RARP_TRANSPORT_NAME = 'RARP';  


ARP and RARP constants MIN_*, MAX_*, ARP_*, RARP_*
MIN_ARP_PACKET = 46; Not Counting Adapter Header
MAX_ARP_PACKET = 46; Not Counting Adapter Header
 
ARP_TIMEOUT = 1000; We wait for 1 second approx for reply
ARP_RETRIES = 4; We try the request 4 times
 
RARP_TIMEOUT = 4000; We wait for 4 seconds for a RARP reply
RARP_RETRIES = 4; We try the request 4 times
 
ARP_HEADER_SIZE = 46; SizeOf(TARPHeader);
RARP_HEADER_SIZE = 46; SizeOf(TRARPHeader);


ARP and RARP messages ARP_*, RARP_*, INARP_*
ARP_REQUEST = $0001; ARP/RARP op codes, Request
ARP_REPLY = $0002; ARP/RARP op codes, Reply
RARP_REQUEST = $0003;  
RARP_REPLY = $0004;  
INARP_REQUEST = $0008; Inverse ARP see RFC 1293
INARP_REPLY = $0009;  


Type definitions



ARP specific types

PARPHeader = ^TARPHeader;

TARPHeader = packed record

Note: 46 Bytes
HardwareType:Word; Hardware address space (Network Order)
ProtocolType:Word; Protocol address space (Network Order)
HardwareLength:Byte; Byte length of hardware address
ProtocolLength:Byte; Byte length of each protocol address
Opcode:Word; Op code (eg ARP_REQUEST or ARP_REPLY) (Network Order)
SourceHardware:THardwareAddress; Source hardware address (of sender)
SourceIP:TInAddr; Source protocol address (of sender) (Network Order)
TargetHardware:THardwareAddress; Target hardware address (if known)
TargetIP:TInAddr; Target protocol address (Network Order)
Reserved:array[0..17] of Word;  

RARP specific types

PRARPHeader = ^TRARPHeader;

TRARPHeader = TARPHeader;

Note: 46 Bytes
   


Class definitions



ARP specific classes

TARPTransportAdapter = class(TTransportAdapter)
TARPTransport = class(TNetworkTransport)
TARPAddressEntry = class(TAddressEntry)
TRARPTransportAdapter = class(TTransportAdapter)
TRARPTransport = class(TNetworkTransport)
TRARPAddressEntry = class(TAddressEntry)


Public variables


None defined

Function declarations



Initialization functions

procedure ARPInit;
Description: To be documented
Note None documented


ARP functions

function CheckARP(ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid ARP packet
Buffer Buffer points to the complete packet without Adapter header


function CheckRARP(ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid RARP packet
Buffer Buffer points to the complete packet without Adapter header


Return to Unit Reference