Package: inet.linklayer.ethernet.basic
EthernetEncapsulation
simple modulePerforms Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation.
Expected environment:
- lowerLayerIn, lowerLayerOut gates should be connected to an ~EthernetCsmaMacPhy
- upperLayerIn, upperLayerOut gates should be connected to a higher layer protocol or application
Functionality:
- packets coming from upper layers will be encapsulated in an EthernetII frame (~EthernetMacHeader) or Ethernet SNAP frame (~Ieee8022LlcSnapHeader) depending on the useSNAP module parameter, and sent to the MAC. The ~EtherType is taken from the ~PacketProtocolTag tag attached to the packet. The source address will be filled in by ~EthernetCsmaMacPhy.
- also accepts SENDPAUSE command (message kind=IEEE802CTRL_SENDPAUSE) from the higher layer: it will send a PAUSE frame, as described in PAUSE frames.
- Ethernet frames arriving from MAC will be decapsulated and sent up to the higher layers. Accepts ~EthernetMacHeader, ~Ieee8022LlcHeader, and ~Ieee8022LlcSnapHeader too.
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Extends
| Name | Type | Description |
|---|---|---|
| SimpleModule | simple module |
Base module for all INET simple modules. |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| displayStringTextFormat | string | "" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| registerProtocol | bool | false |
FIXME //KLUDGE should redesign place of EthernetEncapsulation and LLC modules |
| interfaceTableModule | string |
The path to the InterfaceTable module |
|
| fcsMode | string | "declared" | |
| stopOperationExtraTime | double | -1s |
Extra time after the lifecycle stop operation has finished |
| stopOperationTimeout | double | 2s |
Timeout value for the lifecycle stop operation |
Properties
| Name | Value | Description |
|---|---|---|
| class | EthernetEncapsulation | |
| lifecycleSupport | ||
| display | i=block/layer |
Gates
| Name | Direction | Size | Description |
|---|---|---|---|
| upperLayerIn | input |
TODO accepts packets and socket commands with @messageKinds(SocketCommandCode), too |
|
| upperLayerOut | output |
TODO sends packets and socket indications with @messageKinds(SocketStatusInd), too |
|
| lowerLayerIn | input | ||
| lowerLayerOut | output |
Signals
| Name | Type | Unit | Description |
|---|---|---|---|
| pauseSent | long |
Pause units |
|
| decapPk | cPacket | ||
| packetDropped | inet::Packet | ||
| encapPk | cPacket |
Statistics
| Name | Title | Source | Record | Unit | Interpolation Mode | Description |
|---|---|---|---|---|---|---|
| pauseSent | pause sent | count, sum, vector | ||||
| decapPk | packets decapsulated | decapPk | count, sum(packetBytes), vector(packetBytes) | none | ||
| encapPk | packets encapsulated | encapPk | count, sum(packetBytes), vector(packetBytes) | none |
Source code
// // Performs Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation. // // Expected environment: // - `lowerLayerIn`, `lowerLayerOut` gates should be connected to an ~EthernetCsmaMacPhy // - `upperLayerIn`, `upperLayerOut` gates should be connected to a higher layer // protocol or application // // Functionality: // - packets coming from upper layers will be encapsulated in an `EthernetII` frame // (~EthernetMacHeader) or Ethernet SNAP frame (~Ieee8022LlcSnapHeader) // depending on the `useSNAP` module parameter, // and sent to the MAC. The ~EtherType is taken from the ~PacketProtocolTag tag // attached to the packet. The source address will be filled in by ~EthernetCsmaMacPhy. // - also accepts SENDPAUSE command (message kind=IEEE802CTRL_SENDPAUSE) from // the higher layer: it will send a PAUSE frame, as described in // <a href="ether-pause.html">PAUSE frames</a>. // - Ethernet frames arriving from MAC will be decapsulated and sent up to the // higher layers. Accepts ~EthernetMacHeader, ~Ieee8022LlcHeader, and // ~Ieee8022LlcSnapHeader too. // simple EthernetEncapsulation extends SimpleModule like IEthernetLayer { parameters: @class(EthernetEncapsulation); bool registerProtocol = default(false); //FIXME //KLUDGE should redesign place of EthernetEncapsulation and LLC modules string interfaceTableModule; // The path to the InterfaceTable module string fcsMode @enum("declared","computed") = default("declared"); @lifecycleSupport; double stopOperationExtraTime @unit(s) = default(-1s); // Extra time after the lifecycle stop operation has finished double stopOperationTimeout @unit(s) = default(2s); // Timeout value for the lifecycle stop operation @class(EthernetEncapsulation); @display("i=block/layer"); @signal[encapPk](type=cPacket); @signal[decapPk](type=cPacket); @signal[pauseSent](type=long); // Pause units @signal[packetDropped](type=inet::Packet); @statistic[encapPk](title="packets encapsulated"; source=encapPk; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[decapPk](title="packets decapsulated"; source=decapPk; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[pauseSent](title="pause sent"; record=count,sum,vector); gates: input upperLayerIn; // TODO accepts packets and socket commands with @messageKinds(inet::SocketCommandCode), too output upperLayerOut; // TODO sends packets and socket indications with @messageKinds(inet::SocketStatusInd), too input lowerLayerIn; output lowerLayerOut; }File: src/inet/linklayer/ethernet/basic/EthernetEncapsulation.ned