ExtIpv4Socket

Package: inet.emulation.networklayer.ipv4

simple module ExtIpv4Socket

Provides a bidirectional connection to an IPv4 socket of the host computer which is running the simulation. It writes the packets arrived on upperLayerIn gate to the specified real socket, and sends out packets arrived from the real socket on upperLayerOut gate.

inet.emulation.networklayer.ipv4.ExtIpv4SocketExtIpv4Socketsimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

ExtLowerIpv4

compound module

Provides IPv4 layer functionality for network emulation that connects the simulation to a real network on the host computer. Sends packets from the simulation to the real network and receives packets from the real network into the simulation using raw sockets. Uses Ipv4Encap for packet encapsulation and ExtIpv4Socket for the connection to the host’s networking stack.

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“snt:{numSent} rcv:{numReceived}”

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

namespace

string

“”

packetName

string

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

Properties

Name

Value

Description

class

ExtIpv4Socket

display

i=block/rxtx

Gates

Name

Direction

Size

Description

upperLayerIn

input

upperLayerOut

output

Signals

Name

Type

Unit

Description

packetReceived

Packet

packetReceivedFromUpper

Packet

packetSent

Packet

packetSentToUpper

Packet

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

packetReceived

packets received

packetReceived

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

none

packetReceivedFromUpper

packets received from higher layer

packetReceivedFromUpper

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

none

packetSent

packets sent

packetSent

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

none

packetSentFromUpper

packets sent to higher layer

packetSentToUpper

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

none

Source code

//
// Provides a bidirectional connection to an IPv4 socket of the host
// computer which is running the simulation. It writes the packets arrived on
// `upperLayerIn` gate to the specified real socket, and sends out packets arrived
// from the real socket on `upperLayerOut` gate.
//
simple ExtIpv4Socket extends SimpleModule
{
    parameters:
        @class(ExtIpv4Socket);
        string namespace = default("");
        string packetName = default("Ext-%p-%t-%n");
        displayStringTextFormat = default("snt:{numSent} rcv:{numReceived}");
        @display("i=block/rxtx");
        @signal[packetSentToUpper](type=Packet);
        @signal[packetReceivedFromUpper](type=Packet);
        @signal[packetSent](type=Packet);
        @signal[packetReceived](type=Packet);
        @statistic[packetSentFromUpper](title="packets sent to higher layer"; source=packetSentToUpper; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetReceivedFromUpper](title="packets received from higher layer"; source=packetReceivedFromUpper; 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 upperLayerIn;
        output upperLayerOut @loose;
}

File: src/inet/emulation/networklayer/ipv4/ExtIpv4Socket.ned