NED File src/inet/linklayer/acking/AckingMac.ned
Name | Type | Description |
---|---|---|
AckingMac | compound module |
This module implements a trivial MAC protocol for use in AckingWirelessInterface. |
Source code
// // Copyright (C) 2013 OpenSim Ltd. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program; if not, see <http://www.gnu.org/licenses/>. // // author: Zoltan Bojthe // package inet.linklayer.acking; import inet.queueing.contract.IPacketQueue; import inet.linklayer.base.MacProtocolBase; import inet.linklayer.contract.ILinkLayer; import inet.linklayer.contract.IMacProtocol; // // This module implements a trivial MAC protocol for use in ~AckingWirelessInterface. // // The implementation provides packet encapsulation and decapsulation, but it // doesn't have a real medium access protocol. It doesn't provide carrier sense // mechanism, collision avoidance, collision detection, but it provides optional // out-of-band acknowledgement. Higher layer packets should have MacAddressReq // tag. // // See ~AckingWirelessInterface for rationale and details. // module AckingMac extends MacProtocolBase like ILinkLayer, IMacProtocol { 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(16B); // AckingMacHeader length 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(AckingMac); @signal[linkBroken](type=inet::Packet); @statistic[linkBroken](title="link break"; source=linkBroken; record=count; interpolationmode=none); @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[packetDropIncorrectlyReceived](title="packet drop: incorrectly received"; source=packetDropReasonIsIncorrectlyReceived(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[packetDropInterfaceDown](title="packet drop: interface down"; source=packetDropReasonIsInterfaceDown(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[packetDropNotAddressedToUs](title="packet drop: not addressed to us"; source=packetDropReasonIsNotAddressedToUs(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); submodules: queue: <default("DropTailQueue")> like IPacketQueue { parameters: @display("p=100,100;q=l2queue"); } }