IPv4NetworkLayer

Package: inet.networklayer.ipv4

IPv4NetworkLayer

compound module

Network layer of an IPv4 node.

Interfaces to transport layer: TCP, UDP, echo/ping, RSVP

configurator : IPv4NodeConfigurator

This module has one instance per network node, and it acts like a bridge between the node and the...

Source:
configurator: IPv4NodeConfigurator {
    @display("p=39,158");
} ip : IPv4

Implements the IPv4 protocol.

Source:
ip: IPv4 {
    parameters:
        useProxyARP = true; // as routes with unspecified next-hop addr are quite common
        @display("p=85,95;q=queue");
    gates:
        queueIn[sizeof(parent.ifIn)];
        queueOut[sizeof(parent.ifOut)];
} arp : like IARP

IARP: TODO

Source:
arp: <arpType> like IARP {
    parameters:
        @display("p=165,120;q=pendingQueue;is=s");
} icmp : ICMP

ICMP implementation

Source:
icmp: ICMP {
    parameters:
        @display("p=165,70");
} igmp : like IIGMP

IIGMP: Module interface for IGMP modules.

Source:
igmp: <igmpType> like IIGMP {
    parameters:
        @display("p=39,33");
} errorHandling : ErrorHandling

Handles error notifications that arrive from other protocol modules.

Source:
errorHandling: ErrorHandling {
    parameters:
        @display("p=239,70");
} ipsec : IPsec

Implements basic IPsec (RFC 4301) functionality.

Source:
ipsec: IPsec if hasIpsec {
    @display("p=164,162");
} spd : SecurityPolicyDatabase

Represents the IPsec Security Policy Database (SPD).

Source:
spd: SecurityPolicyDatabase if hasIpsec {
    @display("p=250,120");
} sad : SecurityAssociationDatabase

Represents the IPsec Security Association Database (SAD).

Source:
sad: SecurityAssociationDatabase if hasIpsec {
    @display("p=250,162");
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

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

Used in compound modules

Name Type Description
LDP_LSR compound module

An LDP-capable router.

RSVP_LSR compound module

An RSVP-TE capable router.

Parameters

Name Type Default value Description
proxyARP bool true
hasIpsec bool false
igmpType string "IGMPv2"
arpType string "ARP"
interfaceTableModule string
routingTableModule string

Properties

Name Value Description
display i=block/fork

Gates

Name Direction Size Description
ifIn [ ] input
ifOut [ ] output
transportIn [ ] input
transportOut [ ] output
pingIn [ ] input
pingOut [ ] output
igmpIn input
igmpOut output

Unassigned submodule parameters

Name Type Default value Description
configurator.interfaceTableModule string

The path to the InterfaceTable module

configurator.networkConfiguratorModule string "configurator"

TODO: eventually rename to networkConfigurator

configurator.configureRoutingTable bool true

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

ip.interfaceTableModule string

The path to the InterfaceTable module

ip.routingTableModule string
ip.arpModule string
ip.icmpModule string
ip.procDelay double 0s
ip.timeToLive int 32
ip.multicastTimeToLive int 32
ip.fragmentTimeout double 60s
ip.forceBroadcast bool false
icmp.interfaceTableModule string

The path to the InterfaceTable module

icmp.routingTableModule string
ipsec.networkProtocolModule string "^.ip"
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

Source code

//
// Network layer of an IPv4 node.
//
// Interfaces to transport layer: TCP, UDP, echo/ping, RSVP
//
module IPv4NetworkLayer like INetworkLayer
{
    parameters:
        bool proxyARP = default(true);
        bool hasIpsec = default(false);
        string igmpType = default("IGMPv2");
        string arpType = default("ARP");
        string interfaceTableModule;
        string routingTableModule;
        *.interfaceTableModule = default(absPath(this.interfaceTableModule));
        *.routingTableModule = default(absPath(this.routingTableModule));
        *.arpModule = default(absPath(".arp"));
        *.icmpModule = default(absPath(".icmp"));
        arp.respondToProxyARP = this.proxyARP;
        @display("i=block/fork");
    gates:
        input ifIn[] @labels(INetworkDatagram);
        output ifOut[] @labels(INetworkDatagram);
        input transportIn[] @labels(IPv4ControlInfo/down);
        output transportOut[] @labels(IPv4ControlInfo/up);
        input pingIn[] @labels(PingPayload/down);
        output pingOut[] @labels(PingPayload/up);
        input igmpIn;
        output igmpOut;

    submodules:
        configurator: IPv4NodeConfigurator {
            @display("p=39,158");
        }
        ip: IPv4 {
            parameters:
                useProxyARP = true; // as routes with unspecified next-hop addr are quite common
                @display("p=85,95;q=queue");
            gates:
                queueIn[sizeof(parent.ifIn)];
                queueOut[sizeof(parent.ifOut)];
        }
        arp: <arpType> like IARP {
            parameters:
                @display("p=165,120;q=pendingQueue;is=s");
        }
        icmp: ICMP {
            parameters:
                @display("p=165,70");
        }
        igmp: <igmpType> like IIGMP {
            parameters:
                @display("p=39,33");
        }
        errorHandling: ErrorHandling {
            parameters:
                @display("p=239,70");
        }

        ipsec: IPsec if hasIpsec {
            @display("p=164,162");
        }
        spd: SecurityPolicyDatabase if hasIpsec {
            @display("p=250,120");
        }
        sad: SecurityAssociationDatabase if hasIpsec {
            @display("p=250,162");
        }
    connections allowunconnected:
        for i=0..sizeof(transportIn)-1 {
            transportIn[i] --> { @display("m=n"); } --> ip.transportIn++;
        }
        for i=0..sizeof(transportOut)-1 {
            ip.transportOut++ --> { @display("m=n"); } --> transportOut[i];
        }

        ip.transportOut++ --> icmp.localIn;
        ip.transportIn++ <-- icmp.sendOut;

        ip.transportOut++ --> igmp.ipIn;
        ip.transportIn++ <-- igmp.ipOut;

        for i=0..sizeof(pingOut)-1 {
            icmp.pingOut++ --> { @display("m=n"); } --> pingOut[i];
        }
        for i=0..sizeof(pingIn)-1 {
            icmp.pingIn++ <-- { @display("m=n"); } <-- pingIn[i];
        }

        icmp.errorOut --> errorHandling.in;

        ip.arpOut --> arp.netwIn;
        ip.arpIn <-- arp.netwOut;

        igmp.routerOut --> igmpOut;
        igmp.routerIn <-- igmpIn;

        for i=0..sizeof(ifIn)-1 {
            ip.queueIn[i] <-- { @display("m=s"); } <-- ifIn[i];
        }
        for i=0..sizeof(ifOut)-1 {
            ip.queueOut[i] --> { @display("m=s"); } --> ifOut[i];
        }
}

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