Ipv4NetworkLayer

Package: inet.networklayer.ipv4

compound module Ipv4NetworkLayer

Network layer of an IPv4 node.

Ipv4NetworkLayertransportIn --> up.in++transportOut --> up.out++up.out++ --> igmp.routerInup.in++ --> igmp.routerOutup.out++ --> mp.in++up.in++ --> mp.out++up.out++ --> icmp.transportInup.in++ --> icmp.transportOutigmp.ipOut --> mp.in++igmp.ipIn --> mp.out++icmp.ipOut --> mp.in++icmp.ipIn --> mp.out++mp.out++ --> ip.transportInmp.in++ --> ip.transportOutarp.ifOut --> lp.in++arp.ifIn --> lp.out++ip.queueOut --> lp.in++ip.queueIn --> lp.out++lp.out++ --> ifOutlp.in++ --> ifInconfigurator: inet.networklayer.configurator.ipv4.Ipv4NodeConfigurator (like IIpv4NodeConfigurator) Ipv4NodeConfigurator: Configures the containing network node using information provided by the network's global configu... Source: configurator: <default("Ipv4NodeConfigurator")> like IIpv4NodeConfigurator if typename != "" { parameters: @display("p=100,100;is=s"); }configuratorroutingTable: inet.networklayer.ipv4.Ipv4RoutingTable Stores the routing table. Source: routingTable: Ipv4RoutingTable { parameters: @display("p=100,200;is=s"); }routingTablenatTable: inet.networklayer.ipv4.Ipv4NatTable Stores the network address translation table. Source: natTable: Ipv4NatTable { parameters: @display("p=100,300;is=s"); }natTableup: inet.common.MessageDispatcher Facilitates the interconnection of applications, protocols, and network interfaces, dispatching m... Source: up: MessageDispatcher { parameters: @display("p=550,100;b=600,5"); }upigmp: inet.networklayer.ipv4.Igmpv2 (like IIgmp) Igmpv2: Implementation of IGMPv2 protocol. IIgmp: Module interface for IGMP modules. Source: igmp: <default("Igmpv2")> like IIgmp { parameters: @display("p=400,200"); }igmpicmp: inet.networklayer.ipv4.Icmp ICMP implementation. Source: icmp: Icmp { parameters: @display("p=700,200"); }icmpmp: inet.common.MessageDispatcher Facilitates the interconnection of applications, protocols, and network interfaces, dispatching m... Source: mp: MessageDispatcher { parameters: @display("p=550,300;b=600,5"); }mpip: inet.networklayer.ipv4.Ipv4 (like IIpv4) Ipv4: Implements the IPv4 protocol. IIpv4: Module interface for IPv4 protocol implementations. Source: ip: <default("Ipv4")> like IIpv4 { parameters: @display("p=700,400;q=queue"); }#iparp: inet.networklayer.arp.ipv4.Arp (like IArp) Arp: Implements the Address Resolution Protocol for IPv4 and IEEE 802 6-byte MAC addresses. IArp: Interface for Address Resolution Protocol (ARP) implementations. Source: arp: <default("Arp")> like IArp { parameters: @display("p=400,400;q=pendingQueue"); }#arpipsec: inet.networklayer.ipsec.IPsec Implements basic IPsec (RFC 4301) functionality. Source: ipsec: IPsec if hasIpsec { @display("p=164,162"); }ipsecspd: inet.networklayer.ipsec.SecurityPolicyDatabase Represents the IPsec Security Policy Database (SPD). Source: spd: SecurityPolicyDatabase if hasIpsec { @display("p=250,120"); }spdsad: inet.networklayer.ipsec.SecurityAssociationDatabase Represents the IPsec Security Association Database (SAD). Source: sad: SecurityAssociationDatabase if hasIpsec { @display("p=250,162"); }sadlp: inet.common.MessageDispatcher Facilitates the interconnection of applications, protocols, and network interfaces, dispatching m... Source: lp: MessageDispatcher { parameters: @display("p=550,500;b=600,5"); }lp

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

NetworkLayerNodeBase

compound module

An extension of the link layer node base with network layer functionality. Provides support for multiple network protocols, including IPv4 and IPv6.

Extends

Name

Type

Description

Module

compound module

Base module for all INET compound modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“%i”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

forwarding

bool

false

multicastForwarding

bool

false

hasIpsec

bool

false

interfaceTableModule

string

Properties

Name

Value

Description

class

::inet::Ipv4NetworkLayer

display

i=block/fork

Gates

Name

Direction

Size

Description

ifIn

input

ifOut

output

transportIn

input

transportOut

output

Unassigned submodule parameters

Name

Type

Default value

Description

configurator.displayStringTextFormat

string

“”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

configurator.interfaceTableModule

string

The path to the InterfaceTable module

configurator.routingTableModule

string

configurator.networkConfiguratorModule

string

“configurator”

The absolute path to the Ipv4NetworkConfigurator; use “” if there is no configurator

configurator.configureRoutingTable

bool

true

Add routing entries to the routing table (uses the configurator module)

