EthernetEncapsulation

Package: inet.linklayer.ethernet.basic

EthernetEncapsulation

simple module

Performs Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation.

Expected environment:

  • lowerLayerIn, lowerLayerOut gates should be connected to an EthernetCsmaMac
  • upperLayerIn, upperLayerOut gates should be connected to higher layer protocol or application

Functionality:

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
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 lifecycle stop operation finished

stopOperationTimeout double 2s

timeout value for lifecycle stop operation

Properties

Name Value Description
lifecycleSupport
class EthernetEncapsulation
display i=block/layer

Gates

Name Direction Size Description
upperLayerIn input

TODO accepts packets and socket commands with @messageKinds(inet::SocketCommandCode), too

upperLayerOut output

TODO sends packets and socket indications with @messageKinds(inet::SocketStatusInd), too

lowerLayerIn input
lowerLayerOut output

Signals

Name Type Unit
pauseSent long
decapPk cPacket
packetDropped inet::Packet
encapPk cPacket

Statistics

Name Title Source Record Unit Interpolation Mode
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

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
MessageDispatcherinet::MessageDispatcher::handleRegisterProtocolhandleRegisterProtocol
MessageDispatcherinet::MessageDispatcher::handleRegisterServicehandleRegisterService
Ieee8022Llcinet::Ieee8022Llc::handleRegisterServicehandleRegisterService

Called methods (observed)

functioninfocall from
inet::EthernetEncapsulation::handleOperationStagehandleOperationStageScenarioManager
inet::EthernetEncapsulation::handleRegisterAnyProtocolhandleRegisterAnyProtocolMessageDispatcher
inet::EthernetEncapsulation::handleRegisterProtocolhandleRegisterProtocolMessageDispatcher, Ieee8022Llc
inet::EthernetEncapsulation::handleRegisterServicehandleRegisterServiceMessageDispatcher

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
lowerLayerInPacket0MessageDispatcherDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, NetworkProtocolInd?
lowerLayerInPacket0EthernetCsmaMacDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
lowerLayerInPacket0EthernetMacDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
lowerLayerInPacket0Ieee80211PortalDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, Ieee80211ChannelInd, Ieee80211ModeInd
lowerLayerInPacket4EthernetMacDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerInPacket0MacRelayUnitDirectionTag, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
upperLayerInPacket0Ieee8021dRelayDirectionTag, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
upperLayerInPacket0Ieee8022LlcDispatchProtocolReq, Ieee802SapReq, InterfaceReq, MacAddressReq, PacketProtocolTag, SocketReq?
upperLayerInPacket0ArpDispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag
upperLayerInPacket0FloodingDispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag, InterfaceInd?, L3AddressReq?, MacAddressInd?, SocketReq?
upperLayerInPacket0Ipv4DispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, DirectionTag?, DscpInd?, EcnInd?, ErrorRateInd?, HopLimitInd?, Ieee802SapInd?, InterfaceInd?, L3AddressInd?, MacAddressInd?, MulticastReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, TosInd?, TransportProtocolInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
upperLayerInPacket0Ipv6DispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, InterfaceInd?, MacAddressInd?, MulticastReq?, TransportProtocolInd?
upperLayerInPacket0NextHopForwardingDispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, InterfaceInd?, MacAddressInd?, SocketReq?
upperLayerInPacket0AdaptiveProbabilisticBroadcastDispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag, InterfaceInd?, L3AddressReq?, MacAddressInd?, SocketReq?
upperLayerInPacket0ProbabilisticBroadcastDispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag, InterfaceInd?, L3AddressReq?, MacAddressInd?, SocketReq?
upperLayerInPacket0WiseRouteDispatchProtocolInd, DispatchProtocolReq, InterfaceReq, MacAddressReq, PacketProtocolTag, L3AddressReq?, SocketReq?
upperLayerInPacket4Ipv4DispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag

Outgoing messages (observed)

gatemsgkindctrldestModuletags
lowerLayerOutPacket0EthernetFrameClassifierInterfaceReq, MacAddressReq, PacketProtocolTag, DirectionTag?, DispatchProtocolInd?, EcnInd?, EncapsulationProtocolReq?, Ieee802SapReq?, InterfaceInd?, MacAddressInd?, MulticastReq?, NetworkProtocolInd?, TransportProtocolInd?
lowerLayerOutPacket0EthernetQueueInterfaceReq, MacAddressReq, PacketProtocolTag, DirectionTag?, DispatchProtocolInd?, DscpInd?, EcnInd?, EncapsulationProtocolReq?, ErrorRateInd?, HopLimitInd?, Ieee802SapInd?, Ieee802SapReq?, InterfaceInd?, L3AddressInd?, L3AddressReq?, MacAddressInd?, MulticastReq?, NetworkProtocolInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, TosInd?, TransportProtocolInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
lowerLayerOutPacket0Ieee80211PortalDirectionTag, InterfaceReq, MacAddressReq, PacketProtocolTag
lowerLayerOutPacket0RedDropperDispatchProtocolInd, EncapsulationProtocolReq, InterfaceInd, InterfaceReq, MacAddressInd, MacAddressReq, NetworkProtocolInd, PacketProtocolTag
lowerLayerOutPacket0DropTailQueueInterfaceReq, MacAddressReq, PacketProtocolTag, DirectionTag?, Ieee802SapReq?
lowerLayerOutPacket4EthernetQueueDispatchProtocolInd, EncapsulationProtocolReq, InterfaceInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag
upperLayerOutPacket0MacRelayUnitDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, ErrorRateInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
upperLayerOutPacket0Ieee8021dRelayDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, ErrorRateInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
upperLayerOutPacket0Ieee8022LlcDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0ArpDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0FloodingDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0Ipv4DispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, NetworkProtocolInd?
upperLayerOutPacket0Ipv6DispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0NextHopForwardingDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0AdaptiveProbabilisticBroadcastDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0ProbabilisticBroadcastDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket0WiseRouteDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
upperLayerOutPacket4Ipv4DispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag

Packet operations (observed)

chunkTypepacketAction
setBackOffset
EthernetFcsinsertAtBack, popAtBack
EthernetMacHeaderinsertAtFront, popAtFront

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolReqaddTagIfAbsent, removeTagIfPresent
InterfaceIndgetTag
InterfaceReqgetTag
MacAddressIndaddTagIfAbsent
MacAddressReqgetTag
PacketProtocolTagaddTagIfAbsent

Source code

//
// Performs Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation.
//
// Expected environment:
// - lowerLayerIn, lowerLayerOut gates should be connected to an ~EthernetCsmaMac
// - upperLayerIn, upperLayerOut gates should be connected to higher layer
//   protocol or application
//
// Functionality:
// - packets coming from upper layers will be encapsulated in EthernetII frame
//   (~EthernetMacHeader) or Ethernet SNAP frame (~Ieee8022LlcSnapHeader)
//   depending on the useSNAP module parameter,
//   and sent to MAC. The ~EtherType is taken from the ~PacketProtocolTag tag
//   attached to the packet. The source address will be filled in by ~EthernetCsmaMac.
// - also accepts SENDPAUSE command (message kind=IEEE802CTRL_SENDPAUSE) from
//   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 like IEthernetLayer
{
    parameters:
        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 lifecycle stop operation finished
        double stopOperationTimeout @unit(s) = default(2s);    // timeout value for 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