ExtEthernetTapDevice

Package: inet.emulation.linklayer.ethernet

simple module ExtEthernetTapDevice

Provides a bidirectional connection to a real TAP device of the host computer which is running the simulation. It writes the packets arrived on lowerLayerIn gate to the specified real TAP device, and sends out packets arrived from the real TAP device on lowerLayerOut gate.

inet.emulation.linklayer.ethernet.ExtEthernetTapDeviceExtEthernetTapDevicesimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

ExtUpperEthernetInterface

compound module

Provides an Ethernet network interface suitable for emulation. The upper part of the network interface is realized in the real world using a real TAP device of the host computer which is running the simulation.

ExtUpperIeee80211Interface

compound module

Provides an IEEE 802.11 network interface suitable for emulation. The upper part of the network interface is realized in the real world using a real TAP device of the host computer which is running the simulation.

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“TAP device: {device}\nrcv:{numReceived} snt:{numSent}”

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

device

string

Name of the existing real tap interface

namespace

string

“”

packetNameFormat

string

“Ext-%p-%t-%n”

Properties

Name

Value

Description

class

ExtEthernetTapDevice

display

i=block/rxtx

Gates

Name

Direction

Size

Description

lowerLayerIn

input

lowerLayerOut

output

Signals

Name

Type

Unit

Description

packetReceived

Packet

packetReceivedFromLower

Packet

packetSent

Packet

packetSentToLower

Packet

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

packetReceived

packets received

packetReceived

count,”sum(packetBytes)”,”vector(packetBytes)”

none

packetReceivedFromLower

packets received from higher layer

packetReceivedFromLower

count,”sum(packetBytes)”,”vector(packetBytes)”

none

packetSent

packets sent

packetSent

count,”sum(packetBytes)”,”vector(packetBytes)”

none

packetSentFromLower

packets sent to higher layer

packetSentToLower

count,”sum(packetBytes)”,”vector(packetBytes)”

none

Source code

//
// Provides a bidirectional connection to a real TAP device of the
// host computer which is running the simulation. It writes the packets arrived
// on `lowerLayerIn` gate to the specified real TAP device, and sends out packets
// arrived from the real TAP device on `lowerLayerOut` gate.
//
simple ExtEthernetTapDevice extends SimpleModule
{
    parameters:
        @class(ExtEthernetTapDevice);
        string device; // Name of the existing real tap interface
        string namespace = default("");
        string packetNameFormat = default("Ext-%p-%t-%n");
        displayStringTextFormat = default("TAP device: {device}\nrcv:{numReceived} snt:{numSent}");
        @display("i=block/rxtx");
        @signal[packetSentToLower](type=Packet);
        @signal[packetReceivedFromLower](type=Packet);
        @signal[packetSent](type=Packet);
        @signal[packetReceived](type=Packet);
        @statistic[packetSentFromLower](title="packets sent to higher layer"; source=packetSentToLower; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetReceivedFromLower](title="packets received from higher layer"; source=packetReceivedFromLower; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
    gates:
        input lowerLayerIn @labels(EtherFrame);
        output lowerLayerOut @labels(EtherFrame);
}

File: src/inet/emulation/linklayer/ethernet/ExtEthernetTapDevice.ned