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");
213 m_mac->MlmeGetRequest(MacPibAttributeIdentifier::macExtendedAddress);
225 std::ostream* os = stream->GetStream();
226 std::ios oldState(
nullptr);
227 oldState.copyfmt(*os);
229 std::ostringstream nwkAddr;
230 std::ostringstream ieeeAddr;
235 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
236 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
244 std::ostream* os = stream->GetStream();
245 std::ios oldState(
nullptr);
246 oldState.copyfmt(*os);
248 std::ostringstream nwkAddr;
249 std::ostringstream ieeeAddr;
254 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
255 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
263 std::ostream* os = stream->GetStream();
264 std::ios oldState(
nullptr);
265 oldState.copyfmt(*os);
267 std::ostringstream nwkAddr;
268 std::ostringstream ieeeAddr;
273 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
274 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
282 std::ostream* os = stream->GetStream();
283 std::ios oldState(
nullptr);
284 oldState.copyfmt(*os);
286 std::ostringstream nwkAddr;
287 std::ostringstream ieeeAddr;
292 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
293 *os <<
"[" << ieeeAddr.str() <<
" | " << nwkAddr.str() <<
"] | ";
314 return entry->GetNextHopAddr();
340 msdu->RemoveHeader(nwkHeader);
351 neighborEntry->SetLqi(params.m_mpduLinkQuality);
377 bool rebroadcastFlag =
false;
383 rebroadcastFlag =
true;
391 if (rebroadcastFlag && nwkHeader.
GetRadius() > 0)
394 rebroadcastPkt->AddHeader(nwkHeader);
443 msdu->AddHeader(nwkHeader);
450 msdu->RemoveHeader(payloadType);
465 uint8_t linkCost =
GetLinkCost(params.m_mpduLinkQuality);
470 msdu->RemoveHeader(payload);
472 ReceiveRREQ(params.m_srcAddr, linkCost, nwkHeader, payload);
477 msdu->RemoveHeader(payload);
479 ReceiveRREP(params.m_srcAddr, linkCost, nwkHeader, payload);
484 NS_LOG_ERROR(
"Inter PAN frame received but not supported");
506 uint8_t pathCost = linkCost + payload.
GetPathCost();
539 FindNextHop(macSrcAddr, pathCost, nwkHeader, payload, nextHop);
544 NS_LOG_DEBUG(
"RREQ is for me or my children, sending a RREP to [" << macSrcAddr <<
"]");
555 <<
"] not found, forwarding RREQ");
581 rreqRetryTableEntry->GetRreqEventId().Cancel();
585 uint8_t pathCost = linkCost + payload.
GetPathCost();
600 if (routeEntry->IsGroupIdPresent())
608 routeEntry->SetNextHopAddr(macSrcAddr);
609 discEntry->SetResidualCost(pathCost);
614 if (pathCost < discEntry->GetResidualCost())
616 routeEntry->SetNextHopAddr(macSrcAddr);
617 discEntry->SetResidualCost(pathCost);
622 <<
"] is for me; received from last hop ["
623 << macSrcAddr <<
"]");
646 pendingTxPkt->nsduHandle);
656 mcpsDataparams.
m_dstAddr = routeEntry->GetNextHopAddr();
659 m_mac->McpsDataRequest(mcpsDataparams, pendingTxPkt->txPkt);
676 if (payload.
GetPathCost() < discEntry->GetResidualCost())
681 routeEntry->SetNextHopAddr(macSrcAddr);
683 discEntry->SetResidualCost(pathCost);
685 SendRREP(discEntry->GetSenderAddr(),
693 NS_LOG_ERROR(
"Route discovery entry detected but no corresponding routing "
694 "table entry found");
704 return address ==
"FF:FF" || address ==
"FF:FD" || address ==
"FF:FC" || address ==
"FF:FB";
738 nextHop = entry->GetNextHopAddr();
796 if (pathCost < discEntry->GetForwardCost())
799 discEntry->SetSenderAddr(macSrcAddr);
800 discEntry->SetForwardCost(pathCost);
845 if (pathCost < discEntry->GetForwardCost())
848 routeEntry->SetNextHopAddr(macSrcAddr);
849 discEntry->SetForwardCost(pathCost);
858 NS_LOG_ERROR(
"Entry found in the discovery table but not the routing table");
877 bool routeRecord =
false;
891 routeEntry->SetNextHopAddr(macSrcAddr);
945 packet->PeekHeader(nwkHeaderData);
993 m_mac->McpsDataRequest(mcpsDataparams, packet);
1030 m_mac->McpsDataRequest(mcpsDataparams, packet);
1040 bufferedElement->txPkt->PeekHeader(nwkHeader);
1059 nldeDataConfirmParams.
m_nsduHandle = bufferedElement->nwkHandle;
1074 if (params.m_status != MacStatus::SUCCESS)
1092 std::vector<uint8_t> energyList = params.m_energyDetList;
1095 uint32_t countAcceptableChannels = 0;
1097 for (
uint32_t i = 11; i <= 26; i++)
1099 if ((channelMask >> i) & 1)
1105 channelMaskFiltered |= (1 << i);
1106 energyList.erase(energyList.begin());
1107 countAcceptableChannels++;
1112 NS_LOG_DEBUG(
"[NLME-NETWORK-FORMATION.request]: Energy scan complete, "
1113 << countAcceptableChannels <<
" acceptable channels found : 0x" << std::hex
1114 << channelMaskFiltered << std::dec);
1116 if (countAcceptableChannels == 0)
1132 mlmeParams.
m_chPage = (channelMaskFiltered >> 27) & (0x01F);
1136 m_mac->MlmeScanRequest(mlmeParams);
1143 if (params.m_status == MacStatus::NO_BEACON || params.m_status == MacStatus::SUCCESS)
1145 uint8_t channel = 0;
1153 if (params.m_status == MacStatus::NO_BEACON)
1158 for (uint8_t j = 11; j <= 26; j++)
1178 NS_FATAL_ERROR(
"A coordinator found in active scan, but no channel judgment is "
1179 "supported, cannot complete network formation");
1203 NS_LOG_DEBUG(
"[NLME-NETWORK-FORMATION.request]: Active scan complete, page "
1204 << std::dec <<
static_cast<uint32_t>(page) <<
", channel " << std::dec
1205 <<
static_cast<uint32_t>(channel) <<
" and PAN ID 0x" << std::hex << panId
1206 << std::dec <<
" chosen.");
1221 m_mac->MlmeSetRequest(MacPibAttributeIdentifier::macShortAddress, pibAttr);
1239 NS_LOG_ERROR(
"Unknown error found during network formation");
1247 if (params.m_status == MacStatus::SUCCESS)
1249 NS_LOG_DEBUG(
"[NLME-NETWORK-DISCOVERY.request]: Active scan, "
1259 NS_LOG_DEBUG(
"[NLME-NETWORK-DISCOVERY.request]: Active scan failed with"
1273 if (params.m_status == MacStatus::SUCCESS)
1282 m_mac->MlmeGetRequest(MacPibAttributeIdentifier::macShortAddress);
1288 NS_LOG_DEBUG(
"[NLME-JOIN.request]: Orphan scan completed but no networks found");
1314 if (params.m_status == MacStatus::SUCCESS)
1329 NS_LOG_DEBUG(
"Associated SUCCESSFULLY to PAN ID and Ext PAN ID: "
1331 <<
")" << std::dec);
1335 NS_LOG_ERROR(
"Entry not found while updating relationship");
1341 switch (params.m_status)
1343 case MacStatus::ACCESS_DENIED:
1344 case MacStatus::FULL_CAPACITY:
1348 entry->SetPotentialParent(
false);
1352 NS_LOG_ERROR(
"Neighbor not found when discarding as potential parent");
1356 case MacStatus::NO_ACK:
1359 case MacStatus::CHANNEL_ACCESS_FAILURE:
1386 switch (params.m_status)
1388 case MacStatus::SUCCESS:
1391 case MacStatus::NO_SHORT_ADDRESS:
1394 case MacStatus::SUPERFRAME_OVERLAP:
1397 case MacStatus::TRACKING_OFF:
1400 case MacStatus::INVALID_PARAMETER:
1403 case MacStatus::COUNTER_ERROR:
1406 case MacStatus::UNAVAILABLE_KEY:
1409 case MacStatus::UNSUPPORTED_SECURITY:
1412 case MacStatus::CHANNEL_ACCESS_FAILURE:
1415 case MacStatus::FRAME_TOO_LONG:
1431 NS_LOG_DEBUG(
"[NLME-NETWORK-FORMATION.request]: Complete, Status "
1432 << nwkConfirmStatus <<
" | Pan Id and ExtPanId: (0x" << std::hex <<
m_nwkPanId
1442 confirmParams.
m_status = nwkConfirmStatus;
1448 NS_LOG_DEBUG(
"[NLME-START-ROUTER.request]: Complete, Status "
1449 << nwkConfirmStatus <<
" | Pan Id and ExtPanId: (0x" << std::hex <<
m_nwkPanId
1458 confirmParams.
m_status = nwkConfirmStatus;
1476 if (params.m_status == MacStatus::SUCCESS &&
1477 params.id == MacPibAttributeIdentifier::macShortAddress)
1481 m_mac->MlmeGetRequest(MacPibAttributeIdentifier::macExtendedAddress);
1483 else if (params.m_status == MacStatus::SUCCESS &&
1484 params.id == MacPibAttributeIdentifier::macBeaconPayload)
1496 m_mac->MlmeStartRequest(startParams);
1498 else if (params.m_status == MacStatus::SUCCESS &&
1499 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1519 if (params.m_status == MacStatus::SUCCESS &&
1520 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1539 if (params.m_status == MacStatus::SUCCESS &&
1540 params.id == MacPibAttributeIdentifier::macBeaconPayloadLength)
1544 else if (params.m_status == MacStatus::SUCCESS &&
1545 params.id == MacPibAttributeIdentifier::macBeaconPayload)
1557 NS_LOG_ERROR(
"Beacon payload update failed during a NLME-START-ROUTER.request");
1571 if (
id == MacPibAttributeIdentifier::macExtendedAddress && status == MacStatus::SUCCESS)
1606 if (
id == MacPibAttributeIdentifier::macShortAddress)
1609 m_mac->MlmeGetRequest(MacPibAttributeIdentifier::macPanId);
1611 else if (
id == MacPibAttributeIdentifier::macPanId)
1631 else if (status == MacStatus::SUCCESS)
1633 if (
id == MacPibAttributeIdentifier::macExtendedAddress)
1637 else if (
id == MacPibAttributeIdentifier::macShortAddress)
1641 else if (
id == MacPibAttributeIdentifier::macPanId)
1645 else if (
id == MacPibAttributeIdentifier::pCurrentChannel)
1686 << params.m_orphanAddr <<
" | " << entry->GetNwkAddr()
1687 <<
"] found in neighbor table, responding to orphaned device");
1689 m_mac->MlmeOrphanResponse(respParams);
1700 if (params.m_status == MacStatus::SUCCESS)
1734 if ((params.m_sdu->GetSize() == 0) ||
1743 params.m_sdu->RemoveHeader(beaconPayload);
1759 descriptor.
m_panId = params.m_panDescriptor.m_coorPanId;
1761 descriptor.
m_logCh = params.m_panDescriptor.m_logCh;
1780 NS_LOG_DEBUG(
"Received beacon frame from [" << params.m_panDescriptor.m_coorShortAddr
1789 entry->SetNwkAddr(params.m_panDescriptor.m_coorShortAddr);
1790 entry->SetTimeoutCounter(
Seconds(15728640));
1792 entry->SetLqi(params.m_panDescriptor.m_linkQuality);
1803 if (params.m_panDescriptor.m_coorShortAddr ==
Mac16Address(
"00:00"))
1815 params.m_panDescriptor.m_coorShortAddr,
1823 params.m_panDescriptor.m_linkQuality,
1831 newEntry->SetExtPanId(beaconPayload.
GetExtPanId());
1832 newEntry->SetLogicalCh(params.m_panDescriptor.m_logCh);
1852 if (entry->GetDeviceType() == devType)
1855 responseParams.
m_status = MacStatus::SUCCESS;
1858 m_mac->MlmeAssociateResponse(responseParams);
1908 responseParams.
m_status = MacStatus::SUCCESS;
1921 responseParams.
m_status = MacStatus::FULL_CAPACITY;
1925 NS_LOG_DEBUG(
"Storing an Associate response command with the allocated"
1929 m_mac->MlmeAssociateResponse(responseParams);
1940 NS_LOG_DEBUG(
"The source and the destination of the route request are the same!");
1948 NS_LOG_DEBUG(
"Cannot send data, the device is not currently associated");
1968 if (params.m_useAlias)
1971 nwkHeader.
SetSeqNum(params.m_aliasSeqNumber.GetValue());
1979 if (params.m_radius == 0)
1988 if (params.m_securityEnable)
1991 NS_ABORT_MSG(
"Security processing is currently not supported");
2003 if (params.m_dstAddrMode ==
MCST)
2012 packet->AddHeader(nwkHeader);
2016 if (params.m_dstAddrMode ==
MCST)
2051 mcpsDataparams.
m_dstAddr = entry->GetNwkAddr();
2053 m_mac->McpsDataRequest(mcpsDataparams, packet);
2081 "channelsField and its channelPageCount size do not match "
2082 "in networkFormationParams");
2099 if (params.m_distributedNetwork)
2104 if (params.m_distributedNetwork ==
Mac16Address(
"00:00"))
2126 if (params.m_scanChannelList.channelPageCount != 1)
2133 uint32_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2137 NS_FATAL_ERROR(
"PHY band not supported (Only page 0 is supported)");
2140 uint8_t channelsCount = 0;
2141 for (
int i = 11; i <= 26; i++)
2143 channelsCount += (params.m_scanChannelList.channelsField[0] >> i) & 1;
2149 if (channelsCount == 1)
2155 mlmeParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2158 m_mac->MlmeScanRequest(mlmeParams);
2160 else if (channelsCount > 1)
2164 mlmeParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2167 m_mac->MlmeScanRequest(mlmeParams);
2178 NS_FATAL_ERROR(
"The source and the destination of the route request are the same!");
2229 if (params.m_radius == 0)
2268 else if (params.m_dstAddrMode ==
MCST)
2270 NS_ABORT_MSG(
"Multicast Route discovery not supported");
2281 if (params.m_noRouteCache)
2315 if (params.m_scanDuration > 14)
2320 if (params.m_scanChannelList.channelPageCount != params.m_scanChannelList.channelsField.size())
2323 "and the channelsField structure size does not match");
2329 if (params.m_scanChannelList.channelsField.size() != 1)
2334 uint8_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2344 scanParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2349 <<
" on page " <<
static_cast<uint32_t>(page) <<
" and channels 0x" << std::hex
2350 << params.m_scanChannelList.channelsField[0] << std::dec);
2351 m_mac->MlmeScanRequest(scanParams);
2366 "Device already present in neighbor table. ");
2424 <<
") with address [" << allocatedAddr
2425 <<
" | " << params.m_deviceAddr <<
"]");
2451 if (params.m_scanDuration > 14)
2456 if (params.m_scanChannelList.channelPageCount != params.m_scanChannelList.channelsField.size())
2459 "and the channelsField structure size does not match");
2467 if (params.m_scanChannelList.channelsField.size() != 1)
2472 uint8_t page = (params.m_scanChannelList.channelsField[0] >> 27) & (0x01F);
2489 scanParams.
m_scanChannels = params.m_scanChannelList.channelsField[0];
2495 <<
"sending orphan notifications on page " <<
static_cast<uint32_t>(page)
2496 <<
" and channels " << std::hex << params.m_scanChannelList.channelsField[0]);
2497 m_mac->MlmeScanRequest(scanParams);
2505 NS_LOG_ERROR(
"Error PAN id of neighbor device not found");
2519 assocParams.
m_chNum = bestParentEntry->GetLogicalCh();
2524 if (bestParentEntry->GetNwkAddr() !=
Mac16Address(
"FF:FE"))
2528 NS_LOG_DEBUG(
"Send Assoc. Req. to [" << bestParentEntry->GetNwkAddr()
2529 <<
"] in PAN id and Ext PAN id: " << std::hex
2530 <<
"(0x" << panId <<
" | 0x"
2531 << params.m_extendedPanId <<
")" << std::dec);
2537 NS_LOG_DEBUG(
"Send Assoc. Req. to [" << bestParentEntry->GetNwkAddr()
2538 <<
"] in \nPAN id and Ext PAN id: " << std::hex
2539 <<
"(0x" << panId <<
" | 0x"
2540 << params.m_extendedPanId <<
")" << std::dec);
2550 m_mac->MlmeAssociateRequest(assocParams);
2579 NS_ASSERT_MSG(params.m_beaconOrder == 15,
"Beacon mode not supported for zigbee");
2580 NS_ASSERT_MSG(params.m_superframeOrder == 15,
"Beacon mode not supported for zigbee");
2593 NS_LOG_ERROR(
"This device is not a Zigbee Router or is not joined to this network");
2600 m_mac->MlmeGetRequest(MacPibAttributeIdentifier::pCurrentChannel);
2609 startParams.
m_bcnOrd = params.m_beaconOrder;
2610 startParams.
m_sfrmOrd = params.m_superframeOrder;
2614 m_mac->MlmeStartRequest(startParams);
2679 p->PeekHeader(peekedNwkHeader);
2682 pendingTxPkt->dstAddr = peekedNwkHeader.
GetDstAddr();
2683 pendingTxPkt->nsduHandle = nsduHandle;
2684 pendingTxPkt->txPkt = p;
2706 if ((*iter)->dstAddr == dst)
2733 txPkt->macHandle = macHandle;
2734 txPkt->nwkHandle = nwkHandle;
2740 NS_LOG_DEBUG(
"Zigbee Tx Buffer is full, packet dropped.");
2750 if (bufferedPkt->macHandle == macHandle)
2752 txPkt = bufferedPkt;
2755 [&macHandle](
Ptr<TxPkt> pkt) {
return pkt->macHandle == macHandle; });
2778 case MacStatus::SUCCESS:
2781 case MacStatus::NO_SHORT_ADDRESS:
2784 case MacStatus::SUPERFRAME_OVERLAP:
2787 case MacStatus::TRACKING_OFF:
2790 case MacStatus::LIMIT_REACHED:
2793 case MacStatus::NO_BEACON:
2796 case MacStatus::SCAN_IN_PROGRESS:
2799 case MacStatus::COUNTER_ERROR:
2802 case MacStatus::FRAME_TOO_LONG:
2805 case MacStatus::UNAVAILABLE_KEY:
2808 case MacStatus::UNSUPPORTED_SECURITY:
2811 case MacStatus::CHANNEL_ACCESS_FAILURE:
2814 case MacStatus::INVALID_PARAMETER:
2866 uint8_t mappedValue;
2872 else if ((lqi <= 50) && (lqi > 45))
2876 else if ((lqi <= 45) && (lqi > 40))
2880 else if ((lqi <= 40) && (lqi > 38))
2884 else if ((lqi <= 38) && (lqi > 35))
2888 else if ((lqi <= 35) && (lqi > 24))
2920 uint8_t rreqRetries)
2927 nsdu->AddHeader(payload);
2928 nsdu->AddHeader(payloadType);
2929 nsdu->AddHeader(nwkHeader);
2940 if (rreqRetryTableEntry->GetRreqRetryCount() >= rreqRetries)
2963 rreqRetryTableEntry->SetRreqRetryCount(rreqRetryTableEntry->GetRreqRetryCount() +
2965 rreqRetryTableEntry->SetRreqEventId(rreqRetryEvent);
2996 m_mac->McpsDataRequest(params, nsdu);
3039 params.m_dstAddr = nextHop;
3044 nsdu->AddHeader(payload);
3045 nsdu->AddHeader(payloadType);
3046 nsdu->AddHeader(nwkHeader);
3048 m_mac->McpsDataRequest(params, nsdu);
3079 m_mac->MlmeSetRequest(MacPibAttributeIdentifier::macBeaconPayloadLength, pibAttr);
3093 m_mac->MlmeSetRequest(MacPibAttributeIdentifier::macBeaconPayload, pibAttr);
3105 os <<
"FULL CAPACITY";
3108 os <<
"ACCESS DENIED";
3111 os <<
"COUNTER ERROR";
3114 os <<
"IMPROPER KEY TYPE";
3117 os <<
"IMPROPER SECURITY LEVEL";
3120 os <<
"UNSUPPORTED LEGACY";
3123 os <<
"UNSUPPORTED SECURITY";
3126 os <<
"BEACON LOSS";
3129 os <<
"CHANNEL ACCESS FAILURE";
3135 os <<
"DISABLE TRX FAILURE";
3138 os <<
"SECURITY ERROR";
3141 os <<
"FRAME TOO LONG";
3144 os <<
"INVALID GTS";
3147 os <<
"INVALID HANDLE";
3150 os <<
"NO ACKNOLEDGMENT";
3159 os <<
"NO SHORT ADDRESS";
3165 os <<
"PAN ID CONFLICT";
3171 os <<
"TRANSACTION EXPIRED";
3174 os <<
"TRANSACTION OVERFLOW";
3180 os <<
"UNAVAILABLE KEY";
3183 os <<
"INVALID ADDRESS";
3186 os <<
"ON TIME TOO LONG";
3192 os <<
"TRACKING OFF";
3195 os <<
"INVALID INDEX";
3201 os <<
"SUPERFRAME OVERLAP";
3204 os <<
"INVALID PARAMETER";
3207 os <<
"INVALID REQUEST";
3210 os <<
"NO PERMITED";
3213 os <<
"STARTUP FAILURE";
3216 os <<
"ALREADY PRESENT";
3219 os <<
"SYNC FAILURE";
3222 os <<
"NEIGHBOR TABLE FULL";
3225 os <<
"UNKNOWN DEVICE";
3228 os <<
"UNSUPPORTED ATTRIBUTE";
3231 os <<
"NO NETWORKS";
3234 os <<
"MAX FRAME COUNTER";
3240 os <<
"BAD CCM OUTPUT";
3243 os <<
"ROUTE DISCOVERY FAILED";
3246 os <<
"ROUTE ERROR";
3249 os <<
"BT TABLE FULL";
3252 os <<
"FRAME NOT BUFFERED";
3255 os <<
"INVALID INTERFACE";
3258 os <<
"LIMIT REACHED";
3261 os <<
"SCAN IN PROGRESS";
AttributeValue implementation for Boolean.
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.
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.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
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.
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
Temporally store the NLME-JOIN.indication parameters while the join operations (asocciation) conclude...
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 temporally 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.
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.
void SendRREQ(ZigbeeNwkHeader nwkHeader, ZigbeePayloadRouteRequestCommand payload, uint8_t rreqRetries)
Send a route request command.
AssociateParams m_associateParams
Temporally store parameters during the associate process that take place during a NLME-JOIN....
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.
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...
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Callback< R, Args... > MakeNullCallback()
#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.
@ 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.
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.
Mac64Address extAddress
The extended address of the device to which the request is send.
uint16_t panId
The PAN id used by the device to which the association request is send.
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.