EthernetHost¶
Package: inet.node.ethernet
compound module EthernetHost
A simplified network device that communicates directly over Ethernet without higher layer protocols like IP or TCP. It provides a basic host model for Ethernet-only simulations.
This module includes Ethernet application client and server components that generate and respond to traffic at the Ethernet level. The host uses IEEE 802.2 LLC (Logical Link Control) for data link layer functionality and can be configured to use CSMA/CD (Carrier Sense Multiple Access with Collision Detection) for media access control in half-duplex mode.
See also: EthernetSwitch, EthernetHub, StandardHost
Usage diagram¶
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
hasStatus |
bool |
false |
|
csmacdSupport |
bool |
true |
By default, use CSMA/CD |
fcsMode |
string |
“declared” |
Properties¶
Name |
Value |
Description |
|---|---|---|
display |
i=device/pc2 |
|
labels |
node,ethernet-node |
|
networkNode |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
ethg |
inout |
Unassigned submodule parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
status.displayStringTextFormat |
string |
“{stateStr}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
status.initialStatus |
string |
“UP” |
Initial status of the network node |
interfaceTable.displayStringTextFormat |
string |
“{numInterfaces} interfaces” |
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 |
cli.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
cli.interfaceTableModule |
string |
||
cli.destAddress |
string |
“” |
Destination MAC address, or module path name of destination station; empty means off |
cli.startTime |
double |
this.sendInterval |
Time of sending the first request |
cli.stopTime |
double |
-1s |
Time of finishing sending, negative values mean forever |
cli.localSAP |
int |
0xf0 |
Local service access point |
cli.remoteSAP |
int |
0xf1 |
Remote service access point |
cli.sendInterval |
double |
uniform(0s,1s) |
Interval between sending requests |
cli.reqLength |
int |
100B |
Length of request packets |
cli.respLength |
int |
1KiB |
Length of response packets |
cli.stopOperationExtraTime |
double |
-1s |
Extra time after lifecycle stop operation finished |
cli.stopOperationTimeout |
double |
2s |
Timeout value for lifecycle stop operation |
srv.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
srv.localSAP |
int |
0xf1 |
|
srv.stopOperationExtraTime |
double |
-1s |
Extra time after lifecycle stop operation is finished |
srv.stopOperationTimeout |
double |
2s |
Timeout value for lifecycle stop operation |
dp.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 |
dp.interfaceTableModule |
string |
Module path to the InterfaceTable module |
|
dp.forwardServiceRegistration |
bool |
true |
|
dp.forwardProtocolRegistration |
bool |
true |
|
dp.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 |
dp.serviceMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
dp.protocolMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
llc.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
llc.registerProtocol |
bool |
false |
FIXME //KLUDGE should redesign the placement of EthernetEncapsulation and LLC modules |
encap.displayStringTextFormat |
string |
“passed up: {totalFromMAC}\nsent: {totalFromHigherLayer}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
encap.interfaceTableModule |
string |
The path to the InterfaceTable module |
|
encap.fcsMode |
string |
“declared” |
|
encap.stopOperationExtraTime |
double |
-1s |
Extra time after the lifecycle stop operation has finished |
encap.stopOperationTimeout |
double |
2s |
Timeout value for the lifecycle stop operation |
li.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 |
li.interfaceTableModule |
string |
Module path to the InterfaceTable module |
|
li.forwardServiceRegistration |
bool |
true |
|
li.forwardProtocolRegistration |
bool |
true |
|
li.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 |
li.serviceMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
li.protocolMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
eth.pcapRecorder.displayStringTextFormat |
string |
“rec: %n pks” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.pcapRecorder.verbose |
bool |
true |
Whether to log packets on the module output |
eth.pcapRecorder.recordEmptyPackets |
bool |
true |
Specifies if zero length packets are recorded or not |
eth.pcapRecorder.enableConvertingPackets |
bool |
true |
Specifies if converting packets to link type is allowed or not |
eth.pcapRecorder.pcapFile |
string |
“” |
The PCAP file to be written, suggested value: pcapFile = “${resultdir}/${configname}-#${runnumber}” + fullpath() + “.pcap” |
eth.pcapRecorder.fileFormat |
string |
“pcapng” |
|
eth.pcapRecorder.snaplen |
int |
65535 |
Maximum number of bytes to record per packet |
eth.pcapRecorder.timePrecision |
int |
6 |
Time precision in recorded file. pcap supports only 6 (usec) or 9 (nanosec), pcapng supports more values (see ‘if_tsresol’ option in pcapng file format). |
eth.pcapRecorder.dumpBadFrames |
bool |
true |
Enable dump of frames with hasBitError |
eth.pcapRecorder.sendingSignalNames |
string |
“transmissionEnded” |
Space-separated list of outbound packet signals to subscribe to |
eth.pcapRecorder.receivingSignalNames |
string |
“receptionEnded” |
Space-separated list of inbound packet signals to subscribe to |
eth.pcapRecorder.dumpProtocols |
string |
“ethernetmac ppp ieee80211mac” |
Space-separated list of protocol names as defined in the Protocol class |
eth.pcapRecorder.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.pcapRecorder.helpers |
string |
“” |
Usable PcapRecorder::IHelper helpers for accept packettype and store/convert packet as specified linktype |
eth.pcapRecorder.alwaysFlush |
bool |
false |
Flush the pcapFile after each write to ensure that all packets are captured in case of a crash |
Source code¶
//
// A simplified network device that communicates directly over Ethernet without
// higher layer protocols like IP or TCP. It provides a basic host model for
// Ethernet-only simulations.
//
// This module includes Ethernet application client and server components that generate
// and respond to traffic at the Ethernet level. The host uses IEEE 802.2 LLC (Logical
// Link Control) for data link layer functionality and can be configured to use
// CSMA/CD (Carrier Sense Multiple Access with Collision Detection) for media access
// control in half-duplex mode.
//
// @see ~EthernetSwitch, ~EthernetHub, ~StandardHost
//
module EthernetHost
{
parameters:
bool hasStatus = default(false);
bool csmacdSupport = default(true); // By default, use CSMA/CD
string fcsMode @enum("declared","computed") = default("declared");
@networkNode();
@labels(node,ethernet-node);
@display("i=device/pc2");
eth.csmacdSupport = this.csmacdSupport;
*.interfaceTableModule = default(absPath(".interfaceTable"));
*.fcsMode = this.fcsMode;
eth.encap.typename = "";
llc.registerProtocol = true;
gates:
inout ethg @labels(EtherFrame-conn);
submodules:
status: NodeStatus if hasStatus {
@display("p=100,100;is=s");
}
interfaceTable: InterfaceTable {
parameters:
@display("p=100,240;is=s");
}
cli: EtherAppClient {
parameters:
interface = "eth";
@display("p=350,100");
}
srv: EtherAppServer {
parameters:
@display("p=550,100");
}
dp: MessageDispatcher {
parameters:
@display("p=450,150;b=500,5,,,,1");
}
llc: <default("Ieee8022Llc")> like IIeee8022Llc {
parameters:
@display("p=450,200");
}
encap: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
parameters:
registerProtocol = true;
@display("p=350,300");
}
ethernet: <default("")> like IEthernetLayer if typename != "" {
@display("p=550,300");
}
li: MessageDispatcher {
parameters:
@display("p=450,350;b=500,5");
}
eth: <default("EthernetInterface")> like IEthernetInterface {
parameters:
@display("p=350,400,row,150;q=txQueue");
}
connections:
cli.out --> dp.in++;
dp.out++ --> cli.in;
srv.out --> dp.in++;
dp.out++ --> srv.in;
dp.out++ --> llc.upperLayerIn;
llc.upperLayerOut --> dp.in++;
llc.lowerLayerOut --> encap.upperLayerIn if exists(llc) && exists(encap);
encap.upperLayerOut --> llc.lowerLayerIn if exists(llc) && exists(encap);
encap.lowerLayerOut --> li.in++ if exists(encap);
li.out++ --> encap.lowerLayerIn if exists(encap);
llc.lowerLayerOut --> ethernet.upperLayerIn if exists(llc) && exists(ethernet);
ethernet.upperLayerOut --> llc.lowerLayerIn if exists(llc) && exists(ethernet);
ethernet.lowerLayerOut --> li.in++ if exists(ethernet);
li.out++ --> ethernet.lowerLayerIn if exists(ethernet);
li.out++ --> eth.upperLayerIn;
eth.upperLayerOut --> li.in++;
eth.phys <--> { @display("m=s"); } <--> ethg;
}