A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
zigbee-nwk.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Tokushima University, Japan
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors:
7 *
8 * Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
9 * Ryo Okuda <c611901200@tokushima-u.ac.jp>
10 */
11
12#ifndef ZIGBEE_NWK_H
13#define ZIGBEE_NWK_H
14
15#include "zigbee-group-table.h"
16#include "zigbee-nwk-fields.h"
17#include "zigbee-nwk-header.h"
19#include "zigbee-nwk-tables.h"
20
21#include "ns3/event-id.h"
22#include "ns3/lr-wpan-mac-base.h"
23#include "ns3/mac16-address.h"
24#include "ns3/mac64-address.h"
25#include "ns3/object.h"
26#include "ns3/random-variable-stream.h"
27#include "ns3/sequence-number.h"
28#include "ns3/traced-callback.h"
29#include "ns3/traced-value.h"
30
31#include <cstdint>
32#include <iomanip>
33#include <iterator>
34
35namespace ns3
36{
37
38namespace zigbee
39{
40
41/**
42 * @defgroup zigbee ZIGBEE models
43 *
44 * This section documents the API of the Zigbee Specification related models. For a generic
45 * functional description, please refer to the ns-3 manual.
46 */
47
48static constexpr uint32_t ALL_CHANNELS = 0x07FFF800; //!< Bitmap representing all channels (11~26)
49 //!< LSB b0-b26, b27-b31 MSB
50 //!< Page 0 in Zigbee (250kbps O-QPSK)
51
52/**
53 * @ingroup Zigbee
54 *
55 * Indicates a pending NWK primitive
56 */
57enum PendingPrimitiveNwk : std::uint8_t
58{
59 NLDE_NLME_NONE = 0, //!< No pending primitive
60 NLME_NETWORK_FORMATION = 1, //!< Pending NLME-NETWORK-FORMATION.request primitive
61 NLME_DIRECT_JOIN = 2, //!< Pending NLME-DIRECT-JOIN.request primitive
62 NLME_JOIN = 3, //!< Pending NLME-JOIN.request primitive
63 NLME_START_ROUTER = 4, //!< Pending NLME-START-ROUTER.request primitive
64 NLME_NET_DISCV = 5, //!< Pending NLME-NETWORK-DISCOVERY.request primitive
65 NLME_JOIN_INDICATION = 6, //!< Pending NLME-JOIN.indication primitive
66 NLME_ROUTE_DISCOVERY = 7, //!< Pending NLME-ROUTE-DISCOVERY.request primitive
67 NLDE_DATA = 8 //!< Pending NLDE-DATA.request primitive
68};
69
70/**
71 * @ingroup Zigbee
72 *
73 * Table 3.2 (Address Mode) NLDE-DATA-Request parameters
74 */
76{
77 NO_ADDRESS = 0x00, //!< No destination address
78 MCST = 0x01, //!< Multicast Address mode
79 UCST_BCST = 0x02 //!< Unicast or Broadcast address mode
80};
81
82/**
83 * Use to describe the method used to assign addresses in the NWK layer.
84 * See Zigbee specification r22.1.0, Table 3-58
85 */
87{
88 DISTRIBUTED_ALLOC = 0x00, //!< Distributed address allocation
89 //!< (Zigbee Specification r22.1.0 Section 3.6.1.6)
90 STOCHASTIC_ALLOC = 0x02 //!< Stochastic address allocation
91 //!< (Zigbee Specification r22.1.0 Section 3.6.1.7)
92};
93
94/**
95 * Use to describe the identifier of the zigbee stack profile.
96 */
98{
99 ZIGBEE = 0x01, //!< Zigbee stack profile 0x01 (a.k.a. Zigbee 2006, Zigbee 2007, Zigbee)
100 ZIGBEE_PRO = 0x02 //!< Zigbee stack profile 0x02 (Zigbee Pro, also known as r22.1.0, 3.0)
101};
102
103/**
104 * Use to describe the parameter that controls the method of joining the network.
105 * See Zigbee specification r22.1.0, Table 3-21
106 */
108{
109 ASSOCIATION = 0x00, //!< The device is requesting to join a network through association.
110 DIRECT_OR_REJOIN = 0x01, //!< The device is joining directly or rejoining using the
111 //!< orphaning procedure.
112 REJOINING = 0x02, //!< The device is joining the network using the rejoining procedure.
113 CHANGE_CHANNEL = 0x03 //!< The device is to change the operational network channel to
114 //!< that identified in the ScanChannel parameter.
115};
116
117/**
118 * The status returned while attempting to find the next hop in route towards a specific
119 * destination or a many-to-one route request attempt.
120 */
121enum RouteDiscoveryStatus : std::uint8_t
122{
123 ROUTE_FOUND = 0x01, //!< The next hop toward the destination was found in our
124 //!< routing table or neighbor table (Mesh route).
125 ROUTE_NOT_FOUND = 0x02, //!< The next hop was not found. A new entry is is registered
126 //!< in the routing table with DISCOVER_UNDERWAY status(Mesh route).
127 TABLE_FULL = 0x03, //!< Either the routing or neighbor table are full.
128 ROUTE_UPDATED = 0x04, //!< A route was found and updated with a better route
129 //!< (Mesh route or Many-To-One route)
130 NO_DISCOVER_ROUTE = 0x05, //!< We are currently not allowed to perform a route discovery
131 //!< for this route (RouteDiscover flag in network header is false).
132 DISCOVER_UNDERWAY = 0x06, //!< The route was found in the tables but currently has no next hop.
133 //!< i.e. A previous attempt was already made is currently awaiting
134 //!< for a response (hence the route discover is underway).
135 MANY_TO_ONE_ROUTE = 0x07, //!< A new Many-To-One route was created
136 NO_ROUTE_CHANGE = 0x08 //!< No route entry was created or updated during
137 //!< a Many-To-One process
138};
139
140/**
141 * @ingroup Zigbee
142 *
143 * Network layer status values
144 * Combines Zigbee Specification r22.1.0 Table 3-73 and
145 * and IEEE 802.15.4-2006 Table 78
146 *
147 * Used to report the resulting status of various NWK operations.
148 *
149 * Note: UNSUPPORTED_ATTRIBUTE, LIMIT_REACHED, SCAN_IN_PROGRESS
150 */
151enum NwkStatus : std::uint8_t
152{
153 // MAC defined status:
154 SUCCESS = 0, //!< The operation was completed successfully.
155 FULL_CAPACITY = 0x01, //!< PAN at capacity. Association Status field (std. 2006, Table 83).
156 ACCESS_DENIED = 0x02, //!< PAN access denied. Association Status field (std. 2006, Table 83).
157 COUNTER_ERROR = 0xdb, //!< The frame counter of the received frame is invalid.
158 IMPROPER_KEY_TYPE = 0xdc, //!< The key is not allowed to be used with that frame type.
159 IMPROPER_SECURITY_LEVEL = 0xdd, //!< Insufficient security level expected by the recipient.
160 UNSUPPORTED_LEGACY = 0xde, //!< Deprecated security used in IEEE 802.15.4-2003
161 UNSUPPORTED_SECURITY = 0xdf, //!< The security applied is not supported.
162 BEACON_LOSS = 0xe0, //!< The beacon was lost following a synchronization request.
163 CHANNEL_ACCESS_FAILURE = 0xe1, //!< A Tx could not take place due to activity in the CH.
164 DENIED = 0xe2, //!< The GTS request has been denied by the PAN coordinator.
165 DISABLE_TRX_FAILURE = 0xe3, //!< The attempt to disable the transceier has failed.
166 SECURITY_ERROR = 0xe4, //!< Cryptographic process of the frame failed(FAILED_SECURITY_CHECK).
167 FRAME_TOO_LONG = 0xe5, //!< Frame more than aMaxPHYPacketSize or too large for CAP or GTS.
168 INVALID_GTS = 0xe6, //!< Missing GTS transmit or undefined direction.
169 INVALID_HANDLE = 0xe7, //!< When purging from TX queue handle was not found.
170 INVALID_PARAMETER_MAC = 0xe8, //!< Invalid parameter in response to a request passed to the MAC.
171 NO_ACK = 0xe9, //!< No acknowledgment was received after macMaxFrameRetries.
172 NO_BEACON = 0xea, //!< A scan operation failed to find any network beacons.
173 NO_DATA = 0xeb, //!< No response data were available following a request.
174 NO_SHORT_ADDRESS = 0xec, //!< Failure due to unallocated 16-bit short address.
175 OUT_OF_CAP = 0xed, //!< (Deprecated) See IEEE 802.15.4-2003
176 PAN_ID_CONFLICT = 0xee, //!< PAN id conflict detected and informed to the coordinator.
177 REALIGMENT = 0xef, //!< A coordinator realigment command has been received.
178 TRANSACTION_EXPIRED = 0xf0, //!< The transaction expired and its information discarded.
179 TRANSACTION_OVERFLOW = 0xf1, //!< There is no capacity to store the transaction.
180 TX_ACTIVE = 0xf2, //!< The transceiver was already enabled.
181 UNAVAILABLE_KEY = 0xf3, //!< Unavailable key, unknown or blacklisted.
182 INVALID_ADDRESS = 0xf5, //!< Invalid source or destination address.
183 ON_TIME_TOO_LONG = 0xf6, //!< RX enable request fail due to syms. longer than Bcn. interval
184 PAST_TIME = 0xf7, //!< Rx enable request fail due to lack of time in superframe.
185 TRACKING_OFF = 0xf8, //!< This device is currently not tracking beacons.
186 INVALID_INDEX = 0xf9, //!< A MAC PIB write failed because specified index is out of range.
187 READ_ONLY = 0xfb, //!< SET/GET request issued for a read only attribute.
188 SUPERFRAME_OVERLAP = 0xfd, //!< Coordinator sperframe and this device superframe tx overlap.
189 // Zigbee Specification defined status:
190 INVALID_PARAMETER = 0xc1, //!< Invalid Parameter (Zigbee specification r22.1.0)
191 INVALID_REQUEST = 0xc2, //!< Invalid request (Zigbee specification r22.1.0)
192 NOT_PERMITED = 0xc3, //!< Not permitted (Zigbee specification r22.1.0)
193 STARTUP_FAILURE = 0xc4, //!< Startup failure (Zigbee specification r22.1.0)
194 ALREADY_PRESENT = 0xc5, //!< Already present (Zigbee specification r22.1.0)
195 SYNC_FAILURE = 0xc6, //!< Sync Failure (Zigbee specification r22.1.0)
196 NEIGHBOR_TABLE_FULL = 0xc7, //!< Neighbor table full (Zigbee specification r22.1.0)
197 UNKNOWN_DEVICE = 0xc8, //!< Unknown device (Zigbee specification r22.1.0)
198 UNSUPPORTED_ATTRIBUTE = 0xc9, //!< Unsupported attribute (Zigbee specification r22.1.0)
199 NO_NETWORKS = 0xca, //!< No network (Zigbee specification r22.1.0)
200 MAX_FRM_COUNTER = 0xcc, //!< Max Frame counter (IEEE 802.15.4, Zigbee specification r22.1.0)
201 NO_KEY = 0xcd, //!< No Key (Zigbee specification r22.1.0)
202 BAD_CCM_OUTPUT = 0xce, //!< Bad ccm output (IEEE 802.15.4, Zigbee specification r22.1.0)
203 ROUTE_DISCOVERY_FAILED = 0xd0, //!< Route discovery failed (Zigbee specification r22.1.0)
204 ROUTE_ERROR = 0xd1, //!< Route error (Zigbee specification r22.1.0)
205 BT_TABLE_FULL = 0xd2, //!< Bt table full (Zigbee specification r22.1.0)
206 FRAME_NOT_BUFFERED = 0xd3, //!< Frame not buffered (Zigbee specification r22.1.0)
207 INVALID_INTERFACE = 0xd5, //!< Invalid interface (Zigbee specification r22.1.0)
208 LIMIT_REACHED = 0xd6, //!< Limit reached during network scan (IEEE 802.15.4-2011)
209 SCAN_IN_PROGRESS = 0xd7 //!< The dev was scanning during this call (IEEE 802.5.4)
210};
211
212/**
213 * Overloaded operator to print the value of a NwkStatus.
214 *
215 * @param os The output stream
216 * @param state The text value of the NWK state
217 * @return The output stream with text value of the NWK state
218 */
219std::ostream& operator<<(std::ostream& os, const NwkStatus& state);
220
221/**
222 * Overloaded operator to print uint8_t vectors
223 *
224 * @param os The output stream
225 * @param vec The uint8_t vector to print
226 * @return The output stream with the text value of the uint8_t vector members
227 */
228std::ostream& operator<<(std::ostream& os, const std::vector<uint8_t>& vec);
229
230/**
231 *
232 * @param os The output stream
233 * @param num The uint8_t number to print
234 * @return The output stream with the text value of the uint8_t number
235 */
236std::ostream& operator<<(std::ostream& os, const uint8_t& num);
237
238/**
239 * @ingroup Zigbee
240 *
241 * Status codes for network status command frame and route discovery failures.
242 *
243 */
244enum NetworkStatusCode : std::uint8_t
245{
246 NO_ROUTE_AVAILABLE = 0x00, //!< No route available
247 TREE_LINK_FAILURE = 0x01, //!< Tree link failure
248 NON_TREE_LINK_FAILURE = 0x02, //!< Non tree link failure
249 LOW_BATTERY = 0x03, //!< Low battery
250 NO_ROUTING_CAPACITY = 0x04, //!< No routing capacity
251 NO_INDIRECT_CAPACITY = 0x05, //!< No indirect capacity
252 INDIRECT_TRANSACTION_EXPIRY = 0x06, //!< Indirect transaction expiry
253 TARGET_DEVICE_UNAVAILABLE = 0x07, //!< Target device unavailable
254 TARGET_ADDRESS_UNALLOCATED = 0x08, //!< Target address unallocated
255 PARENT_LINK_FAILURE = 0x09, //!< Parent link failure
256 VALIDATE_ROUTE = 0x0a, //!< Validate route
257 SOURCE_ROUTE_FAILURE = 0x0b, //!< Source route failure
258 MANY_TO_ONE_ROUTE_FAILURE = 0x0c, //!< Many to one route failure
259 ADDRESS_CONFLICT = 0x0d, //!< Address conflict
260 VERIFY_ADDRESS = 0x0e, //!< Verify address
261 PAN_IDENTIFIER_UPDATE = 0x0f, //!< PAN identifier update
262 NETWORK_ADDRESS_UPDATE = 0x10, //!< Network address update
263 BAD_FRAME_COUNTER = 0x11, //!< Bad frame counter
264 BAD_KEY_SEQUENCE_NUMBER = 0x12, //!< Bad key sequence number
265 UNKNOWN_COMMAND = 0x13 //!< Unknown command
266};
267
268/**
269 * @ingroup Zigbee
270 *
271 * Channel List Structure. See Zigbee Specification 3.2.2.2.1
272 */
274{
275 uint8_t channelPageCount; //!< The number of the channel page structures contained in
276 //!< the channel list structure.
277 std::vector<uint32_t> channelsField; //!< The set of channels for a given page.
278
284};
285
286/**
287 * @ingroup Zigbee
288 *
289 * NLDE-DATA.confirm params. See Zigbee Specification 3.2.1.2
290 */
292{
294 //!< the corresponding request.
295 uint8_t m_nsduHandle{0}; //!< The handle associated with the NSDU being confirmed.
296 Time m_txTime{Seconds(0)}; //!< The time indication for the transmitted packet
297 //!< based on the local clock.
298};
299
300/**
301 * @ingroup Zigbee
302 *
303 * NLDE-DATA.indication params. See Zigbee Specification 3.2.1.3.1
304 */
306{
307 AddressMode m_dstAddrMode{UCST_BCST}; //!< Destination address mode.
308 //!< 0x01=MCST, 0x02=BCST or UCST
309 Mac16Address m_dstAddr; //!< The destination address to which the NSDU was sent
310 Mac16Address m_srcAddr; //!< The individual device address from which the NSDU originated
311 uint32_t m_nsduLength{0}; //!< The number of octets comprising the NSDU being indicated
312 uint8_t m_linkQuality{0}; //!< LQI value delivered by the MAC on receipt of this frame
313 Time m_rxTime{Seconds(0)}; //!< A time indication for the received packet
314 //!< based on the local clock
315 bool m_securityUse{false}; //!< An indication of whether the received data is using security
316};
317
318/**
319 * @ingroup Zigbee
320 *
321 * NLDE-DATA.request params. See Zigbee Specification 3.2.1.1
322 */
324{
325 AddressMode m_dstAddrMode{UCST_BCST}; //!< Destination address mode.
326 //!< 0x01=MCST, 0x02=BCST or UCST
327 Mac16Address m_dstAddr; //!< The destination address.
328 uint32_t m_nsduLength{0}; //!< The number of octets comprising the NSDU to be transferred.
329 uint8_t m_nsduHandle{0}; //!< The NSDU handle
330 bool m_useAlias{false}; //!< Indicates if next higher layer use an alias for the current frame.
331 Mac16Address m_aliasSrcAddr; //!< The source address to be used by this NSDU
332 //!< (ignored ifuseAlias = false).
333 SequenceNumber8 m_aliasSeqNumber; //!< The sequence number used by this NSDU
334 //!< (ignored if useAlias = false).
335 uint8_t m_radius{0}; //!< Distance in hops that the frame is allowed to
336 //!< travel through the network.
337 uint8_t m_nonMemberRadius{0}; //!< Distance in hops that a multicast frame will be relayed by
338 //!< nodes not a member of the group. 0x07 = Infinity.
339 uint8_t m_discoverRoute{0}; //!< 0x01 Enable Route Discovery | 0x00: Suppress Route discovery
340 bool m_securityEnable{false}; //!< Enable NWK layer security for the current frame.
341};
342
343/**
344 * @ingroup Zigbee
345 *
346 * NLME-NETWORK-FORMATION.request params. See Zigbee Specification 3.2.2.5.1
347 */
349{
351 //!< that contain a description on the pages and
352 //!< their channels to be scanned.
353 uint8_t m_scanDuration; //!< The time spent of each channel in symbols:
354 //!< aBaseSuperframeDuriantion * (2n+1). n=0-14
355 uint8_t m_beaconOrder; //!< The beacon order
356 uint8_t m_superFrameOrder; //!< The superframe order
357 bool m_batteryLifeExtension; //!< True: The zigbee coordinator is started supporting
358 //!< battery extension mode.
359 bool m_distributedNetwork; //!< Indicates that distributed security will be used.
360 Mac16Address m_distributedNetworkAddress; //!< The address of the device in a
361 //!< distributed network.
362
373};
374
375/**
376 * @ingroup Zigbee
377 *
378 * A group of pending parameters arranged into a structure during the execution of
379 * a NLME-NETWORK-FORMATION.request primitive.
380 */
381struct NetFormPendingParamsGen : public SimpleRefCount<NetFormPendingParamsGen>
382{
383 uint8_t channel{0}; //!< The channel selected during the initial steps of a network formation
384 uint8_t page{0}; //!< The page selected during the initial steps of a network formation.
385 uint16_t panId{0}; //!< The PAN id selected during the initial steps of a network formation.
386};
387
388/**
389 * @ingroup Zigbee
390 *
391 * NLME-NETWORK-FORMATION.confirm params. See Zigbee Specification 3.2.2.6.1
392 */
394{
395 NwkStatus m_status{NwkStatus::INVALID_PARAMETER}; //!< The status as a result of
396 //!< this request
397};
398
399/**
400 * @ingroup Zigbee
401 *
402 * NLME-ROUTE-DISCOVERY.request params. See Zigbee Specification 3.2.2.33
403 */
405{
406 AddressMode m_dstAddrMode{UCST_BCST}; //!< Specifies the kind of destination address.
407 Mac16Address m_dstAddr; //!< The 16-bit destination address or Group ID (MCST destination)
408 //!< of the route discovery.
409 uint16_t m_radius{0}; //!< Optional parameter that describes the number of hops that the
410 //!< route request will travel through the network.
411 bool m_noRouteCache{true}; //!< This flag determines whether the NWK should establish a
412 //!< route record table.
413};
414
415/**
416 * @ingroup Zigbee
417 *
418 * NLME-ROUTE-DISCOVERY.confirm params. See Zigbee Specification r22.1.0, 3.2.2.34
419 */
421{
422 NwkStatus m_status{NwkStatus::INVALID_PARAMETER}; //!< The status as a result of
423 //!< this request.
425 //!< the status parameter has a value of ROUTE_ERROR, this code gives further information about
426 //!< the error occurred. Otherwise, it should be ignored.
427};
428
429/**
430 * @ingroup Zigbee
431 *
432 * NLME-DIRECT-JOIN.request params.
433 * See Zigbee Specification r22.1.0, 3.2.2.16
434 */
436{
437 Mac64Address m_deviceAddr; //!< The EUI-64 bit address of the device directly joined.
438 uint8_t m_capabilityInfo; //!< The operating capabilities of the device
439 //!< being directly joined
440};
441
442/**
443 * @ingroup Zigbee
444 *
445 * NLME-DIRECT-JOIN.confirm params.
446 * See Zigbee Specification r22.1.0, 3.2.2.17
447 */
449{
451 //!< the corresponding request.
452 Mac64Address m_deviceAddr; //!< The IEEE EUI-64 address in the request to
453 //!< which this is a confirmation.
454};
455
456/**
457 * @ingroup Zigbee
458 *
459 * NLME-NETWORK-DISCOVERY.request params.
460 * See Zigbee Specification r22.1.0, 3.2.2.3
461 */
463{
464 ChannelList m_scanChannelList; //!< The list of all channel pages and the associated
465 //!< channels that shall be scanned.
466 uint8_t m_scanDuration{0}; //!< A value used to calculate the length of time to spend
467};
468
469/**
470 * @ingroup lr-wpan
471 *
472 * Network Descriptor, Zigbee Specification r22.1.0, 3.2.2.4, Table 3-12
473 */
475{
476 uint64_t m_extPanId{0xFFFFFFFFFFFFFFFE}; //!< The 64-bit PAN identifier of the network.
477 uint16_t m_panId{0xFFFF}; //!< The 16-bit PAN identifier of the network.
478 uint8_t m_updateId{0}; //!< The value of the UpdateID from the NIB.
479 uint8_t m_logCh{11}; //!< The current channel number occupied by the network.
480 StackProfile m_stackProfile{ZIGBEE_PRO}; //!< The Zigbee stack profile identifier in use in
481 //!< the discovered network.
482 uint8_t m_zigbeeVersion; //!< The version of the zigbee protocol in use in
483 //!< the discovered network.
484 uint8_t m_beaconOrder{15}; //!< The beacon order value of the underlying MAC
485 //!< (Determinates the beacon frequency, 15 = No beacon)
486 uint8_t m_superframeOrder{15}; //!< The superframe order value of the underlying MAC
487 //!< (Determinates the value of the active period)
488 bool m_permitJoining{true}; //!< TRUE = Indicates that at least one zigbee router on the
489 //!< network currently permits joining.
490 bool m_routerCapacity{true}; //!< TRUE = The device is able to accept join requests from
491 //!< router-capable devices.
492 bool m_endDeviceCapacity{true}; //!< TRUE= The device is able to accept join request from
493 //!< end devices.
494};
495
496/**
497 * @ingroup Zigbee
498 *
499 * NLME-NETWORK-DISCOVERY.confirm params. See Zigbee Specification r22.1.0, 3.2.2.4
500 */
502{
504 //!< the corresponding request.
505 uint8_t m_networkCount{0}; //!< Gives the number of networks discovered by the search
506 std::vector<NetworkDescriptor> m_netDescList; //!< A list of descriptors,
507 //!< one for each of the networks discovered.
508};
509
510/**
511 * @ingroup Zigbee
512 *
513 * NLME-JOIN.request params.
514 * See Zigbee Specification r22.1.0, 3.2.2.13
515 */
517{
518 uint64_t m_extendedPanId{1}; //!< The 64 bit PAN identifier of the
519 //!< the network to join.
520 JoiningMethod m_rejoinNetwork; //!< This parameter controls the method of joining the
521 //!< network.
522 ChannelList m_scanChannelList; //!< The list of all channel pages and the associated
523 //!< channels that shall be scanned.
524 uint8_t m_scanDuration{0}; //!< A value used to calculate the length of time to spend
525 //!< scanning each channel.
526 uint8_t m_capabilityInfo; //!< The operating capabilities of the device
527 //!< being directly joined (Bit map).
528 bool m_securityEnable{false}; //!< If the value of RejoinNetwork is REJOINING and this
529 //!< value is true, the device will rejoin securely.
530};
531
532/**
533 * @ingroup Zigbee
534 *
535 * NLME-JOIN.confirm params.
536 * See Zigbee Specification r22.1.0, 3.2.2.15
537 */
539{
540 NwkStatus m_status; //!< The status of
541 //!< the corresponding request.
542 Mac16Address m_networkAddress; //!< The 16 bit network address that was allocated
543 //!< to this device. Equal to 0xFFFF if association
544 //!< was unsuccessful.
545 uint64_t m_extendedPanId; //!< The extended 64 bit PAN ID for the network of which the
546 //!< device is now a member.
547 ChannelList m_channelList; //!< The structure indicating the current channel of the
548 //!< network that has been joined.
549 bool m_enhancedBeacon; //!< True if using enhanced beacons (placeholder, not supported)
550 uint8_t m_macInterfaceIndex; //!< The value of the MAC index from nwkMacInterfaceTable.
551 //!< (placeholder, not supported)
552
562};
563
564/**
565 * @ingroup Zigbee
566 *
567 * NLME-JOIN.indication params.
568 * See Zigbee Specification r22.1.0, 3.2.2.14
569 */
571{
572 Mac16Address m_networkAddress{0xFFFF}; //!< The 16 bit network address of an entity that
573 //!< has been added to the network.
574 Mac64Address m_extendedAddress; //!< The EUI-64 bit address of an entity that has been added
575 //!< to the network.
576 uint8_t m_capabilityInfo; //!< Specifies the operational capabilities of the
577 //!< joining device.
578 JoiningMethod m_rejoinNetwork; //!< This parameter indicates the method used to
579 //!< join the network.
580 bool m_secureRejoin{false}; //!< True if the rejoin was performed in a secure manner.
581};
582
583/**
584 * @ingroup Zigbee
585 *
586 * NLME-START-ROUTER.request params.
587 * See Zigbee Specification r22.1.0, 3.2.2.13
588 */
590{
591 uint8_t m_beaconOrder{15}; //!< The beacon order of the network
592 uint8_t m_superframeOrder{15}; //!< The superframe order of the network
593 bool m_batteryLifeExt{false}; //!< True if the router supports battery life extension mode.
594};
595
596/**
597 * @ingroup Zigbee
598 *
599 * NLME-START-ROUTER.confirm params.
600 * See Zigbee Specification r22.1.0, 3.2.2.10
601 */
603{
605 //!< the corresponding request.
606};
607
608//////////////////////
609// Callbacks //
610//////////////////////
611
612/**
613 * @ingroup Zigbee
614 *
615 * This callback is called after a NSDU has successfully received and
616 * NWK push it to deliver it to the next higher layer.
617 *
618 */
620
621/**
622 * @ingroup Zigbee
623 *
624 * This callback is used to notify the next higher layer with a confirmation in response to
625 * a previously issued NLDE-DATA.request.
626 *
627 */
629
630/**
631 * @ingroup Zigbee
632 *
633 * This callback is used to notify the next higher layer with a confirmation in response to
634 * a previously issued NLME-NETWORK-FORMATION.request.
635 */
637
638/**
639 * @ingroup Zigbee
640 *
641 * This callback is used to notify the next higher layer with a confirmation in response to
642 * a previously issued NLME-NETWORK-DISCOVERY.request.
643 */
645
646/**
647 * @ingroup Zigbee
648 *
649 * This callback is used to notify the next higher layer with a confirmation in response to
650 * a previously issued NLME-ROUTE-DISCOVERY.request.
651 */
653
654/**
655 * @ingroup Zigbee
656 *
657 * This callback is used to notify the next higher layer with a confirmation in response to
658 * a previously issued NLME-DIRECT-JOIN.request.
659 */
661
662/**
663 * @ingroup Zigbee
664 *
665 * This callback is used to notify the next higher layer with a confirmation in response to
666 * a previously issued NLME-JOIN.request.
667 */
669
670/**
671 * @ingroup Zigbee
672 *
673 * This callback is used to notify the next higher layer with an indication that a new
674 * device has successfully joined its network by association or rejoining.
675 */
677
678/**
679 * @ingroup Zigbee
680 *
681 * This callback is used to notify the next higher layer with a confirmation in response to
682 * a previously issued NLME-START-ROUTER.request.
683 */
685
686/**
687 * @ingroup Zigbee
688 *
689 * Class that implements the Zigbee Specification Network Layer
690 */
691class ZigbeeNwk : public Object
692{
693 public:
694 /**
695 * Get the type ID.
696 *
697 * @return the object TypeId
698 */
699 static TypeId GetTypeId();
700
701 /**
702 * Default constructor.
703 */
704 ZigbeeNwk();
705 ~ZigbeeNwk() override;
706
707 /**
708 * Set the underlying MAC to use in this Zigbee NWK
709 *
710 * @param mac The pointer to the underlying LrWpan MAC to set to this Zigbee NWK
711 */
713
714 /**
715 * Get the group table used by this Zigbee NWK.
716 *
717 * @param groupTable The pointer to the group table to set.
718 */
719 void SetGroupTable(Ptr<ZigbeeGroupTable> groupTable);
720
721 /**
722 * Get the underlying MAC used by the current Zigbee NWK.
723 *
724 * @return The pointer to the underlying MAC object currently connected to the Zigbee NWK.
725 */
727
728 /**
729 * Print the entries in the routing table.
730 *
731 * @param stream The stream object used to print.
732 */
734
735 /**
736 * Print the entries in the route discovery table.
737 *
738 * @param stream The stream object used to print.
739 */
741
742 /**
743 * Print the entries in the neighbor table.
744 *
745 * @param stream The stream object used to print.
746 */
748
749 /**
750 * Print the entries in the RREQ retry table.
751 *
752 * @param stream The stream object used to print.
753 */
755
756 /**
757 * Search for a specific destination in this device
758 * neighbor and routing tables.
759 * This function is only a quick reference used for debugging
760 * purposes.
761 *
762 * @param dst The destination to search in our tables
763 * @param neighbor A flag indicating whether or not the returned
764 * next hop was found in our neighbor table.
765 * @return The nexthop address to the destination.
766 */
767 Mac16Address FindRoute(Mac16Address dst, bool& neighbor);
768
769 /**
770 * Obtain this device 16 bit network address (A.K.A. short address).
771 *
772 * This function should only be used for debugging purposes and it
773 * should not be use by higher layers. Higher layers should use
774 * NLME-GET.request instead to obtain this attribute.
775 *
776 * @return Returns this device's 16 bit network address.
777 */
779
780 /**
781 * Obtain this device 64 bit IEEE address (A.K.A. extended address).
782 *
783 * This function should only be used for debugging purposes and it
784 * should not be use by higher layers. Higher layers should use
785 * NLME-GET.request instead to obtain this attribute.
786 *
787 * @return Returns this device's 16 bit network address.
788 */
790
791 /**
792 * IEEE 802.15.4-2011 section 6.3.3
793 * MCPS-DATA.indication
794 * Indicates the reception of an MSDU from MAC to NWK (receiving)
795 *
796 * @param params The MCPS-DATA.indication parameters.
797 * @param msdu The set of octets forming the MSDU.
798 */
800
801 /**
802 * IEEE 802.15.4-2011 section 6.3.2
803 * MCPS-DATA.confirm
804 * Reports the results of a request to a transfer data to another device.
805 *
806 * @param params The MCPS-DATA.confirm parameters.
807 */
809
810 /**
811 * IEEE 802.15.4-2011 section 6.2.10.2
812 * MLME-SCAN.confirm
813 * Reports the results of a scan request.
814 *
815 * @param params The MLME-SCAN.confirm parameters.
816 */
818
819 /**
820 * IEEE 802.15.4-2011 section
821 * MlME-ASSOCIATE.confirm
822 * Report the results of an associate request attempt.
823 *
824 * @param params The MLME-ASSOCIATE.confirm parameters.
825 */
827
828 /**
829 * IEEE 802.15.4-2011 section 7.1.14.2
830 * MLME-START.confirm
831 * Reports the results of a network start request.
832 *
833 * @param params The MLME-START.confirm parameters.
834 */
836
837 /**
838 * IEEE 802.15.4-2011 section 6.2.11.2
839 * MLME-SET.confirm
840 * Reports the result of an attempt to change a MAC PIB attribute.
841 *
842 * @param params The MLME-SET.confirm params
843 */
845
846 /**
847 * IEEE 802.15.4-2011 section 6.2.5.1
848 * MLME-GET.confirm
849 * Reports the result of an attempt to obtain a MAC PIB attribute.
850 *
851 * @param status The status as a result of a MLME-GET.request operation
852 * @param id The identififier of the attribute requested
853 * @param attribute The value of of the attribute requested
854 */
858
859 /**
860 * IEEE 802.15.4-2011 sections 6.2.7.1,
861 * Zigbee Specification r22.1.0 Section 3.6.1.4.3 (parent procedure)
862 * MLME-ORPHAN.indication
863 * Generated by the coordinator and issued to its next higher
864 * layer on receipt of an orphan notification command, as defined
865 * in 5.3.6.
866 *
867 * @param params The MLME-ORPHAN.indication parameters
868 */
870
871 /**
872 * IEEE 802.15.4-2011 section 6.2.4.2
873 * MLME-COMM-STATUS.indication
874 * Allows the MAC MLME to indicate a communication status.
875 *
876 * @param params The MLME-COMM-STATUS.indication parameters
877 */
879
880 /**
881 * IEEE 802.15.4-2011, Section 6.2.4.1
882 * MLME-BEACON-NOTIFY.indication
883 * Allows the MAC MLME to indicate the reception of a beacon with payload.
884 *
885 * @param params The MLME-BEACON-NOTIFY.indication parameters
886 */
888
889 /**
890 * IEEE 802.15.4-2011, Section 6.2.2.2.
891 * MLME-ASSOCIATE.indication
892 * Allows the MAC MLME to indicate the reception of an associate request
893 * on a PAN coordinator or router. In the Zigbee specification this implements
894 * the parent procedure when a device join a network through association
895 * (See Zigbee specification r22.1.0, Section 3.6.1.4.1)
896 *
897 * @param params The MLME-ASSOCIATE.indication parameters
898 */
900
901 /**
902 * Zigbee Specification r22.1.0, Section 3.2.1.1
903 * NLDE-DATA.request
904 * Request to transfer a NSDU.
905 *
906 * @param params the request parameters
907 * @param packet the NSDU to be transmitted
908 */
910
911 /**
912 * Zigbee Specification r22.1.0, Section 3.2.2.5 and 3.6.1.1
913 * NLME-NETWORK-FORMATION.request
914 * Request the formation of a network in a capable device.
915 *
916 * @param params the network formation request params
917 */
919
920 /**
921 * Zigbee Specification r22.1.0, section 3.2.2.33.3 and 3.6.3.5
922 * NLME-ROUTE-DISCOVERY.request
923 * Allows the next higher layer to initiate route discovery.
924 *
925 * @param params the route discovery request params
926 */
928
929 /**
930 * Zigbee Specification r22.1.0, section 3.2.2.3
931 * NLME-NETWORK-DISCOVERY.request
932 * Allows the next higher layer to request that the NWK layer discover
933 * networks currently operating within the personal operating space (POS).
934 *
935 * @param params the network discovery request params
936 */
938
939 /**
940 * Zigbee Specification r22.1.0, section 3.2.2.16 and 3.6.1.4.3
941 * NLME-DIRECT-JOIN.request
942 * Allows the next layer of a Zigbee coordinator or router to request to
943 * directly join another device to its network
944 *
945 * @param params the direct join request params
946 */
948
949 /**
950 * Zigbee Specification r22.1.0, section 3.2.2.13
951 * NLME-JOIN.request
952 * This primitive allows the next higher layer to request to join or rejoin a
953 * network, or to change the operating channel for the device while within an
954 * operating network.
955 *
956 * @param params the join request params
957 */
959
960 /**
961 * Zigbee Specification r22.1.0, section 3.2.2.9
962 * NLME-START-ROUTER.request
963 * This primitive allows the next higher layer of a Zigbee router to initiate
964 * the activities expected of a Zigbee router including the routing of data
965 * framaes, route discovery, and the accepting of request to join the network
966 * from other devices.
967 *
968 * @param params the join request params
969 */
971
972 /**
973 * Set the callback for the end of a RX, as part of the
974 * interconnections between the NWK and the APS sublayer. The callback
975 * implements the callback used in a NLDE-DATA.indication.
976 * @param c the NldeDataIndication callback
977 */
979
980 /**
981 * Set the callback as part of the interconnections between the NWK and
982 * the APS sublayer (or any other higher layer). The callback
983 * implements the callback used in a NLDE-DATA.confirm
984 *
985 * @param c the NldeDataConfirm callback
986 */
988
989 /**
990 * Set the callback as part of the interconnections between the NWK and the
991 * APS sublayer (or any other higher layer). The callback implements the callback
992 * used in a NLME-NETWORK-FORMATION.confirm
993 * @param c the NlmeNetworkFormationConfirm callback
994 */
996
997 /**
998 * Set the callback as part of the interconnections between the NWK and the
999 * APS sublayer (or any other higher layer). The callback implements the callback
1000 * used in a NLME-NETWORK-DISCOVERY.confirm
1001 * @param c the NlmeNetworkDiscoveryConfirm callback
1002 */
1004
1005 /**
1006 * Set the callback as part of the interconnections between the NWK and the
1007 * APS sublayer (or any other higher layer). The callback implements the callback
1008 * used in a NLME-ROUTE-DISCOVERY.confirm
1009 *
1010 * @param c the NlmeRouteDiscoveryConfirm callback
1011 */
1013
1014 /**
1015 * Set the callback as part of the interconnections between the NWK and the
1016 * APS sublayer (or any other higher layer). The callback implements the callback
1017 * used in a NLME-DIRECT-JOIN.confirm
1018 *
1019 * @param c the NlmeDirectJoinConfirm callback
1020 */
1022
1023 /**
1024 * Set the callback as part of the interconnections between the NWK and the
1025 * APS sublayer (or any other higher layer). The callback implements the callback
1026 * used in a NLME-JOIN.confirm
1027 *
1028 * @param c the NlmeJoinConfirm callback
1029 */
1031
1032 /**
1033 * Set the callback as part of the interconnections between the NWK and the
1034 * APS sublayer (or any other higher layer). The callback implements the callback
1035 * used in a NLME-JOIN.indication
1036 *
1037 * @param c the NlmeJoinIndication callback
1038 */
1040
1041 /**
1042 * Set the callback as part of the interconnections between the NWK and the
1043 * APS sublayer (or any other higher layer). The callback implements the callback
1044 * used in a NLME-START-ROUTER.confirm
1045 *
1046 * @param c the NlmeStartRouterConfirm callback
1047 */
1049
1050 /**
1051 * Assign a fixed random variable stream number to the random variables
1052 * used by this model. Return the number of streams (possibly zero) that
1053 * have been assigned.
1054 *
1055 * @param stream first stream index to use
1056 * @return the number of stream indices assigned by this model
1057 */
1058 int64_t AssignStreams(int64_t stream);
1059
1060 /**
1061 * TracedCallback signature for RreqRetriesExhaustedTrace events.
1062 *
1063 * @param rreqId The RREQ id used in the retries
1064 * @param dst The destination address of the RREQ retries
1065 * @param rreqRetriesNum The number of rreq retries attempted
1066 *
1067 */
1068 typedef void (*RreqRetriesExhaustedTracedCallback)(uint8_t rreqId,
1069 Mac16Address dst,
1070 uint8_t rreqRetriesNum);
1071
1072 protected:
1073 void DoInitialize() override;
1074 void DoDispose() override;
1075 void NotifyConstructionCompleted() override;
1076
1077 private:
1078 Ptr<lrwpan::LrWpanMacBase> m_mac; //!< Pointer to the underlying MAC
1079 //!< connected to this Zigbee NWK.
1080
1081 /**
1082 * Structure representing an element in the pending transaction queue.
1083 */
1084 struct PendingTxPkt : public SimpleRefCount<PendingTxPkt>
1085 {
1086 uint8_t nsduHandle; //!< The NSDU handle
1087 Mac16Address dstAddr; //!< The destination network Address
1088 Ptr<Packet> txPkt; //!< The pending packet.
1089 Time expireTime; //!< The expiration time of the packet
1090 };
1091
1092 /**
1093 * The pending transaction queue of data packets awaiting to be transmitted
1094 * until a route to the destination becomes available.
1095 */
1096 std::deque<Ptr<PendingTxPkt>> m_pendingTxQueue;
1097
1098 /**
1099 * The maximum size of the pending transaction queue.
1100 */
1102
1103 /**
1104 * Structure representing an element in the Tx Buffer.
1105 */
1106 struct TxPkt : public SimpleRefCount<TxPkt>
1107 {
1108 uint8_t macHandle; //!< The mac handle (msdu handle).
1109 uint8_t nwkHandle; //!< The nwk handle (nsdu handle).
1110 Ptr<Packet> txPkt; //!< The buffered packet.
1111 };
1112
1113 /**
1114 * The transmission buffer. Copies of DATA packets are stored here
1115 * for post transmission handling.
1116 */
1117 std::deque<Ptr<TxPkt>> m_txBuffer;
1118
1119 /**
1120 * The maximum size of the transmission buffer
1121 */
1123
1124 ///////////////
1125 // Callbacks //
1126 ///////////////
1127
1128 /**
1129 * A trace source that fires when a node has reached the maximum number
1130 * of RREQ retries allowed. The trace provides the RREQ Id, the destination
1131 * address of the RREQ and the number of the maximum allowed retries from
1132 * this node.
1133 *
1134 */
1136
1137 /**
1138 * This callback is used to notify incoming packets to the APS sublayer.
1139 * See Zigbee Specification r22.1.0, section 6.2.1.3.
1140 */
1142
1143 /**
1144 * This callback is used to respond to data PDU (NSDU) transfer
1145 * request issued by APS sublayer to the NWK (or a layer higher to NWK).
1146 * See Zigbee specification r22.1.0, section 3.2.1.2.
1147 */
1149
1150 /**
1151 * This callback is used to to notify the results of a network
1152 * formation to the APS sublayer making the request.
1153 * See Zigbee specification r22.1.0, section 3.2.2.5
1154 */
1156
1157 /**
1158 * This callback is used to to notify the results of a network
1159 * formation to the APS sublayer making the request.
1160 * See Zigbee specification r22.1.0, section 3.2.2.4
1161 */
1163
1164 /**
1165 * This callback is used to to notify the results of a network
1166 * formation to the APS sublayer making the request.
1167 * See Zigbee specification r22.1.0, section 3.2.2.34
1168 */
1170
1171 /**
1172 * This callback is used by the next layer of a zigbee coordinator or
1173 * router to be notified of the result of its request to directly join
1174 * another device to its network
1175 * See Zigbee specification r22.1.0, section 3.2.2.17
1176 */
1178
1179 /**
1180 * This callback is used by the next layer of a zigbee router or device
1181 * to be notified of the result of its request to join
1182 * another device network.
1183 * See Zigbee specification r22.1.0, section 3.2.2.15
1184 */
1186
1187 /**
1188 * This callback is used by the next layer of a zigbee coordinator or
1189 * router to be notified when a new device has successfully joined its
1190 * network by association or rejoined procedures.
1191 * See Zigbee specification r22.1.0, section 3.2.2.14
1192 */
1194
1195 /**
1196 * This callback is used by the next layer of a zigbee router or device
1197 * to be notified of the result of its request to initiate activities
1198 * as a zigbee router
1199 * See Zigbee specification r22.1.0, section 3.2.2.10
1200 */
1202
1203 /**
1204 * The parameters used during a NLME-NETWORK-FORMATION.request. These parameters
1205 * are stored here while the scanning operations and network initialization
1206 * procedures take place.
1207 */
1209
1210 /**
1211 * The values temporarily stored as a result of the initial steps of a
1212 * NLME-NETWORK-FORMATION.request (i.e. after the first energy scan)
1213 * Page, Channel, PanId.
1214 */
1216
1217 /**
1218 * The parameters used during a NLME-JOIN.request. These parameters
1219 * are stored here while the scanning operations and network joining
1220 * procedures take place.
1221 */
1223
1224 /**
1225 * Temporarily store the NLME-JOIN.indication parameters while the
1226 * join operations (asocciation) conclude in the coordinator or router.
1227 */
1229
1230 /**
1231 * Temporarily store the NLME-START-ROUTER.request parameters during
1232 * the router initialization process.
1233 */
1235
1236 /**
1237 * Temporarily store MLME-ASSOCIATE.request parameters
1238 * during a NLME-JOIN.request.
1239 */
1241
1242 /**
1243 * The maximum acceptable energy level used in an energy scan taking place
1244 * during a NLME-NETWORK-FORMATION.request.
1245 */
1247
1248 /**
1249 * Contains the list of channels with acceptable energy levels in a bitmap form.
1250 * This is the result of an Energy Detection (ED) scan during
1251 * a NLME-NETWORK-FORMATION.request
1252 */
1254
1255 /**
1256 * Indicates the current primitive in use in the NWK layer.
1257 */
1259
1260 /**
1261 * The network layer neighbor table
1262 * See Zigbee specification r22.1.0, 3.6.1.5
1263 */
1265
1266 /**
1267 * Use to keep track of neighboring 16 bit PAN id.
1268 * This information is used during the Join process (Association).
1269 */
1271
1272 /**
1273 * The network layer routing table
1274 * See Zigbee specification r22.1.0, 3.6.3.2
1275 */
1277
1278 /**
1279 * The network route discovery table
1280 * See Zigbee specification r22.1.0, 3.6.3.2
1281 */
1283
1284 /**
1285 * Keep track of all the route request retries.
1286 */
1288
1289 /**
1290 * The broadcast transaction table.
1291 * See Zigbee specification r22.1.0, 3.6.5
1292 */
1294
1295 /**
1296 * The Group Table used by this Zigbee NWK.
1297 * See Zigbee specification r22.1.0, 3.6.3.2
1298 */
1300
1301 /**
1302 * Enqueue a packet in the pending transmission queue until
1303 * a route is discovered for its destination.
1304 *
1305 * @param p The packet to enqueue.
1306 * @param nsduHandle The handle associated to this packet
1307 */
1308 void EnqueuePendingTx(Ptr<Packet> p, uint8_t nsduHandle);
1309
1310 /**
1311 * Dequeue a packet previously enqueued in the pending transmission queue.
1312 * This is called after a route has successfully be found and the DATA
1313 * packet is ready to be transmitted.
1314 *
1315 * @param dst The destination of the packet
1316 * @param entry The pending packet element
1317 *
1318 * @return True if successfully dequeued
1319 */
1321
1322 /**
1323 * Dispose of all PendingTxPkt accumulated in the pending transmission queue.
1324 */
1325 void DisposePendingTx();
1326
1327 /**
1328 * Buffer a copy of a DATA frame for post transmission handling
1329 * (Transmission failure counts, retransmission of DATA broadcasts,
1330 * push of confirm notifications to the next layer)
1331 *
1332 * @param p The DATA packet to be buffered in the TxPkt buffer.
1333 * @param macHandle The mac layer handle (msdu handle) associated to this frame.
1334 * @param nwkHandle The nwk layer handle (nsdu handle) associated to this frame.
1335 */
1336 void BufferTxPkt(Ptr<Packet> p, uint8_t macHandle, uint8_t nwkHandle);
1337
1338 /**
1339 * Retrieves a previously DATA frame buffered in the TxPkt buffer.
1340 * If the frame is successfully retrieved, the entry is removed from the
1341 * TxPkt buffer.
1342 *
1343 * @param macHandle The mac layer handle (msdu handle) associated to this frame.
1344 * @param txPkt The packet buffered in the TxPkt buffer.
1345 * @return True if the txPkt is successfully retrieved.
1346 */
1347 bool RetrieveTxPkt(uint8_t macHandle, Ptr<TxPkt>& txPkt);
1348
1349 /**
1350 * Dispose of all the entries in the TxPkt Buffer.
1351 */
1352 void DisposeTxPktBuffer();
1353
1354 /**
1355 * Cast a Mac layer status to a NWK layer status.
1356 *
1357 * @param macStatus The Mac layer status to be casted.
1358 * @return The ZigbeeNwkStatus resulting from the cast.
1359 */
1360 NwkStatus GetNwkStatus(lrwpan::MacStatus macStatus) const;
1361
1362 /**
1363 * Used by a Zigbee coordinator or router to allocate a
1364 * 16 bit address (A.K.A short address or network address)
1365 * to its associated device upon request.
1366 *
1367 * @return The allocated 16 bit address by this router or Zigbee coordinator.
1368 */
1370
1371 /**
1372 * Create and store a MAC beacon payload, then updates its registered size in the MAC.
1373 * This is typically followed by updating the content of the beacon payload.
1374 */
1376
1377 /**
1378 * Updates the content of the beacon payload with the most recent information in the NWK.
1379 */
1380 void UpdateBeaconPayload();
1381
1382 /**
1383 * Get a non linear representation of a Link Quality Indicator (LQI).
1384 * This is used to obtain LQI representations used in the link cost/Path cost
1385 * of a route discovery and the Outgoing cost in the neighbors table.
1386 *
1387 * @param lqi The LQI value (1-255) mapped
1388 * @return The LQI value mapped to a non linear representation (1-7)
1389 */
1390 uint8_t GetLQINonLinearValue(uint8_t lqi) const;
1391
1392 /**
1393 * Obtain the link cost based on the value of the nwkReportConstantCost.
1394 * If nwkReportConstantCost is True, the link will use a constant value of 7,
1395 * if false, it will use the LQI to obtain the link cost.
1396 * When the LQI option is used, the link cost is based on a non linear mapping
1397 * of LQI values.
1398 * See Zigbee specification r22.1.0, 3.6.3.1
1399 * See NXP Zigbee 3.0 Stack User Guide (JN-UG-3113, revision 1.5), page 108.
1400 *
1401 * @param lqi The lqi value (1-255) used to calculate the link cost.
1402 * @return The link cost (1-7).
1403 */
1404 uint8_t GetLinkCost(uint8_t lqi) const;
1405
1406 /**
1407 * Send a route request command.
1408 * See Zigbee specification r22.1.0, Section 3.4.1
1409 *
1410 * @param nwkHeader The network header of the RREQ packet to send
1411 * @param payload The payload header of the RREQ packet to send
1412 * @param rreqRetries The maximum number of retries the broadcast transmission of a route
1413 * request command frame is retried. Only valid for non Many-To-One RREQs.
1414 */
1415 void SendRREQ(ZigbeeNwkHeader nwkHeader,
1417 uint8_t rreqRetries);
1418
1419 /**
1420 * Handles the reception of a route request command.
1421 * See Zigbee specification r22.1.0, Section 3.6.3.5.2
1422 *
1423 * @param macSrcAddr The MAC header source address
1424 * @param nwkHeader The received network Header
1425 * @param payload The received route request command payload
1426 * @param linkCost The link cost associated to the received RREQ
1427 */
1428 void ReceiveRREQ(Mac16Address macSrcAddr,
1429 uint8_t linkCost,
1430 ZigbeeNwkHeader nwkHeader,
1432
1433 /**
1434 * Construct and send a route reply command.
1435 * See Zigbee specification r22.1.0, Section 3.4.2
1436 *
1437 * @param nextHop The address of the next hop in the path back to the RREQ originator.
1438 * @param originator The address of the originator device of the first RREQ.
1439 * @param responder The address of the first device responding to the RREQ with a RREP.
1440 * @param rreqId The RREQ identifier of the originator RREQ.
1441 * @param pathcost The sum value of link costs along the way.
1442 */
1443 void SendRREP(Mac16Address nextHop,
1444 Mac16Address originator,
1445 Mac16Address responder,
1446 uint8_t rreqId,
1447 uint8_t pathcost);
1448
1449 /**
1450 * Handles the reception of a route reply command.
1451 * See Zigbee specification r22.1.0, Section 3.6.3.5.3
1452 *
1453 * @param macSrcAddr The MAC source address of this reply (a.k.a. previous hop)
1454 * @param nwkHeader The received network Header
1455 * @param payload The received route reply command payload
1456 * @param linkCost The link cost associated to the received RREP
1457 */
1458 void ReceiveRREP(Mac16Address macSrcAddr,
1459 uint8_t linkCost,
1460 ZigbeeNwkHeader nwkHeader,
1462
1463 /**
1464 * Process a Multicast Frame received as a member of a multicast group.
1465 * See Zigbee specification r22.1.0 Section 3.6.6.3
1466 *
1467 * @param nwkHeader The network header of the received multicast frame.
1468 * @param msdu The MSDU (MSDU = MAC Service Data Unit) received
1469 * @param params The MCPS-DATA.indication parameters associated to the received frame.
1470 */
1472 Ptr<Packet> msdu,
1474
1475 /**
1476 * Process a Multicast Frame received as a non member of a multicast group.
1477 * See Zigbee specification r22.1.0 Section 3.6.6.4
1478 *
1479 * @param nwkHeader The network header of the received multicast frame.
1480 * @param msdu The MSDU (MSDU = MAC Service Data Unit) received
1481 * @param params The MCPS-DATA.indication parameters associated to the received frame.
1482 */
1484 Ptr<Packet> msdu,
1486
1487 /**
1488 * Returns true if the address is a broadcast address according to
1489 * Zigbee specification r22.1.0, Section 3.6.5, Table 3-69
1490 *
1491 * @param address The address to compare to a broadcast address
1492 * @return True if the address in a broadcast address
1493 */
1494 bool IsBroadcastAddress(Mac16Address address);
1495
1496 /**
1497 * Send a data unicast packet, and if necessary look for the next hop route
1498 * and store the pending data transmission until a route is found.
1499 *
1500 * @param packet The NPDU (nwkHeader + data payload) to transmit.
1501 * @param nwkHandle The NWK handle associated to this packet (nsdu handle).
1502 * A handle of 0 implies that the unicast transmission is a
1503 * retransmission and do not requires a handle which is
1504 * used to identify a packet in confirmations to
1505 * requests (NLDE-DATA.confirm).
1506 */
1507 void SendDataUcst(Ptr<Packet> packet, uint8_t nwkHandle);
1508
1509 /**
1510 * Send a data broadcast packet, and add a record to the broadcast transaction
1511 * table (BTT).
1512 *
1513 * @param packet The NPDU (nwkHeader + data payload) to transmit.
1514 * @param nwkHandle The NWK handle associated to this packet (nsdu handle).
1515 * A handle of 0 implies that the unicast transmission is a
1516 * retransmission and do not requires a handle which is
1517 * used to identify a packet in confirmations to
1518 * requests (NLDE-DATA.confirm).
1519 */
1520 void SendDataBcst(Ptr<Packet> packet, uint8_t nwkHandle);
1521
1522 /**
1523 * Send a data multicast packet to all the members of a multicast group.
1524 *
1525 * @param packet The NPDU (nwkHeader + data payload) to transmit.
1526 * @param nwkHandle The NWK handle associated to this packet (nsdu handle).
1527 * A handle of 0 implies that the unicast transmission is a
1528 * retransmission and do not requires a handle which is
1529 * used to identify a packet in confirmations to
1530 * requests (NLDE-DATA.confirm).
1531 */
1532 void SendDataMcst(Ptr<Packet> packet, uint8_t nwkHandle);
1533
1534 /**
1535 * Find the next hop in route to a destination.
1536 *
1537 * See RouteDiscoveryStatus enumeration for full information on the returned status.
1538 *
1539 * @param macSrcAddr The MAC address received from the previous hop.
1540 * @param pathCost The path cost accumulated in the route discovery so far.
1541 * @param nwkHeader The network header created at the initiator or the received RREQ.
1542 * @param payload The payload header of the initiator or the received RREQ.
1543 * @param nextHop If the destination is found in the routing or neighbor tables
1544 * it contains the address of the next hop towards the destination.
1545 *
1546 * @return The RouteDiscoveryStatus of the route search attempt
1547 */
1549 uint8_t pathCost,
1550 ZigbeeNwkHeader nwkHeader,
1552 Mac16Address& nextHop);
1553
1554 /**
1555 * Process Many-To-One routes. In essence, creating new routes or updating
1556 * existing ones from information contained in the received RREQs.
1557 *
1558 * @param macSrcAddr The MAC address received from the previous hop
1559 * @param pathCost The path cost accumulated in the route discovery so far.
1560 * @param nwkHeader The network header created at the initiator or the received RREQ.
1561 * @param payload The payload header created at the initiator or the received RREQ.
1562 *
1563 * @return The resulting RouteDiscoveryStatus of the Many-To-One process request.
1564 */
1566 uint8_t pathCost,
1567 ZigbeeNwkHeader nwkHeader,
1569
1570 /**
1571 * Provides uniform random values
1572 */
1574
1575 /**
1576 * Provides uniform random values for the route request jitter
1577 */
1579
1580 /**
1581 * Provides uniform random values for the broadcast jitter
1582 */
1584
1585 /**
1586 * Temporarily store beacons information from POS routers and PAN coordinators
1587 * during a network-discovery process.
1588 */
1589 std::vector<NetworkDescriptor> m_networkDescriptorList;
1590
1591 /**
1592 * Points to the beacon payload used during the network formation process.
1593 */
1595
1596 /**
1597 * Used to store the value of the PHY current channel.
1598 */
1600
1601 /////////////////////////////
1602 // Network layer constants //
1603 /////////////////////////////
1604
1605 /**
1606 * Indicates whether the device is capable of becoming the ZigBee coordinator
1607 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant in the specification
1608 * but here is defined as variable to be able to change the devices capabilities.
1609 */
1611
1612 /**
1613 * Indicates the version of the ZigBee NWK protocol in the device.
1614 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant in the specification
1615 * but here is defined as variable to be able to change the devices capabilities.
1616 */
1618
1619 /**
1620 * Indicates the duration until a route discovery expires.
1621 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant in the specification
1622 * but here is defined as variable to be able to change the devices capabilities.
1623 */
1625
1626 /**
1627 * The number of times the first broadcast transmission of a route request command
1628 * frame is retried. Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1629 * in the specification but here is defined as variable to allow the selection of values
1630 * per device.
1631 */
1633
1634 /**
1635 * The number of times the broadcast transmission of a route request command frame is
1636 * retried on relay by an intermediate Zigbee router or coordinator.
1637 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1638 * in the specification but here is defined as variable to allow the selection of values
1639 * per device.
1640 */
1642
1643 /**
1644 * Count the number of retries this device has transmitted an RREQ
1645 */
1647
1648 /**
1649 * Duration between retries of a broadcast route request command frame.
1650 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1651 * in the specification but here is defined as variable to allow the selection of values
1652 * per device.
1653 */
1655
1656 /**
1657 * Minimum Route request broadcast jitter time (msec).
1658 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1659 * in the specification but here is defined as variable to allow the selection of values
1660 * per device.
1661 */
1663
1664 /**
1665 * Maximum Route request broadcast jitter time (msec).
1666 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1667 * in the specification but here is defined as variable to allow the selection of values
1668 * per device.
1669 */
1671
1672 /**
1673 * Minimum Broadcast jitter time (msec).
1674 * Zigbee Specification r22.1.0, Table 3-57. Defined as a constant
1675 * in the specification but here is defined as variable to allow the selection of values
1676 * per device.
1677 */
1679
1680 //////////////////////////////
1681 // Network layer attributes //
1682 //////////////////////////////
1683
1684 /**
1685 * A value that determines the method used to assign addresses.
1686 * See Zigbee specification r22.1.0, Table 3-58
1687 */
1689
1690 /**
1691 * The depth a device can have.
1692 * Default value defined in the stack profile.
1693 * See Zigbee specification r22.1.0 Layer protocol implementation conformance statement (PICS)
1694 * and stack profiles (Section 10.4.2.1)
1695 */
1697
1698 /**
1699 * The number of children a device is allowed to have on its current network.
1700 * Default value defined in the stack profile.
1701 * See Zigbee PRO/2007 Layer protocol implementation conformance statement (PICS)
1702 * and stack profiles (Section 10.4.2.1)
1703 */
1705
1706 /**
1707 * The number of routers any one device is allowed to have as children. This is
1708 * determined by the zigbee coordinator for all devices in the network.
1709 * This value is not used if stochastic address allocation is used.
1710 * Default value defined in the stack profile.
1711 * See Zigbee PRO/2007 Layer protocol implementation conformance statement (PICS)
1712 * and stack profiles (Section 10.4.2.1)
1713 */
1715
1716 /**
1717 * Describes the current stack profile used in this NWK layer
1718 */
1720
1721 /**
1722 * Indicates the index of the requested timeout field that contains the timeout
1723 * in minutes for any end device that does not negotiate a different timeout
1724 * value.
1725 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1726 */
1728
1729 /**
1730 * The extended PAN identifier for the PAN of which the device is a member.
1731 * A value of 0 means that the extended PAN identifier is unknown.
1732 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1733 */
1735
1736 /**
1737 * The 16-bit address that the device uses to communicate with the PAN.
1738 * This attribute reflects the value of the MAC PIB attribute macShortAddress
1739 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1740 */
1742
1743 /**
1744 * The EUI 64 bit IEEE address of the local device.
1745 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1746 */
1748
1749 /**
1750 * This NIB attribute should, at all times, have the same value as macPANId .
1751 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1752 */
1753 uint16_t m_nwkPanId;
1754
1755 /**
1756 *
1757 * The behavior depends upon whether the device is a FFD or RFD.
1758 * For RFD, this records the information received in an End device timeout
1759 * response command indicating the parent information (Table 3-55).
1760 * For FFD, this records the device's local capabilities.
1761 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1762 */
1764
1765 /**
1766 * This NIB attribute contains the device capability information established
1767 * at network joining time.
1768 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1769 */
1771
1772 /**
1773 * This NIB attribute is a flag determining if this device is a concentrator
1774 * (Use in Many-To-One routing).
1775 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1776 */
1778
1779 /**
1780 * This NIB attribute indicates the hop count radius for concentrator
1781 * route discoveries (Used by Many-To-One routing).
1782 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1783 */
1785
1786 /**
1787 * The time in seconds between concentrator route discoveries.
1788 * If set to 0x0000, the discoveries are done at the start up
1789 * and by the next higher layer only.
1790 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1791 */
1793
1794 /**
1795 * This NIB attribute indicates whether the NWK layer should assume the ability to
1796 * use hierarchical routing.
1797 * True = Hierarchical routing False = Never use hierarchical routing
1798 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1799 */
1801
1802 /**
1803 * If false, the NWK layer shall calculate the link cost from all neighbor nodes
1804 * using the LQI values reported by the MAC layer, otherwise it shall report a
1805 * constant value (7).
1806 * See Zigbe Specification r22.1.0, Table 3-58 (NIB attributes)
1807 */
1809
1810 /**
1811 * Describes the current route symmetry:
1812 * True: Routes are considered to be symmetric links. Backward and forward routes
1813 * are created during one-route discovery and they are identical.
1814 * False: Routes are not consider to be comprised of symmetric links. Only the forward
1815 * route is stored during route discovery.
1816 * See Zigbe Specification r22.1.0, Table 3-58 (NIB attributes)
1817 */
1819
1820 /**
1821 * The maximum number of retries allowed after a broadcast transmission failure
1822 * See Zigbe Specification r22.1.0, Table 3-58 (NIB attributes)
1823 */
1825
1826 /**
1827 * The maximum time duration in milliseconds allowed for the parent all the child devices to
1828 * retransmit a broadcast message.
1829 * See Zigbe Specification r22.1.0, Table 3-58 (NIB attributes)
1830 * See Zigbee-2007 Layer PICS and Stack Profiles
1831 */
1833
1834 /**
1835 * Time duration that a broadcast message needs to encompass the entire network.
1836 * Its default value is calculated based on other NIB attributes.
1837 * See Zigbe Specification r22.1.0, Table 3-58 (NIB attributes)
1838 */
1840
1841 /**
1842 * The sequence number used to identify outgoing frames
1843 * See Zigbee specification r22.1.0, Table 3-58 (NIB attributes)
1844 */
1846
1847 /**
1848 * The counter used to identify route request commands
1849 */
1851
1852 /**
1853 * The handle assigned when doing a transmission request
1854 * to the MAC layer
1855 */
1857
1858 /**
1859 * The expiration time of routing table entry.
1860 * This value is not standardized and it is implementation dependent.
1861 */
1863};
1864
1865} // namespace zigbee
1866} // namespace ns3
1867
1868#endif /* ZIGBEE_NWK_H */
Callback template class.
Definition callback.h:422
This class can contain 16 bit addresses.
an EUI-64 address
Object()
Constructor.
Definition object.cc:96
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
Simulation virtual time values and global simulation resolution.
Definition nstime.h:96
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:49
The Broadcast Transaction Table (BTT) The BTT is used to keep track of data broadcast transactions.
The network layer Network Table See Zigbee specification r22.1.0, 3.6.1.5.
A table that keeps record of neighbors devices NWK extended PAN ids (64 bits) and their related 16 bi...
The network layer Route Discovery Table See Zigbee specification r22.1.0, 3.6.3.2.
The network layer Routing Table.
A table storing information about upcoming route request retries.
Represent the NWK Header with the Frame Control and Routing fields Zigbee Specification r22....
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.
Ptr< ZigbeeGroupTable > m_nwkGroupIdTable
The Group Table used by this Zigbee NWK.
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.
Definition zigbee-nwk.cc:35
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.
Ptr< UniformRandomVariable > m_bcstJitter
Provides uniform random values for the broadcast jitter.
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.
void ReceiveMulticastNonMemberFrame(ZigbeeNwkHeader nwkHeader, Ptr< Packet > msdu, lrwpan::McpsDataIndicationParams params)
Process a Multicast Frame received as a non member of a multicast group.
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 ReceiveMulticastMemberFrame(ZigbeeNwkHeader nwkHeader, Ptr< Packet > msdu, lrwpan::McpsDataIndicationParams params)
Process a Multicast Frame received as a member of a multicast group.
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 SetGroupTable(Ptr< ZigbeeGroupTable > groupTable)
Get the group table used by this Zigbee NWK.
void SetNlmeStartRouterConfirmCallback(NlmeStartRouterConfirmCallback c)
Set the callback as part of the interconnections between the NWK and the APS sublayer (or any other h...
Time m_nwkPassiveAckTimeout
The maximum time duration in milliseconds allowed for the parent all the child devices to retransmit ...
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....
double m_nwkcMaxBroadcastJitter
Minimum Broadcast jitter time (msec).
void SendDataMcst(Ptr< Packet > packet, uint8_t nwkHandle)
Send a data multicast packet to all the members of a multicast group.
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(* RreqRetriesExhaustedTracedCallback)(uint8_t rreqId, Mac16Address dst, uint8_t rreqRetriesNum)
TracedCallback signature for RreqRetriesExhaustedTrace events.
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.
Represent a variable portion of the zigbee payload header that includes the route request command.
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.
SequenceNumber< uint8_t, int8_t > SequenceNumber8
8 bit Sequence number.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1369
AddrAllocMethod
Use to describe the method used to assign addresses in the NWK layer.
Definition zigbee-nwk.h:87
@ STOCHASTIC_ALLOC
Stochastic address allocation (Zigbee Specification r22.1.0 Section 3.6.1.7)
Definition zigbee-nwk.h:90
@ DISTRIBUTED_ALLOC
Distributed address allocation (Zigbee Specification r22.1.0 Section 3.6.1.6)
Definition zigbee-nwk.h:88
Callback< void, NlmeRouteDiscoveryConfirmParams > NlmeRouteDiscoveryConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:652
JoiningMethod
Use to describe the parameter that controls the method of joining the network.
Definition zigbee-nwk.h:108
@ CHANGE_CHANNEL
The device is to change the operational network channel to that identified in the ScanChannel paramet...
Definition zigbee-nwk.h:113
@ REJOINING
The device is joining the network using the rejoining procedure.
Definition zigbee-nwk.h:112
@ ASSOCIATION
The device is requesting to join a network through association.
Definition zigbee-nwk.h:109
@ DIRECT_OR_REJOIN
The device is joining directly or rejoining using the orphaning procedure.
Definition zigbee-nwk.h:110
Callback< void, NlmeNetworkFormationConfirmParams > NlmeNetworkFormationConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:636
NetworkStatusCode
Status codes for network status command frame and route discovery failures.
Definition zigbee-nwk.h:245
@ MANY_TO_ONE_ROUTE_FAILURE
Many to one route failure.
Definition zigbee-nwk.h:258
@ NO_ROUTING_CAPACITY
No routing capacity.
Definition zigbee-nwk.h:250
@ VERIFY_ADDRESS
Verify address.
Definition zigbee-nwk.h:260
@ PAN_IDENTIFIER_UPDATE
PAN identifier update.
Definition zigbee-nwk.h:261
@ VALIDATE_ROUTE
Validate route.
Definition zigbee-nwk.h:256
@ TREE_LINK_FAILURE
Tree link failure.
Definition zigbee-nwk.h:247
@ INDIRECT_TRANSACTION_EXPIRY
Indirect transaction expiry.
Definition zigbee-nwk.h:252
@ BAD_KEY_SEQUENCE_NUMBER
Bad key sequence number.
Definition zigbee-nwk.h:264
@ TARGET_DEVICE_UNAVAILABLE
Target device unavailable.
Definition zigbee-nwk.h:253
@ NO_ROUTE_AVAILABLE
No route available.
Definition zigbee-nwk.h:246
@ LOW_BATTERY
Low battery.
Definition zigbee-nwk.h:249
@ TARGET_ADDRESS_UNALLOCATED
Target address unallocated.
Definition zigbee-nwk.h:254
@ SOURCE_ROUTE_FAILURE
Source route failure.
Definition zigbee-nwk.h:257
@ NO_INDIRECT_CAPACITY
No indirect capacity.
Definition zigbee-nwk.h:251
@ ADDRESS_CONFLICT
Address conflict.
Definition zigbee-nwk.h:259
@ UNKNOWN_COMMAND
Unknown command.
Definition zigbee-nwk.h:265
@ NON_TREE_LINK_FAILURE
Non tree link failure.
Definition zigbee-nwk.h:248
@ PARENT_LINK_FAILURE
Parent link failure.
Definition zigbee-nwk.h:255
@ NETWORK_ADDRESS_UPDATE
Network address update.
Definition zigbee-nwk.h:262
@ BAD_FRAME_COUNTER
Bad frame counter.
Definition zigbee-nwk.h:263
Callback< void, NlmeStartRouterConfirmParams > NlmeStartRouterConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:684
Callback< void, NlmeJoinIndicationParams > NlmeJoinIndicationCallback
This callback is used to notify the next higher layer with an indication that a new device has succes...
Definition zigbee-nwk.h:676
AddressMode
Table 3.2 (Address Mode) NLDE-DATA-Request parameters.
Definition zigbee-nwk.h:76
@ MCST
Multicast Address mode.
Definition zigbee-nwk.h:78
@ NO_ADDRESS
No destination address.
Definition zigbee-nwk.h:77
@ UCST_BCST
Unicast or Broadcast address mode.
Definition zigbee-nwk.h:79
Callback< void, NldeDataIndicationParams, Ptr< Packet > > NldeDataIndicationCallback
This callback is called after a NSDU has successfully received and NWK push it to deliver it to the n...
Definition zigbee-nwk.h:619
StackProfile
Use to describe the identifier of the zigbee stack profile.
Definition zigbee-nwk.h:98
@ ZIGBEE
Zigbee stack profile 0x01 (a.k.a.
Definition zigbee-nwk.h:99
@ ZIGBEE_PRO
Zigbee stack profile 0x02 (Zigbee Pro, also known as r22.1.0, 3.0)
Definition zigbee-nwk.h:100
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 ...
Definition zigbee-nwk.h:122
@ NO_DISCOVER_ROUTE
We are currently not allowed to perform a route discovery for this route (RouteDiscover flag in netwo...
Definition zigbee-nwk.h:130
@ ROUTE_NOT_FOUND
The next hop was not found.
Definition zigbee-nwk.h:125
@ MANY_TO_ONE_ROUTE
A new Many-To-One route was created.
Definition zigbee-nwk.h:135
@ ROUTE_FOUND
The next hop toward the destination was found in our routing table or neighbor table (Mesh route).
Definition zigbee-nwk.h:123
@ NO_ROUTE_CHANGE
No route entry was created or updated during a Many-To-One process.
Definition zigbee-nwk.h:136
@ DISCOVER_UNDERWAY
The route was found in the tables but currently has no next hop.
Definition zigbee-nwk.h:132
@ ROUTE_UPDATED
A route was found and updated with a better route (Mesh route or Many-To-One route)
Definition zigbee-nwk.h:128
@ TABLE_FULL
Either the routing or neighbor table are full.
Definition zigbee-nwk.h:127
Callback< void, NlmeNetworkDiscoveryConfirmParams > NlmeNetworkDiscoveryConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:644
static constexpr uint32_t ALL_CHANNELS
Bitmap representing all channels (11~26) LSB b0-b26, b27-b31 MSB Page 0 in Zigbee (250kbps O-QPSK)
Definition zigbee-nwk.h:48
Callback< void, NldeDataConfirmParams > NldeDataConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:628
Callback< void, NlmeDirectJoinConfirmParams > NlmeDirectJoinConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:660
PendingPrimitiveNwk
Indicates a pending NWK primitive.
Definition zigbee-nwk.h:58
@ NLME_NET_DISCV
Pending NLME-NETWORK-DISCOVERY.request primitive.
Definition zigbee-nwk.h:64
@ NLME_DIRECT_JOIN
Pending NLME-DIRECT-JOIN.request primitive.
Definition zigbee-nwk.h:61
@ NLME_NETWORK_FORMATION
Pending NLME-NETWORK-FORMATION.request primitive.
Definition zigbee-nwk.h:60
@ NLME_JOIN
Pending NLME-JOIN.request primitive.
Definition zigbee-nwk.h:62
@ NLDE_NLME_NONE
No pending primitive.
Definition zigbee-nwk.h:59
@ NLME_START_ROUTER
Pending NLME-START-ROUTER.request primitive.
Definition zigbee-nwk.h:63
@ NLME_JOIN_INDICATION
Pending NLME-JOIN.indication primitive.
Definition zigbee-nwk.h:65
@ NLME_ROUTE_DISCOVERY
Pending NLME-ROUTE-DISCOVERY.request primitive.
Definition zigbee-nwk.h:66
@ NLDE_DATA
Pending NLDE-DATA.request primitive.
Definition zigbee-nwk.h:67
Callback< void, NlmeJoinConfirmParams > NlmeJoinConfirmCallback
This callback is used to notify the next higher layer with a confirmation in response to a previously...
Definition zigbee-nwk.h:668
NwkStatus
Network layer status values Combines Zigbee Specification r22.1.0 Table 3-73 and and IEEE 802....
Definition zigbee-nwk.h:152
@ BEACON_LOSS
The beacon was lost following a synchronization request.
Definition zigbee-nwk.h:162
@ UNSUPPORTED_LEGACY
Deprecated security used in IEEE 802.15.4-2003.
Definition zigbee-nwk.h:160
@ ALREADY_PRESENT
Already present (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:194
@ READ_ONLY
SET/GET request issued for a read only attribute.
Definition zigbee-nwk.h:187
@ MAX_FRM_COUNTER
Max Frame counter (IEEE 802.15.4, Zigbee specification r22.1.0)
Definition zigbee-nwk.h:200
@ UNSUPPORTED_SECURITY
The security applied is not supported.
Definition zigbee-nwk.h:161
@ DISABLE_TRX_FAILURE
The attempt to disable the transceier has failed.
Definition zigbee-nwk.h:165
@ FULL_CAPACITY
PAN at capacity.
Definition zigbee-nwk.h:155
@ NO_DATA
No response data were available following a request.
Definition zigbee-nwk.h:173
@ IMPROPER_KEY_TYPE
The key is not allowed to be used with that frame type.
Definition zigbee-nwk.h:158
@ INVALID_PARAMETER_MAC
Invalid parameter in response to a request passed to the MAC.
Definition zigbee-nwk.h:170
@ TRANSACTION_OVERFLOW
There is no capacity to store the transaction.
Definition zigbee-nwk.h:179
@ SUPERFRAME_OVERLAP
Coordinator sperframe and this device superframe tx overlap.
Definition zigbee-nwk.h:188
@ NOT_PERMITED
Not permitted (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:192
@ INVALID_REQUEST
Invalid request (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:191
@ OUT_OF_CAP
(Deprecated) See IEEE 802.15.4-2003
Definition zigbee-nwk.h:175
@ NO_NETWORKS
No network (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:199
@ SECURITY_ERROR
Cryptographic process of the frame failed(FAILED_SECURITY_CHECK).
Definition zigbee-nwk.h:166
@ UNSUPPORTED_ATTRIBUTE
Unsupported attribute (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:198
@ TRANSACTION_EXPIRED
The transaction expired and its information discarded.
Definition zigbee-nwk.h:178
@ REALIGMENT
A coordinator realigment command has been received.
Definition zigbee-nwk.h:177
@ SUCCESS
The operation was completed successfully.
Definition zigbee-nwk.h:154
@ LIMIT_REACHED
Limit reached during network scan (IEEE 802.15.4-2011)
Definition zigbee-nwk.h:208
@ NO_SHORT_ADDRESS
Failure due to unallocated 16-bit short address.
Definition zigbee-nwk.h:174
@ INVALID_INTERFACE
Invalid interface (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:207
@ INVALID_INDEX
A MAC PIB write failed because specified index is out of range.
Definition zigbee-nwk.h:186
@ UNAVAILABLE_KEY
Unavailable key, unknown or blacklisted.
Definition zigbee-nwk.h:181
@ INVALID_PARAMETER
Invalid Parameter (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:190
@ INVALID_ADDRESS
Invalid source or destination address.
Definition zigbee-nwk.h:182
@ FRAME_NOT_BUFFERED
Frame not buffered (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:206
@ IMPROPER_SECURITY_LEVEL
Insufficient security level expected by the recipient.
Definition zigbee-nwk.h:159
@ INVALID_HANDLE
When purging from TX queue handle was not found.
Definition zigbee-nwk.h:169
@ CHANNEL_ACCESS_FAILURE
A Tx could not take place due to activity in the CH.
Definition zigbee-nwk.h:163
@ TX_ACTIVE
The transceiver was already enabled.
Definition zigbee-nwk.h:180
@ BAD_CCM_OUTPUT
Bad ccm output (IEEE 802.15.4, Zigbee specification r22.1.0)
Definition zigbee-nwk.h:202
@ UNKNOWN_DEVICE
Unknown device (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:197
@ ACCESS_DENIED
PAN access denied.
Definition zigbee-nwk.h:156
@ NEIGHBOR_TABLE_FULL
Neighbor table full (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:196
@ FRAME_TOO_LONG
Frame more than aMaxPHYPacketSize or too large for CAP or GTS.
Definition zigbee-nwk.h:167
@ BT_TABLE_FULL
Bt table full (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:205
@ DENIED
The GTS request has been denied by the PAN coordinator.
Definition zigbee-nwk.h:164
@ ROUTE_DISCOVERY_FAILED
Route discovery failed (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:203
@ SYNC_FAILURE
Sync Failure (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:195
@ TRACKING_OFF
This device is currently not tracking beacons.
Definition zigbee-nwk.h:185
@ COUNTER_ERROR
The frame counter of the received frame is invalid.
Definition zigbee-nwk.h:157
@ NO_ACK
No acknowledgment was received after macMaxFrameRetries.
Definition zigbee-nwk.h:171
@ STARTUP_FAILURE
Startup failure (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:193
@ ON_TIME_TOO_LONG
RX enable request fail due to syms.
Definition zigbee-nwk.h:183
@ NO_BEACON
A scan operation failed to find any network beacons.
Definition zigbee-nwk.h:172
@ SCAN_IN_PROGRESS
The dev was scanning during this call (IEEE 802.5.4)
Definition zigbee-nwk.h:209
@ PAST_TIME
Rx enable request fail due to lack of time in superframe.
Definition zigbee-nwk.h:184
@ PAN_ID_CONFLICT
PAN id conflict detected and informed to the coordinator.
Definition zigbee-nwk.h:176
@ ROUTE_ERROR
Route error (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:204
@ NO_KEY
No Key (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:201
@ INVALID_GTS
Missing GTS transmit or undefined direction.
Definition zigbee-nwk.h:168
Every class exported by the ns3 library is enclosed in the ns3 namespace.
MLME-ASSOCIATE.confirm params.
MLME-ASSOCIATE.indication params.
MLME-ASSOCIATE.request params.
MLME-BEACON-NOTIFY.indication params.
MLME-COMM-STATUS.indication params.
MLME-ORPHAN.indication params.
Channel List Structure.
Definition zigbee-nwk.h:274
uint8_t channelPageCount
The number of the channel page structures contained in the channel list structure.
Definition zigbee-nwk.h:275
std::vector< uint32_t > channelsField
The set of channels for a given page.
Definition zigbee-nwk.h:277
A group of pending parameters arranged into a structure during the execution of a NLME-NETWORK-FORMAT...
Definition zigbee-nwk.h:382
uint8_t channel
The channel selected during the initial steps of a network formation.
Definition zigbee-nwk.h:383
uint16_t panId
The PAN id selected during the initial steps of a network formation.
Definition zigbee-nwk.h:385
uint8_t page
The page selected during the initial steps of a network formation.
Definition zigbee-nwk.h:384
Network Descriptor, Zigbee Specification r22.1.0, 3.2.2.4, Table 3-12.
Definition zigbee-nwk.h:475
uint16_t m_panId
The 16-bit PAN identifier of the network.
Definition zigbee-nwk.h:477
uint8_t m_updateId
The value of the UpdateID from the NIB.
Definition zigbee-nwk.h:478
uint8_t m_superframeOrder
The superframe order value of the underlying MAC (Determinates the value of the active period)
Definition zigbee-nwk.h:486
bool m_routerCapacity
TRUE = The device is able to accept join requests from router-capable devices.
Definition zigbee-nwk.h:490
bool m_endDeviceCapacity
TRUE= The device is able to accept join request from end devices.
Definition zigbee-nwk.h:492
StackProfile m_stackProfile
The Zigbee stack profile identifier in use in the discovered network.
Definition zigbee-nwk.h:480
uint8_t m_logCh
The current channel number occupied by the network.
Definition zigbee-nwk.h:479
uint8_t m_beaconOrder
The beacon order value of the underlying MAC.
Definition zigbee-nwk.h:484
uint8_t m_zigbeeVersion
The version of the zigbee protocol in use in the discovered network.
Definition zigbee-nwk.h:482
uint64_t m_extPanId
The 64-bit PAN identifier of the network.
Definition zigbee-nwk.h:476
bool m_permitJoining
TRUE = Indicates that at least one zigbee router on the network currently permits joining.
Definition zigbee-nwk.h:488
NLDE-DATA.confirm params.
Definition zigbee-nwk.h:292
uint8_t m_nsduHandle
The handle associated with the NSDU being confirmed.
Definition zigbee-nwk.h:295
NwkStatus m_status
The status of the corresponding request.
Definition zigbee-nwk.h:293
Time m_txTime
The time indication for the transmitted packet based on the local clock.
Definition zigbee-nwk.h:296
NLDE-DATA.indication params.
Definition zigbee-nwk.h:306
AddressMode m_dstAddrMode
Destination address mode.
Definition zigbee-nwk.h:307
Time m_rxTime
A time indication for the received packet based on the local clock.
Definition zigbee-nwk.h:313
uint32_t m_nsduLength
The number of octets comprising the NSDU being indicated.
Definition zigbee-nwk.h:311
uint8_t m_linkQuality
LQI value delivered by the MAC on receipt of this frame.
Definition zigbee-nwk.h:312
bool m_securityUse
An indication of whether the received data is using security.
Definition zigbee-nwk.h:315
Mac16Address m_srcAddr
The individual device address from which the NSDU originated.
Definition zigbee-nwk.h:310
Mac16Address m_dstAddr
The destination address to which the NSDU was sent.
Definition zigbee-nwk.h:309
NLDE-DATA.request params.
Definition zigbee-nwk.h:324
uint8_t m_nonMemberRadius
Distance in hops that a multicast frame will be relayed by nodes not a member of the group.
Definition zigbee-nwk.h:337
uint32_t m_nsduLength
The number of octets comprising the NSDU to be transferred.
Definition zigbee-nwk.h:328
SequenceNumber8 m_aliasSeqNumber
The sequence number used by this NSDU (ignored if useAlias = false).
Definition zigbee-nwk.h:333
Mac16Address m_dstAddr
The destination address.
Definition zigbee-nwk.h:327
bool m_securityEnable
Enable NWK layer security for the current frame.
Definition zigbee-nwk.h:340
bool m_useAlias
Indicates if next higher layer use an alias for the current frame.
Definition zigbee-nwk.h:330
Mac16Address m_aliasSrcAddr
The source address to be used by this NSDU (ignored ifuseAlias = false).
Definition zigbee-nwk.h:331
uint8_t m_nsduHandle
The NSDU handle.
Definition zigbee-nwk.h:329
uint8_t m_radius
Distance in hops that the frame is allowed to travel through the network.
Definition zigbee-nwk.h:335
AddressMode m_dstAddrMode
Destination address mode.
Definition zigbee-nwk.h:325
uint8_t m_discoverRoute
0x01 Enable Route Discovery | 0x00: Suppress Route discovery
Definition zigbee-nwk.h:339
NLME-DIRECT-JOIN.confirm params.
Definition zigbee-nwk.h:449
NwkStatus m_status
The status the corresponding request.
Definition zigbee-nwk.h:450
Mac64Address m_deviceAddr
The IEEE EUI-64 address in the request to which this is a confirmation.
Definition zigbee-nwk.h:452
NLME-DIRECT-JOIN.request params.
Definition zigbee-nwk.h:436
Mac64Address m_deviceAddr
The EUI-64 bit address of the device directly joined.
Definition zigbee-nwk.h:437
uint8_t m_capabilityInfo
The operating capabilities of the device being directly joined.
Definition zigbee-nwk.h:438
Mac16Address m_networkAddress
The 16 bit network address that was allocated to this device.
Definition zigbee-nwk.h:542
NwkStatus m_status
The status of the corresponding request.
Definition zigbee-nwk.h:540
uint8_t m_macInterfaceIndex
The value of the MAC index from nwkMacInterfaceTable.
Definition zigbee-nwk.h:550
uint64_t m_extendedPanId
The extended 64 bit PAN ID for the network of which the device is now a member.
Definition zigbee-nwk.h:545
ChannelList m_channelList
The structure indicating the current channel of the network that has been joined.
Definition zigbee-nwk.h:547
bool m_enhancedBeacon
True if using enhanced beacons (placeholder, not supported)
Definition zigbee-nwk.h:549
NLME-JOIN.indication params.
Definition zigbee-nwk.h:571
Mac64Address m_extendedAddress
The EUI-64 bit address of an entity that has been added to the network.
Definition zigbee-nwk.h:574
uint8_t m_capabilityInfo
Specifies the operational capabilities of the joining device.
Definition zigbee-nwk.h:576
JoiningMethod m_rejoinNetwork
This parameter indicates the method used to join the network.
Definition zigbee-nwk.h:578
Mac16Address m_networkAddress
The 16 bit network address of an entity that has been added to the network.
Definition zigbee-nwk.h:572
bool m_secureRejoin
True if the rejoin was performed in a secure manner.
Definition zigbee-nwk.h:580
NLME-JOIN.request params.
Definition zigbee-nwk.h:517
JoiningMethod m_rejoinNetwork
This parameter controls the method of joining the network.
Definition zigbee-nwk.h:520
ChannelList m_scanChannelList
The list of all channel pages and the associated channels that shall be scanned.
Definition zigbee-nwk.h:522
uint8_t m_scanDuration
A value used to calculate the length of time to spend scanning each channel.
Definition zigbee-nwk.h:524
uint8_t m_capabilityInfo
The operating capabilities of the device being directly joined (Bit map).
Definition zigbee-nwk.h:526
uint64_t m_extendedPanId
The 64 bit PAN identifier of the the network to join.
Definition zigbee-nwk.h:518
bool m_securityEnable
If the value of RejoinNetwork is REJOINING and this value is true, the device will rejoin securely.
Definition zigbee-nwk.h:528
NLME-NETWORK-DISCOVERY.confirm params.
Definition zigbee-nwk.h:502
uint8_t m_networkCount
Gives the number of networks discovered by the search.
Definition zigbee-nwk.h:505
std::vector< NetworkDescriptor > m_netDescList
A list of descriptors, one for each of the networks discovered.
Definition zigbee-nwk.h:506
NwkStatus m_status
The status of the corresponding request.
Definition zigbee-nwk.h:503
NLME-NETWORK-DISCOVERY.request params.
Definition zigbee-nwk.h:463
uint8_t m_scanDuration
A value used to calculate the length of time to spend.
Definition zigbee-nwk.h:466
ChannelList m_scanChannelList
The list of all channel pages and the associated channels that shall be scanned.
Definition zigbee-nwk.h:464
NLME-NETWORK-FORMATION.confirm params.
Definition zigbee-nwk.h:394
NwkStatus m_status
The status as a result of this request.
Definition zigbee-nwk.h:395
NLME-NETWORK-FORMATION.request params.
Definition zigbee-nwk.h:349
Mac16Address m_distributedNetworkAddress
The address of the device in a distributed network.
Definition zigbee-nwk.h:360
uint8_t m_superFrameOrder
The superframe order.
Definition zigbee-nwk.h:356
bool m_batteryLifeExtension
True: The zigbee coordinator is started supporting battery extension mode.
Definition zigbee-nwk.h:357
bool m_distributedNetwork
Indicates that distributed security will be used.
Definition zigbee-nwk.h:359
ChannelList m_scanChannelList
A structure that contain a description on the pages and their channels to be scanned.
Definition zigbee-nwk.h:350
uint8_t m_scanDuration
The time spent of each channel in symbols: aBaseSuperframeDuriantion * (2n+1).
Definition zigbee-nwk.h:353
NLME-ROUTE-DISCOVERY.confirm params.
Definition zigbee-nwk.h:421
NwkStatus m_status
The status as a result of this request.
Definition zigbee-nwk.h:422
NetworkStatusCode m_networkStatusCode
In case where.
Definition zigbee-nwk.h:424
NLME-ROUTE-DISCOVERY.request params.
Definition zigbee-nwk.h:405
bool m_noRouteCache
This flag determines whether the NWK should establish a route record table.
Definition zigbee-nwk.h:411
AddressMode m_dstAddrMode
Specifies the kind of destination address.
Definition zigbee-nwk.h:406
uint16_t m_radius
Optional parameter that describes the number of hops that the route request will travel through the n...
Definition zigbee-nwk.h:409
Mac16Address m_dstAddr
The 16-bit destination address or Group ID (MCST destination) of the route discovery.
Definition zigbee-nwk.h:407
NLME-START-ROUTER.confirm params.
Definition zigbee-nwk.h:603
NwkStatus m_status
The status of the corresponding request.
Definition zigbee-nwk.h:604
NLME-START-ROUTER.request params.
Definition zigbee-nwk.h:590
uint8_t m_beaconOrder
The beacon order of the network.
Definition zigbee-nwk.h:591
bool m_batteryLifeExt
True if the router supports battery life extension mode.
Definition zigbee-nwk.h:593
uint8_t m_superframeOrder
The superframe order of the network.
Definition zigbee-nwk.h:592
Structure representing an element in the pending transaction queue.
Time expireTime
The expiration time of the packet.
Mac16Address dstAddr
The destination network Address.
uint8_t nsduHandle
The NSDU handle.
Ptr< Packet > txPkt
The pending packet.
Structure representing an element in the Tx Buffer.
Ptr< Packet > txPkt
The buffered packet.
uint8_t nwkHandle
The nwk handle (nsdu handle).
uint8_t macHandle
The mac handle (msdu handle).