Simple Module IdealMac

Package: inet.linklayer.ideal
File: src/inet/linklayer/ideal/IdealMac.ned

C++ definition

Implements a trivial MAC layer for use in IdealWirelessNic.

This module only provides encapsulation/decapsulation (into IdealMacFrame), but no real medium access protocol.

Higher layer packets should have Ieee802Ctrl attached to them as control info.

See IdealWirelessNic for rationale and details.

IdealMac

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram:

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

Extends:

Name Type Description
MACProtocolBase simple module

Module base for different MAC protocols.

Used in compound modules:

Name Type Description
IdealWirelessNic compound module

Highly abstracted wireless NIC that consists of a unit disk radio and a trivial MAC protocol. It offers simplicity for scenarios where Layer 1 and 2 effects can be completely ignored, for example testing the basic functionality of a wireless ad-hoc routing protocol.

Ieee802154UWBIRNic compound module (no description)

Parameters:

Name Type Default value Description
interfaceTableModule string
address string "auto"

MAC address as hex string (12 hex digits), or "auto". "auto" values will be replaced by a generated MAC address in init stage 0.

bitrate double
mtu int 4470B
headerLength int 0B

IdealMacFrame.byteLength = headerLength + packetFromUpperLayer.byteLength

promiscuous bool false
fullDuplex bool true

allows transmitting and receiving simultaneously (transceiver radio mode)

useAck bool true
ackTimeout double 100ms

Properties:

Name Value Description
display i=block/rxtx
class IdealMac

Gates:

Name Direction Size Description
upperLayerIn input
upperLayerOut output
lowerLayerIn input
lowerLayerOut output

Signals:

Name Type Unit
dropPkNotForUs IdealMacFrame
NF_LINK_BREAK IdealMacFrame

Statistics:

Name Title Source Record Unit Interpolation Mode
passedUpPk packets passed to higher layer packetSentToUpper count, sum(packetBytes), vector(packetBytes) none
rcvdPkFromHL packets received from higher layer packetReceivedFromUpper count, sum(packetBytes), vector(packetBytes) none
droppedPkNotForUs packets dropped/not for us dropPkNotForUs count, sum(packetBytes), vector(packetBytes) none
sentDownPk packets sent to lower layer packetSentToLower count, sum(packetBytes), vector(packetBytes) none
rcvdPkFromLL packets received from lower layer packetReceivedFromLower count, sum(packetBytes), vector(packetBytes) none

Source code:

//
// Implements a trivial MAC layer for use in ~IdealWirelessNic.
//
// This module only provides encapsulation/decapsulation (into IdealMacFrame),
// but no real medium access protocol.
//
// Higher layer packets should have Ieee802Ctrl attached to them as
// control info.
//
// See ~IdealWirelessNic for rationale and details.
//
simple IdealMac extends MACProtocolBase like ILinkLayer
{
    parameters:
        string address = default("auto");   // MAC address as hex string (12 hex digits), or
                                            // "auto". "auto" values will be replaced by
                                            // a generated MAC address in init stage 0.
        double bitrate @unit("bps");
        int mtu @unit("B") = default(4470B);
        int headerLength @unit("B") = default(0B);       // IdealMacFrame.byteLength = headerLength + packetFromUpperLayer.byteLength
        bool promiscuous = default(false);
        bool fullDuplex = default(true);    // allows transmitting and receiving simultaneously (transceiver radio mode)
        bool useAck = default(true);
        double ackTimeout @unit("s") = default(100ms);

        @class(IdealMac);
        @signal[dropPkNotForUs](type=IdealMacFrame);
        @signal[NF_LINK_BREAK](type=IdealMacFrame);
        @statistic[passedUpPk](title="packets passed to higher layer"; source=packetSentToUpper; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[sentDownPk](title="packets sent to lower layer"; source=packetSentToLower; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[rcvdPkFromHL](title="packets received from higher layer"; source=packetReceivedFromUpper; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[rcvdPkFromLL](title="packets received from lower layer"; source=packetReceivedFromLower; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[droppedPkNotForUs](title="packets dropped/not for us"; source=dropPkNotForUs; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
}