routingTable.displayStringTextFormat

string

“{routingTableStatusText}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

routingTable.interfaceTableModule

string

The path to the InterfaceTable module

routingTable.routerId

string

“auto”

For routers, the router id using IPv4 address dotted

routingTable.netmaskRoutes

string

“*”

Maintain netmask routes for interfaces

routingTable.forwarding

bool

true

Turns IP forwarding on/off

routingTable.multicastForwarding

bool

false

Turns multicast forwarding on/off

routingTable.useAdminDist

bool

false

Use Cisco-like administrative distances

routingTable.routingFile

string

“”

Routing table file name

natTable.displayStringTextFormat

string

“{numNatEntries} entries”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

natTable.networkProtocolModule

string

“^.ip”

natTable.config

xml

xml(“<config></config>”)

XML configuration parameters for network address translation

up.displayStringTextFormat

string

“processed {numProcessedPackets} pk ({processedTotalLength})”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

up.interfaceTableModule

string

Module path to the InterfaceTable module

up.forwardServiceRegistration

bool

true

up.forwardProtocolRegistration

bool

true

up.interfaceMapping

object

{}

Maps network interface names to connected submodule names (e.g. {“eth0”: “bridging”}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default

up.serviceMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

up.protocolMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

igmp.displayStringTextFormat

string

“”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

igmp.interfaceTableModule

string

The path to the InterfaceTable module

igmp.routingTableModule

string

igmp.checksumMode

string

“declared”

igmp.enabled

bool

true

igmp.robustnessVariable

int

2

IGMP is robust to (robustnessVariable-1) packet loss

igmp.queryInterval

double

125s

igmp.queryResponseInterval

double

10s

igmp.groupMembershipInterval

double

(robustnessVariable * queryInterval) + queryResponseInterval

igmp.otherQuerierPresentInterval

double

(robustnessVariable * queryInterval) + (queryResponseInterval / 2)

igmp.startupQueryInterval

double

queryInterval / 4

igmp.startupQueryCount

int

robustnessVariable

igmp.lastMemberQueryInterval

double

1s

igmp.lastMemberQueryCount

int

robustnessVariable

igmp.unsolicitedReportInterval

double

10s

icmp.displayStringTextFormat

string

“”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

icmp.interfaceTableModule

string

The path to the InterfaceTable module

icmp.routingTableModule

string

icmp.checksumMode

string

“declared”

icmp.quoteLength

int

8B

Number of bytes from original packet to quote in ICMP reply

mp.displayStringTextFormat

string

“processed {numProcessedPackets} pk ({processedTotalLength})”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

mp.interfaceTableModule

string

Module path to the InterfaceTable module

mp.forwardServiceRegistration

bool

true

mp.forwardProtocolRegistration

bool

true

mp.interfaceMapping

object

{}

Maps network interface names to connected submodule names (e.g. {“eth0”: “bridging”}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default

mp.serviceMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

mp.protocolMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

ip.displayStringTextFormat

string

“{ipv4StatusText}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ip.interfaceTableModule

string

The path to the InterfaceTable module

ip.routingTableModule

string

ip.arpModule

string

ip.icmpModule

string

ip.checksumMode

string

“declared”

ip.timeToLive

int

32

ip.multicastTimeToLive

int

32

ip.fragmentTimeout

double

60s

ip.limitedBroadcast

bool

false

Send out limited broadcast packets coming from the higher layer

ip.directBroadcastInterfaces

string

“”

List of interfaces where direct broadcast is enabled (by default direct broadcast is disabled on all interfaces)

ip.enableLocalOutMulticastRouting

bool

false

Enable using the multicast routing table for determining outgoing interfaces for local out packets

ip.enableTimestampOption

bool

false

When enabled, IP inserts a timestamp option into the IP header

ip.maxLifetime

double

-1s

Packets older than the limit are discarded

arp.displayStringTextFormat

string

“size:{arpCacheSize} sent:{numRequestsSent}\nrepl:{numRepliesSent} fail:{numFailedResolutions}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

arp.interfaceTableModule

string

The path to the InterfaceTable module

arp.routingTableModule

string

arp.retryTimeout

double

1s

Number of seconds ARP waits between retries to resolve an IPv4 address

arp.retryCount

int

3

Number of times ARP will attempt to resolve an IPv4 address

arp.cacheTimeout

double

120s

Number of seconds unused entries in the cache will time out

arp.proxyArpInterfaces

string

“*”

List of interfaces that proxy ARP is enabled on (all interfaces by default)

ipsec.displayStringTextFormat

string

“IN: ACCEPT: {inAccept} DROP: {inDrop} BYPASS: {inBypass}\n OUT: PROTECT: {outProtect} DROP: {outDrop} BYPASS: {outBypass}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipsec.networkProtocolModule

string

“^.ip”

ipsec.networkProtocol

string

“ipv4”

address family this instance protects (set to “ipv6” in Ipv6NetworkLayer)

ipsec.interfaceTableModule

string

ipsec.spdModule

string

“^.spd”

ipsec.sadModule

string

“^.sad”

ipsec.spdConfig

xml

ipsec.defaultProtection

string

“”

If not “”: value to use where <Protection> element is absent from the configuration

ipsec.defaultEspMode

string

“”

If not “”: value to use where <EspMode> element is absent from the configuration

ipsec.defaultEncryptionAlg

string

“”

If not “”: value to use where <EncryptionAlg> element is absent from the configuration

ipsec.defaultAuthenticationAlg

string

“”

If not “”: value to use where <defaultAuthenticationAlg> element is absent from the configuration

ipsec.defaultMaxTfcPadLength

int

0

Value to use where <MaxTfcPadLength> element is absent from the configuration

ipsec.ahProtectOutDelay

double

0.0s

ipsec.ahProtectInDelay

double

0.0s

ipsec.espProtectOutDelay

double

0.0s

ipsec.espProtectInDelay

double

0.0s

spd.displayStringTextFormat

string

“entries: {numEntries}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

sad.displayStringTextFormat

string

“entries: {numEntries}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

lp.displayStringTextFormat

string

“processed {numProcessedPackets} pk ({processedTotalLength})”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

lp.interfaceTableModule

string

Module path to the InterfaceTable module

lp.forwardServiceRegistration

bool

true

lp.forwardProtocolRegistration

bool

true

lp.interfaceMapping

object

{}

Maps network interface names to connected submodule names (e.g. {“eth0”: “bridging”}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default

lp.serviceMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

lp.protocolMapping

object

{}

Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

Source code

//
// Network layer of an IPv4 node.
//
//
module Ipv4NetworkLayer extends Module like INetworkLayer
{
    parameters:
        bool forwarding = default(false);
        bool multicastForwarding = default(false);
        bool hasIpsec = default(false);
        string interfaceTableModule;
        displayStringTextFormat = default("%i");
        *.forwarding = this.forwarding;
        *.multicastForwarding = this.multicastForwarding;
        *.interfaceTableModule = default(absPath(this.interfaceTableModule));
        *.routingTableModule = default(absPath(".routingTable"));
        *.arpModule = default(absPath(".arp"));
        *.icmpModule = default(absPath(".icmp"));
        @class(::inet::Ipv4NetworkLayer);
        @display("i=block/fork");

    gates:
        input ifIn @labels(INetworkHeader);
        output ifOut @labels(INetworkHeader);
        input transportIn @labels(Ipv4ControlInfo/down);
        output transportOut @labels(Ipv4ControlInfo/up);

    submodules:
        configurator: <default("Ipv4NodeConfigurator")> like IIpv4NodeConfigurator if typename != "" {
            parameters:
                @display("p=100,100;is=s");
        }
        routingTable: Ipv4RoutingTable {
            parameters:
                @display("p=100,200;is=s");
        }
        natTable: Ipv4NatTable {
            parameters:
                @display("p=100,300;is=s");
        }
        up: MessageDispatcher {
            parameters:
                @display("p=550,100;b=600,5");
        }
        igmp: <default("Igmpv2")> like IIgmp {
            parameters:
                @display("p=400,200");
        }
        icmp: Icmp {
            parameters:
                @display("p=700,200");
        }
        mp: MessageDispatcher {
            parameters:
                @display("p=550,300;b=600,5");
        }
        ip: <default("Ipv4")> like IIpv4 {
            parameters:
                @display("p=700,400;q=queue");
        }
        arp: <default("Arp")> like IArp {
            parameters:
                @display("p=400,400;q=pendingQueue");
        }
        ipsec: IPsec if hasIpsec {
            @display("p=164,162");
        }
        spd: SecurityPolicyDatabase if hasIpsec {
            @display("p=250,120");
        }
        sad: SecurityAssociationDatabase if hasIpsec {
            @display("p=250,162");
        }
        lp: MessageDispatcher {
            parameters:
                @display("p=550,500;b=600,5");
        }

    connections allowunconnected:
        transportIn --> { @display("m=n"); } --> up.in++;
        transportOut <-- { @display("m=n"); } <-- up.out++;

        up.out++ --> igmp.routerIn;
        up.in++ <-- igmp.routerOut;

        up.out++ --> mp.in++;
        up.in++ <-- mp.out++;

        up.out++ --> icmp.transportIn;
        up.in++ <-- icmp.transportOut;

        igmp.ipOut --> mp.in++;
        igmp.ipIn <-- mp.out++;

        icmp.ipOut --> mp.in++;
        icmp.ipIn <-- mp.out++;

        mp.out++ --> ip.transportIn;
        mp.in++ <-- ip.transportOut;

        arp.ifOut --> lp.in++;
        arp.ifIn <-- lp.out++;

        ip.queueOut --> lp.in++;
        ip.queueIn <-- lp.out++;

        lp.out++ --> { @display("m=s"); } --> ifOut;
        lp.in++ <-- { @display("m=s"); } <-- ifIn;
}

File: src/inet/networklayer/ipv4/Ipv4NetworkLayer.ned