A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
zigbee-nwk-tables.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 * Ryo Okuda <c611901200@tokushima-u.ac.jp>
8 * Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
9 */
10
11#ifndef ZIGBEE_TABLES_H
12#define ZIGBEE_TABLES_H
13
14#include "zigbee-nwk-fields.h"
15
16#include "ns3/mac16-address.h"
17#include "ns3/mac64-address.h"
18#include "ns3/output-stream-wrapper.h"
19#include "ns3/timer.h"
20
21#include <cassert>
22#include <deque>
23#include <map>
24#include <stdint.h>
25#include <sys/types.h>
26
27namespace ns3
28{
29namespace zigbee
30{
31
32/**
33 * @ingroup zigbee
34 * Route record states
35 */
37{
38 ROUTE_ACTIVE = 0x0, //!< Route active
39 ROUTE_DISCOVERY_UNDERWAY = 0x1, //!< Route discovery underway
40 ROUTE_DISCOVER_FAILED = 0x2, //!< Route discovery failed
41 ROUTE_INACTIVE = 0x3, //!< Route inactive
42 ROUTE_VALIDATION_UNDERWAY = 0x4, //!< Route discovery validation underway
43};
44
45/**
46 * @ingroup zigbee
47 * The relationship between the neighbor and the current device
48 */
50{
51 NBR_PARENT = 0x0, //!< Neighbor is the parent
52 NBR_CHILD = 0x01, //!< Neighbor is the child
53 NBR_SIBLING = 0x02, //!< Neighbor is the sibling
54 NBR_NONE = 0x03, //!< No relationship
55 NBR_PREV_CHILD = 0x04, //!< Neighbor was a previous child
56 NBR_UNAUTH_CHILD = 0x05, //!< Neighbor is an unauthenticated child
57};
58
59/**
60 * @ingroup zigbee
61 * The network layer device type
62 */
64{
65 ZIGBEE_COORDINATOR = 0x0, //!< Zigbee coordinator
66 ZIGBEE_ROUTER = 0x01, //!< Zigbee router
67 ZIGBEE_ENDDEVICE = 0x02 //!< Zigbee end device
68};
69
70/**
71 * @ingroup zigbee
72 * Routing table entry
73 * Zigbee Specification r22.1.0, Table 3-66
74 */
75class RoutingTableEntry : public SimpleRefCount<RoutingTableEntry>
76{
77 public:
78 /**
79 * The constructor the routing table entry.
80 *
81 * @param dst The destination nwkAddress (MAC 16-bit Address).
82 * @param status The status of the current entry.
83 * @param noRouteCache The value of the route cache flag.
84 * @param manyToOne The value of the manyToOne flag.
85 * @param routeRecordReq The value of the Route record required flag.
86 * @param groupId The value of the group id flag.
87 * @param nextHopAddr The value of the 16 bit next hop address.
88 */
90 RouteStatus status,
91 bool noRouteCache,
92 bool manyToOne,
93 bool routeRecordReq,
94 bool groupId,
95 Mac16Address nextHopAddr);
96
99
100 /**
101 * Set the entry destination nwkAddress (MAC 16-bit address)
102 *
103 * @param dst The value of the destination nwkAddress
104 */
106
107 /**
108 * Get the entry destination nwkAddress(MAC 16-bit address)
109 *
110 * @return The value of the nwkAddress stored in this entry.
111 */
113
114 /**
115 * Indicates if the No Route Cache flag is active.
116 *
117 * @return The value of the no route cache flag.
118 */
119 bool IsNoRouteCache() const;
120
121 /**
122 * Indicates if the Many-to-One flag is active.
123 *
124 * @return The value of the Many-to-one flag.
125 */
126 bool IsManyToOne() const;
127
128 /**
129 * Indicate if the route record request is active.
130 *
131 * @return The value of the route record request flag.
132 */
133 bool IsRouteRecordReq() const;
134
135 /**
136 * Indicates if the Group Id flag is active.
137 *
138 * @return The value of the Group id flag.
139 */
140 bool IsGroupIdPresent() const;
141
142 /**
143 * Set the value of the next hop address.
144 *
145 * @param nextHopAddr The next hop 16-bit nwkAddress
146 */
147 void SetNextHopAddr(Mac16Address nextHopAddr);
148
149 /**
150 * Get the value of the next hop address.
151 *
152 * @return Mac16Address The 16 bit next hop address.
153 */
155
156 /**
157 * Set the lifetime of the entry
158 * @param lt The time used in the entry lifetime
159 */
160 void SetLifeTime(Time lt);
161
162 /**
163 * Get the value of the entry lifetime.
164 * @return the lifetime
165 */
166 Time GetLifeTime() const;
167
168 /**
169 * Set the status of the routing table entry.
170 * @param status the status of the routing table entry.
171 */
172 void SetStatus(RouteStatus status);
173
174 /**
175 * Get the status of the routing table entry.
176 * @return The status of the routing table entry.
177 */
178 RouteStatus GetStatus() const;
179
180 /**
181 * Print the values of the routing table entry.
182 *
183 * @param stream The stream object used to print.
184 */
185 void Print(Ptr<OutputStreamWrapper> stream) const;
186
187 private:
188 Mac16Address m_destination; //!< The 16 bit network address or group id of this route.
189 //!< If the dst device is a router, coordinator or end device, and
190 //!< nwkAddrAlloc has a value of STOCHASTIC_ALLOC this field shall
191 //!< contain the actual 16 bit addr of that device. If the dst
192 //!< device is an end device and nwkAddrAlloc has a value of
193 //!< DISTRIBUTED_ALLOC, this field shall contain the 16 bit
194 //!< nwk address of the device's parent.
195 RouteStatus m_status; //!< The status of the route.
196 //!< Also see Zigbee specification r22.1.0, Table 3-67
197 bool m_noRouteCache{true}; //!< A flag indicating that the destination indicated by
198 //!< this address does not store source routes.
199 bool m_manyToOne{false}; //!< A flag indicating that the destination is a concentrator
200 //!< that issued a many-to-one route request
201 bool m_routeRecordReq{false}; //!< A flag indicating that the route record command frame should
202 //!< be sent to the destination prior to the next data packet.
203 bool m_groupId{false}; //!< A flag indicating that the destination address is a group id.
204 Mac16Address m_nextHopAddr; //!< The 16 bit network address of the next hop on the way to the
205 //!< destination.
206 Time m_lifeTime; //!< Indicates the lifetime of the entry
207};
208
209/**
210 * The Network layer Route Discovery Table Entry
211 * See Zigbee specification r22.1.0, Table 3-68
212 */
213class RouteDiscoveryTableEntry : public SimpleRefCount<RouteDiscoveryTableEntry>
214{
215 public:
216 /**
217 * The constructor of the route discovery entry
218 *
219 * @param rreqId The sequence number used by the RREQ command frame
220 * @param src The source address of the RREQ initiator.
221 * @param snd The address of the device that has sent most recent lowest cost RREQ.
222 * @param forwardCost The accumulated path cost from the RREQ src to this device.
223 * @param residualCost The accumulated path cost from this device to the destination.
224 * @param expTime The expiration time of this entry.
225 */
226 RouteDiscoveryTableEntry(uint8_t rreqId,
227 Mac16Address src,
228 Mac16Address snd,
229 uint8_t forwardCost,
230 uint8_t residualCost,
231 Time expTime);
232
235
236 /**
237 * Get the route request id (The sequence number used by the RREQ command frame).
238 *
239 * @return The route request id (RREQ command frame sequence number).
240 */
241 uint8_t GetRreqId() const;
242
243 /**
244 * Get the source address of the entry's RREQ initiator.
245 *
246 * @return The address of the RREQ initiator.
247 */
249
250 /**
251 * Get the sender address of the entry.
252 *
253 * @return The sender address
254 */
256
257 /**
258 * Get the forward cost of this entry.
259 *
260 * @return The forward cost
261 */
262 uint8_t GetForwardCost() const;
263
264 /**
265 * Get the value of a residual cost (pathcost) updated by a RREP
266 * in this entry.
267 *
268 * @return The residual cost.
269 */
270 uint8_t GetResidualCost() const;
271
272 /**
273 * Set the forward cost of this entry
274 *
275 * @param pathCost The pathCost of the most optimal route found.
276 */
277 void SetForwardCost(uint8_t pathCost);
278
279 /**
280 * Set the sender address of this entry
281 * @param sender The last hop sender of the last optimal route found.
282 */
283 void SetSenderAddr(Mac16Address sender);
284
285 /**
286 * Set the resulting pathcost on a reception of a RREP previously requested.
287 *
288 * @param pathcost The pathcost contained in the RREP
289 */
290 void SetResidualCost(uint8_t pathcost);
291
292 /**
293 * Get the expiration time of this entry
294 *
295 * @return The expiration time of this entry.
296 */
297 Time GetExpTime() const;
298
299 /**
300 * Set the expiration time of the route discovery entry.
301 *
302 * @param exp The expiration time.
303 */
304 void SetExpTime(Time exp);
305
306 /**
307 * Print the values of the route discovery table entry
308 *
309 * @param stream The stream object used to print.
310 */
311 void Print(Ptr<OutputStreamWrapper> stream) const;
312
313 private:
314 uint8_t m_routeRequestId; //!< The sequence number for a RREQ command frame that is incremented
315 //!< each time a device initiates a RREQ.
316 Mac16Address m_sourceAddr; //!< The 16-bit network address of the RREQ initiator.
317 Mac16Address m_senderAddr; //!< The 16-bit network address of the device that has sent
318 //!< the most recent lowest cost RREQ command frame corresponding to
319 //!< this entry's RREQ id and source addr. This field is used to
320 //!< determine the path that an eventual RREP command should follow.
321 uint8_t m_forwardCost; //!< The accumulated path cost from the source of the RREQ to the
322 //!< current device.
323 uint8_t m_residualCost; //!< The accumulated path cost from the current device to the
324 //!< destination device.
325 Time m_expirationTime; //!< A time stamp indicating the expiration time. The default value
326 //!< of the entry is equals to current time + nwkcRouteDiscoveryTime.
327};
328
329/**
330 * The Network layer Neighbor Table Entry
331 * See Zigbee specification r22.1.0, Table 3-63
332 */
333class NeighborTableEntry : public SimpleRefCount<NeighborTableEntry>
334{
335 public:
338
339 /**
340 * Construct a new Neighbor Table Entry object. This constructor do not include
341 * the optional or additional fields.
342 *
343 * @param extAddr The EUI-64 address of the device to register (IEEEaddress)
344 * @param nwkAddr The short address of the device to register (The MAC 16 address)
345 * @param deviceType The type of neighbor device
346 * @param rxOnWhenIdle Indication of whether the neighbor enabled during idle periods.
347 * @param endDevConfig The end device configuration
348 * @param timeoutCounter The remaining current time in seconds.
349 * @param devTimeout The timeout in seconds of the end device
350 * @param relationship The relationship between the neighbor and the current device
351 * @param txFailure Indicates whether or not a previous Tx to the device was successful.
352 * @param lqi The link quality indicator (LQI) value
353 * @param outgoingCost Cost of the link measured by the neighbor
354 * @param age Num of nwkLinkStatusPeriods since the link status cmd was received.
355 * @param keepaliveRx Indicates if at least one keep alive was received since the router was
356 * rebooted.
357 * @param macInterfaceIndex The MAC interface index
358 */
360 Mac16Address nwkAddr,
361 NwkDeviceType deviceType,
362 bool rxOnWhenIdle,
363 uint16_t endDevConfig,
364 Time timeoutCounter,
365 Time devTimeout,
366 Relationship relationship,
367 uint8_t txFailure,
368 uint8_t lqi,
369 uint8_t outgoingCost,
370 uint8_t age,
371 bool keepaliveRx,
372 uint8_t macInterfaceIndex);
373
374 /**
375 * Get the entry registered IEEE address (EUI-64 address).
376 *
377 * @return The entry EUI-64 address.
378 */
379 Mac64Address GetExtAddr() const;
380
381 /**
382 * Get the entry registered Network address (MAC short address).
383 *
384 * @return The 16 bit address registered in this entry.
385 */
386 Mac16Address GetNwkAddr() const;
387
388 /**
389 * Get the device type of this neighbor device.
390 *
391 * @return The type of device registered for this neighbor.
392 */
394
395 /**
396 * Return true is neighboring device is on when idle.
397 *
398 * @return True if device is on when idle.
399 */
400 bool IsRxOnWhenIdle() const;
401
402 /**
403 * Get the end device configuration object.
404 *
405 * @return The end device configuration in this entry.
406 */
407 uint16_t GetEndDevConfig() const;
408
409 /**
410 * Get the timeout counter object.
411 *
412 * @return The extended PAN Id registered to this entry.
413 */
414 Time GetTimeoutCounter() const;
415
416 /**
417 * Get the device timeout object.
418 *
419 * @return The device timeout time
420 */
421 Time GetDevTimeout() const;
422
423 /**
424 * Get the relationship object.
425 *
426 * @return The relationship between the neighbor and current device.
427 */
428 uint8_t GetRelationship() const;
429
430 /**
431 * Get the Tx Failure object
432 *
433 * @return A value indicating if a prev Tx to the device was successful.
434 */
435 uint8_t GetTxFailure() const;
436
437 /**
438 * Get the LQI value from this device to an entry neighbor
439 *
440 * @return The LQI value
441 */
442 uint8_t GetLqi() const;
443
444 /**
445 * Get the outgoing cost object.
446 *
447 * @return The cost of the outgoing link as measured by a neighbor.
448 */
449 uint8_t GetOutgoingCost() const;
450
451 /**
452 * Get the number of nwkLinkStatusPeriod intervals since the
453 * link status command was received.
454 *
455 * @return The number of nwkLinkStatusPeriod intervals
456 */
457 uint8_t GetAge() const;
458
459 /**
460 * Get the time in symbols at which the last beacon frame
461 * was received from the neighbor.
462 *
463 * @return time in symbols since last beacon frame.
464 */
465 uint64_t GetIncBeaconTimestamp() const;
466
467 /**
468 * Get the transmission time difference in symbols, between the
469 * neighbor's beacon and its parent beacon.
470 *
471 * @return Time difference (symbols) between beacon and parent beacon.
472 */
473 uint64_t GetBeaconTxTimeOffset() const;
474
475 /**
476 * Get the MAC Interface Index object
477 *
478 * @return The MAC interface index registered for this entry
479 */
480 uint8_t GetMacInterfaceIndex() const;
481
482 /**
483 * Get the number of unicast bytes transmitted to the neighbor
484 * registered in this entry.
485 *
486 * @return Unicast transmitted bytes.
487 */
489
490 /**
491 * Get the number of unicast bytes received to the neighbor
492 * registered in this entry.
493 *
494 * @return Unicast transmitted bytes.
495 */
497
498 /**
499 * Get the extended PAN identifier
500 *
501 * @return The extended PAN identifier.
502 */
503 uint64_t GetExtPanId() const;
504
505 /**
506 * Get the logical channel used by the the neighbor in this entry.
507 *
508 * @return The channel number used by this neighbor.
509 */
510 uint8_t GetLogicalCh() const;
511
512 /**
513 * The depth of the neighbor device.
514 *
515 * @return The depth of the neighbor device in this entryj
516 */
517 uint8_t GetDepth() const;
518
519 /**
520 * Get the value of the beacon order set in this neighbor.
521 * See IEEE 802.15.4-2011.
522 *
523 * @return The value of the beacon order registered for this neighbor entry.
524 */
525 uint8_t GetBeaconOrder() const;
526
527 /**
528 * Get the the value of the potential parent field.
529 *
530 * @return A confirmation of whether of not the device has been discarded a potential parent.
531 */
532 uint8_t IsPotentialParent() const;
533
534 /**
535 * Set the entry registered Network address (MAC short address).
536 *
537 * @param nwkAddr The 16 bit address to set in this entry.
538 */
539 void SetNwkAddr(Mac16Address nwkAddr);
540
541 /**
542 * Set the device type of this neighbor device.
543 *
544 * @param devType The device to set for this entry.
545 */
546 void SetDeviceType(NwkDeviceType devType);
547
548 /**
549 * Set the device is on when idle flag.
550 *
551 * @param onWhenIdle Set if device is on when idle.
552 */
553 void SetRxOnWhenIdle(bool onWhenIdle);
554
555 /**
556 * Set the end device configuration.
557 *
558 * @param conf The end device configuration to set in this entry.
559 */
560 void SetEndDevConfig(uint16_t conf);
561
562 /**
563 * Set the timeout counter object.
564 *
565 * @param counter The timeout counter used by this entry.
566 */
567 void SetTimeoutCounter(Time counter);
568
569 /**
570 * Set the device timeout object.
571 *
572 * @param timeout The device timeout time
573 */
575
576 /**
577 * Set the relationship object.
578 *
579 * @param relationship The relationship between the neighbor and current device.
580 */
581 void SetRelationship(Relationship relationship);
582
583 /**
584 * Set the Tx Failure object
585 *
586 * @param failure A value indicating if a prev Tx to the device was successful.
587 */
588 void SetTxFailure(uint8_t failure);
589
590 /**
591 * Set the Link quality indicator value from this device to an entry neighbor
592 *
593 * @param lqi The LQI value
594 */
595 void SetLqi(uint8_t lqi);
596
597 /**
598 * Set the outgoing cost object.
599 *
600 * @param cost The cost of the outgoing link as measured by a neighbor.
601 */
602 void SetOutgoingCost(uint8_t cost);
603
604 /**
605 * Set the number of nwkLinkStatusPeriod intervals since the
606 * link status command was received.
607 *
608 * @param age The number of nwkLinkStatusPeriod intervals
609 */
610 void SetAge(uint8_t age);
611
612 /**
613 * Set the time in symbols at which the last beacon frame
614 * was received from the neighbor.
615 *
616 * @param timestamp time in symbols since last beacon frame.
617 */
618 void SetIncBeaconTimestamp(uint64_t timestamp);
619
620 /**
621 * Set the transmission time difference in symbols, between the
622 * neighbor's beacon and its parent beacon.
623 *
624 * @param offset Time difference (symbols) between beacon and parent beacon.
625 */
626 void SetBeaconTxTimeOffset(uint64_t offset);
627
628 /**
629 * Set the MAC Interface Index object
630 *
631 * @param index The MAC interface index registered for this entry
632 */
633 void SetMacInterfaceIndex(uint8_t index);
634
635 /**
636 * Set the number of unicast bytes transmitted to the neighbor
637 * registered in this entry.
638 *
639 * @param txBytes Unicast transmitted bytes.
640 */
641 void SetMacUcstBytesTx(uint32_t txBytes);
642
643 /**
644 * Set the number of unicast bytes received to the neighbor
645 * registered in this entry.
646 *
647 * @param rxBytes Unicast transmitted bytes.
648 */
649 void SetMacUcstBytesRx(uint32_t rxBytes);
650
651 /**
652 * Set the extended PAN identifier
653 *
654 * @param extPanId The extended PAN identifier.
655 */
656 void SetExtPanId(uint64_t extPanId);
657
658 /**
659 * Set the logical channel used by the the neighbor in this entry.
660 *
661 * @param channel The channel number used by this neighbor.
662 */
663 void SetLogicalCh(uint8_t channel);
664
665 /**
666 * Set the depth of the neighbor device.
667 *
668 * @param depth The depth of the neighbor device in this entryj
669 */
670 void SetDepth(uint8_t depth);
671
672 /**
673 * Set the value of the beacon order set in this neighbor.
674 * See IEEE 802.15.4-2011.
675 *
676 * @param bo The value of the beacon order registered for this neighbor entry.
677 */
678 void SetBeaconOrder(uint8_t bo);
679
680 /**
681 * Set the the value of the potential parent field.
682 *
683 * @param confirm A confirm of whether or not the device has been discarded a potential parent.
684 */
685 void SetPotentialParent(bool confirm);
686
687 /**
688 * Print the values of the neighbor table entry.
689 *
690 * @param stream The stream object used to print.
691 */
692 void Print(Ptr<OutputStreamWrapper> stream) const;
693
694 private:
695 Mac64Address m_extAddr; //!< The IEEE EUI-64 bit address that is unique to every device.
696 Mac16Address m_nwkAddr; //!< The 16 bit network address of the neighboring device.
697 NwkDeviceType m_deviceType; //!< The type of neighbor device
698 bool m_rxOnWhenIdle; //!< Indicates if the neighbor receiver is enabled during idle periods.
699 uint16_t m_endDevConfig; //!< The end device configuration.
700 //!< See Zigbee Specification r22.1.0, 3.4.11.3.2
701 Time m_timeoutCounter; //!< Indicates the current time remaining in seconds, for the end device.
702 Time m_devTimeout; //!< This field indicates the timeout, in seconds, for the end device child.
703 Relationship m_relationship; //!< Relationship between the neighbor and the current device.
704 uint8_t m_txFailure; //!< A value indicating if previous transmissions to the device
705 //!< were successful or not. Higher values indicate more failures.
706 uint8_t m_lqi; //!< The estimated link quality for RF transmissions from this device
707 //!< See Zigbee specification r22.1.0, 3.6.3.1
708 uint8_t m_outgoingCost; //!< The cost of the outgoing link as measured by the neighbor.
709 //!< A value of 0 indicates no outgoing cost available.
710 uint8_t m_age; //!< The number of nwkLinkStatusPeriod intervals since link status command
711 //!< was received. Mandatory if m_nwkSymLink = true
712 uint64_t m_incBeaconTimestamp; //!< The time in symbols at which the last beacon frame
713 //!< was received from the neighbor. This is equal to the
714 //!< timestamp taken when the beacon frame was received
715 //!< (Optional Field) See IEEE 802.15.4-2015[B1]
716 uint64_t m_beaconTxTimeOffset; //!< The transmission time difference in symbols, between the
717 //!< neighbor's beacon and its parent beacon (Optional field).
718 bool m_keepaliveRx; //!< This value indicates at least one keepalive has been received
719 //!< from the end device since the router has rebooted.
720 uint8_t m_macInterfaceIndex; //!< This is an index into the MAC Interface Table indicating
721 //! what interface the neighbor or child is bound to.
722 uint32_t m_macUcstBytesTx; //!< The number of bytes transmitted via MAC unicast to the
723 //!< neighbor (Optional field).
724 uint32_t m_macUcstBytesRx; //!< The number of bytes received via MAC unicasts from this
725 //!< neighbor (Optional field).
726
727 // Additional Neighbor Table Fields (Optional fields)
728 // See Zigbee specification r22.1.0, Table 3-64
729
730 uint64_t m_extPanId; //!< The extendend PAN id (based on the Zigbee coordinator EUI-64 address)
731 uint8_t m_logicalCh; //!< The logical channel on which the network is operating.
732 uint8_t m_depth; //!< The tree depth of the neighbor device
733 uint8_t m_bo{15}; //!< The beacon order of the device (See IEEE 802.15.4-2011)
734 bool m_potentialParent{true}; //!< An indication of whether the device has been
735 //!< ruled out as a potential parent.
736};
737
738/**
739 * A table that keeps record of neighbors devices NWK extended PAN ids (64 bits)
740 * and their related 16 bit MAC pan id. This is not explicitly mentioned
741 * in the Zigbee specification but it is required to keep record of this to
742 * enable the join process through association. This approach is also used by
743 * other stacks like Zboss stack 1.0.
744 */
746{
747 public:
748 /**
749 * The constructor of the PanIdTable.
750 */
751 PanIdTable();
752
753 /**
754 * Add an entry to the PAN Id table.
755 *
756 * @param extPanId The extended PAN identifier (64 bits).
757 * @param panId The 16 bit PAN id used by the MAC layer .
758 */
759 void AddEntry(uint64_t extPanId, uint16_t panId);
760
761 /**
762 * Get the 16 bit MAC PAN id based on the reference extended PAN id.
763 *
764 * @param extPanId The NWK extended PAN identifier (64 bits).
765 * @param panId The returned 16 bit PAN Id.
766 * @return True if the entry was found
767 */
768 bool GetEntry(uint64_t extPanId, uint16_t& panId);
769
770 /**
771 * Dispose of the table and all its elements
772 */
773 void Dispose();
774
775 private:
776 std::map<uint64_t, uint16_t> m_panIdTable; //!< The Map object that represents
777 //!< the table of PAN ids.
778};
779
780/**
781 * The route request retry table entry.
782 * It represents information stored about future route requests retries.
783 */
784class RreqRetryTableEntry : public SimpleRefCount<RreqRetryTableEntry>
785{
786 public:
787 /**
788 * The constructor of the RREQ retry table entry
789 *
790 * @param rreqId The RREQ ID
791 * @param rreqRetryEvent The EventId of the next RREQ retry callback
792 * @param rreqRetryCount The current number of RREQ retries for this RREQ ID
793 */
794 RreqRetryTableEntry(uint8_t rreqId, EventId rreqRetryEvent, uint8_t rreqRetryCount);
795
796 /**
797 * Get the RREQ Id from the entry
798 *
799 * @return The RREQ ID from the entry
800 */
801 uint8_t GetRreqId() const;
802
803 /**
804 * Set the RREQ retry count from the entry
805 *
806 * @param rreqRetryCount The value of the RREQ retry count
807 */
808 void SetRreqRetryCount(uint8_t rreqRetryCount);
809
810 /**
811 * Get the RREQ retry count from the entry
812 *
813 * @return The RREQ retry count
814 */
815 uint8_t GetRreqRetryCount() const;
816
817 /**
818 * Set the event id of the RREQ retry
819 *
820 * @param eventId The event id corresponding to the next RREQ retry callback
821 */
822 void SetRreqEventId(EventId eventId);
823
824 /**
825 * Get the RREQ id of the RREQ retry
826 *
827 * @return The event id
828 */
830
831 /**
832 * Print the values of the RREQ retry table entry.
833 *
834 * @param stream The stream object used to print.
835 */
836 void Print(Ptr<OutputStreamWrapper> stream) const;
837
838 private:
839 uint8_t m_rreqId; //!< The RREQ ID
840 EventId m_rreqRetryEventId; //!< The event id of the next RREQ retry callback
841 uint8_t m_rreqRetryCount; //!< The number of RREQ retries
842};
843
844/**
845 * A broadcast Transaction Record (BTR)
846 * As described in Table 3-70
847 */
848class BroadcastTransactionRecord : public SimpleRefCount<BroadcastTransactionRecord>
849{
850 public:
853
854 /**
855 * Construct a new Broadcast Transaction Record (BTR) entry.
856 *
857 * @param srcAddr The source address of the BTR.
858 * @param seq The sequence number of the BTR.
859 * @param exp The expiration time of the BTR.
860 */
861 BroadcastTransactionRecord(Mac16Address srcAddr, uint8_t seq, Time exp);
862
863 /**
864 * Get the source address of the BTR.
865 *
866 * @return The source address.
867 */
868 Mac16Address GetSrcAddr() const;
869
870 /**
871 * Get the sequence number of the BTR.
872 *
873 * @return The sequence number.
874 */
875 uint8_t GetSeqNum() const;
876
877 /**
878 * Get the value of the expiration time in the BTR.
879 *
880 * @return The expiration time
881 */
882 Time GetExpirationTime() const;
883
884 /**
885 * Get the broadcast retry count value
886 *
887 * @return The broadcast retry count value
888 */
889 uint8_t GetBcstRetryCount() const;
890
891 /**
892 * Set the source address of the BTR
893 *
894 * @param srcAddr The source address of the BTR
895 */
896 void SetSrcAddr(Mac16Address srcAddr);
897
898 /**
899 * Set the sequence number of the BTR
900 *
901 * @param seq The sequence number of the BTR
902 */
903 void SetSeqNum(uint8_t seq);
904
905 /**
906 * Set the expiration time object
907 *
908 * @param exp The expiration time of the BTR
909 */
910 void SetExpirationTime(Time exp);
911
912 /**
913 * Set the Broadcast retry count object
914 *
915 * @param count The value of the counter
916 */
917 void SetBcstRetryCount(uint8_t count);
918
919 /**
920 * Print the values of the BTR.
921 *
922 * @param stream The stream object used to print.
923 */
924 void Print(Ptr<OutputStreamWrapper> stream) const;
925
926 private:
927 Mac16Address m_srcAddr; //!< The 16-bit network address of the broadcast initiator.
928 uint8_t m_sequenceNumber; //!< The RREQ sequence number of the initiator's broadcast.
929 Time m_expirationTime; //!< An indicator of when the entry expires
930 uint8_t m_broadcastRetryCount; //!< The number of times this BCST has been retried.
931};
932
933/**
934 * The network layer Routing Table.
935 * See Zigbee specification r22.1.0, 3.6.3.2
936 */
938{
939 public:
940 /**
941 * The constructuctor of a Routing Table object
942 */
943 RoutingTable();
944
945 /**
946 * Adds an entry to the routing table.
947 *
948 * @param rt The routing table entry
949 * @return True if the entry was added to the table.
950 */
952
953 /**
954 * Look for an specific entry in the routing table.
955 *
956 * @param dstAddr The value of the destination address used to look for an entry.
957 * @param entryFound The returned entry if found
958 * @return True if the entry was found in the routing table.
959 */
960 bool LookUpEntry(Mac16Address dstAddr, Ptr<RoutingTableEntry>& entryFound);
961
962 /**
963 * Purge old entries from the routing table.
964 */
965 void Purge();
966
967 /**
968 * Identify and mark entries as ROUTE_INACTIVE status for entries who
969 * have exceeded their lifetimes.
970 */
972
973 /**
974 * Remove an entry from the routing table.
975 *
976 * @param dst The MAC 16 bit destination address of the entry to remove.
977 */
978 void Delete(Mac16Address dst);
979
980 /**
981 * Delete the first occrurance of an expired entry (ROUTE_INACTIVE status)
982 */
983 void DeleteExpiredEntry();
984
985 /**
986 * Print the Routing table.
987 *
988 * @param stream The stream object used to print the routing table.
989 */
990 void Print(Ptr<OutputStreamWrapper> stream) const;
991
992 /**
993 * Dispose of the table and all its elements
994 */
995 void Dispose();
996
997 /**
998 * Get the size of the routing table.
999 *
1000 * @return The current size of the routing table
1001 */
1002 uint32_t GetSize();
1003
1004 /**
1005 * Set the maximum size of the routing table
1006 *
1007 * @param size The size of the routing table.
1008 */
1009 void SetMaxTableSize(uint32_t size);
1010
1011 /**
1012 * Get the maximum size of the routing table.
1013 *
1014 * @return The maximum size of the routing table.
1015 */
1016 uint32_t GetMaxTableSize() const;
1017
1018 private:
1019 uint32_t m_maxTableSize; //!< The maximum size of the routing table;
1020 std::deque<Ptr<RoutingTableEntry>> m_routingTable; //!< The object that
1021 //!< represents the routing table.
1022};
1023
1024/**
1025 * The network layer Route Discovery Table
1026 * See Zigbee specification r22.1.0, 3.6.3.2
1027 */
1029{
1030 public:
1031 /**
1032 * Constructor of route discovery table
1033 */
1035
1036 /**
1037 * Add an entry to the route discovery table, in essence the contents of a RREQ command.
1038 *
1039 * @param rt The route discovery table entry.
1040 * @return True if the entry was added successfully
1041 */
1043
1044 /**
1045 * Look up for a route discovery table entry, the seareched entry must match the id
1046 * and the src address of the initiator.
1047 *
1048 * @param id The RREQ id (RREQ command sequence number)
1049 * @param src The 16 bit address of the initiator device.
1050 * @param entryFound The returned entry if found
1051 * @return True if element found
1052 */
1053 bool LookUpEntry(uint8_t id, Mac16Address src, Ptr<RouteDiscoveryTableEntry>& entryFound);
1054
1055 /**
1056 * Purge old entries from the route discovery table.
1057 */
1058 void Purge();
1059
1060 /**
1061 * Delete an entry from the route discovery table.
1062 *
1063 * @param id The RREQ id of the entry to delete.
1064 * @param src The src address of the initiator of the entry to delete.
1065 */
1066 void Delete(uint8_t id, Mac16Address src);
1067
1068 /**
1069 * Print the contents of the route discovery table
1070 *
1071 * @param stream The stream object used to print the table.
1072 */
1073 void Print(Ptr<OutputStreamWrapper> stream);
1074
1075 /**
1076 * Dispose of the table and all its elements
1077 */
1078 void Dispose();
1079
1080 private:
1081 uint32_t m_maxTableSize; //!< The maximum size of the route discovery table
1082 std::deque<Ptr<RouteDiscoveryTableEntry>> m_routeDscTable; //!< The route discovery table object
1083};
1084
1085/**
1086 * The network layer Network Table
1087 * See Zigbee specification r22.1.0, 3.6.1.5
1088 */
1090{
1091 public:
1092 /**
1093 * The neighbor table constructor
1094 */
1095 NeighborTable();
1096
1097 /**
1098 * Add an entry to the neighbor table.
1099 *
1100 * @param entry The entry to be added to the neighbor table.
1101 * @return True if the entry was added to the table.
1102 */
1104
1105 /**
1106 * Look and return and entry if exists in the neighbor table.
1107 *
1108 * @param nwkAddr The network address used to look for an element in the table.
1109 * @param entryFound The returned entry if found in the neighbor table.
1110 * @return True if the entry was found false otherwise.
1111 */
1112 bool LookUpEntry(Mac16Address nwkAddr, Ptr<NeighborTableEntry>& entryFound);
1113
1114 /**
1115 * Look and return and entry if exists in the neighbor table.
1116 *
1117 * @param extAddr The extended address (EUI-64) used to look for an element in the table.
1118 * @param entryFound The returned entry if found in the neighbor table.
1119 * @return True if the entry was found false otherwise.
1120 */
1121 bool LookUpEntry(Mac64Address extAddr, Ptr<NeighborTableEntry>& entryFound);
1122
1123 /**
1124 * Look for this device Parent neighbor (A.K.A coordinator).
1125 *
1126 * @param entryFound The returned entry if found in the neighbor table.
1127 * @return True if the parent was found in the neighbor table.
1128 */
1129 bool GetParent(Ptr<NeighborTableEntry>& entryFound);
1130
1131 /**
1132 * Perform a search for the best candidate parent based on some attributes.
1133 * See Association Join process , Zigbee specification R21, Section 3.6.1.4.1
1134 *
1135 * @param epid The extended PAN id of the network in which we look for parent candidates.
1136 * @param entryFound The returned entry if found
1137 * @return True if element found
1138 */
1139 bool LookUpForBestParent(uint64_t epid, Ptr<NeighborTableEntry>& entryFound);
1140
1141 /**
1142 * Remove old entries from the neighbor table.
1143 */
1144 void Purge();
1145
1146 /**
1147 * Delete the specified entry from the neighbor table.
1148 *
1149 * @param extAddr The EUI-64 of the entry to be removed from the neighbor table
1150 */
1151 void Delete(Mac64Address extAddr);
1152
1153 /**
1154 * Print the neighbor table
1155 *
1156 * @param stream The output stream where the table is printed
1157 */
1158 void Print(Ptr<OutputStreamWrapper> stream) const;
1159
1160 /**
1161 * Get the size of the neighbor table.
1162 *
1163 * @return The current size of the neighbor table
1164 */
1165 uint32_t GetSize();
1166
1167 /**
1168 * Set the maximum size of the neighbor table
1169 *
1170 * @param size The size of the neighbor table.
1171 */
1172 void SetMaxTableSize(uint32_t size);
1173
1174 /**
1175 * Get the maximum size of the neighbor table.
1176 *
1177 * @return The maximum size of the neighbor table.
1178 */
1179 uint32_t GetMaxTableSize() const;
1180
1181 /**
1182 * Dispose of the table and all its elements
1183 */
1184 void Dispose();
1185
1186 private:
1187 /**
1188 * Get the link cost based on the link quality indicator (LQI) value.
1189 * The calculation of the link cost is based on a non-linear mapping of
1190 * the lqi. A link cost of 1 is the best possible value (equivalent to 255 LQI).
1191 *
1192 * @param lqi The link quality indicator value (0-255)
1193 * @return The link cost value (1-7)
1194 */
1195 uint8_t GetLinkCost(uint8_t lqi) const;
1196
1197 std::deque<Ptr<NeighborTableEntry>> m_neighborTable; //!< The neighbor table object
1198 uint32_t m_maxTableSize; //!< The maximum size of the neighbor table
1199};
1200
1201/**
1202 * A table storing information about upcoming route request retries. This table is use to keep
1203 * track of all RREQ retry attempts from a given device.
1204 */
1206{
1207 public:
1208 /**
1209 * Adds an entry to the table
1210 *
1211 * @param entry The RREQ retry table entry
1212 * @return True if the entry was added to the table.
1213 */
1215
1216 /**
1217 * Look up for an entry in the table
1218 *
1219 * @param rreqId The RREQ ID used to look up for an entry in the table
1220 * @param entryFound The returned entry if found in the table
1221 * @return True if a searched entry is found
1222 */
1223 bool LookUpEntry(uint8_t rreqId, Ptr<RreqRetryTableEntry>& entryFound);
1224
1225 /**
1226 * Delete an entry from the table using the RREQ ID
1227 *
1228 * @param rreqId The RREQ ID use to delete an entry from the table
1229 */
1230 void Delete(uint8_t rreqId);
1231
1232 /**
1233 * Print the neighbor table
1234 *
1235 * @param stream The output stream where the table is printed
1236 */
1237 void Print(Ptr<OutputStreamWrapper> stream) const;
1238
1239 /**
1240 * Dispose of the table and all its elements
1241 */
1242 void Dispose();
1243
1244 private:
1245 std::deque<Ptr<RreqRetryTableEntry>>
1246 m_rreqRetryTable; //!< The Table containing RREQ Table entries.
1247};
1248
1249/**
1250 * The Broadcast Transaction Table (BTT)
1251 * The BTT is used to keep track of data broadcast transactions.
1252 * The broadcast of link status request and route requests (RREQ) commands
1253 * are handled differently and not recorded by this table.
1254 * See Zigbee specification r22.1.0, Section 3.6.5
1255 */
1257{
1258 public:
1260
1261 /**
1262 * Add a broadcast transaction record (BTR) to the broadcast transaction table(BTT).
1263 *
1264 * @param entry The object representing the BTR
1265 * @return True if the object was added.
1266 */
1268
1269 /**
1270 * Get the current Size of the broadcast transaction table (BTT).
1271 *
1272 * @return uint32_t
1273 */
1274 uint32_t GetSize();
1275
1276 /**
1277 * Set the maximum size of the broadcast transaction table (BTT)
1278 *
1279 * @param size The size of the broadcast transaction table (BTT).
1280 */
1281 void SetMaxTableSize(uint32_t size);
1282
1283 /**
1284 * Get the maximum size of the broadcast transaction table (BTT)
1285 *
1286 * @return The maximum size of the broadcast transaction table (BTT).
1287 */
1288 uint32_t GetMaxTableSize() const;
1289
1290 /**
1291 * Look up for broadcast transaction record in the broadcast transaction table (BTT).
1292 *
1293 * @param seq The sequence number of the broadcasted frame.
1294 * @param entryFound The returned entry if found in the table
1295 *
1296 * @return True if a searched entry is found
1297 */
1298 bool LookUpEntry(uint8_t seq, Ptr<BroadcastTransactionRecord>& entryFound);
1299
1300 /**
1301 * Purge expired entries from the broadcast transaction table (BTT).
1302 */
1303 void Purge();
1304
1305 /**
1306 * Dispose of all broadcast transaction records (BTR) in the broadcast transaction table(BTT).
1307 */
1308 void Dispose();
1309
1310 /**
1311 * Print the broadcast transaction table (BTT)
1312 *
1313 * @param stream The output stream where the table is printed
1314 */
1315 void Print(Ptr<OutputStreamWrapper> stream);
1316
1317 private:
1318 uint32_t m_maxTableSize; //!< The maximum size of the Broadcast Transaction table
1319 std::deque<Ptr<BroadcastTransactionRecord>>
1320 m_broadcastTransactionTable; //!< The list object representing the broadcast transaction
1321 //!< table (BTT)
1322};
1323
1324} // namespace zigbee
1325} // namespace ns3
1326
1327#endif /* ZIGBEE_TABLES_H */
An identifier for simulation events.
Definition event-id.h:45
This class can contain 16 bit addresses.
an EUI-64 address
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
A broadcast Transaction Record (BTR) As described in Table 3-70.
Mac16Address GetSrcAddr() const
Get the source address of the BTR.
void SetSrcAddr(Mac16Address srcAddr)
Set the source address of the BTR.
uint8_t GetBcstRetryCount() const
Get the broadcast retry count value.
void SetSeqNum(uint8_t seq)
Set the sequence number of the BTR.
uint8_t m_sequenceNumber
The RREQ sequence number of the initiator's broadcast.
uint8_t m_broadcastRetryCount
The number of times this BCST has been retried.
uint8_t GetSeqNum() const
Get the sequence number of the BTR.
void SetBcstRetryCount(uint8_t count)
Set the Broadcast retry count object.
Time GetExpirationTime() const
Get the value of the expiration time in the BTR.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the values of the BTR.
Time m_expirationTime
An indicator of when the entry expires.
Mac16Address m_srcAddr
The 16-bit network address of the broadcast initiator.
void SetExpirationTime(Time exp)
Set the expiration time object.
The Broadcast Transaction Table (BTT) The BTT is used to keep track of data broadcast transactions.
void Dispose()
Dispose of all broadcast transaction records (BTR) in the broadcast transaction table(BTT).
void Print(Ptr< OutputStreamWrapper > stream)
Print the broadcast transaction table (BTT)
uint32_t m_maxTableSize
The maximum size of the Broadcast Transaction table.
void Purge()
Purge expired entries from the broadcast transaction table (BTT).
void SetMaxTableSize(uint32_t size)
Set the maximum size of the broadcast transaction table (BTT)
std::deque< Ptr< BroadcastTransactionRecord > > m_broadcastTransactionTable
The list object representing the broadcast transaction table (BTT)
uint32_t GetMaxTableSize() const
Get the maximum size of the broadcast transaction table (BTT)
uint32_t GetSize()
Get the current Size of the broadcast transaction table (BTT).
bool AddEntry(Ptr< BroadcastTransactionRecord > entry)
Add a broadcast transaction record (BTR) to the broadcast transaction table(BTT).
bool LookUpEntry(uint8_t seq, Ptr< BroadcastTransactionRecord > &entryFound)
Look up for broadcast transaction record in the broadcast transaction table (BTT).
The Network layer Neighbor Table Entry See Zigbee specification r22.1.0, Table 3-63.
uint8_t GetRelationship() const
Get the relationship object.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the values of the neighbor table entry.
uint64_t m_extPanId
The extendend PAN id (based on the Zigbee coordinator EUI-64 address)
uint8_t GetLogicalCh() const
Get the logical channel used by the the neighbor in this entry.
Time GetTimeoutCounter() const
Get the timeout counter object.
uint32_t GetMacUcstBytesTx() const
Get the number of unicast bytes transmitted to the neighbor registered in this entry.
void SetOutgoingCost(uint8_t cost)
Set the outgoing cost object.
Mac64Address m_extAddr
The IEEE EUI-64 bit address that is unique to every device.
uint8_t GetLqi() const
Get the LQI value from this device to an entry neighbor.
Time GetDevTimeout() const
Get the device timeout object.
uint8_t GetMacInterfaceIndex() const
Get the MAC Interface Index object.
uint32_t GetMacUcstBytesRx() const
Get the number of unicast bytes received to the neighbor registered in this entry.
uint8_t m_outgoingCost
The cost of the outgoing link as measured by the neighbor.
void SetNwkAddr(Mac16Address nwkAddr)
Set the entry registered Network address (MAC short address).
uint64_t GetExtPanId() const
Get the extended PAN identifier.
void SetMacUcstBytesRx(uint32_t rxBytes)
Set the number of unicast bytes received to the neighbor registered in this entry.
uint8_t m_lqi
The estimated link quality for RF transmissions from this device See Zigbee specification r22....
uint64_t m_incBeaconTimestamp
The time in symbols at which the last beacon frame was received from the neighbor.
void SetLqi(uint8_t lqi)
Set the Link quality indicator value from this device to an entry neighbor.
uint8_t m_bo
The beacon order of the device (See IEEE 802.15.4-2011)
uint8_t IsPotentialParent() const
Get the the value of the potential parent field.
uint8_t GetAge() const
Get the number of nwkLinkStatusPeriod intervals since the link status command was received.
void SetIncBeaconTimestamp(uint64_t timestamp)
Set the time in symbols at which the last beacon frame was received from the neighbor.
Mac16Address m_nwkAddr
The 16 bit network address of the neighboring device.
uint32_t m_macUcstBytesRx
The number of bytes received via MAC unicasts from this neighbor (Optional field).
Time m_timeoutCounter
Indicates the current time remaining in seconds, for the end device.
void SetRxOnWhenIdle(bool onWhenIdle)
Set the device is on when idle flag.
uint8_t m_depth
The tree depth of the neighbor device.
uint16_t m_endDevConfig
The end device configuration.
void SetBeaconOrder(uint8_t bo)
Set the value of the beacon order set in this neighbor.
~NeighborTableEntry()
void SetTimeoutCounter(Time counter)
Set the timeout counter object.
uint64_t m_beaconTxTimeOffset
The transmission time difference in symbols, between the neighbor's beacon and its parent beacon (Opt...
NwkDeviceType GetDeviceType() const
Get the device type of this neighbor device.
void SetLogicalCh(uint8_t channel)
Set the logical channel used by the the neighbor in this entry.
uint64_t GetBeaconTxTimeOffset() const
Get the transmission time difference in symbols, between the neighbor's beacon and its parent beacon.
bool m_rxOnWhenIdle
Indicates if the neighbor receiver is enabled during idle periods.
uint8_t m_logicalCh
The logical channel on which the network is operating.
void SetBeaconTxTimeOffset(uint64_t offset)
Set the transmission time difference in symbols, between the neighbor's beacon and its parent beacon.
void SetRelationship(Relationship relationship)
Set the relationship object.
Mac16Address GetNwkAddr() const
Get the entry registered Network address (MAC short address).
void SetPotentialParent(bool confirm)
Set the the value of the potential parent field.
Relationship m_relationship
Relationship between the neighbor and the current device.
Mac64Address GetExtAddr() const
Get the entry registered IEEE address (EUI-64 address).
bool m_keepaliveRx
This value indicates at least one keepalive has been received from the end device since the router ha...
uint8_t m_txFailure
A value indicating if previous transmissions to the device were successful or not.
void SetTxFailure(uint8_t failure)
Set the Tx Failure object.
void SetDeviceType(NwkDeviceType devType)
Set the device type of this neighbor device.
void SetEndDevConfig(uint16_t conf)
Set the end device configuration.
void SetDevTimeout(Time timeout)
Set the device timeout object.
bool IsRxOnWhenIdle() const
Return true is neighboring device is on when idle.
uint16_t GetEndDevConfig() const
Get the end device configuration object.
uint8_t GetDepth() const
The depth of the neighbor device.
void SetMacInterfaceIndex(uint8_t index)
Set the MAC Interface Index object.
uint8_t GetOutgoingCost() const
Get the outgoing cost object.
uint8_t GetTxFailure() const
Get the Tx Failure object.
bool m_potentialParent
An indication of whether the device has been ruled out as a potential parent.
void SetAge(uint8_t age)
Set the number of nwkLinkStatusPeriod intervals since the link status command was received.
uint8_t GetBeaconOrder() const
Get the value of the beacon order set in this neighbor.
uint32_t m_macUcstBytesTx
The number of bytes transmitted via MAC unicast to the neighbor (Optional field).
uint8_t m_macInterfaceIndex
This is an index into the MAC Interface Table indicating what interface the neighbor or child is boun...
Time m_devTimeout
This field indicates the timeout, in seconds, for the end device child.
void SetMacUcstBytesTx(uint32_t txBytes)
Set the number of unicast bytes transmitted to the neighbor registered in this entry.
void SetDepth(uint8_t depth)
Set the depth of the neighbor device.
uint8_t m_age
The number of nwkLinkStatusPeriod intervals since link status command was received.
uint64_t GetIncBeaconTimestamp() const
Get the time in symbols at which the last beacon frame was received from the neighbor.
NwkDeviceType m_deviceType
The type of neighbor device.
void SetExtPanId(uint64_t extPanId)
Set the extended PAN identifier.
NeighborTableEntry()
The network layer Network Table See Zigbee specification r22.1.0, 3.6.1.5.
bool GetParent(Ptr< NeighborTableEntry > &entryFound)
Look for this device Parent neighbor (A.K.A coordinator).
void Dispose()
Dispose of the table and all its elements.
void SetMaxTableSize(uint32_t size)
Set the maximum size of the neighbor table.
bool LookUpForBestParent(uint64_t epid, Ptr< NeighborTableEntry > &entryFound)
Perform a search for the best candidate parent based on some attributes.
NeighborTable()
The neighbor table constructor.
std::deque< Ptr< NeighborTableEntry > > m_neighborTable
The neighbor table object.
uint8_t GetLinkCost(uint8_t lqi) const
Get the link cost based on the link quality indicator (LQI) value.
bool AddEntry(Ptr< NeighborTableEntry > entry)
Add an entry to the neighbor table.
uint32_t m_maxTableSize
The maximum size of the neighbor table.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the neighbor table.
void Purge()
Remove old entries from the neighbor table.
bool LookUpEntry(Mac16Address nwkAddr, Ptr< NeighborTableEntry > &entryFound)
Look and return and entry if exists in the neighbor table.
uint32_t GetSize()
Get the size of the neighbor table.
void Delete(Mac64Address extAddr)
Delete the specified entry from the neighbor table.
uint32_t GetMaxTableSize() const
Get the maximum size of the neighbor table.
A table that keeps record of neighbors devices NWK extended PAN ids (64 bits) and their related 16 bi...
std::map< uint64_t, uint16_t > m_panIdTable
The Map object that represents the table of PAN ids.
bool GetEntry(uint64_t extPanId, uint16_t &panId)
Get the 16 bit MAC PAN id based on the reference extended PAN id.
void AddEntry(uint64_t extPanId, uint16_t panId)
Add an entry to the PAN Id table.
PanIdTable()
The constructor of the PanIdTable.
void Dispose()
Dispose of the table and all its elements.
The Network layer Route Discovery Table Entry See Zigbee specification r22.1.0, Table 3-68.
Time m_expirationTime
A time stamp indicating the expiration time.
void SetSenderAddr(Mac16Address sender)
Set the sender address of this entry.
void SetExpTime(Time exp)
Set the expiration time of the route discovery entry.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the values of the route discovery table entry.
Mac16Address m_senderAddr
The 16-bit network address of the device that has sent the most recent lowest cost RREQ command frame...
uint8_t m_routeRequestId
The sequence number for a RREQ command frame that is incremented each time a device initiates a RREQ.
void SetResidualCost(uint8_t pathcost)
Set the resulting pathcost on a reception of a RREP previously requested.
uint8_t GetRreqId() const
Get the route request id (The sequence number used by the RREQ command frame).
Mac16Address m_sourceAddr
The 16-bit network address of the RREQ initiator.
Mac16Address GetSenderAddr() const
Get the sender address of the entry.
uint8_t GetResidualCost() const
Get the value of a residual cost (pathcost) updated by a RREP in this entry.
uint8_t m_residualCost
The accumulated path cost from the current device to the destination device.
~RouteDiscoveryTableEntry()
uint8_t m_forwardCost
The accumulated path cost from the source of the RREQ to the current device.
Mac16Address GetSourceAddr() const
Get the source address of the entry's RREQ initiator.
uint8_t GetForwardCost() const
Get the forward cost of this entry.
Time GetExpTime() const
Get the expiration time of this entry.
RouteDiscoveryTableEntry()
void SetForwardCost(uint8_t pathCost)
Set the forward cost of this entry.
The network layer Route Discovery Table See Zigbee specification r22.1.0, 3.6.3.2.
std::deque< Ptr< RouteDiscoveryTableEntry > > m_routeDscTable
The route discovery table object.
RouteDiscoveryTable()
Constructor of route discovery table.
void Purge()
Purge old entries from the route discovery table.
void Dispose()
Dispose of the table and all its elements.
void Delete(uint8_t id, Mac16Address src)
Delete an entry from the route discovery table.
bool AddEntry(Ptr< RouteDiscoveryTableEntry > rt)
Add an entry to the route discovery table, in essence the contents of a RREQ command.
uint32_t m_maxTableSize
The maximum size of the route discovery table.
bool LookUpEntry(uint8_t id, Mac16Address src, Ptr< RouteDiscoveryTableEntry > &entryFound)
Look up for a route discovery table entry, the seareched entry must match the id and the src address ...
void Print(Ptr< OutputStreamWrapper > stream)
Print the contents of the route discovery table.
Routing table entry Zigbee Specification r22.1.0, Table 3-66.
RoutingTableEntry()
bool IsGroupIdPresent() const
Indicates if the Group Id flag is active.
bool m_noRouteCache
A flag indicating that the destination indicated by this address does not store source routes.
void SetNextHopAddr(Mac16Address nextHopAddr)
Set the value of the next hop address.
Mac16Address m_nextHopAddr
The 16 bit network address of the next hop on the way to the destination.
void SetLifeTime(Time lt)
Set the lifetime of the entry.
RouteStatus m_status
The status of the route.
bool m_manyToOne
A flag indicating that the destination is a concentrator that issued a many-to-one route request.
void SetStatus(RouteStatus status)
Set the status of the routing table entry.
bool m_routeRecordReq
A flag indicating that the route record command frame should be sent to the destination prior to the ...
Mac16Address GetNextHopAddr() const
Get the value of the next hop address.
bool m_groupId
A flag indicating that the destination address is a group id.
~RoutingTableEntry()
bool IsNoRouteCache() const
Indicates if the No Route Cache flag is active.
bool IsRouteRecordReq() const
Indicate if the route record request is active.
Time GetLifeTime() const
Get the value of the entry lifetime.
RouteStatus GetStatus() const
Get the status of the routing table entry.
Mac16Address m_destination
The 16 bit network address or group id of this route.
Mac16Address GetDestination() const
Get the entry destination nwkAddress(MAC 16-bit address)
bool IsManyToOne() const
Indicates if the Many-to-One flag is active.
void SetDestination(Mac16Address dst)
Set the entry destination nwkAddress (MAC 16-bit address)
void Print(Ptr< OutputStreamWrapper > stream) const
Print the values of the routing table entry.
Time m_lifeTime
Indicates the lifetime of the entry.
The network layer Routing Table.
void DeleteExpiredEntry()
Delete the first occrurance of an expired entry (ROUTE_INACTIVE status)
uint32_t m_maxTableSize
The maximum size of the routing table;.
bool AddEntry(Ptr< RoutingTableEntry > rt)
Adds an entry to the routing table.
void Delete(Mac16Address dst)
Remove an entry from the routing table.
uint32_t GetMaxTableSize() const
Get the maximum size of the routing table.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the Routing table.
uint32_t GetSize()
Get the size of the routing table.
bool LookUpEntry(Mac16Address dstAddr, Ptr< RoutingTableEntry > &entryFound)
Look for an specific entry in the routing table.
void IdentifyExpiredEntries()
Identify and mark entries as ROUTE_INACTIVE status for entries who have exceeded their lifetimes.
void SetMaxTableSize(uint32_t size)
Set the maximum size of the routing table.
RoutingTable()
The constructuctor of a Routing Table object.
void Purge()
Purge old entries from the routing table.
std::deque< Ptr< RoutingTableEntry > > m_routingTable
The object that represents the routing table.
void Dispose()
Dispose of the table and all its elements.
The route request retry table entry.
EventId m_rreqRetryEventId
The event id of the next RREQ retry callback.
EventId GetRreqEventId()
Get the RREQ id of the RREQ retry.
uint8_t m_rreqRetryCount
The number of RREQ retries.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the values of the RREQ retry table entry.
uint8_t GetRreqId() const
Get the RREQ Id from the entry.
RreqRetryTableEntry(uint8_t rreqId, EventId rreqRetryEvent, uint8_t rreqRetryCount)
The constructor of the RREQ retry table entry.
void SetRreqEventId(EventId eventId)
Set the event id of the RREQ retry.
uint8_t m_rreqId
The RREQ ID.
void SetRreqRetryCount(uint8_t rreqRetryCount)
Set the RREQ retry count from the entry.
uint8_t GetRreqRetryCount() const
Get the RREQ retry count from the entry.
A table storing information about upcoming route request retries.
std::deque< Ptr< RreqRetryTableEntry > > m_rreqRetryTable
The Table containing RREQ Table entries.
void Print(Ptr< OutputStreamWrapper > stream) const
Print the neighbor table.
void Dispose()
Dispose of the table and all its elements.
bool LookUpEntry(uint8_t rreqId, Ptr< RreqRetryTableEntry > &entryFound)
Look up for an entry in the table.
void Delete(uint8_t rreqId)
Delete an entry from the table using the RREQ ID.
bool AddEntry(Ptr< RreqRetryTableEntry > entry)
Adds an entry to the table.
NwkDeviceType
The network layer device type.
RouteStatus
Route record states.
Relationship
The relationship between the neighbor and the current device.
@ ZIGBEE_COORDINATOR
Zigbee coordinator.
@ ZIGBEE_ENDDEVICE
Zigbee end device.
@ ZIGBEE_ROUTER
Zigbee router.
@ ROUTE_VALIDATION_UNDERWAY
Route discovery validation underway.
@ ROUTE_ACTIVE
Route active.
@ ROUTE_INACTIVE
Route inactive.
@ ROUTE_DISCOVER_FAILED
Route discovery failed.
@ ROUTE_DISCOVERY_UNDERWAY
Route discovery underway.
@ NBR_UNAUTH_CHILD
Neighbor is an unauthenticated child.
@ NBR_PREV_CHILD
Neighbor was a previous child.
@ NBR_CHILD
Neighbor is the child.
@ NBR_SIBLING
Neighbor is the sibling.
@ NBR_PARENT
Neighbor is the parent.
@ NBR_NONE
No relationship.
Definition conf.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout