ARP

Package: inet.networklayer.arp.ipv4

ARP

simple module

Implements the Address Resolution Protocol for IPv4 and IEEE 802 6-byte MAC addresses.

ARP packets are represented by the ARPPacket class.

Communication Between ARP and IPv4 modules: IPv4 module call the ARP::getMACAddressFor(ipv4Address) method for get the MACAddress of next hop. If this method could not resolve an IPv4 address to MAC address, then IPv4 uses the ARP::startAddressResolution() method. ARP emit a completedARPResolution signal, when added/modified an entry in ARP table. ARP emit a failedARPResolution signal when an ARP request failed (ARP request sent retryCount times and retryTimeout elapsed).

ARP resolution is used over broadcast interfaces only, that is, over interfaces that have the isBroadcast() flag set in InterfaceEntry (see InterfaceTable). Since routing files (.irt or .mrt files, given as parameter to IPv4RoutingTable) may modify the default interface configuration, you must take care that these files don't contain the word BROADCAST e.g. for PPP interfaces.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
interfaceTableModule string

The path to the InterfaceTable module

routingTableModule string
retryTimeout double 1s

number seconds ARP waits between retries to resolve an IPv4 address

retryCount int 3

number of times ARP will attempt to resolve an IPv4 address

cacheTimeout double 120s

number seconds unused entries in the cache will time out

respondToProxyARP bool true

reply to proxy ARP requests (i.e. for IP addresses that this node can route)

Properties

Name Value Description
display i=block/layer

Gates

Name Direction Size Description
netwIn input

incoming ARP requests and replies

netwOut output

outgoing ARP requests/replies, and datagrams with resolved next hop

Signals

Name Type Unit
sentReply long
failedARPResolution inet::IARP::Notification
sentReq long
initiatedARPResolution inet::IARP::Notification
completedARPResolution inet::IARP::Notification

Statistics

Name Title Source Record Unit Interpolation Mode
sentReply ARP replies sent count, vector
failedARPResolution ARP failed resolutions count
sentReq ARP request sent count, vector
initiatedARPResolution ARP initiated resolutions count
completedARPResolution ARP completed resolutions count

Source code

//
// Implements the Address Resolution Protocol for IPv4 and IEEE 802 6-byte
// MAC addresses.
//
// ARP packets are represented by the ~ARPPacket class.
//
// Communication Between ARP and IPv4 modules:
// IPv4 module call the ARP::getMACAddressFor(ipv4Address) method for get the MACAddress
// of next hop. If this method could not resolve an IPv4 address to MAC address, then IPv4
// uses the ARP::startAddressResolution() method.
// ARP emit a completedARPResolution signal, when added/modified an entry in ARP table.
// ARP emit a failedARPResolution signal when an ARP request failed (ARP request sent
// retryCount times and retryTimeout elapsed).
//
// ARP resolution is used over <i>broadcast</i> interfaces only,
// that is, over interfaces that have the <tt>isBroadcast()</tt> flag set in
// <tt>InterfaceEntry</tt> (see ~InterfaceTable). Since routing files
// (<tt>.irt</tt> or <tt>.mrt</tt> files, given as parameter to ~IPv4RoutingTable)
// may modify the default interface configuration, you must take care that
// these files don't contain the word <tt>BROADCAST</tt> e.g. for PPP
// interfaces.
//
simple ARP like IARP
{
    parameters:
        string interfaceTableModule;   // The path to the InterfaceTable module
        string routingTableModule;
        double retryTimeout @unit("s") = default(1s); // number seconds ARP waits between retries to resolve an IPv4 address
        int retryCount = default(3);   // number of times ARP will attempt to resolve an IPv4 address
        double cacheTimeout @unit("s") = default(120s); // number seconds unused entries in the cache will time out
        bool respondToProxyARP = default(true);        // reply to proxy ARP requests (i.e. for IP addresses that this node can route)
        @display("i=block/layer");
        @signal[sentReq](type=long);
        @signal[sentReply](type=long);
        @signal[initiatedARPResolution](type=inet::IARP::Notification);
        @signal[completedARPResolution](type=inet::IARP::Notification);
        @signal[failedARPResolution](type=inet::IARP::Notification);
        @statistic[sentReq](title="ARP request sent"; record=count,vector);
        @statistic[sentReply](title="ARP replies sent"; record=count,vector);
        @statistic[initiatedARPResolution](title="ARP initiated resolutions"; record=count);
        @statistic[completedARPResolution](title="ARP completed resolutions"; record=count);
        @statistic[failedARPResolution](title="ARP failed resolutions"; record=count);
    gates:
        input netwIn @labels(ARPPacket+Ieee802Ctrl); // incoming ARP requests and replies
        output netwOut @labels(ARPPacket+Ieee802Ctrl,IPv4Datagram+Ieee802Ctrl);  // outgoing ARP requests/replies, and datagrams with resolved next hop
}
File: src/inet/networklayer/arp/ipv4/ARP.ned