21#include "ns3/double.h"
24#include "ns3/packet.h"
25#include "ns3/random-variable-stream.h"
26#include "ns3/simulator.h"
27#include "ns3/uinteger.h"
29#undef NS_LOG_APPEND_CONTEXT
30#define NS_LOG_APPEND_CONTEXT \
31 std::clog << "[" << m_shortAddress << " | " << m_macExtendedAddress << "] ";
59 os <<
"CHANNEL_ACCESS_FAILURE";
65 os <<
"SET PHY to TX ON";
68 os <<
"MAC GTS PERIOD";
71 os <<
"SUPERFRAME INACTIVE PERIOD";
74 os <<
"CSMA DEFERRED TO NEXT PERIOD";
84 TypeId(
"ns3::lrwpan::LrWpanMac")
87 .SetGroupName(
"LrWpan")
89 .AddAttribute(
"PanId",
90 "16-bit identifier of the associated PAN",
94 .AddTraceSource(
"MacTxEnqueue",
95 "Trace source indicating a packet has been "
96 "enqueued in the transaction queue",
98 "ns3::Packet::TracedCallback")
99 .AddTraceSource(
"MacTxDequeue",
100 "Trace source indicating a packet has was "
101 "dequeued from the transaction queue",
103 "ns3::Packet::TracedCallback")
104 .AddTraceSource(
"MacIndTxEnqueue",
105 "Trace source indicating a packet has been "
106 "enqueued in the indirect transaction queue",
108 "ns3::Packet::TracedCallback")
109 .AddTraceSource(
"MacIndTxDequeue",
110 "Trace source indicating a packet has was "
111 "dequeued from the indirect transaction queue",
113 "ns3::Packet::TracedCallback")
114 .AddTraceSource(
"MacTx",
115 "Trace source indicating a packet has "
116 "arrived for transmission by this device",
118 "ns3::Packet::TracedCallback")
119 .AddTraceSource(
"MacTxOk",
120 "Trace source indicating a packet has been "
123 "ns3::Packet::TracedCallback")
124 .AddTraceSource(
"MacTxDrop",
125 "Trace source indicating a packet has been "
126 "dropped during transmission",
128 "ns3::Packet::TracedCallback")
129 .AddTraceSource(
"MacIndTxDrop",
130 "Trace source indicating a packet has been "
131 "dropped from the indirect transaction queue"
132 "(The pending transaction list)",
134 "ns3::Packet::TracedCallback")
135 .AddTraceSource(
"MacPromiscRx",
136 "A packet has been received by this device, "
137 "has been passed up from the physical layer "
138 "and is being forwarded up the local protocol stack. "
139 "This is a promiscuous trace,",
141 "ns3::Packet::TracedCallback")
142 .AddTraceSource(
"MacRx",
143 "A packet has been received by this device, "
144 "has been passed up from the physical layer "
145 "and is being forwarded up the local protocol stack. "
146 "This is a non-promiscuous trace,",
148 "ns3::Packet::TracedCallback")
149 .AddTraceSource(
"MacRxDrop",
150 "Trace source indicating a packet was received, "
151 "but dropped before being forwarded up the stack",
153 "ns3::Packet::TracedCallback")
154 .AddTraceSource(
"Sniffer",
155 "Trace source simulating a non-promiscuous "
156 "packet sniffer attached to the device",
158 "ns3::Packet::TracedCallback")
159 .AddTraceSource(
"PromiscSniffer",
160 "Trace source simulating a promiscuous "
161 "packet sniffer attached to the device",
163 "ns3::Packet::TracedCallback")
164 .AddTraceSource(
"MacStateValue",
165 "The state of LrWpan Mac",
167 "ns3::TracedValueCallback::LrWpanMacState")
168 .AddTraceSource(
"MacIncSuperframeStatus",
169 "The period status of the incoming superframe",
171 "ns3::TracedValueCallback::SuperframeState")
172 .AddTraceSource(
"MacOutSuperframeStatus",
173 "The period status of the outgoing superframe",
175 "ns3::TracedValueCallback::SuperframeState")
176 .AddTraceSource(
"MacState",
177 "The state of LrWpan Mac",
179 "ns3::lrwpan::LrWpanMac::StateTracedCallback")
180 .AddTraceSource(
"MacSentPkt",
181 "Trace source reporting some information about "
184 "ns3::lrwpan::LrWpanMac::SentTracedCallback")
185 .AddTraceSource(
"IfsEnd",
186 "Trace source reporting the end of an "
187 "Interframe space (IFS)",
189 "ns3::Packet::TracedCallback");
396 NS_LOG_ERROR(
this <<
" packet too big: " << p->GetSize());
407 NS_LOG_ERROR(
this <<
" Can not send packet with no Address field");
415 switch (params.m_srcAddrMode)
422 NS_ABORT_MSG(
"Can not set source address type to ADDR_MODE_RESERVED. Aborting.");
433 NS_LOG_ERROR(
this <<
" Can not send packet with incorrect Source Address mode = "
434 << params.m_srcAddrMode);
442 switch (params.m_dstAddrMode)
449 NS_ABORT_MSG(
"Can not set destination address type to ADDR_MODE_RESERVED. Aborting.");
460 NS_LOG_ERROR(
this <<
" Can not send packet with incorrect Destination Address mode = "
461 << params.m_dstAddrMode);
494 NS_LOG_LOGIC(
"LrWpanMac::McpsDataRequest: requested an ACK on broadcast or "
495 "multicast destination ("
496 << shortAddr <<
") - forcefully removing it.");
531 p->AddHeader(macHdr);
540 p->AddTrailer(macTrailer);
542 NS_LOG_ERROR(
this <<
" Indirect transmissions not currently supported");
556 p->AddHeader(macHdr);
565 p->AddTrailer(macTrailer);
567 auto txQElement = std::make_shared<TxQueueElement>();
568 txQElement->txQMsduHandle = params.m_msduHandle;
569 txQElement->txQPkt = p;
594 if ((params.m_bcnOrd > 15) || (params.m_sfrmOrd > params.m_bcnOrd))
601 NS_LOG_ERROR(
this <<
"Incorrect superframe order or beacon order.");
621 confirmParams.
m_chPage = params.m_chPage;
630 NS_LOG_ERROR(
this <<
" A channel scan is already in progress");
641 NS_LOG_ERROR(
this <<
"Invalid scan duration or unsupported scan type");
670 pibAttr->phyCurrentPage = params.m_chPage;
686 bool invalidRequest =
false;
688 if (params.m_coordPanId == 0xffff)
690 invalidRequest =
true;
693 if (!invalidRequest && params.m_coordAddrMode ==
SHORT_ADDR)
698 invalidRequest =
true;
701 else if (!invalidRequest && params.m_coordAddrMode ==
EXT_ADDR)
703 if (params.m_coordExtAddr ==
Mac64Address(
"ff:ff:ff:ff:ff:ff:ff:ff") ||
704 params.m_coordExtAddr ==
Mac64Address(
"ff:ff:ff:ff:ff:ff:ff:ed"))
706 invalidRequest =
true;
714 NS_LOG_ERROR(
this <<
" Invalid PAN id in Association request");
726 pibAttr->phyCurrentPage = params.m_chPage;
780 commandPacket->AddHeader(macPayload);
781 commandPacket->AddHeader(macHdr);
787 macTrailer.
SetFcs(commandPacket);
790 commandPacket->AddTrailer(macTrailer);
824 if (params.m_assocMember)
838 commandPacket->AddHeader(macPayload);
839 commandPacket->AddHeader(macHdr);
845 macTrailer.
SetFcs(commandPacket);
848 commandPacket->AddTrailer(macTrailer);
850 auto txQElement = std::make_shared<TxQueueElement>();
851 txQElement->txQPkt = commandPacket;
862 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
865 pibAttr->phyCurrentChannel = params.m_logCh;
871 uint64_t searchSymbols;
872 Time searchBeaconTime;
879 if (params.m_trackBcn)
885 searchBeaconTime =
Seconds((
double)searchSymbols / symbolRate);
959 pibAttr->phyCurrentChannel = attribute->pCurrentChannel;
965 pibAttr->phyCurrentPage = attribute->pCurrentPage;
977 confirmParams.
id = id;
1015 attributes->pCurrentChannel =
m_phy->GetCurrentChannelNum();
1018 attributes->pCurrentPage =
m_phy->GetCurrentPage();
1046 params.m_dsn = receivedMacHdr.
GetSeqNum();
1047 params.m_mpduLinkQuality = lqi;
1050 params.m_rssi = rssi;
1052 switch (params.m_srcAddrMode)
1067 switch (params.m_dstAddrMode)
1125 beaconPacket->AddHeader(macPayload);
1126 beaconPacket->AddHeader(macHdr);
1133 macTrailer.
SetFcs(beaconPacket);
1136 beaconPacket->AddTrailer(macTrailer);
1144 NS_LOG_DEBUG(
"Outgoing superframe Active Portion (Beacon + CAP + CFP): "
1155 auto txQElement = std::make_shared<TxQueueElement>();
1156 txQElement->txQPkt = beaconPacket;
1186 commandPacket->AddHeader(macPayload);
1187 commandPacket->AddHeader(macHdr);
1193 macTrailer.
SetFcs(commandPacket);
1196 commandPacket->AddTrailer(macTrailer);
1198 auto txQElement = std::make_shared<TxQueueElement>();
1199 txQElement->txQPkt = commandPacket;
1227 commandPacket->AddHeader(macPayload);
1228 commandPacket->AddHeader(macHdr);
1234 macTrailer.
SetFcs(commandPacket);
1237 commandPacket->AddTrailer(macTrailer);
1239 auto txQElement = std::make_shared<TxQueueElement>();
1240 txQElement->txQPkt = commandPacket;
1276 commandPacket->AddHeader(macPayload);
1277 commandPacket->AddHeader(macHdr);
1283 macTrailer.
SetFcs(commandPacket);
1286 commandPacket->AddTrailer(macTrailer);
1288 auto txQElement = std::make_shared<TxQueueElement>();
1289 txQElement->txQPkt = commandPacket;
1334 commandPacket->AddHeader(macPayload);
1335 commandPacket->AddHeader(macHdr);
1341 macTrailer.
SetFcs(commandPacket);
1344 commandPacket->AddTrailer(macTrailer);
1347 auto txQElement = std::make_shared<TxQueueElement>();
1348 txQElement->txQPkt = commandPacket;
1357 rxDataReqPkt->RemoveHeader(receivedMacHdr);
1359 rxDataReqPkt->RemoveHeader(receivedMacPayload);
1363 auto indTxQElement = std::make_shared<IndTxQueueElement>();
1368 auto txQElement = std::make_shared<TxQueueElement>();
1369 txQElement->txQPkt = indTxQElement->txQPkt;
1374 NS_LOG_DEBUG(
"Requested element not found in pending list");
1405 NS_LOG_ERROR(
this <<
" Coordinator realignment request not supported");
1483 bool channelFound =
false;
1489 channelFound =
true;
1579 bool channelFound =
false;
1584 channelFound =
true;
1630 uint64_t capDuration;
1632 uint64_t symbolRate;
1634 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1641 endCapTime =
Seconds((
double)capDuration / symbolRate);
1645 NS_LOG_DEBUG(
"Outgoing superframe CAP duration " << (endCapTime.GetSeconds() * symbolRate)
1646 <<
" symbols (" << endCapTime.As(
Time::S)
1648 NS_LOG_DEBUG(
"Active Slots duration " << activeSlot <<
" symbols");
1658 endCapTime =
Seconds((
double)capDuration / symbolRate);
1662 NS_LOG_DEBUG(
"Incoming superframe CAP duration " << (endCapTime.GetSeconds() * symbolRate)
1663 <<
" symbols (" << endCapTime.As(
Time::S)
1665 NS_LOG_DEBUG(
"Active Slots duration " << activeSlot <<
" symbols");
1678 uint64_t cfpDuration;
1680 uint64_t symbolRate;
1682 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1688 endCfpTime =
Seconds((
double)cfpDuration / symbolRate);
1689 if (cfpDuration > 0)
1694 NS_LOG_DEBUG(
"Incoming superframe CFP duration " << cfpDuration <<
" symbols ("
1695 << endCfpTime.As(
Time::S) <<
")");
1706 endCfpTime =
Seconds((
double)cfpDuration / symbolRate);
1708 if (cfpDuration > 0)
1713 NS_LOG_DEBUG(
"Outgoing superframe CFP duration " << cfpDuration <<
" symbols ("
1714 << endCfpTime.As(
Time::S) <<
")");
1727 uint64_t inactiveDuration;
1728 Time endInactiveTime;
1729 uint64_t symbolRate;
1731 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1736 endInactiveTime =
Seconds((
double)inactiveDuration / symbolRate);
1738 if (inactiveDuration > 0)
1743 NS_LOG_DEBUG(
"Incoming superframe Inactive Portion duration "
1744 << inactiveDuration <<
" symbols (" << endInactiveTime.
As(
Time::S) <<
")");
1750 endInactiveTime =
Seconds((
double)inactiveDuration / symbolRate);
1752 if (inactiveDuration > 0)
1757 NS_LOG_DEBUG(
"Outgoing superframe Inactive Portion duration "
1758 << inactiveDuration <<
" symbols (" << endInactiveTime.
As(
Time::S) <<
")");
1778 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1796 uint64_t searchSymbols;
1797 Time searchBeaconTime;
1800 searchBeaconTime =
Seconds((
double)searchSymbols / symbolRate);
1815 (p->GetSize() *
m_phy->GetPhySymbolsPerOctet());
1818 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1821 NS_LOG_DEBUG(
"Beacon Received; forwarding up (m_macBeaconRxTime: "
1826 p->RemoveHeader(receivedMacPayload);
1875 m_csmaCa->SetBatteryLifeExtension(
true);
1879 m_csmaCa->SetBatteryLifeExtension(
false);
1902 NS_LOG_DEBUG(
this <<
" Device not associated, cannot process beacon");
1907 if (p->GetSize() > 0)
1916 beaconParams.
m_sdu = p;
1924 bool descriptorExists =
false;
1934 descriptor.m_coorPanId == panDescriptor.
m_coorPanId);
1940 descriptorExists = (descriptor.m_coorExtAddr == panDescriptor.
m_coorExtAddr &&
1941 descriptor.m_coorPanId == panDescriptor.
m_coorPanId);
1944 if (descriptorExists)
1950 if (!descriptorExists)
1967 uint64_t searchSymbols;
1968 Time searchBeaconTime;
1972 searchBeaconTime =
Seconds(
static_cast<double>(searchSymbols / symbolRate));
1998 beaconParams.
m_sdu = p;
2009 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
2012 p->RemoveHeader(receivedMacPayload);
2032 NS_LOG_DEBUG(
"Beacon Request command received in beacon mode: Ignore");
2094 params.m_dsn = receivedMacHdr.
GetSeqNum();
2095 params.m_mpduLinkQuality = lqi;
2098 params.m_rssi = rssi;
2100 switch (params.m_srcAddrMode)
2115 switch (params.m_dstAddrMode)
2140 txPkt->RemoveHeader(txMacHdr);
2166 double symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2177 txPkt->RemoveHeader(txCmdPayload);
2267 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
2269 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2325 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
2344 if (
m_csmaCa->GetBatteryLifeExtension())
2379 return pndAddrFields;
2420 p->RemoveTrailer(receivedMacTrailer);
2424 p->RemoveHeader(receivedMacHdr);
2442 if (!receivedMacTrailer.
CheckFcs(p))
2462 acceptFrame = (receivedMacHdr.
GetFrameVer() <= 1);
2490 acceptFrame = !receivedMacHdr.
IsAckReq();
2494 acceptFrame =
false;
2507 acceptFrame =
false;
2514 acceptFrame =
false;
2520 acceptFrame =
false;
2528 p->PeekHeader(receivedMacPayload);
2533 acceptFrame =
false;
2543 ceil(6 *
m_phy->GetPhySymbolsPerOctet());
2544 auto symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2545 Time ackTime =
Seconds((
double)ackSymbols / symbolRate);
2547 if (ackTime >= timeLeftInCap)
2549 NS_LOG_DEBUG(
"Command frame received but not enough time to transmit ACK "
2550 "before the end of CAP ");
2551 acceptFrame =
false;
2590 NS_LOG_DEBUG(
"Received a packet with ACK required while in CSMA. Cancel "
2605 p->PeekHeader(receivedMacPayload);
2609 NS_LOG_DEBUG(
"Data Request Command Received; processing ACK");
2612 NS_LOG_DEBUG(
"Association Request Command Received; processing ACK");
2618 NS_LOG_DEBUG(
"Association Response Command Received; processing ACK");
2630 NS_LOG_DEBUG(
"Assoc. Resp Cmd received before Data Req. Cmd. in "
2631 "Association request");
2653 else if (receivedMacHdr.
IsData())
2674 ackPacket->AddHeader(macHdr);
2679 macTrailer.
SetFcs(ackPacket);
2681 ackPacket->AddTrailer(macTrailer);
2705 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2717 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
2723 pkt->RemoveHeader(hdr);
2729 txQElement->txQPkt =
nullptr;
2730 txQElement =
nullptr;
2759 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
2763 if (ifsTime == lifsTime)
2768 else if (ifsTime == sifsTime)
2793 m_txPkt->PeekHeader(peekedMacHdr);
2802 pkt->RemoveHeader(macHdr);
2803 pkt->RemoveHeader(cmdPayload);
2871 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
2876 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2897 auto indTxQElement = std::make_shared<IndTxQueueElement>();
2899 p->PeekHeader(peekedMacHdr);
2912 indTxQElement->dstExtAddress = peekedMacHdr.
GetExtDstAddr();
2915 indTxQElement->seqNum = peekedMacHdr.
GetSeqNum();
2933 double symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2936 indTxQElement->expireTime = expireTime;
2937 indTxQElement->txQPkt = p;
2946 indTxQElement->txQPkt->PeekHeader(peekedMacHdr);
2967 if ((*iter)->dstExtAddress == dst)
3004 else if (peekedMacHdr.
IsData())
3032 <<
" Sequence Number |"
3034 <<
" Expire time\n";
3038 transaction->txQPkt->PeekHeader(peekedMacHdr);
3039 os << transaction->dstExtAddress <<
" "
3040 <<
static_cast<uint32_t>(transaction->seqNum) <<
" ";
3044 os <<
" Command Frame ";
3046 else if (peekedMacHdr.
IsData())
3048 os <<
" Data Frame ";
3052 os <<
" Unknown Frame ";
3055 os << transaction->expireTime.As(
Time::S) <<
"\n";
3067 <<
" Sequence Number |"
3069 <<
" Frame type |\n";
3071 for (
const auto& transaction :
m_txQueue)
3073 transaction->txQPkt->PeekHeader(peekedMacHdr);
3082 os <<
" Command Frame ";
3084 else if (peekedMacHdr.
IsData())
3086 os <<
" Data Frame ";
3090 os <<
" Unknown Frame ";
3103 m_csmaCa->AssignStreams(stream + 1);
3111 p->PeekHeader(peekedMacHdr);
3117 if (((*it)->dstExtAddress == peekedMacHdr.
GetExtDstAddr()) &&
3118 ((*it)->seqNum == peekedMacHdr.
GetSeqNum()))
3128 ((*it)->seqNum == peekedMacHdr.
GetSeqNum()))
3150 symbolRate =
m_phy->GetDataOrSymbolRate(
false);
3166 uint64_t beaconSymbols =
m_phy->GetPhySHRDuration() +
3167 1 *
m_phy->GetPhySymbolsPerOctet() +
3225 txOriginalPkt->RemoveHeader(txMacHdr);
3227 txOriginalPkt->RemoveHeader(txMacPayload);
3260 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
3261 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
3277 recvOriginalPkt->RemoveHeader(receivedMacHdr);
3282 recvOriginalPkt->RemoveHeader(receivedMacPayload);
3365 std::shared_ptr<TxQueueElement> txQElement =
m_txQueue.front();
3370 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
3385 NS_FATAL_ERROR(
"Transmission attempt failed with PHY status " << status);
3388 if (!ifsWaitTime.
IsZero())
3419 m_phy->PlmeEdRequest();
3461 m_phy->PlmeEdRequest();
3491 bool channelFound =
false;
3496 channelFound =
true;
3520 NS_LOG_ERROR(
this <<
"Channel Scan: Invalid channel page");
3527 auto symbolRate =
static_cast<uint64_t
>(
m_phy->GetDataOrSymbolRate(
false));
3536 uint64_t scanDurationSym =
3539 nextScanTime =
Seconds(
static_cast<double>(scanDurationSym) / symbolRate);
3590 <<
" could not be set in the current page");
3627 NS_LOG_ERROR(
"Invalid channel parameter in MLME-start");
3656 NS_LOG_ERROR(
"Invalid page parameter in MLME-associate");
3684 NS_LOG_ERROR(
"Invalid channel parameter in MLME-associate");
3761 pkt->RemoveHeader(macHdr);
3766 pkt->RemoveHeader(cmdPayload);
3861 else if (macHdr.
IsData())
3900 NS_LOG_DEBUG(
"****** PACKET DEFERRED to the next superframe *****");
3952 ceil(6 *
m_phy->GetPhySymbolsPerOctet());
3992 NS_LOG_DEBUG(
"ERROR: Packet not for the coordinator!");
4029 return (
m_phy->GetPhySHRDuration() + 1 *
m_phy->GetPhySymbolsPerOctet() +
4030 (
m_txPkt->GetSize() *
m_phy->GetPhySymbolsPerOctet()));
This class can contain 16 bit addresses.
bool IsMulticast() const
Checks if the address is a multicast address according to RFC 4944 Section 9 (i.e....
bool IsBroadcast() const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
static Mac64Address Allocate()
Allocate a new Mac64Address.
static bool ChecksumEnabled()
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsZero() const
Exactly equivalent to t == 0.
a unique identifier for an interface.
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Implements the header for the MAC payload command frame according to the IEEE 802....
MacCommand GetCommandFrameType() const
Get the command frame type ID.
Mac16Address GetShortAddr() const
Get the Short address assigned by the coordinator (Association Response and Coordinator Realigment co...
uint16_t GetPanId() const
Get the PAN identifier.
void SetPage(uint8_t page)
Set the logical channel page number.
void SetShortAddr(Mac16Address shortAddr)
Set the Short Address Assigned by the coordinator (Association Response and Coordinator Realigment Co...
uint8_t GetCapabilityField() const
Get the Capability Information Field from the command payload header.
void SetCommandFrameType(MacCommand macCmd)
Set the command frame type.
Mac16Address GetCoordShortAddr() const
Get the coordinator short address.
void SetCapabilityField(uint8_t cap)
Set the Capability Information Field to the command payload header (Association Request Command).
void SetCoordShortAddr(Mac16Address addr)
Set the coordinator short address (16 bit address).
@ ASSOCIATION_RESP
Association response (RFD true: Rx).
@ DATA_REQ
Data Request (RFD true: Tx).
@ COOR_REALIGN
Coordinator Realignment (RFD true: Rx).
@ ORPHAN_NOTIF
Orphan Notification (RFD true: Tx).
@ ASSOCIATION_REQ
Association request (RFD true: Tx).
@ BEACON_REQ
Beacon Request (RFD true: none ).
void SetAssociationStatus(uint8_t status)
Set status resulting from the association attempt (Association Response Command).
uint8_t GetAssociationStatus() const
Get the status resulting from an association request (Association Response Command).
void SetPanId(uint16_t id)
Get the PAN identifier.
void SetChannel(uint8_t channel)
Set the logical channel number.
Represent the GTS information fields.
bool GetGtsPermit() const
Get the GTS Specification Permit.
Lr-wpan MAC layer abstraction.
MlmeOrphanIndicationCallback m_mlmeOrphanIndicationCallback
This callback is used to indicate the reception of a orphan notification command.
MlmeGetConfirmCallback m_mlmeGetConfirmCallback
This callback is used to report the result of an attribute read request to the upper layers.
MlmeAssociateIndicationCallback m_mlmeAssociateIndicationCallback
This callback is used to indicate the reception of an association request command.
MlmeSetConfirmCallback m_mlmeSetConfirmCallback
This callback is used to report the result of an attribute writing request to the upper layers.
MlmePollConfirmCallback m_mlmePollConfirmCallback
This callback is used to report the status after a device send data command request to the coordinato...
MlmeCommStatusIndicationCallback m_mlmeCommStatusIndicationCallback
This callback is instigated through a response primitive.
McpsDataConfirmCallback m_mcpsDataConfirmCallback
This callback is used to report data transmission request status to the upper layers.
McpsDataIndicationCallback m_mcpsDataIndicationCallback
This callback is used to notify incoming packets to the upper layers.
MlmeScanConfirmCallback m_mlmeScanConfirmCallback
This callback is used to report the result of a scan on a group of channels for the selected channel ...
MlmeAssociateConfirmCallback m_mlmeAssociateConfirmCallback
This callback is used to report the status after a device request an association with a coordinator.
MlmeSyncLossIndicationCallback m_mlmeSyncLossIndicationCallback
This callback is used to indicate the loss of synchronization with a coordinator.
MlmeBeaconNotifyIndicationCallback m_mlmeBeaconNotifyIndicationCallback
This callback is used to notify incoming beacon packets to the upper layers.
MlmeStartConfirmCallback m_mlmeStartConfirmCallback
This callback is used to report the start of a new PAN or the begin of a new superframe configuration...
Ptr< Packet > m_rxPkt
The command request packet received.
TracedCallback< Ptr< const Packet > > m_macTxDequeueTrace
The trace source fired when packets are dequeued from the L3/l2 transmission queue.
void RemovePendTxQElement(Ptr< Packet > p)
Remove an element from the pending transaction list.
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but dropped before being forwa...
uint8_t m_deviceCapability
Indication of current device capability (FFD or RFD).
std::vector< uint8_t > m_macBeaconPayload
The set with the contents of the beacon payload.
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
TracedCallback< Ptr< const Packet > > m_macIndTxDequeueTrace
The trace source fired when packets are dequeued from the L3/l2 indirect transmission queue (Pending ...
Ptr< LrWpanPhy > GetPhy()
Get the underlying PHY of the MAC.
uint32_t m_superframeDuration
Indication of the superframe duration in symbols.
void AwaitBeacon()
Called after the end of an INCOMING superframe to start the moment a device waits for a new incoming ...
void EndStartRequest()
Called to end a MLME-START.request after changing the page and channel number.
void MlmeAssociateResponse(MlmeAssociateResponseParams params) override
IEEE 802.15.4-2011, section 6.2.2.3 MLME-ASSOCIATE.response Primitive used to initiate a response to ...
bool m_macPromiscuousMode
Indicates if MAC sublayer is in receive all mode.
Ptr< LrWpanCsmaCa > m_csmaCa
The CSMA/CA implementation used by this MAC.
void SendAck(uint8_t seqno)
Send an acknowledgment packet for the given sequence number.
uint8_t m_numCsmacaRetry
The number of CSMA/CA retries used for sending the current packet.
Ptr< Packet > m_txPkt
The packet which is currently being sent by the MAC layer.
MlmeStartRequestParams m_startParams
The parameters used during a MLME-START.request.
void PurgeInd()
Purge expired transactions from the pending transactions list.
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaCa)
Set the CSMA/CA implementation to be used by the MAC.
EventId m_scanEvent
Scheduler event for the end of an ACTIVE or PASSIVE channel scan.
void PdDataConfirm(PhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.1.2 Confirm the end of transmission of an MPDU to MAC.
void SendOrphanNotificationCommand()
Called to send a orphan notification command.
Mac64Address m_macExtendedAddress
The extended 64 address (IEEE EUI-64) used by this MAC.
EventId m_scanEnergyEvent
Scheduler event for the end of a ED channel scan.
uint16_t m_macPanIdScan
Temporarily stores the value of the current m_macPanId when a MLME-SCAN.request is performed.
EventId m_setMacState
Scheduler event for a deferred MAC state change.
void ReceiveData(uint8_t lqi, int8_t rssi, const LrWpanMacHeader &receivedMacHdr, Ptr< Packet > p)
Used to process the reception of data.
uint32_t m_macBeaconPayloadLength
The length, in octets, of the beacon payload.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
TracedCallback< Ptr< const Packet >, uint8_t, uint8_t > m_sentPktTrace
The trace source fired when packets are considered as successfully sent or the transmission has been ...
void ReceiveInPromiscuousMode(uint8_t lqi, int8_t rssi, const LrWpanMacHeader &receivedMacHdr, Ptr< Packet > p)
Process a frame when promiscuous mode is active.
uint64_t m_assocRespCmdWaitTime
The maximum wait time for an association response command after the reception of data request command...
GtsFields GetGtsFields()
Constructs the Guaranteed Time Slots (GTS) Fields from local information.
void SetIndTxQMaxSize(uint32_t queueSize)
Set the max size of the indirect transmit queue (Pending Transaction list).
uint8_t m_incomingSuperframeOrder
Used by all devices that have a parent.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
uint32_t m_macLIFSPeriod
The minimum time forming a Long InterFrame Spacing (LIFS) period.
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
std::vector< uint8_t > m_unscannedChannels
The list of unscanned channels during a scan operation.
bool m_macRxOnWhenIdle
Indication of whether the MAC sublayer is to enable its receiver during idle periods.
bool DequeueInd(Mac64Address dst, std::shared_ptr< IndTxQueueElement > entry)
Extracts a packet from pending transactions list (Indirect transmissions).
void PrintTransmitQueueSize()
Print the number of elements in the packet transmit queue.
uint16_t m_channelScanIndex
The channel list index used to obtain the current scanned channel.
void SendAssocRequestCommand()
Called to send an associate request command.
void PrintReceivedPacket(const LrWpanMacHeader &receivedMacHdr)
Display the MAC header contents of a successfully received packet when logs are active.
EventId m_beaconEvent
Scheduler event for generation of one beacon.
void BeaconSearchTimeout()
Called if the device is unable to locate a beacon in the time set by MLME-SYNC.request.
uint32_t m_macSIFSPeriod
The minimum time forming a Short InterFrame Spacing (SIFS) period.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets are being sent down to L1.
void MlmeSyncRequest(MlmeSyncRequestParams params) override
IEEE 802.15.4-2011, section 6.2.13.1 MLME-SYNC.request Request to synchronize with the coordinator by...
SequenceNumber8 m_macDsn
Sequence number added to transmitted data or MAC command frame, 00-ff.
void ChangeMacState(MacState newState)
Change the current MAC state to the given new state.
Mac16Address m_macCoordShortAddress
The short address of the coordinator through which the device is associated.
Mac64Address GetCoordExtAddress() const
Get the coordinator extended address currently associated to this device.
void MlmeGetRequest(MacPibAttributeIdentifier id) override
IEEE 802.15.4-2006, section 7.1.6.1 MLME-GET.request Request information about a given PIB attribute.
void ReceiveBeacon(uint8_t lqi, const LrWpanMacHeader &receivedMacHdr, Ptr< Packet > p)
Used to process the reception of a beacon packet.
uint8_t m_macSuperframeOrder
Used by a PAN coordinator or coordinator.
TracedValue< SuperframeStatus > m_incSuperframeStatus
The current period of the incoming superframe.
void SetPanId(uint16_t panId)
Set the PAN id used by this MAC.
void MlmeStartRequest(MlmeStartRequestParams params) override
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
MlmeScanRequestParams m_scanParams
The parameters used during a MLME-SCAN.request.
void SetLrWpanMacState(MacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment.
void SetShortAddress(Mac16Address address)
Set the short address of this MAC.
uint8_t m_incomingBeaconOrder
The beaconOrder value of the INCOMING frame.
void PrintTxQueue(std::ostream &os) const
Print the Transmit Queue.
void CheckQueue()
Check the transmission queue.
uint32_t m_incomingSuperframeDuration
Indication of the superframe duration in symbols (e.g.
TracedCallback< Ptr< const Packet > > m_macIndTxEnqueueTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets are dropped due to missing ACKs or because of transmission failur...
void SetMacMaxFrameRetries(uint8_t retries)
Set the macMaxFrameRetries attribute value.
uint16_t m_macTransactionPersistenceTime
The maximum time (in UNIT periods) that a transaction is stored by a coordinator and indicated in its...
void MlmeOrphanResponse(MlmeOrphanResponseParams params) override
IEEE 802.15.4-2011, section 6.2.7.2 MLME-ORPHAN.response Primitive used to initiatte a response to an...
void AckWaitTimeout()
Handle an ACK timeout with a packet retransmission, if there are retransmission left,...
uint32_t m_maxTxQueueSize
The maximum size of the transmit queue.
TracedCallback< Ptr< const Packet > > m_macIndTxDropTrace
The trace source fired when packets are dropped due to indirect Tx queue overflows or expiration.
uint8_t m_retransmission
The number of already used retransmission for the currently transmitted packet.
LrWpanMac()
Default constructor.
EventId m_incCfpEvent
Scheduler event for the end of the incoming superframe CFP.
std::vector< uint8_t > m_energyDetectList
The list of energy measurements, one for each channel searched during an ED scan.
void ReceiveAcknowledgment(const LrWpanMacHeader &receivedMacHdr, Ptr< Packet > p)
Used to process an acknowledgment packet.
SequenceNumber8 m_macBsn
Sequence number added to transmitted beacon frame, 00-ff.
TracedCallback< MacState, MacState > m_macStateLogger
A trace source that fires when the MAC changes states.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
Mac64Address GetExtendedAddress() const
Get the extended address of this MAC.
void DoDispose() override
Destructor implementation.
uint8_t m_fnlCapSlot
Indication of the Slot where the CAP portion of the OUTGOING Superframe ends.
MlmeAssociateRequestParams m_associateParams
The parameters used during a MLME-ASSOCIATE.request.
uint32_t m_incomingBeaconInterval
Indication of the interval a node should receive a superframe expressed in symbols.
bool m_macAssociationPermit
Indication of whether a coordinator is currently allowing association.
static TypeId GetTypeId()
Get the type ID.
uint64_t GetMacAckWaitDuration() const
Get the macAckWaitDuration attribute value.
void SetTxQMaxSize(uint32_t queueSize)
Set the max size of the transmit queue.
TracedCallback< Time > m_macIfsEndTrace
The trace source is fired at the end of any Interframe Space (IFS).
void MlmeAssociateRequest(MlmeAssociateRequestParams params) override
IEEE 802.15.4-2011, section 6.2.2.1 MLME-ASSOCIATE.request Request primitive used by a device to requ...
bool GetRxOnWhenIdle() const
Check if the receiver will be enabled when the MAC is idle.
void EnqueueInd(Ptr< Packet > p)
Adds a packet to the pending transactions list (Indirect transmissions).
Time m_macBeaconTxTime
The time that the device transmitted its last beacon frame.
std::vector< PanDescriptor > m_panDescriptorList
The list of PAN descriptors accumulated during channel scans, used to select a PAN to associate.
uint8_t m_maxEnergyLevel
The maximum energy level detected during ED scan on the current channel.
Mac16Address GetShortAddress() const
Get the short address of this MAC.
bool m_macAutoRequest
Indication of whether a device automatically sends data request command if its address is listed in t...
PendingAddrFields GetPendingAddrFields()
Constructs Pending Address Fields from the local information, the Pending Address Fields are part of ...
uint64_t m_rxBeaconSymbols
The total size of the received beacon in symbols.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< LrWpanPhy > m_phy
The PHY associated with this MAC.
EventId m_cfpEvent
Scheduler event for the end of the outgoing superframe CFP.
uint16_t GetPanId() const
Get the PAN id used by this MAC.
TracedCallback< Ptr< const Packet > > m_macTxOkTrace
The trace source fired when packets where successfully transmitted, that is an acknowledgment was rec...
bool m_panCoor
Indication of whether the current device is the PAN coordinator.
std::deque< std::shared_ptr< IndTxQueueElement > > m_indTxQueue
The indirect transmit queue used by the MAC pending messages (The pending transaction list).
void SendAssocResponseCommand(Ptr< Packet > rxDataReqPkt)
Called to send an associate response command.
Time m_macBeaconRxTime
The time that the device received its last bit of the beacon frame.
void PdDataIndication(uint32_t psduLength, Ptr< Packet > p, uint8_t lqi, int8_t rssi)
IEEE 802.15.4-2006 section 6.2.1.3 PD-DATA.indication Indicates the transfer of an MPDU from PHY to M...
void SetAssociatedCoor(Mac16Address mac)
Check if the packet destination is its coordinator.
void StartCFP(SuperframeType superframeType)
Called to begin the Contention Free Period (CFP) in a beacon-enabled mode.
uint16_t m_macPanId
16 bits id of PAN on which this device is operating.
bool PrepareRetransmission()
Check for remaining retransmissions for the packet currently being sent.
void PrintPendingTxQueue(std::ostream &os) const
Print the Pending transaction list.
uint32_t m_ifs
The value of the necessary InterFrame Space after the transmission of a packet.
void MlmeSetRequest(MacPibAttributeIdentifier id, Ptr< MacPibAttributes > attribute) override
IEEE 802.15.4-2011, section 6.2.11.1 MLME-SET.request Attempts to write the given value to the indica...
bool m_beaconTrackingOn
Indication of whether the current device is tracking incoming beacons.
void SendBeaconRequestCommand()
Called to send a beacon request command.
uint32_t m_maxIndTxQueueSize
The maximum size of the indirect transmit queue (The pending transaction list).
void ReceiveCommand(uint8_t lqi, const LrWpanMacHeader &receivedMacHdr, Ptr< Packet > p)
Used to process the reception of a command packet.
void IfsWaitTimeout(Time ifsTime)
After a successful transmission of a frame (beacon, data) or an ack frame reception,...
EventId m_ifsEvent
Scheduler event for Interframe spacing wait time.
void MlmeScanRequest(MlmeScanRequestParams params) override
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
Ptr< UniformRandomVariable > m_uniformVar
The uniform random variable used in this mac layer.
uint8_t m_macMaxFrameRetries
The maximum number of retries allowed after a transmission failure.
PendingPrimitiveStatus m_pendPrimitive
Indicates the pending primitive when PLME.SET operation (page or channel switch) is called from withi...
EventId m_respWaitTimeout
Scheduler event for a response to a request command frame.
uint16_t GetSuperframeField()
Constructs a Superframe specification field from the local information, the superframe Specification ...
bool IsCoordDest()
Check if the packet destination is its coordinator.
EventId m_ackWaitTimeout
Scheduler event for the ACK timeout of the currently transmitted data packet.
void StartCAP(SuperframeType superframeType)
Called to begin the Contention Access Period (CAP) in a beacon-enabled mode.
Mac64Address m_macCoordExtendedAddress
The extended address of the coordinator through which the device is associated.
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p) override
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
void EnqueueTxQElement(std::shared_ptr< TxQueueElement > txQElement)
Add an element to the transmission queue.
EventId m_incCapEvent
Scheduler event for the end of the incoming superframe CAP.
Mac16Address GetCoordShortAddress() const
Get the coordinator short address currently associated to this device.
std::deque< std::shared_ptr< TxQueueElement > > m_txQueue
The transmit queue used by the MAC.
void SendDataRequestCommand()
Used to send a data request command (i.e.
EventId m_trackingEvent
Scheduler event to track the incoming beacons.
uint64_t GetTxPacketSymbols()
Obtain the number of symbols in the packet which is currently being sent by the MAC layer.
uint32_t m_beaconInterval
Indication of the Interval used by the coordinator to transmit beacon frames expressed in symbols.
Mac16Address m_shortAddress
The short address (16 bit address) used by this MAC.
EventId m_assocResCmdWaitTimeout
Scheduler event for the lost of a association response command frame.
void PlmeGetAttributeConfirm(PhyEnumeration status, PhyPibAttributeIdentifier id, Ptr< PhyPibAttributes > attribute)
IEEE 802.15.4-2006 section 6.2.2.6 PLME-GET.confirm Get attributes per definition from Table 23 in se...
uint8_t m_macBeaconOrder
Used by a PAN coordinator or coordinator.
void SetPhy(Ptr< LrWpanPhy > phy)
Set the underlying PHY for the MAC.
void MlmePollRequest(MlmePollRequestParams params) override
IEEE 802.15.4-2011, section 6.2.14.2 MLME-POLL.request Prompts the device to request data from the co...
void RemoveFirstTxQElement()
Remove the tip of the transmission queue, including clean up related to the last packet transmission.
TracedValue< SuperframeStatus > m_outSuperframeStatus
The current period of the outgoing superframe.
void SetRxOnWhenIdle(bool rxOnWhenIdle)
Set if the receiver should be enabled when the MAC is idle.
void PlmeCcaConfirm(PhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
void PlmeSetAttributeConfirm(PhyEnumeration status, PhyPibAttributeIdentifier id)
IEEE 802.15.4-2006 section 6.2.2.10 PLME-SET.confirm Set attributes per definition from Table 23 in s...
EventId m_scanOrphanEvent
Scheduler event for the end of an ORPHAN channel scan.
void StartInactivePeriod(SuperframeType superframeType)
Start the Inactive Period in a beacon-enabled mode.
uint32_t GetIfsSize()
Get the size of the Interframe Space according to MPDU size (m_txPkt).
EventId m_capEvent
Scheduler event for the end of the outgoing superframe CAP.
void PlmeSetTRXStateConfirm(PhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.
TracedValue< MacState > m_macState
The current state of the MAC layer.
void EndChannelEnergyScan()
Called at the end of one ED channel scan.
uint8_t m_incomingFnlCapSlot
Indication of the Slot where the CAP portion of the INCOMING Superframe ends.
bool m_ignoreDataCmdAck
This flag informs the MAC that an association response command was received before the acknowledgment...
TracedCallback< Ptr< const Packet > > m_macTxEnqueueTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
uint8_t m_numLostBeacons
The number of consecutive loss beacons in a beacon tracking operation.
uint8_t GetMacMaxFrameRetries() const
Get the macMaxFrameRetries attribute value.
bool IsTxAckReq()
Check if the packet to transmit requires acknowledgment.
void SendOneBeacon()
Called to send a single beacon frame.
void LostAssocRespCommand()
Called after m_assocRespCmdWaitTime timeout while waiting for an association response command.
void PlmeEdConfirm(PhyEnumeration status, uint8_t energyLevel)
IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level.
bool m_coor
Indicates if the current device is a coordinator type.
uint8_t m_lastRxFrameLqi
Keep track of the last received frame Link Quality Indicator.
void EndChannelScan()
Called at the end of the current channel scan (Active or Passive) for a given duration.
void EndAssociateRequest()
Called to end an MLME-ASSOCIATE.request after changing the page and channel number.
uint64_t m_macResponseWaitTime
The maximum time, in multiples of aBaseSuperframeDuration, a device shall wait for a response command...
void DoInitialize() override
Initialize() implementation.
Represent the Mac Trailer with the Frame Check Sequence field.
void EnableFcs(bool enable)
Enable or disable FCS calculation for this trailer.
void SetFcs(Ptr< const Packet > p)
Calculate and set the FCS value based on the given packet.
bool CheckFcs(Ptr< const Packet > p)
Check the FCS of a given packet against the FCS value stored in the trailer.
Represent the Pending Address Specification field.
Represent the Superframe Specification information field.
void SetPanCoor(bool panCoor)
Set the Superframe Specification PAN coordinator field.
uint8_t GetFinalCapSlot() const
Get the the Final CAP Slot.
void SetAssocPermit(bool assocPermit)
Set the Superframe Specification Association Permit field.
void SetBattLifeExt(bool battLifeExt)
Set the Superframe Specification Battery Life Extension (BLE).
bool IsBattLifeExt() const
Check if the Battery Life Extension bit is enabled.
uint8_t GetBeaconOrder() const
Get the Superframe Specification Beacon Order field.
uint8_t GetFrameOrder() const
Get the Superframe Specification Frame Order field.
uint16_t GetSuperframe() const
Get the Superframe specification information field.
void SetFinalCapSlot(uint8_t capSlot)
Set the superframe specification Final CAP slot field.
void SetBeaconOrder(uint8_t bcnOrder)
Set the superframe specification Beacon Order field.
void SetSuperframeOrder(uint8_t frmOrder)
Set the superframe specification Superframe Order field.
constexpr uint32_t aMaxSIFSFrameSize
The maximum size of an MPDU, in octets, that can be followed by a Short InterFrame Spacing (SIFS) per...
constexpr uint32_t aMaxLostBeacons
The number of consecutive lost beacons that will cause the MAC sublayer of a receiving device to decl...
constexpr uint32_t aMaxBeaconPayloadLength
The maximum size, in octets, of a beacon payload.
constexpr uint32_t aMaxPhyPacketSize
The maximum packet size accepted by the PHY.
constexpr uint32_t aUnitBackoffPeriod
Number of symbols per CSMA/CA time unit, default 20 symbols.
constexpr uint32_t aTurnaroundTime
The turnaround time in symbol periods for switching the transceiver from RX to TX or vice-versa.
constexpr uint32_t aBaseSuperframeDuration
Length of a superframe in symbols.
constexpr uint32_t aMinMPDUOverhead
The minimum number of octets added by the MAC sublayer to the PSDU.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Callback< R, Args... > MakeNullCallback()
Build null Callbacks which take no arguments, for varying number of template arguments,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
MacPibAttributeIdentifier
IEEE 802.15.4-2006 PHY and MAC PIB Attribute Identifiers Table 23 and Table 86.
SuperframeType
Superframe type.
PhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
MacStatus
The status of a confirm or an indication primitive as a result of a previous request.
PhyPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
@ macPanId
The 16-bit identifier of the Personal Area Network (PAN).
@ pCurrentChannel
RF channel used for transmissions and receptions.
@ macShortAddress
The short address of the device (16 bit address).
@ macRxOnWhenIdle
Indication of whether the MAC is enabled during idle periods.
@ macBeaconPayloadLength
The length in octets of the beacon payload.
@ macPromiscuousMode
Indication of whether the MAC sublayer is in a promiscuous mode.
@ pCurrentPage
The current channel page.
@ macExtendedAddress
The extended address of the device (64 bit address).
@ macAssociationPermit
Indication of whether a coordinator is allowing association.
@ macBeaconPayload
The contents of the beacon payload.
@ CHANNEL_ACCESS_FAILURE
CHANNEL_ACCESS_FAILURE.
@ CHANNEL_IDLE
CHANNEL_IDLE.
@ SET_PHY_TX_ON
SET_PHY_TX_ON.
@ MAC_CSMA_DEFERRED
MAC_CSMA_DEFERRED.
@ MAC_INACTIVE
MAC_INACTIVE.
@ MAC_SENDING
MAC_SENDING.
@ MAC_ACK_PENDING
MAC_ACK_PENDING.
@ BEACON
The Beacon transmission or reception Period.
@ INACTIVE
Inactive Period or unslotted CSMA-CA.
@ CAP
Contention Access Period.
@ CFP
Contention Free Period.
@ MLME_SCAN_REQ
Pending MLME-SCAN.request primitive.
@ MLME_NONE
No pending primitive.
@ MLME_START_REQ
Pending MLME-START.request primitive.
@ MLME_ASSOC_REQ
Pending MLME-ASSOCIATION.request primitive.
@ FFD
Full Functional Device (FFD).
@ INCOMING
Incoming Superframe.
@ OUTGOING
Outgoing Superframe.
@ IEEE_802_15_4_PHY_RX_ON
@ IEEE_802_15_4_PHY_TRX_OFF
@ IEEE_802_15_4_PHY_TX_ON
@ IEEE_802_15_4_PHY_SUCCESS
@ IEEE_802_15_4_PHY_UNSPECIFIED
@ TX_OPTION_GTS
TX_OPTION_GTS.
@ TX_OPTION_ACK
TX_OPTION_ACK.
@ TX_OPTION_INDIRECT
TX_OPTION_INDIRECT.
@ TRANSACTION_OVERFLOW
There is no capacity to store the transaction.
@ NO_BEACON
A scan operation failed to find any network beacons.
@ UNSUPPORTED_ATTRIBUTE
SET/GET request issued with a non supported ID.
@ NO_SHORT_ADDRESS
Failure due to unallocated 16-bit short address.
@ ACCESS_DENIED
PAN access denied.
@ BEACON_LOSS
The beacon was lost following a synchronization request.
@ CHANNEL_ACCESS_FAILURE
A Tx could not take place due to activity in the CH.
@ READ_ONLY
SET/GET request issued for a read only attribute.
@ TRANSACTION_EXPIRED
The transaction expired and its information discarded.
@ SCAN_IN_PROGRESS
Scan failed because already performing another scan.
@ FRAME_TOO_LONG
Frame more than aMaxPHYPacketSize or too large for CAP or GTS.
@ INVALID_ADDRESS
Invalid source or destination address.
@ FULL_CAPACITY
PAN at capacity.
@ SUCCESS
The operation was completed successfully.
@ NO_ACK
No acknowledgment was received after macMaxFrameRetries.
@ NO_DATA
No response data were available following a request.
@ INVALID_PARAMETER
Primitive parameter not supported or out of range.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
SequenceNumber< uint8_t, int8_t > SequenceNumber8
8 bit Sequence number.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
std::ostream & operator<<(std::ostream &os, const SuperframeField &superframeField)
Stream insertion operator.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
MCPS-DATA.confirm params.
MacStatus m_status
The status of the last MSDU transmission.
uint8_t m_msduHandle
MSDU handle.
MCPS-DATA.indication params.
MCPS-DATA.request params.
MLME-ASSOCIATE.confirm params.
Mac16Address m_assocShortAddr
The short address used in the association request.
MacStatus m_status
The status of a MLME-associate.request.
MLME-ASSOCIATE.indication params.
uint8_t lqi
The link quality indicator of the received associate request command (Not officially supported in the...
Mac64Address m_extDevAddr
The extended address of the device requesting association.
uint8_t capabilityInfo
The operational capabilities of the device requesting association.
MLME-ASSOCIATE.request params.
MLME-ASSOCIATE.response params.
MLME-BEACON-NOTIFY.indication params.
PanDescriptor m_panDescriptor
The PAN descriptor for the received beacon.
uint32_t m_sduLength
The number of octets contained in the beacon payload.
uint8_t m_bsn
The beacon sequence number.
Ptr< Packet > m_sdu
The set of octets comprising the beacon payload.
MLME-COMM-STATUS.indication params.
uint8_t m_dstAddrMode
The destination addressing mode for this primitive.
uint16_t m_panId
The PAN identifier of the device from which the frame was received or to which the frame was being se...
Mac64Address m_srcExtAddr
The extended address of the entity from which the frame causing the error originated.
MacStatus m_status
The communication status.
Mac16Address m_srcShortAddr
The short address of the entity from which the frame causing the error originated.
Mac16Address m_dstShortAddr
The short address of the device for which the frame was intended.
uint8_t m_srcAddrMode
The source addressing mode for this primitive.
Mac64Address m_dstExtAddr
The extended address of the device for which the frame was intended.
MLME-ORPHAN.indication params.
Mac64Address m_orphanAddr
The address of the orphaned device.
MLME-ORPHAN.response params.
MLME-START.confirm params.
MacStatus m_status
The confirmation status resulting from a MLME-poll.request.
MLME-POLL.request params.
MLME-SCAN.confirm params.
std::vector< uint8_t > m_unscannedCh
A list of channels given in the request which were not scanned (Not valid for ED scans).
uint32_t m_chPage
The channel page on which the scan was performed.
std::vector< uint8_t > m_energyDetList
A list of energy measurements, one for each channel searched during ED scan (Not valid for Active,...
MacStatus m_status
The status of the scan request.
std::vector< PanDescriptor > m_panDescList
A list of PAN descriptor, one for each beacon found (Not valid for ED and Orphan scans).
uint8_t m_resultListSize
The number of elements returned in the appropriate result list.
uint8_t m_scanType
Indicates the type of scan performed (ED,ACTIVE,PASSIVE,ORPHAN).
MLME-SCAN.request params.
MacStatus m_status
The result of the request to write the PIB attribute.
MacPibAttributeIdentifier id
The id of the PIB attribute that was written.
MLME-START.confirm params.
MacStatus m_status
The status of a MLME-start.request.
MLME-START.request params.
MLME-SYNC-LOSS.indication params.
uint16_t m_panId
The PAN identifier with which the device lost synchronization or to which it was realigned.
MacStatus m_lossReason
The reason for the lost of synchronization.
MLME-SYNC.request params.
PAN Descriptor, Table 17 IEEE 802.15.4-2011.
uint16_t m_coorPanId
The PAN ID of the coordinator as specified in the received beacon frame.
uint8_t m_logCh
The current channel number occupied by the network.
Time m_timeStamp
Beacon frame reception time.
bool m_gtsPermit
TRUE if the beacon is from the PAN coordinator that is accepting GTS requests.
Mac16Address m_coorShortAddr
The coordinator short address as specified in the coordinator address mode.
uint16_t m_superframeSpec
The superframe specification as specified in the received beacon frame.
AddressMode m_coorAddrMode
The coordinator addressing mode corresponding to the received beacon frame.
uint8_t m_linkQuality
The LQI at which the network beacon was received.
uint8_t m_logChPage
The current channel page occupied by the network.
Mac64Address m_coorExtAddr
The coordinator extended address as specified in the coordinator address mode.