22#include <ns3/double.h>
25#include <ns3/packet.h>
26#include <ns3/random-variable-stream.h>
27#include <ns3/simulator.h>
28#include <ns3/uinteger.h>
30#undef NS_LOG_APPEND_CONTEXT
31#define NS_LOG_APPEND_CONTEXT \
32 std::clog << "[" << m_shortAddress << " | " << m_macExtendedAddress << "] ";
60 os <<
"CHANNEL_ACCESS_FAILURE";
66 os <<
"SET PHY to TX ON";
69 os <<
"MAC GTS PERIOD";
72 os <<
"SUPERFRAME INACTIVE PERIOD";
75 os <<
"CSMA DEFERRED TO NEXT PERIOD";
85 TypeId(
"ns3::lrwpan::LrWpanMac")
88 .SetGroupName(
"LrWpan")
90 .AddAttribute(
"PanId",
91 "16-bit identifier of the associated PAN",
95 .AddTraceSource(
"MacTxEnqueue",
96 "Trace source indicating a packet has been "
97 "enqueued in the transaction queue",
99 "ns3::Packet::TracedCallback")
100 .AddTraceSource(
"MacTxDequeue",
101 "Trace source indicating a packet has was "
102 "dequeued from the transaction queue",
104 "ns3::Packet::TracedCallback")
105 .AddTraceSource(
"MacIndTxEnqueue",
106 "Trace source indicating a packet has been "
107 "enqueued in the indirect transaction queue",
109 "ns3::Packet::TracedCallback")
110 .AddTraceSource(
"MacIndTxDequeue",
111 "Trace source indicating a packet has was "
112 "dequeued from the indirect transaction queue",
114 "ns3::Packet::TracedCallback")
115 .AddTraceSource(
"MacTx",
116 "Trace source indicating a packet has "
117 "arrived for transmission by this device",
119 "ns3::Packet::TracedCallback")
120 .AddTraceSource(
"MacTxOk",
121 "Trace source indicating a packet has been "
124 "ns3::Packet::TracedCallback")
125 .AddTraceSource(
"MacTxDrop",
126 "Trace source indicating a packet has been "
127 "dropped during transmission",
129 "ns3::Packet::TracedCallback")
130 .AddTraceSource(
"MacIndTxDrop",
131 "Trace source indicating a packet has been "
132 "dropped from the indirect transaction queue"
133 "(The pending transaction list)",
135 "ns3::Packet::TracedCallback")
136 .AddTraceSource(
"MacPromiscRx",
137 "A packet has been received by this device, "
138 "has been passed up from the physical layer "
139 "and is being forwarded up the local protocol stack. "
140 "This is a promiscuous trace,",
142 "ns3::Packet::TracedCallback")
143 .AddTraceSource(
"MacRx",
144 "A packet has been received by this device, "
145 "has been passed up from the physical layer "
146 "and is being forwarded up the local protocol stack. "
147 "This is a non-promiscuous trace,",
149 "ns3::Packet::TracedCallback")
150 .AddTraceSource(
"MacRxDrop",
151 "Trace source indicating a packet was received, "
152 "but dropped before being forwarded up the stack",
154 "ns3::Packet::TracedCallback")
155 .AddTraceSource(
"Sniffer",
156 "Trace source simulating a non-promiscuous "
157 "packet sniffer attached to the device",
159 "ns3::Packet::TracedCallback")
160 .AddTraceSource(
"PromiscSniffer",
161 "Trace source simulating a promiscuous "
162 "packet sniffer attached to the device",
164 "ns3::Packet::TracedCallback")
165 .AddTraceSource(
"MacStateValue",
166 "The state of LrWpan Mac",
168 "ns3::TracedValueCallback::LrWpanMacState")
169 .AddTraceSource(
"MacIncSuperframeStatus",
170 "The period status of the incoming superframe",
172 "ns3::TracedValueCallback::SuperframeState")
173 .AddTraceSource(
"MacOutSuperframeStatus",
174 "The period status of the outgoing superframe",
176 "ns3::TracedValueCallback::SuperframeState")
177 .AddTraceSource(
"MacState",
178 "The state of LrWpan Mac",
180 "ns3::lrwpan::LrWpanMac::StateTracedCallback")
181 .AddTraceSource(
"MacSentPkt",
182 "Trace source reporting some information about "
185 "ns3::lrwpan::LrWpanMac::SentTracedCallback")
186 .AddTraceSource(
"IfsEnd",
187 "Trace source reporting the end of an "
188 "Interframe space (IFS)",
190 "ns3::Packet::TracedCallback");
390 NS_LOG_ERROR(
this <<
" packet too big: " << p->GetSize());
401 NS_LOG_ERROR(
this <<
" Can not send packet with no Address field");
409 switch (params.m_srcAddrMode)
416 NS_ABORT_MSG(
"Can not set source address type to ADDR_MODE_RESERVED. Aborting.");
427 NS_LOG_ERROR(
this <<
" Can not send packet with incorrect Source Address mode = "
428 << params.m_srcAddrMode);
436 switch (params.m_dstAddrMode)
443 NS_ABORT_MSG(
"Can not set destination address type to ADDR_MODE_RESERVED. Aborting.");
454 NS_LOG_ERROR(
this <<
" Can not send packet with incorrect Destination Address mode = "
455 << params.m_dstAddrMode);
488 NS_LOG_LOGIC(
"LrWpanMac::McpsDataRequest: requested an ACK on broadcast or "
489 "multicast destination ("
490 << shortAddr <<
") - forcefully removing it.");
525 p->AddHeader(macHdr);
534 p->AddTrailer(macTrailer);
536 NS_LOG_ERROR(
this <<
" Indirect transmissions not currently supported");
550 p->AddHeader(macHdr);
559 p->AddTrailer(macTrailer);
562 txQElement->txQMsduHandle = params.m_msduHandle;
563 txQElement->txQPkt = p;
588 if ((params.m_bcnOrd > 15) || (params.m_sfrmOrd > params.m_bcnOrd))
595 NS_LOG_ERROR(
this <<
"Incorrect superframe order or beacon order.");
615 confirmParams.
m_chPage = params.m_chPage;
624 NS_LOG_ERROR(
this <<
" A channel scan is already in progress");
635 NS_LOG_ERROR(
this <<
"Invalid scan duration or unsupported scan type");
664 pibAttr->phyCurrentPage = params.m_chPage;
678 bool invalidRequest =
false;
680 if (params.m_coordPanId == 0xffff)
682 invalidRequest =
true;
685 if (!invalidRequest && params.m_coordAddrMode ==
SHORT_ADDR)
690 invalidRequest =
true;
693 else if (!invalidRequest && params.m_coordAddrMode ==
EXT_ADDR)
695 if (params.m_coordExtAddr ==
Mac64Address(
"ff:ff:ff:ff:ff:ff:ff:ff") ||
696 params.m_coordExtAddr ==
Mac64Address(
"ff:ff:ff:ff:ff:ff:ff:ed"))
698 invalidRequest =
true;
706 NS_LOG_ERROR(
this <<
" Invalid PAN id in Association request");
718 pibAttr->phyCurrentPage = params.m_chPage;
772 commandPacket->AddHeader(macPayload);
773 commandPacket->AddHeader(macHdr);
779 macTrailer.
SetFcs(commandPacket);
782 commandPacket->AddTrailer(macTrailer);
816 if (params.m_assocMember)
830 commandPacket->AddHeader(macPayload);
831 commandPacket->AddHeader(macHdr);
837 macTrailer.
SetFcs(commandPacket);
840 commandPacket->AddTrailer(macTrailer);
843 txQElement->txQPkt = commandPacket;
854 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
857 pibAttr->phyCurrentChannel = params.m_logCh;
863 uint64_t searchSymbols;
864 Time searchBeaconTime;
871 if (params.m_trackBcn)
877 searchBeaconTime =
Seconds((
double)searchSymbols / symbolRate);
951 pibAttr->phyCurrentChannel = attribute->pCurrentChannel;
957 pibAttr->phyCurrentPage = attribute->pCurrentPage;
969 confirmParams.
id = id;
1007 attributes->pCurrentChannel =
m_phy->GetCurrentChannelNum();
1010 attributes->pCurrentPage =
m_phy->GetCurrentPage();
1067 beaconPacket->AddHeader(macPayload);
1068 beaconPacket->AddHeader(macHdr);
1075 macTrailer.
SetFcs(beaconPacket);
1078 beaconPacket->AddTrailer(macTrailer);
1086 NS_LOG_DEBUG(
"Outgoing superframe Active Portion (Beacon + CAP + CFP): "
1098 txQElement->txQPkt = beaconPacket;
1128 commandPacket->AddHeader(macPayload);
1129 commandPacket->AddHeader(macHdr);
1135 macTrailer.
SetFcs(commandPacket);
1138 commandPacket->AddTrailer(macTrailer);
1141 txQElement->txQPkt = commandPacket;
1169 commandPacket->AddHeader(macPayload);
1170 commandPacket->AddHeader(macHdr);
1176 macTrailer.
SetFcs(commandPacket);
1179 commandPacket->AddTrailer(macTrailer);
1182 txQElement->txQPkt = commandPacket;
1218 commandPacket->AddHeader(macPayload);
1219 commandPacket->AddHeader(macHdr);
1225 macTrailer.
SetFcs(commandPacket);
1228 commandPacket->AddTrailer(macTrailer);
1231 txQElement->txQPkt = commandPacket;
1276 commandPacket->AddHeader(macPayload);
1277 commandPacket->AddHeader(macHdr);
1283 macTrailer.
SetFcs(commandPacket);
1286 commandPacket->AddTrailer(macTrailer);
1290 txQElement->txQPkt = commandPacket;
1299 rxDataReqPkt->RemoveHeader(receivedMacHdr);
1301 rxDataReqPkt->RemoveHeader(receivedMacPayload);
1311 txQElement->txQPkt = indTxQElement->txQPkt;
1316 NS_LOG_DEBUG(
"Requested element not found in pending list");
1347 NS_LOG_ERROR(
this <<
" Coordinator realignment request not supported");
1425 bool channelFound =
false;
1431 channelFound =
true;
1521 bool channelFound =
false;
1526 channelFound =
true;
1572 uint64_t capDuration;
1574 uint64_t symbolRate;
1576 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1583 endCapTime =
Seconds((
double)capDuration / symbolRate);
1587 NS_LOG_DEBUG(
"Outgoing superframe CAP duration " << (endCapTime.GetSeconds() * symbolRate)
1588 <<
" symbols (" << endCapTime.As(
Time::S)
1590 NS_LOG_DEBUG(
"Active Slots duration " << activeSlot <<
" symbols");
1600 endCapTime =
Seconds((
double)capDuration / symbolRate);
1604 NS_LOG_DEBUG(
"Incoming superframe CAP duration " << (endCapTime.GetSeconds() * symbolRate)
1605 <<
" symbols (" << endCapTime.As(
Time::S)
1607 NS_LOG_DEBUG(
"Active Slots duration " << activeSlot <<
" symbols");
1620 uint64_t cfpDuration;
1622 uint64_t symbolRate;
1624 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1630 endCfpTime =
Seconds((
double)cfpDuration / symbolRate);
1631 if (cfpDuration > 0)
1636 NS_LOG_DEBUG(
"Incoming superframe CFP duration " << cfpDuration <<
" symbols ("
1637 << endCfpTime.As(
Time::S) <<
")");
1648 endCfpTime =
Seconds((
double)cfpDuration / symbolRate);
1650 if (cfpDuration > 0)
1655 NS_LOG_DEBUG(
"Outgoing superframe CFP duration " << cfpDuration <<
" symbols ("
1656 << endCfpTime.As(
Time::S) <<
")");
1669 uint64_t inactiveDuration;
1670 Time endInactiveTime;
1671 uint64_t symbolRate;
1673 symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1678 endInactiveTime =
Seconds((
double)inactiveDuration / symbolRate);
1680 if (inactiveDuration > 0)
1685 NS_LOG_DEBUG(
"Incoming superframe Inactive Portion duration "
1686 << inactiveDuration <<
" symbols (" << endInactiveTime.
As(
Time::S) <<
")");
1692 endInactiveTime =
Seconds((
double)inactiveDuration / symbolRate);
1694 if (inactiveDuration > 0)
1699 NS_LOG_DEBUG(
"Outgoing superframe Inactive Portion duration "
1700 << inactiveDuration <<
" symbols (" << endInactiveTime.
As(
Time::S) <<
")");
1720 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1738 uint64_t searchSymbols;
1739 Time searchBeaconTime;
1742 searchBeaconTime =
Seconds((
double)searchSymbols / symbolRate);
1757 (p->GetSize() *
m_phy->GetPhySymbolsPerOctet());
1760 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
1763 NS_LOG_DEBUG(
"Beacon Received; forwarding up (m_macBeaconRxTime: "
1768 p->RemoveTrailer(receivedMacTrailer);
1771 p->RemoveHeader(receivedMacHdr);
1774 p->RemoveHeader(receivedMacPayload);
1823 m_csmaCa->SetBatteryLifeExtension(
true);
1827 m_csmaCa->SetBatteryLifeExtension(
false);
1850 NS_LOG_DEBUG(
this <<
" Device not associated, cannot process beacon");
1855 if (p->GetSize() > 0)
1864 beaconParams.
m_sdu = p;
1872 bool descriptorExists =
false;
1882 descriptor.m_coorPanId == panDescriptor.
m_coorPanId);
1888 descriptorExists = (descriptor.m_coorExtAddr == panDescriptor.
m_coorExtAddr &&
1889 descriptor.m_coorPanId == panDescriptor.
m_coorPanId);
1892 if (descriptorExists)
1898 if (!descriptorExists)
1915 uint64_t searchSymbols;
1916 Time searchBeaconTime;
1920 searchBeaconTime =
Seconds(
static_cast<double>(searchSymbols / symbolRate));
1946 beaconParams.
m_sdu = p;
1984 if (
m_csmaCa->GetBatteryLifeExtension())
2019 return pndAddrFields;
2058 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
2065 p->RemoveTrailer(receivedMacTrailer);
2072 if (!receivedMacTrailer.
CheckFcs(p))
2079 p->RemoveHeader(receivedMacHdr);
2082 params.m_dsn = receivedMacHdr.
GetSeqNum();
2083 params.m_mpduLinkQuality = lqi;
2086 switch (params.m_srcAddrMode)
2099 switch (params.m_dstAddrMode)
2117 NS_LOG_DEBUG(
"Packet from [" << params.m_srcAddr <<
"] to [" << params.m_dstAddr
2123 NS_LOG_DEBUG(
"Packet from [" << params.m_srcExtAddr <<
"] to ["
2124 << params.m_dstExtAddr <<
"]");
2129 NS_LOG_DEBUG(
"Packet from [" << params.m_srcAddr <<
"] to [" << params.m_dstExtAddr
2135 NS_LOG_DEBUG(
"Packet from [" << params.m_srcExtAddr <<
"] to [" << params.m_dstAddr
2148 NS_LOG_ERROR(
this <<
" Data Indication Callback not initialized");
2158 acceptFrame = (receivedMacHdr.
GetFrameVer() <= 1);
2186 acceptFrame = !receivedMacHdr.
IsAckReq();
2190 acceptFrame =
false;
2203 acceptFrame =
false;
2210 acceptFrame =
false;
2216 acceptFrame =
false;
2226 p->PeekHeader(receivedMacPayload);
2232 acceptFrame =
false;
2242 ceil(6 *
m_phy->GetPhySymbolsPerOctet());
2243 Time ackTime =
Seconds((
double)ackSymbols / symbolRate);
2245 if (ackTime >= timeLeftInCap)
2247 NS_LOG_DEBUG(
"Command frame received but not enough time to transmit ACK "
2248 "before the end of CAP ");
2249 acceptFrame =
false;
2285 NS_LOG_DEBUG(
"Received a packet with ACK required while in CSMA. Cancel "
2295 m_rxPkt = originalPkt->Copy();
2300 p->PeekHeader(receivedMacPayload);
2304 NS_LOG_DEBUG(
"Data Request Command Received; processing ACK");
2307 NS_LOG_DEBUG(
"Association Request Command Received; processing ACK");
2311 NS_LOG_DEBUG(
"Association Response Command Received; processing ACK");
2325 NS_LOG_DEBUG(
"Packet from [" << params.m_srcAddr <<
"] to [" << params.m_dstAddr
2331 NS_LOG_DEBUG(
"Packet from [" << params.m_srcExtAddr <<
"] to ["
2332 << params.m_dstExtAddr <<
"]");
2337 NS_LOG_DEBUG(
"Packet from [" << params.m_srcAddr <<
"] to ["
2338 << params.m_dstExtAddr <<
"]");
2343 NS_LOG_DEBUG(
"Packet from [" << params.m_srcExtAddr <<
"] to ["
2344 << params.m_dstAddr <<
"]");
2356 p->PeekHeader(receivedMacPayload);
2454 pkt->RemoveHeader(macHdr);
2455 pkt->RemoveHeader(cmdPayload);
2460 double symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2504 double symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2550 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2608 ackPacket->AddHeader(macHdr);
2613 macTrailer.
SetFcs(ackPacket);
2615 ackPacket->AddTrailer(macTrailer);
2639 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2657 pkt->RemoveHeader(hdr);
2663 txQElement->txQPkt =
nullptr;
2664 txQElement =
nullptr;
2693 auto symbolRate = (uint64_t)
m_phy->GetDataOrSymbolRate(
false);
2697 if (ifsTime == lifsTime)
2702 else if (ifsTime == sifsTime)
2736 pkt->RemoveHeader(macHdr);
2737 pkt->RemoveHeader(cmdPayload);
2810 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
2833 p->PeekHeader(peekedMacHdr);
2846 indTxQElement->dstExtAddress = peekedMacHdr.
GetExtDstAddr();
2849 indTxQElement->seqNum = peekedMacHdr.
GetSeqNum();
2867 double symbolRate =
m_phy->GetDataOrSymbolRate(
false);
2870 indTxQElement->expireTime = expireTime;
2871 indTxQElement->txQPkt = p;
2880 indTxQElement->txQPkt->PeekHeader(peekedMacHdr);
2901 if ((*iter)->dstExtAddress == dst)
2938 else if (peekedMacHdr.
IsData())
2966 <<
" Sequence Number |"
2968 <<
" Expire time\n";
2972 transaction->txQPkt->PeekHeader(peekedMacHdr);
2973 os << transaction->dstExtAddress <<
" "
2974 <<
static_cast<uint32_t>(transaction->seqNum) <<
" ";
2978 os <<
" Command Frame ";
2980 else if (peekedMacHdr.
IsData())
2982 os <<
" Data Frame ";
2986 os <<
" Unknown Frame ";
2989 os << transaction->expireTime.As(
Time::S) <<
"\n";
3001 <<
" Sequence Number |"
3003 <<
" Frame type |\n";
3007 transaction->txQPkt->PeekHeader(peekedMacHdr);
3016 os <<
" Command Frame ";
3018 else if (peekedMacHdr.
IsData())
3020 os <<
" Data Frame ";
3024 os <<
" Unknown Frame ";
3037 m_csmaCa->AssignStreams(stream + 1);
3045 p->PeekHeader(peekedMacHdr);
3051 if (((*it)->dstExtAddress == peekedMacHdr.
GetExtDstAddr()) &&
3052 ((*it)->seqNum == peekedMacHdr.
GetSeqNum()))
3062 ((*it)->seqNum == peekedMacHdr.
GetSeqNum()))
3084 symbolRate =
m_phy->GetDataOrSymbolRate(
false);
3100 uint64_t beaconSymbols =
m_phy->GetPhySHRDuration() +
3101 1 *
m_phy->GetPhySymbolsPerOctet() +
3159 txOriginalPkt->RemoveHeader(txMacHdr);
3161 txOriginalPkt->RemoveHeader(txMacPayload);
3195 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
3211 recvOriginalPkt->RemoveHeader(receivedMacHdr);
3216 recvOriginalPkt->RemoveHeader(receivedMacPayload);
3304 confirmParams.
m_msduHandle = txQElement->txQMsduHandle;
3319 NS_FATAL_ERROR(
"Transmission attempt failed with PHY status " << status);
3322 if (!ifsWaitTime.
IsZero())
3353 m_phy->PlmeEdRequest();
3395 m_phy->PlmeEdRequest();
3425 bool channelFound =
false;
3430 channelFound =
true;
3454 NS_LOG_ERROR(
this <<
"Channel Scan: Invalid channel page");
3461 auto symbolRate =
static_cast<uint64_t
>(
m_phy->GetDataOrSymbolRate(
false));
3470 uint64_t scanDurationSym =
3473 nextScanTime =
Seconds(
static_cast<double>(scanDurationSym) / symbolRate);
3524 <<
" could not be set in the current page");
3561 NS_LOG_ERROR(
"Invalid channel parameter in MLME-start");
3590 NS_LOG_ERROR(
"Invalid page parameter in MLME-associate");
3618 NS_LOG_ERROR(
"Invalid channel parameter in MLME-associate");
3695 pkt->RemoveHeader(macHdr);
3700 pkt->RemoveHeader(cmdPayload);
3795 else if (macHdr.
IsData())
3834 NS_LOG_DEBUG(
"****** PACKET DEFERRED to the next superframe *****");
3886 ceil(6 *
m_phy->GetPhySymbolsPerOctet());
3926 NS_LOG_DEBUG(
"ERROR: Packet not for the coordinator!");
3963 return (
m_phy->GetPhySHRDuration() + 1 *
m_phy->GetPhySymbolsPerOctet() +
bool IsNull() const
Check for null implementation.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsPending() const
This method is syntactic sugar for !IsExpired().
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
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.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< Packet > Copy() const
performs a COW copy of the packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
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...
Class that implements the LR-WPAN MAC state machine.
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
Temporally 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.
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 ...
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)
std::deque< Ptr< IndTxQueueElement > > m_indTxQueue
The indirect transmit queue used by the MAC pending messages (The 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.
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.
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.
std::deque< Ptr< TxQueueElement > > m_txQueue
The transmit queue used by the MAC.
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.
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 ReceiveBeacon(uint8_t lqi, Ptr< Packet > p)
Used to process the reception of a beacon packet.
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.
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 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 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.
void PdDataIndication(uint32_t psduLength, Ptr< Packet > p, uint8_t lqi)
IEEE 802.15.4-2006 section 6.2.1.3 PD-DATA.indication Indicates the transfer of an MPDU from PHY to M...
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.
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.
void SendDataRequestCommand()
Used to send a data request command (i.e.
bool DequeueInd(Mac64Address dst, Ptr< IndTxQueueElement > entry)
Extracts a packet from pending transactions list (Indirect transmissions).
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.
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 EnqueueTxQElement(Ptr< TxQueueElement > txQElement)
Add an element to the transmission queue.
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...
Callback< R, Args... > MakeNullCallback()
#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.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
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.
Mac64Address m_coordExtAddr
The extended address of the coordinator with which to associate.
uint8_t m_coordAddrMode
The coordinator addressing mode for this primitive and subsequent MPDU.
uint8_t m_capabilityInfo
Specifies the operational capabilities of the associating device (bitmap).
Mac16Address m_coordShortAddr
The short address of the coordinator with which to associate.
uint8_t m_chNum
The channel number on which to attempt association.
uint16_t m_coordPanId
The identifier of the PAN with which to associate.
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.
MlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
uint32_t m_scanChannels
The channel numbers to be scanned.
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
uint32_t m_chPage
The channel page on which to perform scan.
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.
bool m_battLifeExt
Flag indicating whether or not the Battery life extension (BLE) features are used.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
uint32_t m_logChPage
Logical channel page on which to start using the new superframe configuration.
bool m_coorRealgn
True if a realignment request command is to be transmitted prior changing the superframe.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
bool m_panCoor
On true this device will become coordinator.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
uint16_t m_PanId
Pan Identifier used by the device.
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.