17#include "ns3/packet.h"
18#include "ns3/simulator.h"
22#undef NS_LOG_APPEND_CONTEXT
23#define NS_LOG_APPEND_CONTEXT \
24 std::clog << "[" << m_nwkNetworkAddress << " | " << m_nwkIeeeAddress << "] ";
38 TypeId(
"ns3::zigbee::ZigbeeNwk")
40 .SetGroupName(
"Zigbee")
42 .AddAttribute(
"NwkcCoordinatorCapable",
43 "[Constant] Indicates whether the device is capable of becoming a"
44 "Zigbee coordinator.",
48 .AddAttribute(
"NwkcProtocolVersion",
49 "[Constant] The version of the Zigbee NWK protocol in"
50 "the device (placeholder)",
54 .AddAttribute(
"NwkcRouteDiscoveryTime",
55 "[Constant] The duration until a route discovery expires",
60 .AddAttribute(
"NwkcInitialRREQRetries",
61 "[Constant] The number of times the first broadcast transmission"
62 "of a RREQ cmd frame is retried.",
66 .AddAttribute(
"NwkcRREQRetries",
67 "[Constant] The number of times the broadcast transmission of a"
68 "RREQ cmd frame is retried on relay by intermediate router or"
73 .AddAttribute(
"NwkcRREQRetryInterval",
74 "[Constant] The duration between retries of a broadcast RREQ "
79 .AddAttribute(
"NwkcMinRREQJitter",
80 "[Constant] The minimum jitter for broadcast retransmission "
85 .AddAttribute(
"NwkcMaxRREQJitter",
86 "[Constant] The duration between retries of a broadcast RREQ (msec)",
90 .AddAttribute(
"MaxPendingTxQueueSize",
91 "The maximum size of the table storing pending packets awaiting "
92 "to be transmitted after discovering a route to the destination.",
96 .AddTraceSource(
"RreqRetriesExhausted",
97 "Trace source indicating when a node has "
98 "reached the maximum allowed number of RREQ retries during a "
99 "route discovery request",
101 "ns3::zigbee::ZigbeeNwk::RreqRetriesExhaustedTracedCallback");
223 std::ostream* os = stream->GetStream();
224 std::ios oldState(
nullptr);
225 oldState.copyfmt(*os);
227 std::ostringstream nwkAddr;
228 std::ostringstream ieeeAddr;
233 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
234 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
242 std::ostream* os = stream->GetStream();
243 std::ios oldState(
nullptr);
244 oldState.copyfmt(*os);
246 std::ostringstream nwkAddr;
247 std::ostringstream ieeeAddr;
252 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
253 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
261 std::ostream* os = stream->GetStream();
262 std::ios oldState(
nullptr);
263 oldState.copyfmt(*os);
265 std::ostringstream nwkAddr;
266 std::ostringstream ieeeAddr;
271 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
272 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
280 std::ostream* os = stream->GetStream();
281 std::ios oldState(
nullptr);
282 oldState.copyfmt(*os);
284 std::ostringstream nwkAddr;
285 std::ostringstream ieeeAddr;
290 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
291 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
312 return entry->GetNextHopAddr();
338 msdu->RemoveHeader(nwkHeader);
349 neighborEntry->SetLqi(params.m_mpduLinkQuality);
375 bool rebroadcastFlag =
false;
381 rebroadcastFlag =
true;
389 if (rebroadcastFlag && nwkHeader.
GetRadius() > 0)
392 rebroadcastPkt->AddHeader(nwkHeader);
441 msdu->AddHeader(nwkHeader);
448 msdu->RemoveHeader(payloadType);
463 uint8_t linkCost =
GetLinkCost(params.m_mpduLinkQuality);
468 msdu->RemoveHeader(payload);
470 ReceiveRREQ(params.m_srcAddr, linkCost, nwkHeader, payload);
475 msdu->RemoveHeader(payload);
477 ReceiveRREP(params.m_srcAddr, linkCost, nwkHeader, payload);
482 NS_LOG_ERROR(
"Inter PAN frame received but not supported");
504 uint8_t pathCost = linkCost + payload.
GetPathCost();
537 FindNextHop(macSrcAddr, pathCost, nwkHeader, payload, nextHop);
542 NS_LOG_DEBUG(
"RREQ is for me or my children, sending a RREP to [" << macSrcAddr <<
"]");
553 <<
"] not found, forwarding RREQ");
579 rreqRetryTableEntry->GetRreqEventId().Cancel();
583 uint8_t pathCost = linkCost + payload.
GetPathCost();
598 if (routeEntry->IsGroupIdPresent())
606 routeEntry->SetNextHopAddr(macSrcAddr);
607 discEntry->SetResidualCost(pathCost);
612 if (pathCost < discEntry->GetResidualCost())
614 routeEntry->SetNextHopAddr(macSrcAddr);
615 discEntry->SetResidualCost(pathCost);
620 <<
"] is for me; received from last hop ["
621 << macSrcAddr <<
"]");
644 pendingTxPkt->nsduHandle);
654 mcpsDataparams.
m_dstAddr = routeEntry->GetNextHopAddr();
660 pendingTxPkt->txPkt);
677 if (payload.
GetPathCost() < discEntry->GetResidualCost())
682 routeEntry->SetNextHopAddr(macSrcAddr);
684 discEntry->SetResidualCost(pathCost);
686 SendRREP(discEntry->GetSenderAddr(),
694 NS_LOG_ERROR(
"Route discovery entry detected but no corresponding routing "
695 "table entry found");
705 return address ==
"FF:FF" || address ==
"FF:FD" || address ==
"FF:FC" || address ==
"FF:FB";
739 nextHop = entry->GetNextHopAddr();
797 if (pathCost < discEntry->GetForwardCost())
800 discEntry->SetSenderAddr(macSrcAddr);
801 discEntry->SetForwardCost(pathCost);
846 if (pathCost < discEntry->GetForwardCost())
849 routeEntry->SetNextHopAddr(macSrcAddr);
850 discEntry->SetForwardCost(pathCost);
859 NS_LOG_ERROR(
"Entry found in the discovery table but not the routing table");
878 bool routeRecord =
false;
892 routeEntry->SetNextHopAddr(macSrcAddr);
946 packet->PeekHeader(nwkHeaderData);
1041 bufferedElement->txPkt->PeekHeader(nwkHeader);
1060 nldeDataConfirmParams.
m_nsduHandle = bufferedElement->nwkHandle;
1075 if (params.m_status != MacStatus::SUCCESS)
1095 std::vector<uint8_t> energyList = params.m_energyDetList;
1100 << std::hex << channelMask << std::dec <<
" | EnergyList: " << energyList);
1103 uint32_t countAcceptableChannels = 0;
1104 uint8_t energyListPos = 0;
1108 if (channelMask & (1 << i))
1113 countAcceptableChannels++;
1120 <<
"Energy scan complete, " << countAcceptableChannels
1124 if (countAcceptableChannels == 0)
1151 if (params.m_status == MacStatus::NO_BEACON || params.m_status == MacStatus::SUCCESS)
1161 uint8_t channel = 0;
1165 std::vector<uint8_t> pansPerChannel(27);
1167 for (
const auto& panDescriptor : params.m_panDescList)
1171 secondFilteredChannelMask &= ~(1 << panDescriptor.m_logCh);
1173 pansPerChannel[panDescriptor.m_logCh] += 1;
1180 if (secondFilteredChannelMask & (1 << i))
1187 if (channel < 11 || channel > 26)
1191 uint8_t channelIndex = 0;
1192 uint8_t lowestPanNum = 99;
1193 for (
const auto& numPans : pansPerChannel)
1195 if (numPans != 0 && numPans <= lowestPanNum)
1197 channel = channelIndex;
1198 lowestPanNum = numPans;
1204 "Invalid channel in PAN descriptor list during ACTIVE scan");
1214 <<
"Active scan complete, page " << std::dec << page <<
", channel "
1215 << std::dec << channel <<
" and PAN ID 0x" << std::hex << panId << std::dec
1233 MacPibAttributeIdentifier::macShortAddress,
1258 if (params.m_status == MacStatus::SUCCESS)
1262 <<
" PARENT capable device(s) found");
1271 NS_LOG_DEBUG(
"[NLME-NETWORK-DISCOVERY.request]: Active scan failed with"
1285 if (params.m_status == MacStatus::SUCCESS)
1296 MacPibAttributeIdentifier::macShortAddress);
1302 NS_LOG_DEBUG(
"[NLME-JOIN.request]: Orphan scan completed but no networks found");
1329 if (params.m_status == MacStatus::SUCCESS)
1347 <<
"Status: " << joinConfirmParams.
m_status <<
" | PAN ID: 0x"
1348 << std::hex <<
m_nwkPanId <<
" | Extended PAN ID: 0x"
1353 NS_LOG_ERROR(
"Entry not found while updating relationship");
1363 <<
"Status: " << joinConfirmParams.
m_status <<
" | PAN ID: 0x"
1364 << std::hex <<
m_nwkPanId <<
" | Extended PAN ID: 0x"
1369 NS_LOG_ERROR(
"Entry not found while updating relationship");
1377 if (params.m_status == MacStatus::FULL_CAPACITY)
1384 entry->SetPotentialParent(
false);
1388 NS_LOG_ERROR(
"Neighbor not found when discarding as potential parent");
1395 entry->SetPotentialParent(
false);
1399 NS_LOG_ERROR(
"Neighbor not found when discarding as potential parent");
1440 <<
"Status: " << nwkConfirmStatus <<
" | PAN ID:" << std::hex <<
m_nwkPanId
1450 confirmParams.
m_status = nwkConfirmStatus;
1457 <<
"Status: " << nwkConfirmStatus <<
" | PAN ID: 0x" << std::hex <<
m_nwkPanId
1467 confirmParams.
m_status = nwkConfirmStatus;
1485 if (params.m_status == MacStatus::SUCCESS &&
1486 params.id == MacPibAttributeIdentifier::macShortAddress)
1492 MacPibAttributeIdentifier::macExtendedAddress);
1494 else if (params.m_status == MacStatus::SUCCESS &&
1495 params.id == MacPibAttributeIdentifier::macBeaconPayload)
1509 else if (params.m_status == MacStatus::SUCCESS &&
1510 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1530 if (params.m_status == MacStatus::SUCCESS &&
1531 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1550 if (params.m_status == MacStatus::SUCCESS &&
1551 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1555 else if (params.m_status == MacStatus::SUCCESS &&
1556 params.id == MacPibAttributeIdentifier::macBeaconPayload)
1569 NS_LOG_ERROR(
"Beacon payload update failed during a NLME-START-ROUTER.request");
1582 if (status == MacStatus::SUCCESS)
1584 if (
id == MacPibAttributeIdentifier::macExtendedAddress)
1588 else if (
id == MacPibAttributeIdentifier::macShortAddress)
1592 else if (
id == MacPibAttributeIdentifier::macPanId)
1596 else if (
id == MacPibAttributeIdentifier::pCurrentChannel)
1604 if (
id == MacPibAttributeIdentifier::macExtendedAddress && status == MacStatus::SUCCESS)
1638 if (
id == MacPibAttributeIdentifier::macShortAddress)
1642 MacPibAttributeIdentifier::macPanId);
1644 else if (
id == MacPibAttributeIdentifier::macPanId)
1663 status == MacStatus::SUCCESS)
1665 if (
id == MacPibAttributeIdentifier::pCurrentChannel)
1719 << params.m_orphanAddr <<
" | " << entry->GetNwkAddr()
1720 <<
"] found in neighbor table, responding to orphaned device");
1733 if (params.m_status == MacStatus::SUCCESS)
1767 if ((params.m_sdu->GetSize() == 0) ||
1776 params.m_sdu->RemoveHeader(beaconPayload);
1792 descriptor.
m_panId = params.m_panDescriptor.m_coorPanId;
1794 descriptor.
m_logCh = params.m_panDescriptor.m_logCh;
1813 NS_LOG_DEBUG(
"Received beacon frame from [" << params.m_panDescriptor.m_coorShortAddr
1822 entry->SetNwkAddr(params.m_panDescriptor.m_coorShortAddr);
1823 entry->SetTimeoutCounter(
Seconds(15728640));
1825 entry->SetLqi(params.m_panDescriptor.m_linkQuality);
1836 if (params.m_panDescriptor.m_coorShortAddr ==
Mac16Address(
"00:00"))
1848 params.m_panDescriptor.m_coorShortAddr,
1856 params.m_panDescriptor.m_linkQuality,
1864 newEntry->SetExtPanId(beaconPayload.
GetExtPanId());
1865 newEntry->SetLogicalCh(params.m_panDescriptor.m_logCh);
1885 if (entry->GetDeviceType() == devType)
1888 responseParams.
m_status = MacStatus::SUCCESS;
1941 responseParams.
m_status = MacStatus::SUCCESS;
1954 responseParams.
m_status = MacStatus::FULL_CAPACITY;
1959 <<
"Storing an Associate response command with the allocated address "
1973 NS_LOG_DEBUG(
"The source and the destination of the route request are the same!");
1981 NS_LOG_DEBUG(
"Cannot send data, the device is not currently associated");
2001 if (params.m_useAlias)
2004 nwkHeader.
SetSeqNum(params.m_aliasSeqNumber.GetValue());
2012 if (params.m_radius == 0)
2021 if (params.m_securityEnable)
2024 NS_ABORT_MSG(
"Security processing is currently not supported");
2036 if (params.m_dstAddrMode ==
MCST)
2045 packet->AddHeader(nwkHeader);
2049 if (params.m_dstAddrMode ==
MCST)
2084 mcpsDataparams.
m_dstAddr = entry->GetNwkAddr();
2114 "channelsField and its channelPageCount size do not match "
2115 "in networkFormationParams");
2132 if (params.m_distributedNetwork)
2137 if (params.m_distributedNetwork ==
Mac16Address(
"00:00"))
2159 if (params.m_scanChannelList.channelPageCount != 1)
2166 uint32_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2170 NS_FATAL_ERROR(
"PHY band not supported (Only page 0 is supported)");
2173 uint8_t channelsCount = 0;
2174 for (
int i = 11; i <= 26; i++)
2176 channelsCount += (params.m_scanChannelList.channelsField[0] >> i) & 1;
2182 if (channelsCount == 1)
2188 mlmeParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2193 else if (channelsCount > 1)
2197 mlmeParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2211 NS_FATAL_ERROR(
"The source and the destination of the route request are the same!");
2262 if (params.m_radius == 0)
2301 else if (params.m_dstAddrMode ==
MCST)
2303 NS_ABORT_MSG(
"Multicast Route discovery not supported");
2314 if (params.m_noRouteCache)
2348 if (params.m_scanDuration > 14)
2353 if (params.m_scanChannelList.channelPageCount != params.m_scanChannelList.channelsField.size())
2356 "and the channelsField structure size does not match");
2362 if (params.m_scanChannelList.channelsField.size() != 1)
2367 uint8_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2377 scanParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2382 <<
" on page " << page <<
" and channels 0x" << std::hex
2383 << params.m_scanChannelList.channelsField[0] << std::dec);
2400 "Device already present in neighbor table. ");
2458 <<
") with address [" << allocatedAddr
2459 <<
" | " << params.m_deviceAddr <<
"]");
2485 if (params.m_scanDuration > 14)
2490 if (params.m_scanChannelList.channelPageCount != params.m_scanChannelList.channelsField.size())
2493 "and the channelsField structure size does not match");
2501 if (params.m_scanChannelList.channelsField.size() != 1)
2506 uint8_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2523 scanParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2529 <<
"sending orphan notifications on page " << page <<
" and channels "
2530 << std::hex << params.m_scanChannelList.channelsField[0]);
2540 NS_LOG_ERROR(
"Error PAN id of neighbor device not found");
2554 assocParams.
m_chNum = bestParentEntry->GetLogicalCh();
2559 if (bestParentEntry->GetNwkAddr() !=
Mac16Address(
"FF:FE"))
2564 <<
"Send Association Request [" << bestParentEntry->GetNwkAddr()
2565 <<
"] | PAN ID: " << std::hex <<
"0x" << panId
2566 <<
" | Extended PAN ID: 0x" << params.m_extendedPanId << std::dec);
2572 NS_LOG_DEBUG(
"Send Assoc. Req. to [" << bestParentEntry->GetNwkAddr()
2573 <<
"] in \nPAN id and Ext PAN id: " << std::hex
2574 <<
"(0x" << panId <<
" | 0x"
2575 << params.m_extendedPanId <<
")" << std::dec);
2613 NS_ASSERT_MSG(params.m_beaconOrder == 15,
"Beacon mode not supported for zigbee");
2614 NS_ASSERT_MSG(params.m_superframeOrder == 15,
"Beacon mode not supported for zigbee");
2629 NS_LOG_ERROR(
"This device is not a Zigbee Router or is not joined to this network");
2639 MacPibAttributeIdentifier::pCurrentChannel);
2704 p->PeekHeader(peekedNwkHeader);
2707 pendingTxPkt->dstAddr = peekedNwkHeader.
GetDstAddr();
2708 pendingTxPkt->nsduHandle = nsduHandle;
2709 pendingTxPkt->txPkt = p;
2731 if ((*iter)->dstAddr == dst)
2758 txPkt->macHandle = macHandle;
2759 txPkt->nwkHandle = nwkHandle;
2765 NS_LOG_DEBUG(
"Zigbee Tx Buffer is full, packet dropped.");
2775 if (bufferedPkt->macHandle == macHandle)
2777 txPkt = bufferedPkt;
2780 [&macHandle](
Ptr<TxPkt> pkt) {
return pkt->macHandle == macHandle; });
2801 return static_cast<NwkStatus>(macStatus);
2846 uint8_t mappedValue;
2852 else if ((lqi <= 50) && (lqi > 45))
2856 else if ((lqi <= 45) && (lqi > 40))
2860 else if ((lqi <= 40) && (lqi > 38))
2864 else if ((lqi <= 38) && (lqi > 35))
2868 else if ((lqi <= 35) && (lqi > 24))
2900 uint8_t rreqRetries)
2907 nsdu->AddHeader(payload);
2908 nsdu->AddHeader(payloadType);
2909 nsdu->AddHeader(nwkHeader);
2920 if (rreqRetryTableEntry->GetRreqRetryCount() >= rreqRetries)
2943 rreqRetryTableEntry->SetRreqRetryCount(rreqRetryTableEntry->GetRreqRetryCount() +
2945 rreqRetryTableEntry->SetRreqEventId(rreqRetryEvent);
3019 params.m_dstAddr = nextHop;
3024 nsdu->AddHeader(payload);
3025 nsdu->AddHeader(payloadType);
3026 nsdu->AddHeader(nwkHeader);
3061 MacPibAttributeIdentifier::macBeaconPayloadLength,
3078 MacPibAttributeIdentifier::macBeaconPayload,
3091 os <<
"FULL CAPACITY";
3094 os <<
"ACCESS DENIED";
3097 os <<
"COUNTER ERROR";
3100 os <<
"IMPROPER KEY TYPE";
3103 os <<
"IMPROPER SECURITY LEVEL";
3106 os <<
"UNSUPPORTED LEGACY";
3109 os <<
"UNSUPPORTED SECURITY";
3112 os <<
"BEACON LOSS";
3115 os <<
"CHANNEL ACCESS FAILURE";
3121 os <<
"DISABLE TRX FAILURE";
3124 os <<
"SECURITY ERROR";
3127 os <<
"FRAME TOO LONG";
3130 os <<
"INVALID GTS";
3133 os <<
"INVALID HANDLE";
3136 os <<
"INVALID PARAMETER MAC";
3139 os <<
"NO ACKNOLEDGMENT";
3148 os <<
"NO SHORT ADDRESS";
3154 os <<
"PAN ID CONFLICT";
3160 os <<
"TRANSACTION EXPIRED";
3163 os <<
"TRANSACTION OVERFLOW";
3169 os <<
"UNAVAILABLE KEY";
3172 os <<
"INVALID ADDRESS";
3175 os <<
"ON TIME TOO LONG";
3181 os <<
"TRACKING OFF";
3184 os <<
"INVALID INDEX";
3190 os <<
"SUPERFRAME OVERLAP";
3193 os <<
"INVALID PARAMETER";
3196 os <<
"INVALID REQUEST";
3199 os <<
"NO PERMITED";
3202 os <<
"STARTUP FAILURE";
3205 os <<
"ALREADY PRESENT";
3208 os <<
"SYNC FAILURE";
3211 os <<
"NEIGHBOR TABLE FULL";
3214 os <<
"UNKNOWN DEVICE";
3217 os <<
"UNSUPPORTED ATTRIBUTE";
3220 os <<
"NO NETWORKS";
3223 os <<
"MAX FRAME COUNTER";
3229 os <<
"BAD CCM OUTPUT";
3232 os <<
"ROUTE DISCOVERY FAILED";
3235 os <<
"ROUTE ERROR";
3238 os <<
"BT TABLE FULL";
3241 os <<
"FRAME NOT BUFFERED";
3244 os <<
"INVALID INTERFACE";
3247 os <<
"LIMIT REACHED";
3250 os <<
"SCAN IN PROGRESS";
3257operator<<(std::ostream& os,
const std::vector<uint8_t>& vec)
3259 std::copy(vec.begin(), vec.end(), std::ostream_iterator<uint16_t>(os,
" "));
3264operator<<(std::ostream& os,
const uint8_t& num)
3266 os << static_cast<uint16_t>(num);
bool IsNull() const
Check for null implementation.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
An identifier for simulation events.
This class can contain 16 bit addresses.
static Mac16Address GetBroadcast()
uint64_t ConvertToInt() const
A base class which provides memory management and object aggregation.
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte 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.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
virtual void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p)=0
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
virtual void MlmeOrphanResponse(MlmeOrphanResponseParams params)=0
IEEE 802.15.4-2011, section 6.2.7.2 MLME-ORPHAN.response Primitive used to initiatte a response to an...
virtual void MlmeGetRequest(MacPibAttributeIdentifier id)=0
IEEE 802.15.4-2006, section 7.1.6.1 MLME-GET.request Request information about a given PIB attribute.
virtual void MlmeScanRequest(MlmeScanRequestParams params)=0
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
virtual void MlmeAssociateResponse(MlmeAssociateResponseParams params)=0
IEEE 802.15.4-2011, section 6.2.2.3 MLME-ASSOCIATE.response Primitive used to initiate a response to ...
virtual void MlmeStartRequest(MlmeStartRequestParams params)=0
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
virtual void MlmeAssociateRequest(MlmeAssociateRequestParams params)=0
IEEE 802.15.4-2011, section 6.2.2.1 MLME-ASSOCIATE.request Request primitive used by a device to requ...
virtual void MlmeSetRequest(MacPibAttributeIdentifier id, Ptr< MacPibAttributes > attribute)=0
IEEE 802.15.4-2011, section 6.2.11.1 MLME-SET.request Attempts to write the given value to the indica...
void Dispose()
Dispose of all broadcast transaction records (BTR) in the broadcast transaction table(BTT).
bool AddEntry(Ptr< BroadcastTransactionRecord > entry)
Add a broadcast transaction record (BTR) to the broadcast transaction table(BTT).
bool LookUpEntry(uint8_t seq, Ptr< BroadcastTransactionRecord > &entryFound)
Look up for broadcast transaction record in the broadcast transaction table (BTT).
bool GetParent(Ptr< NeighborTableEntry > &entryFound)
Look for this device Parent neighbor (A.K.A coordinator).
void Dispose()
Dispose of the table and all its elements.
bool LookUpForBestParent(uint64_t epid, Ptr< NeighborTableEntry > &entryFound)
Perform a search for the best candidate parent based on some attributes.
bool AddEntry(Ptr< NeighborTableEntry > entry)
Add an entry to the neighbor table.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the neighbor table.
bool LookUpEntry(Mac16Address nwkAddr, Ptr< NeighborTableEntry > &entryFound)
Look and return and entry if exists in the neighbor table.
uint32_t GetSize()
Get the size of the neighbor table.
void Delete(Mac64Address extAddr)
Delete the specified entry from the neighbor table.
bool GetEntry(uint64_t extPanId, uint16_t &panId)
Get the 16 bit MAC PAN id based on the reference extended PAN id.
void AddEntry(uint64_t extPanId, uint16_t panId)
Add an entry to the PAN Id table.
void Dispose()
Dispose of the table and all its elements.
void Dispose()
Dispose of the table and all its elements.
void Delete(uint8_t id, Mac16Address src)
Delete an entry from the route discovery table.
bool AddEntry(Ptr< RouteDiscoveryTableEntry > rt)
Add an entry to the route discovery table, in essence the contents of a RREQ command.
bool LookUpEntry(uint8_t id, Mac16Address src, Ptr< RouteDiscoveryTableEntry > &entryFound)
Look up for a route discovery table entry, the seareched entry must match the id and the src address ...
void Print(Ptr< OutputStreamWrapper > stream)
Print the contents of the route discovery table.
void DeleteExpiredEntry()
Delete the first occrurance of an expired entry (ROUTE_INACTIVE status)
bool AddEntry(Ptr< RoutingTableEntry > rt)
Adds an entry to the routing table.
uint32_t GetMaxTableSize() const
Get the maximum size of the routing table.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the Routing table.
uint32_t GetSize()
Get the size of the routing table.
bool LookUpEntry(Mac16Address dstAddr, Ptr< RoutingTableEntry > &entryFound)
Look for an specific entry in the routing table.
void Dispose()
Dispose of the table and all its elements.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the neighbor table.
void Dispose()
Dispose of the table and all its elements.
bool LookUpEntry(uint8_t rreqId, Ptr< RreqRetryTableEntry > &entryFound)
Look up for an entry in the table.
void Delete(uint8_t rreqId)
Delete an entry from the table using the RREQ ID.
bool AddEntry(Ptr< RreqRetryTableEntry > entry)
Adds an entry to the table.
Represents the payload portion of a beacon frame.
bool GetRouterCapacity() const
Get the router capacity capability.
void SetDeviceDepth(uint8_t deviceDepth)
Set the cevice depth object.
uint8_t GetProtocolId() const
Get the Protocol Id used.
uint8_t GetStackProfile() const
Get the Stack Profile used.
void SetRouterCapacity(bool routerCapacity)
Set the Router Capacity capability True = The device is able to accept join.request from router-capab...
uint64_t GetExtPanId() const
Get the extended PAN identifier.
void SetStackProfile(uint8_t stackProfile)
Set the network profile identifier.
void SetEndDevCapacity(bool endDevCapacity)
Set the end device Capacity.
bool GetEndDevCapacity() const
Get the end dev capacity.
void SetTxOffset(uint32_t txOffset)
Set the Tx Offset time in symbols.
void SetExtPanId(uint64_t extPanId)
Set the extended PAN id.
Class that implements the Zigbee Specification Network Layer.
void SendDataUcst(Ptr< Packet > packet, uint8_t nwkHandle)
Send a data unicast packet, and if necessary look for the next hop route and store the pending data t...
NeighborTable m_nwkNeighborTable
The network layer neighbor table See Zigbee specification r22.1.0, 3.6.1.5.
RouteDiscoveryStatus ProcessManyToOneRoute(Mac16Address macSrcAddr, uint8_t pathCost, ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteRequestCommand payload)
Process Many-To-One routes.
ZigbeeNwk()
Default constructor.
Mac64Address GetIeeeAddress() const
Obtain this device 64 bit IEEE address (A.K.A.
NlmeStartRouterRequestParams m_startRouterParams
Temporarily store the NLME-START-ROUTER.request parameters during the router initialization process.
uint8_t m_nwkConcentratorDiscoveryTime
The time in seconds between concentrator route discoveries.
void DisposePendingTx()
Dispose of all PendingTxPkt accumulated in the pending transmission queue.
uint8_t m_nwkCapabilityInformation
This NIB attribute contains the device capability information established at network joining time.
void MlmeOrphanIndication(lrwpan::MlmeOrphanIndicationParams params)
IEEE 802.15.4-2011 sections 6.2.7.1, Zigbee Specification r22.1.0 Section 3.6.1.4....
void UpdateBeaconPayload()
Updates the content of the beacon payload with the most recent information in the NWK.
TracedCallback< uint8_t, Mac16Address, uint8_t > m_rreqRetriesExhaustedTrace
A trace source that fires when a node has reached the maximum number of RREQ retries allowed.
Mac16Address AllocateNetworkAddress()
Used by a Zigbee coordinator or router to allocate a 16 bit address (A.K.A short address or network a...
void NlmeDirectJoinRequest(NlmeDirectJoinRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.16 and 3.6.1.4.3 NLME-DIRECT-JOIN.request Allows the next...
RoutingTable m_nwkRoutingTable
The network layer routing table See Zigbee specification r22.1.0, 3.6.3.2.
double m_nwkcMinRREQJitter
Minimum Route request broadcast jitter time (msec).
SequenceNumber8 m_nwkSequenceNumber
The sequence number used to identify outgoing frames See Zigbee specification r22....
NlmeNetworkFormationRequestParams m_netFormParams
The parameters used during a NLME-NETWORK-FORMATION.request.
void McpsDataConfirm(lrwpan::McpsDataConfirmParams params)
IEEE 802.15.4-2011 section 6.3.2 MCPS-DATA.confirm Reports the results of a request to a transfer dat...
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random values.
NlmeJoinIndicationParams m_joinIndParams
Temporarily store the NLME-JOIN.indication parameters while the join operations (asocciation) conclud...
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const
Print the entries in the routing table.
Mac16Address FindRoute(Mac16Address dst, bool &neighbor)
Search for a specific destination in this device neighbor and routing tables.
void SetNlmeJoinConfirmCallback(NlmeJoinConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
void NlmeStartRouterRequest(NlmeStartRouterRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.9 NLME-START-ROUTER.request This primitive allows the nex...
void SetNlmeRouteDiscoveryConfirmCallback(NlmeRouteDiscoveryConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
uint8_t m_currentChannel
Used to store the value of the PHY current channel.
Time m_routeExpiryTime
The expiration time of routing table entry.
static TypeId GetTypeId()
Get the type ID.
void NldeDataRequest(NldeDataRequestParams params, Ptr< Packet > packet)
Zigbee Specification r22.1.0, Section 3.2.1.1 NLDE-DATA.request Request to transfer a NSDU.
void SendRREP(Mac16Address nextHop, Mac16Address originator, Mac16Address responder, uint8_t rreqId, uint8_t pathcost)
Construct and send a route reply command.
void PrintNeighborTable(Ptr< OutputStreamWrapper > stream) const
Print the entries in the neighbor table.
void MlmeSetConfirm(lrwpan::MlmeSetConfirmParams params)
IEEE 802.15.4-2011 section 6.2.11.2 MLME-SET.confirm Reports the result of an attempt to change a MAC...
void UpdateBeaconPayloadLength()
Create and store a MAC beacon payload, then updates its registered size in the MAC.
StackProfile m_nwkStackProfile
Describes the current stack profile used in this NWK layer.
NlmeDirectJoinConfirmCallback m_nlmeDirectJoinConfirmCallback
This callback is used by the next layer of a zigbee coordinator or router to be notified of the resul...
bool m_nwkReportConstantCost
If false, the NWK layer shall calculate the link cost from all neighbor nodes using the LQI values re...
Time m_nwkcRREQRetryInterval
Duration between retries of a broadcast route request command frame.
void DoInitialize() override
Initialize() implementation.
NlmeNetworkFormationConfirmCallback m_nlmeNetworkFormationConfirmCallback
This callback is used to to notify the results of a network formation to the APS sublayer making the ...
void MlmeCommStatusIndication(lrwpan::MlmeCommStatusIndicationParams params)
IEEE 802.15.4-2011 section 6.2.4.2 MLME-COMM-STATUS.indication Allows the MAC MLME to indicate a comm...
PanIdTable m_panIdTable
Use to keep track of neighboring 16 bit PAN id.
Mac16Address m_nwkNetworkAddress
The 16-bit address that the device uses to communicate with the PAN.
RouteDiscoveryStatus FindNextHop(Mac16Address macSrcAddr, uint8_t pathCost, ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteRequestCommand payload, Mac16Address &nextHop)
Find the next hop in route to a destination.
void SetMac(Ptr< lrwpan::LrWpanMacBase > mac)
Set the underlying MAC to use in this Zigbee NWK.
uint8_t m_nwkParentInformation
The behavior depends upon whether the device is a FFD or RFD.
SequenceNumber8 m_macHandle
The handle assigned when doing a transmission request to the MAC layer.
NlmeJoinRequestParams m_joinParams
The parameters used during a NLME-JOIN.request.
void MlmeBeaconNotifyIndication(lrwpan::MlmeBeaconNotifyIndicationParams params)
IEEE 802.15.4-2011, Section 6.2.4.1 MLME-BEACON-NOTIFY.indication Allows the MAC MLME to indicate the...
void SetNlmeJoinIndicationCallback(NlmeJoinIndicationCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
uint8_t m_nwkcInitialRREQRetries
The number of times the first broadcast transmission of a route request command frame is retried.
void SetNlmeNetworkDiscoveryConfirmCallback(NlmeNetworkDiscoveryConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
void MlmeAssociateConfirm(lrwpan::MlmeAssociateConfirmParams params)
IEEE 802.15.4-2011 section MlME-ASSOCIATE.confirm Report the results of an associate request attempt.
void EnqueuePendingTx(Ptr< Packet > p, uint8_t nsduHandle)
Enqueue a packet in the pending transmission queue until a route is discovered for its destination.
void NlmeNetworkDiscoveryRequest(NlmeNetworkDiscoveryRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.3 NLME-NETWORK-DISCOVERY.request Allows the next higher l...
Ptr< NetFormPendingParamsGen > m_netFormParamsGen
The values temporarily stored as a result of the initial steps of a NLME-NETWORK-FORMATION....
NlmeStartRouterConfirmCallback m_nlmeStartRouterConfirmCallback
This callback is used by the next layer of a zigbee router or device to be notified of the result of ...
NlmeJoinConfirmCallback m_nlmeJoinConfirmCallback
This callback is used by the next layer of a zigbee router or device to be notified of the result of ...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void NlmeJoinRequest(NlmeJoinRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.13 NLME-JOIN.request This primitive allows the next highe...
uint8_t m_nwkConcentratorRadius
This NIB attribute indicates the hop count radius for concentrator route discoveries (Used by Many-To...
double m_nwkcMaxRREQJitter
Maximum Route request broadcast jitter time (msec).
Mac64Address m_nwkIeeeAddress
The EUI 64 bit IEEE address of the local device.
void SetNlmeStartRouterConfirmCallback(NlmeStartRouterConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
void ReceiveRREP(Mac16Address macSrcAddr, uint8_t linkCost, ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteReplyCommand payload)
Handles the reception of a route reply command.
uint16_t m_nwkPanId
This NIB attribute should, at all times, have the same value as macPANId .
void SetNldeDataConfirmCallback(NldeDataConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
Ptr< Packet > m_beaconPayload
Points to the beacon payload used during the network formation process.
uint8_t m_countRREQRetries
Count the number of retries this device has transmitted an RREQ.
PendingPrimitiveNwk m_pendPrimitiveNwk
Indicates the current primitive in use in the NWK layer.
bool IsBroadcastAddress(Mac16Address address)
Returns true if the address is a broadcast address according to Zigbee specification r22....
BroadcastTransactionTable m_btt
The broadcast transaction table.
void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
uint8_t m_nwkMaxBroadcastRetries
The maximum number of retries allowed after a broadcast transmission failure See Zigbe Specification ...
uint32_t m_maxPendingTxQueueSize
The maximum size of the pending transaction queue.
uint8_t m_nwkMaxDepth
The depth a device can have.
AddrAllocMethod m_nwkAddrAlloc
A value that determines the method used to assign addresses.
std::vector< NetworkDescriptor > m_networkDescriptorList
Temporarily store beacons information from POS routers and PAN coordinators during a network-discover...
NldeDataConfirmCallback m_nldeDataConfirmCallback
This callback is used to respond to data PDU (NSDU) transfer request issued by APS sublayer to the NW...
Ptr< lrwpan::LrWpanMacBase > m_mac
Pointer to the underlying MAC connected to this Zigbee NWK.
void MlmeStartConfirm(lrwpan::MlmeStartConfirmParams params)
IEEE 802.15.4-2011 section 7.1.14.2 MLME-START.confirm Reports the results of a network start request...
uint8_t GetLinkCost(uint8_t lqi) const
Obtain the link cost based on the value of the nwkReportConstantCost.
void MlmeAssociateIndication(lrwpan::MlmeAssociateIndicationParams params)
IEEE 802.15.4-2011, Section 6.2.2.2.
void ReceiveRREQ(Mac16Address macSrcAddr, uint8_t linkCost, ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteRequestCommand payload)
Handles the reception of a route request command.
void PrintRREQRetryTable(Ptr< OutputStreamWrapper > stream) const
Print the entries in the RREQ retry table.
void PrintRouteDiscoveryTable(Ptr< OutputStreamWrapper > stream)
Print the entries in the route discovery table.
Ptr< UniformRandomVariable > m_rreqJitter
Provides uniform random values for the route request jitter.
NwkStatus GetNwkStatus(lrwpan::MacStatus macStatus) const
Cast a Mac layer status to a NWK layer status.
uint16_t m_nwkMaxChildren
The number of children a device is allowed to have on its current network.
uint8_t m_scanEnergyThreshold
The maximum acceptable energy level used in an energy scan taking place during a NLME-NETWORK-FORMATI...
void MlmeScanConfirm(lrwpan::MlmeScanConfirmParams params)
IEEE 802.15.4-2011 section 6.2.10.2 MLME-SCAN.confirm Reports the results of a scan request.
void NlmeNetworkFormationRequest(NlmeNetworkFormationRequestParams params)
Zigbee Specification r22.1.0, Section 3.2.2.5 and 3.6.1.1 NLME-NETWORK-FORMATION.request Request the ...
SequenceNumber8 m_routeRequestId
The counter used to identify route request commands.
NlmeNetworkDiscoveryConfirmCallback m_nlmeNetworkDiscoveryConfirmCallback
This callback is used to to notify the results of a network formation to the APS sublayer making the ...
uint16_t m_nwkEndDeviceTimeoutDefault
Indicates the index of the requested timeout field that contains the timeout in minutes for any end d...
void DisposeTxPktBuffer()
Dispose of all the entries in the TxPkt Buffer.
bool m_nwkIsConcentrator
This NIB attribute is a flag determining if this device is a concentrator (Use in Many-To-One routing...
Time m_nwkcRouteDiscoveryTime
Indicates the duration until a route discovery expires.
uint8_t m_txBufferMaxSize
The maximum size of the transmission buffer.
lrwpan::MlmeAssociateRequestParams m_associateParams
Temporarily store MLME-ASSOCIATE.request parameters during a NLME-JOIN.request.
void SendRREQ(ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteRequestCommand payload, uint8_t rreqRetries)
Send a route request command.
RreqRetryTable m_rreqRetryTable
Keep track of all the route request retries.
bool m_nwkUseTreeRouting
This NIB attribute indicates whether the NWK layer should assume the ability to use hierarchical rout...
void SetNlmeNetworkFormationConfirmCallback(NlmeNetworkFormationConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
Time m_nwkNetworkBroadcastDeliveryTime
Time duration that a broadcast message needs to encompass the entire network.
NlmeRouteDiscoveryConfirmCallback m_nlmeRouteDiscoveryConfirmCallback
This callback is used to to notify the results of a network formation to the APS sublayer making the ...
void SetNlmeDirectJoinConfirmCallback(NlmeDirectJoinConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
bool m_nwkSymLink
Describes the current route symmetry: True: Routes are considered to be symmetric links.
uint32_t m_filteredChannelMask
Contains the list of channels with acceptable energy levels in a bitmap form.
std::deque< Ptr< PendingTxPkt > > m_pendingTxQueue
The pending transaction queue of data packets awaiting to be transmitted until a route to the destina...
uint16_t m_nwkMaxRouters
The number of routers any one device is allowed to have as children.
bool m_nwkcCoordinatorCapable
Indicates whether the device is capable of becoming the ZigBee coordinator Zigbee Specification r22....
void McpsDataIndication(lrwpan::McpsDataIndicationParams params, Ptr< Packet > msdu)
IEEE 802.15.4-2011 section 6.3.3 MCPS-DATA.indication Indicates the reception of an MSDU from MAC to ...
void BufferTxPkt(Ptr< Packet > p, uint8_t macHandle, uint8_t nwkHandle)
Buffer a copy of a DATA frame for post transmission handling (Transmission failure counts,...
bool RetrieveTxPkt(uint8_t macHandle, Ptr< TxPkt > &txPkt)
Retrieves a previously DATA frame buffered in the TxPkt buffer.
void NlmeRouteDiscoveryRequest(NlmeRouteDiscoveryRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.33.3 and 3.6.3.5 NLME-ROUTE-DISCOVERY....
std::deque< Ptr< TxPkt > > m_txBuffer
The transmission buffer.
Ptr< lrwpan::LrWpanMacBase > GetMac() const
Get the underlying MAC used by the current Zigbee NWK.
uint8_t GetLQINonLinearValue(uint8_t lqi) const
Get a non linear representation of a Link Quality Indicator (LQI).
void SetNldeDataIndicationCallback(NldeDataIndicationCallback c)
Set the callback for the end of a RX, as part of the interconnections between the NWK and the APS sub...
void DoDispose() override
Destructor implementation.
uint8_t m_nwkcRREQRetries
The number of times the broadcast transmission of a route request command frame is retried on relay b...
bool DequeuePendingTx(Mac16Address dst, Ptr< PendingTxPkt > entry)
Dequeue a packet previously enqueued in the pending transmission queue.
uint8_t m_nwkcProtocolVersion
Indicates the version of the ZigBee NWK protocol in the device.
void SendDataBcst(Ptr< Packet > packet, uint8_t nwkHandle)
Send a data broadcast packet, and add a record to the broadcast transaction table (BTT).
Mac16Address GetNetworkAddress() const
Obtain this device 16 bit network address (A.K.A.
void MlmeGetConfirm(lrwpan::MacStatus status, lrwpan::MacPibAttributeIdentifier id, Ptr< lrwpan::MacPibAttributes > attribute)
IEEE 802.15.4-2011 section 6.2.5.1 MLME-GET.confirm Reports the result of an attempt to obtain a MAC ...
NldeDataIndicationCallback m_nldeDataIndicationCallback
This callback is used to notify incoming packets to the APS sublayer.
RouteDiscoveryTable m_nwkRouteDiscoveryTable
The network route discovery table See Zigbee specification r22.1.0, 3.6.3.2.
uint64_t m_nwkExtendedPanId
The extended PAN identifier for the PAN of which the device is a member.
NlmeJoinIndicationCallback m_nlmeJoinIndicationCallback
This callback is used by the next layer of a zigbee coordinator or router to be notified when a new d...
Represent a variable portion of the zigbee payload header that includes the route reply command.
void SetRouteReqId(uint8_t rid)
Set the Route request identifier.
Mac16Address GetRespAddr() const
Get the Responder address.
uint8_t GetPathCost() const
Get the path cost.
Mac16Address GetOrigAddr() const
Get the Originator address.
void SetRespAddr(Mac16Address addr)
Set Responder address.
uint8_t GetRouteReqId() const
Get the Route request identifier.
void SetOrigAddr(Mac16Address addr)
Set Originator address.
void SetPathCost(uint8_t cost)
Set the path cost.
Represent a variable portion of the zigbee payload header that includes the route request command.
uint8_t GetPathCost() const
Set the path cost.
uint8_t GetRouteReqId() const
Get the Route request identifier.
void SetCmdOptManyToOneField(enum ManyToOne manyToOne)
Set the command option field Many To One.
void SetPathCost(uint8_t cost)
Set the path cost.
uint8_t GetCmdOptManyToOneField() const
Get the command option field Many To One.
void SetRouteReqId(uint8_t id)
Set the Route request identifier.
void SetDstAddr(Mac16Address addr)
Set Destination address.
Mac16Address GetDstAddr() const
Get the Destination address.
Represent the static portion of the zigbee payload header that describes the payload command type.
NwkCommandType GetCmdType() const
Get the command frame type.
#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_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
MacPibAttributeIdentifier
IEEE 802.15.4-2006 PHY and MAC PIB Attribute Identifiers Table 23 and Table 86.
MacStatus
The status of a confirm or an indication primitive as a result of a previous request.
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.
Time Minutes(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t 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.
NwkDeviceType
The network layer device type.
static const double RequestedTimeoutField[15]
Requested Timeout Field See Zigbee Specification r22.1.0, 3.4.11.3.1.
NwkStatus
Network layer status values Combines Zigbee Specification r22.1.0 Table 3-73 and and IEEE 802....
@ ZIGBEE_COORDINATOR
Zigbee coordinator.
@ ZIGBEE_ENDDEVICE
Zigbee end device.
@ ZIGBEE_ROUTER
Zigbee router.
@ ROUTE_VALIDATION_UNDERWAY
Route discovery validation underway.
@ ROUTE_ACTIVE
Route active.
@ ROUTE_DISCOVERY_UNDERWAY
Route discovery underway.
@ NO_ROUTING_CAPACITY
No routing capacity.
@ NO_ROUTE_AVAILABLE
No route available.
@ ENDDEVICE
End device or router treated as an end device.
@ MCST
Multicast Address mode.
@ NO_ADDRESS
No destination address.
@ UCST_BCST
Unicast or Broadcast address mode.
@ NLME_NET_DISCV
Pending NLME-NETWORK-DISCOVERY.request primitive.
@ NLME_NETWORK_FORMATION
Pending NLME-NETWORK-FORMATION.request primitive.
@ NLME_JOIN
Pending NLME-JOIN.request primitive.
@ NLDE_NLME_NONE
No pending primitive.
@ NLME_START_ROUTER
Pending NLME-START-ROUTER.request primitive.
@ NLME_JOIN_INDICATION
Pending NLME-JOIN.indication primitive.
@ NLME_ROUTE_DISCOVERY
Pending NLME-ROUTE-DISCOVERY.request primitive.
@ NBR_CHILD
Neighbor is the child.
@ NBR_PARENT
Neighbor is the parent.
@ NBR_NONE
No relationship.
@ BEACON_LOSS
The beacon was lost following a synchronization request.
@ UNSUPPORTED_LEGACY
Deprecated security used in IEEE 802.15.4-2003.
@ ALREADY_PRESENT
Already present (Zigbee specification r22.1.0)
@ READ_ONLY
SET/GET request issued for a read only attribute.
@ MAX_FRM_COUNTER
Max Frame counter (IEEE 802.15.4, Zigbee specification r22.1.0)
@ UNSUPPORTED_SECURITY
The security applied is not supported.
@ DISABLE_TRX_FAILURE
The attempt to disable the transceier has failed.
@ FULL_CAPACITY
PAN at capacity.
@ NO_DATA
No response data were available following a request.
@ IMPROPER_KEY_TYPE
The key is not allowed to be used with that frame type.
@ INVALID_PARAMETER_MAC
Invalid parameter in response to a request passed to the MAC.
@ TRANSACTION_OVERFLOW
There is no capacity to store the transaction.
@ SUPERFRAME_OVERLAP
Coordinator sperframe and this device superframe tx overlap.
@ NOT_PERMITED
Not permitted (Zigbee specification r22.1.0)
@ INVALID_REQUEST
Invalid request (Zigbee specification r22.1.0)
@ OUT_OF_CAP
(Deprecated) See IEEE 802.15.4-2003
@ NO_NETWORKS
No network (Zigbee specification r22.1.0)
@ SECURITY_ERROR
Cryptographic process of the frame failed(FAILED_SECURITY_CHECK).
@ UNSUPPORTED_ATTRIBUTE
Unsupported attribute (Zigbee specification r22.1.0)
@ TRANSACTION_EXPIRED
The transaction expired and its information discarded.
@ REALIGMENT
A coordinator realigment command has been received.
@ SUCCESS
The operation was completed successfully.
@ LIMIT_REACHED
Limit reached during network scan (IEEE 802.15.4-2011)
@ NO_SHORT_ADDRESS
Failure due to unallocated 16-bit short address.
@ INVALID_INTERFACE
Invalid interface (Zigbee specification r22.1.0)
@ INVALID_INDEX
A MAC PIB write failed because specified index is out of range.
@ UNAVAILABLE_KEY
Unavailable key, unknown or blacklisted.
@ INVALID_PARAMETER
Invalid Parameter (Zigbee specification r22.1.0)
@ INVALID_ADDRESS
Invalid source or destination address.
@ FRAME_NOT_BUFFERED
Frame not buffered (Zigbee specification r22.1.0)
@ IMPROPER_SECURITY_LEVEL
Insufficient security level expected by the recipient.
@ INVALID_HANDLE
When purging from TX queue handle was not found.
@ CHANNEL_ACCESS_FAILURE
A Tx could not take place due to activity in the CH.
@ TX_ACTIVE
The transceiver was already enabled.
@ BAD_CCM_OUTPUT
Bad ccm output (IEEE 802.15.4, Zigbee specification r22.1.0)
@ UNKNOWN_DEVICE
Unknown device (Zigbee specification r22.1.0)
@ ACCESS_DENIED
PAN access denied.
@ NEIGHBOR_TABLE_FULL
Neighbor table full (Zigbee specification r22.1.0)
@ FRAME_TOO_LONG
Frame more than aMaxPHYPacketSize or too large for CAP or GTS.
@ BT_TABLE_FULL
Bt table full (Zigbee specification r22.1.0)
@ DENIED
The GTS request has been denied by the PAN coordinator.
@ ROUTE_DISCOVERY_FAILED
Route discovery failed (Zigbee specification r22.1.0)
@ SYNC_FAILURE
Sync Failure (Zigbee specification r22.1.0)
@ TRACKING_OFF
This device is currently not tracking beacons.
@ COUNTER_ERROR
The frame counter of the received frame is invalid.
@ NO_ACK
No acknowledgment was received after macMaxFrameRetries.
@ STARTUP_FAILURE
Startup failure (Zigbee specification r22.1.0)
@ ON_TIME_TOO_LONG
RX enable request fail due to syms.
@ NO_BEACON
A scan operation failed to find any network beacons.
@ SCAN_IN_PROGRESS
The dev was scanning during this call (IEEE 802.5.4)
@ PAST_TIME
Rx enable request fail due to lack of time in superframe.
@ PAN_ID_CONFLICT
PAN id conflict detected and informed to the coordinator.
@ ROUTE_ERROR
Route error (Zigbee specification r22.1.0)
@ NO_KEY
No Key (Zigbee specification r22.1.0)
@ INVALID_GTS
Missing GTS transmit or undefined direction.
@ STOCHASTIC_ALLOC
Stochastic address allocation (Zigbee Specification r22.1.0 Section 3.6.1.7)
@ DISTRIBUTED_ALLOC
Distributed address allocation (Zigbee Specification r22.1.0 Section 3.6.1.6)
DiscoverRouteType
Zigbee Specification r22.1.0, Values of the discover route sub-field (Table 3-47)
@ ENABLE_ROUTE_DISCOVERY
Enable route discovery.
@ ASSOCIATION
The device is requesting to join a network through association.
@ DIRECT_OR_REJOIN
The device is joining directly or rejoining using the orphaning procedure.
@ NWK_COMMAND
Network command frame type.
@ INTER_PAN
Inter-Pan frame type.
@ ROUTE_REP_CMD
Route response command.
@ ROUTE_REQ_CMD
Route request command.
StackProfile
Use to describe the identifier of the zigbee stack profile.
@ ZIGBEE_PRO
Zigbee stack profile 0x02 (Zigbee Pro, also known as r22.1.0, 3.0)
std::ostream & operator<<(std::ostream &os, const NwkStatus &state)
Overloaded operator to print the value of a NwkStatus.
RouteDiscoveryStatus
The status returned while attempting to find the next hop in route towards a specific destination or ...
@ NO_DISCOVER_ROUTE
We are currently not allowed to perform a route discovery for this route (RouteDiscover flag in netwo...
@ ROUTE_NOT_FOUND
The next hop was not found.
@ MANY_TO_ONE_ROUTE
A new Many-To-One route was created.
@ ROUTE_FOUND
The next hop toward the destination was found in our routing table or neighbor table (Mesh route).
@ NO_ROUTE_CHANGE
No route entry was created or updated during a Many-To-One process.
@ DISCOVER_UNDERWAY
The route was found in the tables but currently has no next hop.
@ ROUTE_UPDATED
A route was found and updated with a better route (Mesh route or Many-To-One route)
@ TABLE_FULL
Either the routing or neighbor table are full.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
MCPS-DATA.confirm params.
MCPS-DATA.indication params.
MCPS-DATA.request params.
AddressMode m_dstAddrMode
Destination address mode.
Mac16Address m_dstAddr
Destination address.
uint16_t m_dstPanId
Destination PAN identifier.
AddressMode m_srcAddrMode
Source address mode.
uint8_t m_txOptions
Tx Options (bitfield)
uint8_t m_msduHandle
MSDU handle.
MLME-ASSOCIATE.confirm params.
MLME-ASSOCIATE.indication params.
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.
uint32_t m_chPage
The channel page on which to attempt association.
uint16_t m_coordPanId
The identifier of the PAN with which to associate.
MLME-ASSOCIATE.response params.
Mac16Address m_assocShortAddr
The short address allocated by the coordinator on successful assoc.
MacStatus m_status
The status of the association attempt (As defined on Table 83 IEEE 802.15.4-2006)
Mac64Address m_extDevAddr
The extended address of the device requesting association.
MLME-BEACON-NOTIFY.indication params.
MLME-COMM-STATUS.indication params.
MLME-ORPHAN.indication params.
MLME-ORPHAN.response params.
bool m_assocMember
T = allocated with this coord | F = otherwise.
Mac64Address m_orphanAddr
The address of the orphaned device.
Mac16Address m_shortAddr
The short address allocated.
MLME-SCAN.confirm params.
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.
MLME-START.confirm params.
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.
uint8_t channelPageCount
The number of the channel page structures contained in the channel list structure.
std::vector< uint32_t > channelsField
The set of channels for a given page.
Network Descriptor, Zigbee Specification r22.1.0, 3.2.2.4, Table 3-12.
uint16_t m_panId
The 16-bit PAN identifier of the network.
uint8_t m_updateId
The value of the UpdateID from the NIB.
uint8_t m_superframeOrder
The superframe order value of the underlying MAC (Determinates the value of the active period)
bool m_routerCapacity
TRUE = The device is able to accept join requests from router-capable devices.
bool m_endDeviceCapacity
TRUE= The device is able to accept join request from end devices.
StackProfile m_stackProfile
The Zigbee stack profile identifier in use in the discovered network.
uint8_t m_logCh
The current channel number occupied by the network.
uint8_t m_beaconOrder
The beacon order value of the underlying MAC.
uint8_t m_zigbeeVersion
The version of the zigbee protocol in use in the discovered network.
uint64_t m_extPanId
The 64-bit PAN identifier of the network.
bool m_permitJoining
TRUE = Indicates that at least one zigbee router on the network currently permits joining.
NLDE-DATA.confirm params.
uint8_t m_nsduHandle
The handle associated with the NSDU being confirmed.
NwkStatus m_status
The status of the corresponding request.
Time m_txTime
The time indication for the transmitted packet based on the local clock.
NLDE-DATA.indication params.
AddressMode m_dstAddrMode
Destination address mode.
Time m_rxTime
A time indication for the received packet based on the local clock.
uint32_t m_nsduLength
The number of octets comprising the NSDU being indicated.
uint8_t m_linkQuality
LQI value delivered by the MAC on receipt of this frame.
bool m_securityUse
An indication of whether the received data is using security.
Mac16Address m_srcAddr
The individual device address from which the NSDU originated.
Mac16Address m_dstAddr
The destination address to which the NSDU was sent.
NLDE-DATA.request params.
NLME-DIRECT-JOIN.confirm params.
NwkStatus m_status
The status the corresponding request.
Mac64Address m_deviceAddr
The IEEE EUI-64 address in the request to which this is a confirmation.
NLME-DIRECT-JOIN.request params.
NLME-JOIN.confirm params.
Mac16Address m_networkAddress
The 16 bit network address that was allocated to this device.
NwkStatus m_status
The status of the corresponding request.
uint8_t m_macInterfaceIndex
The value of the MAC index from nwkMacInterfaceTable.
uint64_t m_extendedPanId
The extended 64 bit PAN ID for the network of which the device is now a member.
ChannelList m_channelList
The structure indicating the current channel of the network that has been joined.
bool m_enhancedBeacon
True if using enhanced beacons (placeholder, not supported)
NLME-JOIN.indication params.
Mac64Address m_extendedAddress
The EUI-64 bit address of an entity that has been added to the network.
uint8_t m_capabilityInfo
Specifies the operational capabilities of the joining device.
JoiningMethod m_rejoinNetwork
This parameter indicates the method used to join the network.
Mac16Address m_networkAddress
The 16 bit network address of an entity that has been added to the network.
NLME-JOIN.request params.
ChannelList m_scanChannelList
The list of all channel pages and the associated channels that shall be scanned.
uint8_t m_capabilityInfo
The operating capabilities of the device being directly joined (Bit map).
uint64_t m_extendedPanId
The 64 bit PAN identifier of the the network to join.
NLME-NETWORK-DISCOVERY.confirm params.
uint8_t m_networkCount
Gives the number of networks discovered by the search.
std::vector< NetworkDescriptor > m_netDescList
A list of descriptors, one for each of the networks discovered.
NwkStatus m_status
The status of the corresponding request.
NLME-NETWORK-DISCOVERY.request params.
NLME-ROUTE-DISCOVERY.confirm params.
NwkStatus m_status
The status as a result of this request.
NetworkStatusCode m_networkStatusCode
In case where.
NLME-ROUTE-DISCOVERY.request params.
NLME-START-ROUTER.confirm params.
NwkStatus m_status
The status of the corresponding request.
NLME-START-ROUTER.request params.
uint8_t m_beaconOrder
The beacon order of the network.
bool m_batteryLifeExt
True if the router supports battery life extension mode.
uint8_t m_superframeOrder
The superframe order of the network.