ShortcutMac

Package: inet.linklayer.shortcut

simple module ShortcutMac

Implements a simple shortcut to peer MAC protocol that completely bypasses the physical layer. Packets received from the upper layer protocols are never lost. The MAC protocol directly sends packets to the destination MAC protocol without any physical layer processing. Physical layer overhead is simply simulated by overhead bits, overhead transmission duration and a propagation delay.

inet.linklayer.shortcut.ShortcutMacShortcutMacsimple

Inheritance diagram

Extends

Name

Type

Description

MacProtocolBase

simple module

Module base for different MAC protocols.

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

interfaceTableModule

string

address

string

“auto”

MAC address as a hex string (12 hex digits), or

bitrate

double

“auto”. “auto” values will be replaced by a generated MAC address in init stage 0.

mtu

int

1500B

lengthOverhead

int

0b

Extra length added to packets

durationOverhead

double

0s

Extra transmission duration added to packets

propagationDelay

double

0s

Propagation time to all destinations

packetLoss

double

0

Packet loss probability

Properties

Name

Value

Description

class

ShortcutMac

display

i=block/rxtx

Gates

Name

Direction

Size

Description

upperLayerIn

input

upperLayerOut

output

lowerLayerIn

input

lowerLayerOut

output

peerIn

input

Signals

Name

Type

Unit

Description

packetDropped

cPacket

packetReceivedFromLower

cPacket

packetReceivedFromUpper

cPacket

packetSentToLower

cPacket

packetSentToUpper

cPacket

Source code

//
// Implements a simple shortcut to peer MAC protocol that completely
// bypasses the physical layer. Packets received from the upper layer protocols
// are never lost. The MAC protocol directly sends packets to the destination
// MAC protocol without any physical layer processing. Physical layer overhead
// is simply simulated by overhead bits, overhead transmission duration and
// a propagation delay.
//
simple ShortcutMac extends MacProtocolBase like ILinkLayer, IMacProtocol
{
    parameters:
        string address @mutable = default("auto");   // MAC address as a 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(1500B);
        volatile int lengthOverhead @unit(b) = default(0b); // Extra length added to packets
        volatile double durationOverhead @unit(s) = default(0s); // Extra transmission duration added to packets
        volatile double propagationDelay @unit(s) = default(0s); // Propagation time to all destinations
        volatile double packetLoss = default(0); // Packet loss probability
        @class(ShortcutMac);
        @display("i=block/rxtx");
    gates:
        input peerIn;
}

File: src/inet/linklayer/shortcut/ShortcutMac.ned