ExtIpv4TunDevice¶
Package: inet.emulation.networklayer.ipv4
simple module ExtIpv4TunDevice
Provides a bidirectional connection to a real TUN device of the
host computer which is running the simulation. It writes the packets arrived
on lowerLayerIn gate to the specified real TUN device, and sends out packets
arrived from real TAP device on lowerLayerOut gate.
Usage diagram¶
Inheritance diagram¶
Used in compound modules¶
Name |
Type |
Description |
|---|---|---|
compound module |
Provides IPv4 layer functionality for network emulation that connects simulated applications to a real network on the host computer. Uses a real TUN device on the host OS to capture and inject packets at the IP layer, allowing simulated applications to communicate with real-world network endpoints through the host’s networking stack. |
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for all INET simple modules. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“TUN 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 |
||
namespace |
string |
“” |
|
packetNameFormat |
string |
“Ext” |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
ExtIpv4TunDevice |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
lowerLayerIn |
input |
||
lowerLayerOut |
output |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
packetReceived |
|||
packetReceivedFromLower |
|||
packetSent |
|||
packetSentToLower |
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 TUN device of the
// host computer which is running the simulation. It writes the packets arrived
// on `lowerLayerIn` gate to the specified real TUN device, and sends out packets
// arrived from real TAP device on `lowerLayerOut` gate.
//
simple ExtIpv4TunDevice extends SimpleModule
{
parameters:
@class(ExtIpv4TunDevice);
string device;
string namespace = default("");
string packetNameFormat = default("Ext");
displayStringTextFormat = default("TUN device: {device}\nrcv:{numReceived} snt:{numSent}");
@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/networklayer/ipv4/ExtIpv4TunDevice.ned