SimpleNetworkLayer

Package: inet.networklayer.common

compound module SimpleNetworkLayer

Provides a simple network layer.

Usage diagram

Inheritance diagram

Parameters

Name

Type

Default value

Description

interfaceTableModule

string

Properties

Name

Value

Description

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

echo.displayStringTextFormat

string

“”

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

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

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

//
// Provides a simple network layer.
//
module SimpleNetworkLayer like INetworkLayer
{
    parameters:
        string interfaceTableModule;
        *.interfaceTableModule = default(absPath(this.interfaceTableModule));
        @display("i=block/fork");

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

    submodules:
        echo: EchoProtocol {
            parameters:
                @display("p=450,100");
        }
        up: MessageDispatcher {
            parameters:
                @display("p=300,200;b=480,5");
        }
        arp: <default("")> like IArp if typename != "" {
            parameters:
                @display("p=150,300;q=pendingQueue");
        }
        np: <> like INetworkProtocol {
            parameters:
                @display("p=300,300;q=queue");
        }
        lp: MessageDispatcher {
            parameters:
                @display("p=300,400;b=480,5");
        }

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

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

        up.out++ --> echo.ipIn;
        up.in++ <-- echo.ipOut;

        lp.out++ --> arp.ifIn if exists(arp);
        lp.in++ <-- arp.ifOut if exists(arp);

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

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

File: src/inet/networklayer/common/SimpleNetworkLayer.ned