EthernetHost2

Package: inet.tests.ethernet

EthernetHost2

compound module

An example host with one Ethernet interface and an Ethernet traffic generator directly connected to it. This host model does not contain higher layer protocols (IP, TCP). By default is configured to use half-duplex MAC (CSMA/CD).

app : EtherTrafGen

A simple traffic generator for the Ethernet model and the 802.11 model, and generally for any L2...

Source:
app: EtherTrafGen {
    parameters:
        @display("p=200,100");
        interface = "eth";
} interfaceTable : InterfaceTable

Keeps the table of network interfaces.

Source:
interfaceTable: InterfaceTable {
    parameters:
        @display("p=70,200;is=s");
} llc : like IIeee8022Llc

Source:
llc: <default("Ieee8022Llc")> like IIeee8022Llc {
    parameters:
        @display("p=200,200");
} ethernet : like IEthernetLayer

EthernetEncapsulation: Performs Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation.

IEthernetLayer: Module interface for Ethernet protocol layer implementations.

Source:
ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
    @display("p=200,300");
} eth : like IEthernetInterface

EthernetInterface: Represents an Ethernet network interface.

IEthernetInterface: Interface for Ethernet network interfaces.

Source:
eth: <default("EthernetInterface")> like IEthernetInterface {
    parameters:
        @display("p=200,400,row,150;q=txQueue");
}

Usage diagram

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

Used in

Name Type Description
HostsWithBus network (no description)
HostsWithHub network (no description)
HostsWithSwitch network (no description)
TwoHosts network (no description)

Parameters

Name Type Default value Description
csmacdSupport bool true

by default use CSMA/CD

fcsMode string "declared"

Properties

Name Value Description
networkNode
labels node
display i=device/pc2

Gates

Name Direction Size Description
ethg inout

Unassigned submodule parameters

Name Type Default value Description
app.displayStringTextFormat string ""

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

app.destAddress string ""

Destination MAC address, or module path name of destination station; empty means off

app.interfaceTableModule string
app.ssap int -1

Llc ssap to set on outgoing packets

app.dsap int -1

Llc dsap to set on outgoing packets

app.startTime double this.sendInterval

Time of sending the first packet

app.stopTime double -1s

Time of finishing sending, negative values mean forever

app.sendInterval double

Interval between sending bursts

app.numPacketsPerBurst int 1

Number of packets to send per burst (packets within a burst are sent at the same simulation time)

app.packetLength int

Length of packets to send

app.stopOperationExtraTime double -1s

Extra time after lifecycle stop operation finished

app.stopOperationTimeout double 2s

Timeout value for lifecycle stop operation

interfaceTable.displayStringTextFormat string ""

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

interfaceTable.displayAddresses bool false

Whether to display IP addresses on links

eth.bitrate double

Source code

//
// An example host with one Ethernet interface and an Ethernet traffic
// generator directly connected to it. This host model does not contain
// higher layer protocols (IP, TCP). By default is configured to use
// half-duplex MAC (CSMA/CD).
//
module EthernetHost2
{
    parameters:
        bool csmacdSupport = default(true);  // by default use CSMA/CD
        string fcsMode @enum("declared","computed") = default("declared");
        *.interfaceTableModule = default(absPath(".interfaceTable"));
        *.fcsMode = this.fcsMode;
        eth.csmacdSupport = this.csmacdSupport;
        llc.registerProtocol = true;
        @networkNode();
        @labels(node,ethernet-node);
        @display("i=device/pc2");
    gates:
        inout ethg @labels(EtherFrame-conn);
    submodules:
        app: EtherTrafGen {
            parameters:
                @display("p=200,100");
                interface = "eth";
        }
        interfaceTable: InterfaceTable {
            parameters:
                @display("p=70,200;is=s");
        }
        llc: <default("Ieee8022Llc")> like IIeee8022Llc {
            parameters:
                @display("p=200,200");
        }
        ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
            @display("p=200,300");
        }
        eth: <default("EthernetInterface")> like IEthernetInterface {
            parameters:
                @display("p=200,400,row,150;q=txQueue");
        }
    connections:
        app.out --> llc.upperLayerIn;
        app.in <-- llc.upperLayerOut;
        llc.lowerLayerOut --> ethernet.upperLayerIn;
        llc.lowerLayerIn <-- ethernet.upperLayerOut;
        ethernet.lowerLayerOut --> eth.upperLayerIn;
        ethernet.lowerLayerIn <-- eth.upperLayerOut;
        eth.phys <--> { @display("m=s"); } <--> ethg;
}

File: tests/networks/ethernet/EthernetHost2.ned