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