A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
zigbee-aps.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 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 */
10
11#ifndef ZIGBEE_APS_H
12#define ZIGBEE_APS_H
13
14#include "zigbee-aps-header.h"
15#include "zigbee-aps-tables.h"
16#include "zigbee-group-table.h"
17#include "zigbee-nwk.h"
18
19#include "ns3/event-id.h"
20#include "ns3/mac16-address.h"
21#include "ns3/mac64-address.h"
22#include "ns3/object.h"
23#include "ns3/random-variable-stream.h"
24#include "ns3/sequence-number.h"
25#include "ns3/traced-callback.h"
26#include "ns3/traced-value.h"
27
28#include <cstdint>
29#include <iomanip>
30#include <iterator>
31
32namespace ns3
33{
34namespace zigbee
35{
36
37/**
38 * @ingroup zigbee
39 *
40 * APS Destination Address Mode,
41 * Zigbee Specification r22.1.0
42 * Table 2-2 APSDE-DATA.request Parameters
43 * See Table 2-4 APSDE-DATA.indication Parameters
44 */
45enum class ApsDstAddressMode : std::uint8_t
46{
47 DST_ADDR_AND_DST_ENDPOINT_NOT_PRESENT = 0x00, //!< Destination address and destination endpoint
48 //!< not present.
49 GROUP_ADDR_DST_ENDPOINT_NOT_PRESENT = 0x01, //!< Group address or 16-bit destination address
50 //!< present but destination endpoint not present.
51 DST_ADDR16_DST_ENDPOINT_PRESENT = 0x02, //!< 16-bit destination address and destination
52 //!< endpoint present.
53 DST_ADDR64_DST_ENDPOINT_PRESENT = 0x03, //!< 64-bit destination address and destination
54 //!< endpoint present.
55 DST_ADDR64_DST_ENDPOINT_NOT_PRESENT = 0x04 //!< 64-bit address present but destination
56 //!< endpoint not present.
57};
58
59/**
60 * @ingroup zigbee
61 *
62 * APS Source Address Mode,
63 * Zigbee Specification r22.1.0
64 * See Table 2-4 APSDE-DATA.indication Parameters
65 */
66enum class ApsSrcAddressMode : std::uint8_t
67{
68 SRC_ADDR16_SRC_ENDPOINT_PRESENT = 0x02, //!< 16-bit source address and source endpoint present
69 SRC_ADDR64_SRC_ENDPOINT_PRESENT = 0x03, //!< 64-bit source address and source endpoint present
70 SRC_ADDR64_SRC_ENDPOINT_NOT_PRESENT = 0x04 //!< 64-bit source address present but source
71 //!< endpoint not present
72};
73
74/**
75 * @ingroup zigbee
76 *
77 * APS Security status
78 * See Zigbee Specification r22.1.0, Table 2-4
79 * APSDE-DATA.indication Parameters
80 */
81enum class ApsSecurityStatus : std::uint8_t
82{
83 UNSECURED = 0x00, //!< Unsecured status
84 SECURED_NWK_KEY = 0x01, //!< Use NWK secure key
85 SECURED_LINK_KEY = 0x02 //!< Use link secure key
86};
87
88/**
89 * @ingroup zigbee
90 *
91 * APS Sub-layer Status Values
92 * See Zigbee Specification r22.1.0, Table 2-27
93 */
94enum class ApsStatus : std::uint8_t
95{
96 SUCCESS = 0x00, //!< A request has been executed successfully.
97 ASDU_TOO_LONG = 0xa0, //!< A received fragmented
98 //!< frame could not be defragmented at the current time.
99 DEFRAG_DEFERRED = 0xa1, //!< Defragmentation deferred.
100 DEFRAG_UNSUPPORTED = 0xa2, //!< Defragmentation is not supported.
101 ILLEGAL_REQUEST = 0xa3, //!< Illegal request
102 INVALID_BINDING = 0xa4, //!< Invalid binding
103 INVALID_GROUP = 0xa5, //!< Invalid group
104 INVALID_PARAMETER = 0xa6, //!< A parameter value was invalid or out of range
105 NO_ACK = 0xa7, //!< No Acknowledgment
106 NO_BOUND_DEVICE = 0xa8, //!< No bound device
107 NO_SHORT_ADDRESS = 0xa9, //!< No short address present
108 NOT_SUPPORTED = 0xaa, //!< Not supported in APS
109 SECURED_LINK_KEY = 0xab, //!< Secured link key present
110 SECURED_NWK_KEY = 0xac, //!< Secured network key present
111 SECURITY_FAIL = 0xad, //!< Security failed
112 TABLE_FULL = 0xae, //!< Binding table or group table is full
113 UNSECURED = 0xaf, //!< Unsecured
114 UNSUPPORTED_ATTRIBUTE = 0xb0 //!< Unsupported attribute
115};
116
117/**
118 * @ingroup zigbee
119 *
120 * Zigbee Specification r22.1.0, Section 2.2.4.1.1
121 * APSDE-DATA.request params.
122 */
124{
127 Mac16Address m_dstAddr16; //!< The destination 16-bit address
128 Mac64Address m_dstAddr64; //!< The destination 64-bit address
129 uint8_t m_dstEndPoint{0}; //!< The destination endpoint
130 uint16_t m_profileId{0}; //!< The application profile ID
131 uint16_t m_clusterId{0}; //!< The application cluster ID
132 uint8_t m_srcEndPoint{0}; //!< The source endpoint
133 uint32_t m_asduLength{0}; //!< The ASDU length
134 uint8_t m_txOptions{0}; //!< Transmission options
135 bool m_useAlias{false}; //!< Indicates if alias is used in this transmission
136 Mac16Address m_aliasSrcAddr; //!< Alias source address
137 uint8_t m_aliasSeqNumb{0}; //!< Alias sequence number
138 uint8_t m_radius{0}; //!< Radius (Number of hops this message travels)
139};
140
141/**
142 * @ingroup zigbee
143 *
144 * Zigbee Specification r22.1.0, Section 2.2.4.1.2
145 * APSDE-DATA.confirm params.
146 */
148{
151 Mac16Address m_dstAddr16; //!< The destination 16-bit address.
152 Mac64Address m_dstAddr64; //!< The destination IEEE address (64-bit address).
153 uint8_t m_dstEndPoint{0}; //!< The destination endpoint.
154 uint8_t m_srcEndPoint{0}; //!< The source endpoint.
156 Time m_txTime; //!< The transmission timestamp.
157};
158
159/**
160 * @ingroup zigbee
161 *
162 * Zigbee Specification r22.1.0, Section 2.2.4.1.3
163 * APSDE-DATA.indications params.
164 */
166{
169 //!< address mode
170 Mac16Address m_dstAddr16; //!< The destination 16-bit address
171 Mac64Address m_dstAddr64; //!< The destination IEEE address (64-bit address)
172 uint8_t m_dstEndPoint{0xF0}; //!< The destination endpoint
175 //!< source address mode
176
177 Mac16Address m_srcAddress16; //!< The 16-bit address
178 Mac64Address m_srcAddress64; //!< The IEEE source address (64-bit address)
179 uint8_t m_srcEndpoint{0xF0}; //!< The application source endpoint
180 uint16_t m_profileId{0xC0DE}; //!< The application profile ID
181 uint16_t m_clusterId{0x0000}; //!< The application cluster ID
182 uint8_t asduLength{0}; //!< The size of the the ASDU packet
183 ApsStatus m_status{ApsStatus::SUCCESS}; //!< The data indication status
185 uint8_t m_linkQuality{0}; //!< The link quality indication value
186 Time m_rxTime; //!< The reception timestamp
187};
188
189/**
190 * @ingroup zigbee
191 *
192 * Zigbee Specification r22.1.0, Sections 2.2.4.3.1 and 2.2.4.3.3
193 * APSME-BIND.request and APSME-UNBIND.request params.
194 */
196{
197 Mac64Address m_srcAddr; //!< The source IEEE address (64-bit address)
198 uint8_t m_srcEndPoint{0}; //!< The application source endpoint
199 uint16_t m_clusterId{0}; //!< The application cluster ID
202 Mac16Address m_dstAddr16; //!< The destination 16-bit address
203 Mac64Address m_dstAddr64; //!< The destination 64-bit address
204 uint8_t m_dstEndPoint{0xF0}; //!< The application destination endpoint
205};
206
207/**
208 * @ingroup zigbee
209 *
210 * Zigbee Specification r22.1.0, Sections 2.2.4.3.2 and 2.2.4.3.4
211 * APSME-BIND.confirm and APSME-UNBIND.confirm params
212 */
214{
215 ApsStatus m_status{ApsStatus::UNSUPPORTED_ATTRIBUTE}; //!< The status of the bind request
216 Mac64Address m_srcAddr; //!< The application source address
217 uint8_t m_srcEndPoint{0}; //!< The application source endpoint
218 uint16_t m_clusterId{0}; //!< The application cluster ID
221 Mac16Address m_dstAddr16; //!< The destination 16-bit address
222 Mac64Address m_dstAddr64; //!< The destination 64-bit address
223 uint8_t m_dstEndPoint{0xF0}; //!< The application destination endpoint
224};
225
226/**
227 * @ingroup zigbee
228 *
229 * Zigbee Specification r22.1.0, Section 2.2.4.5.1 and 2.2.4.5.3
230 * APSME-ADD-GROUP.request and APSME-REMOVE-GROUP.request params
231 */
233{
234 Mac16Address m_groupAddress; //!< The group address to add
235 uint8_t m_endPoint{1}; //!< The endpoint to which the group address is associated
236};
237
238/**
239 * @ingroup zigbee
240 *
241 * Zigbee Specification r22.1.0, Section 2.2.4.5.2 and 2.2.4.5.4
242 * APSME-ADD-GROUP.confirm and APSME-REMOVE-GROUP.confirm params
243 */
245{
246 ApsStatus m_status{ApsStatus::INVALID_PARAMETER}; //!< The status of the add group request
247 Mac16Address m_groupAddress; //!< The group address being added
248 uint8_t m_endPoint{1}; //!< The endpoint to which the given group is being added.
249};
250
251/**
252 * @ingroup zigbee
253 *
254 * Zigbee Specification r22.1.0, Section 2.2.4.5.6
255 * APSME-REMOVE-ALL-GROUPS.request params
256 */
258{
260 ApsStatus::INVALID_PARAMETER}; //!< The status of the remove all groups request
261 uint8_t m_endPoint{1}; //!< The endpoint from which all groups are being removed.
262};
263
264//////////////////////
265// Callbacks //
266//////////////////////
267
268/**
269 * @ingroup zigbee
270 *
271 * This callback is called to confirm a successfully transmission of an ASDU.
272 */
274
275/**
276 * @ingroup zigbee
277 *
278 * This callback is called after a ASDU has successfully received and
279 * APS push it to deliver it to the next higher layer (typically the application framework).
280 */
282
283/**
284 * @ingroup zigbee
285 *
286 * This callback is called to confirm a successfully addition of a destination
287 * into the binding table.
288 */
290
291/**
292 * @ingroup zigbee
293 *
294 * This callback is called to confirm a successfully unbind request performed
295 * into the binding table.
296 */
298
299/**
300 * @ingroup zigbee
301 *
302 * This callback is called to confirm a successfully addition of a group address
303 * and or endPoint into the group table.
304 */
306
307/**
308 * @ingroup zigbee
309 *
310 * This callback is called to confirm a successfully removal of a group address
311 * and or endPoint from the group table.
312 */
314
315/**
316 * @ingroup zigbee
317 *
318 * This callback is called to confirm a successfully removal of an endpoint from
319 * all the the groups.
320 */
322
323/**
324 * @ingroup zigbee
325 *
326 * Zigbee Specification r22.1.0, Section 2.2.3
327 * Class that implements the Zigbee Specification Application Support Sub-layer (APS).
328 */
329class ZigbeeAps : public Object
330{
331 public:
332 /**
333 * Get the type ID.
334 *
335 * @return the object TypeId
336 */
337 static TypeId GetTypeId();
338
339 /**
340 * Default constructor.
341 */
342 ZigbeeAps();
343 ~ZigbeeAps() override;
344
345 /**
346 * Set the underlying NWK to use in this Zigbee APS
347 *
348 * @param nwk The pointer to the underlying Zigbee NWK to set to this Zigbee APS
349 */
350 void SetNwk(Ptr<ZigbeeNwk> nwk);
351
352 /**
353 * Get the group table used by this Zigbee APS.
354 *
355 * @param groupTable The pointer to the group table to set.
356 */
357 void SetGroupTable(Ptr<ZigbeeGroupTable> groupTable);
358
359 /**
360 * Get the underlying NWK used by the current Zigbee APS.
361 *
362 * @return The pointer to the underlying NWK object currently connected to the Zigbee APS.
363 */
364 Ptr<ZigbeeNwk> GetNwk() const;
365
366 /**
367 * Zigbee Specification r22.1.0, Section 2.2.4.1.1
368 * APSDE-DATA.request
369 * Request the transmission of data to one or more entities.
370 *
371 * @param params The APSDE data request params
372 * @param asdu The packet to transmit
373 */
375
376 /**
377 * Zigbee Specification r22.1.0, Section 2.2.4.3.1
378 * APSME-BIND.request
379 * Bind a source entry to one or more destination entries in the binding table.
380 *
381 * @param params The APSDE bind request params
382 */
384
385 /**
386 * Zigbee Specification r22.1.0, Section 2.2.4.3.3
387 * APSME-BIND.request
388 * Unbind a destination entry from a source entry in the binding table.
389 *
390 * @param params The APSDE bind request params
391 */
393
394 /**
395 * Zigbee Specification r22.1.0, Section 2.2.4.5.1
396 * APSME-ADD-GROUP.request
397 * Request that group membership for a particular group be added
398 * for a particular endpoint.
399 *
400 * @param params The APSME add group request params
401 */
403
404 /**
405 * Zigbee Specification r22.1.0, Section 2.2.4.5.3
406 * APSME-REMOVE-GROUP.request
407 * Request that group membership for a particular group be removed
408 * for a particular endpoint.
409 *
410 * @param params The APSME remove group request params
411 */
413
414 /**
415 * Zigbee Specification r22.1.0, Section 2.2.4.5.5
416 * APSME-REMOVE-ALL-GROUPS.request
417 * Remove membership in all groups from an endpoint, so that no group-addressed frames
418 * will be delivered to that endpoint.
419 *
420 * @param endPoint The endpoint from which all groups are being removed.
421 */
422 void ApsmeRemoveAllGroupsRequest(uint8_t endPoint);
423
424 /**
425 * Zigbee Specification r22.1.0, Section 3.2.1.2
426 * NLDE-DATA.confirm
427 * Used to report to the APS the transmission of data from the NWK.
428 *
429 * @param params The NLDE data confirm params
430 */
432
433 /**
434 * Zigbee Specification r22.1.0, Section 3.2.1.3
435 * NLDE-DATA.indication
436 * Used to report to the APS the reception of data from the NWK.
437 *
438 * @param params The NLDE data indication params
439 * @param nsdu The packet received
440 */
442
443 /**
444 * Zigbee Specification r22.1.0, Section 2.2.8.4.2
445 * Reception and Rejection of data from the NWK.
446 *
447 * @param apsHeader The APS header of the received packet
448 * @param params The NLDE data indication params
449 * @param nsdu The packet received
450 */
451 void ReceiveData(const ZigbeeApsHeader& apsHeader,
452 const NldeDataIndicationParams& params,
453 Ptr<Packet> nsdu);
454
455 /**
456 * Set the callback as part of the interconnections between the APS and
457 * the next layer or service (typically the application framework). The callback
458 * implements the callback used in a APSDE-DATA.confirm
459 *
460 * @param c the ApsdeDataConfirm callback
461 */
463
464 /**
465 * Set the callback as part of the interconnections between the APS and
466 * the next layer or service (typically the application framework). The callback
467 * implements the callback used in a APSDE-DATA.indication
468 *
469 * @param c the ApsdeDataIndication callback
470 */
472
473 /**
474 * Set the callback as part of the interconnections between the APS and
475 * the next layer or service (typically the application framework). The callback
476 * implements the callback used in a APSME-BIND.confirm
477 *
478 * @param c the ApsmeBindConfirm callback
479 */
481
482 /**
483 * Set the callback as part of the interconnections between the APS and
484 * the next layer or service (typically the application framework). The callback
485 * implements the callback used in a APSDE-UNBIND.confirm
486 *
487 * @param c the ApsdeUnbindConfirm callback
488 */
490
491 /**
492 * Set the callback as part of the interconnections between the APS and
493 * the next layer or service (typically the application framework). The callback
494 * implements the callback used in a APSME-ADD-GROUP.confirm
495 *
496 * @param c the ApsmeAddGroupConfirm callback
497 */
499
500 /**
501 * Set the callback as part of the interconnections between the APS and
502 * the next layer or service (typically the application framework). The callback
503 * implements the callback used in a APSME-REMOVE-GROUP.confirm
504 *
505 * @param c the ApsmeRemoveGroupConfirm callback
506 */
508
509 /**
510 * Set the callback as part of the interconnections between the APS and
511 * the next layer or service (typically the application framework). The callback
512 * implements the callback used in a APSME-REMOVE-ALL-GROUPS.confirm
513 *
514 * @param c the ApsmeRemoveAllGroupsConfirm callback
515 */
517
518 protected:
519 void DoInitialize() override;
520 void DoDispose() override;
521 void NotifyConstructionCompleted() override;
522
523 private:
524 /**
525 * Send a Groupcast or IEEE address destination from a list of destination in
526 * the binding table.
527 *
528 * @param params The APSDE data request params
529 * @param asdu The packet to transmit
530 */
532
533 /**
534 * Send a regular UCST or BCST data transmission to a known 16-bit address destination.
535 *
536 * @param params The APSDE data request params
537 * @param asdu The packet to transmit
538 */
540
541 /**
542 * Send a Groupcast to a group address destination.
543 *
544 * @param params The APSDE data request params
545 * @param asdu The packet to transmit
546 */
548
549 /**
550 * This callback is used to to notify the results of a data transmission
551 * request to the Application framework (AF) making the request.
552 * See Zigbee specification r22.1.0, Section 2.2.4.1.2
553 */
555
556 /**
557 * This callback is used to to notify the reception of data
558 * to the Application framework (AF).
559 * See Zigbee specification r22.1.0, Section 2.2.4.1.3
560 */
562
563 /**
564 * This callback is used to to notify the result of a binding
565 * request in the APS to the Application framework (AF).
566 * See Zigbee specification r22.1.0, Section 2.2.4.3.2
567 */
569
570 /**
571 * This callback is used to to notify the result of a unbinding
572 * request in the APS to the Application framework (AF).
573 * See Zigbee specification r22.1.0, Section 2.2.4.3.4
574 */
576
577 /**
578 * This callback is used to to notify the result of endpoint addition
579 * request in the APS to the Application framework (AF).
580 * See Zigbee specification r22.1.0, Section 2.2.4.5.2
581 */
583
584 /**
585 * This callback is used to to notify the result of a endpoint removal
586 * request in the APS to the Application framework (AF).
587 * See Zigbee specification r22.1.0, Section 2.2.4.5.4
588 */
590
591 /**
592 * This callback is used to to notify the result of a endpoint removal
593 * request in the APS to the Application framework (AF).
594 * See Zigbee specification r22.1.0, Section 2.2.4.5.5
595 */
597
598 /**
599 * The underlying Zigbee NWK connected to this Zigbee APS.
600 */
602
603 /**
604 * The group table used by this Zigbee APS.
605 * The group table is a shared resource with the NWK layer.
606 * Zigbee Specification r22.1.0, Section 2.2.7.2
607 */
609
610 /**
611 * The sequence number used in packet Tx with APS headers.
612 * Zigbee Specification r22.1.0, Section 2.2.7.2
613 */
615
616 /**
617 * The binding table used by this Zigbee APS.
618 * Zigbee Specification r22.1.0, Section 2.2.7.2
619 */
621
622 /**
623 * The APS non-member radius, used to limit the number of hops
624 * for non-member multicast group devices when using NWK layer multicast.
625 * Valid range 0x00 to 0x07.
626 * Zigbee Specification r22.1.0, Section 2.2.7.2
627 */
629};
630
631/**
632 * @ingroup zigbee
633 *
634 * Helper class used to craft the transmission options bitmap used by the
635 * APSDE-DATA.request.
636 */
638{
639 public:
640 /**
641 * The constructor of the Tx options class.
642 *
643 * @param value The value to set in the Tx options.
644 */
645 ZigbeeApsTxOptions(uint8_t value = 0);
646
647 /**
648 * Set the security enable bit of the TX options.
649 *
650 * @param enable True if security is enabled.
651 */
652 void SetSecurityEnabled(bool enable);
653
654 /**
655 * Set the use network key bit of the TX options.
656 *
657 * @param enable True if Network key should be used.
658 */
659 void SetUseNwkKey(bool enable);
660
661 /**
662 * Set the Acknowledgement required bit of the Tx options.
663 *
664 * @param enable True if ACK is required.
665 */
666 void SetAckRequired(bool enable);
667
668 /**
669 * Set the fragmentation bit of the Tx options
670 *
671 * @param enable True if fragmentation is allowed in the transmission.
672 */
673 void SetFragmentationPermitted(bool enable);
674
675 /**
676 * Set the include extended nonce bit of the Tx options
677 *
678 * @param enable True if the frame should include the extended nonce
679 */
680 void SetIncludeExtendedNonce(bool enable);
681
682 /**
683 * Show if the security enable bit of the Tx options is present.
684 *
685 * @return True if the bit is active
686 */
687 bool IsSecurityEnabled() const;
688
689 /**
690 * Show if the use network key bit of the Tx options is present.
691 *
692 * @return True if the bit is active
693 */
694 bool IsUseNwkKey() const;
695
696 /**
697 * Show if the ACK bit of the Tx options is present.
698 *
699 * @return True if the bit is active
700 */
701 bool IsAckRequired() const;
702
703 /**
704 * Show if the fragmentation permitted bit of the Tx options is present.
705 *
706 * @return True if the bit is active
707 */
708 bool IsFragmentationPermitted() const;
709
710 /**
711 * Show if the include extended nonce bit of the Tx options is present.
712 *
713 * @return True if the bit is active
714 */
715 bool IsIncludeExtendedNonce() const;
716
717 /**
718 * Get the complete bitmap containing the Tx options
719 *
720 * @return The Tx options bitmap.
721 */
722 uint8_t GetTxOptions() const;
723
724 private:
725 /**
726 * Set a bit value into a position in the uint8_t representint the Tx options.
727 *
728 * @param pos Position to shift
729 * @param value Value to set
730 */
731 void SetBit(int pos, bool value);
732
733 /**
734 * Get the value of the bit at the position indicated.
735 *
736 * @param pos The position in the uint8_t Tx options
737 * @return True if the bit value was obtained
738 */
739 bool GetBit(int pos) const;
740
741 uint8_t m_txOptions; //!< the bitmap representing the Tx options
742};
743
744} // namespace zigbee
745} // namespace ns3
746
747#endif /* ZIGBEE_APS_H */
Callback template class.
Definition callback.h:422
This class can contain 16 bit addresses.
an EUI-64 address
Object()
Constructor.
Definition object.cc:96
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
Simulation virtual time values and global simulation resolution.
Definition nstime.h:96
a unique identifier for an interface.
Definition type-id.h:49
APS Binding Table See Zigbee specification r22.1.0, Table 2-134 Similar to the z-boss implementation,...
Defines the APS header use by data transfer and commands issued from the APS layer.
void ApsmeBindRequest(ApsmeBindRequestParams params)
Zigbee Specification r22.1.0, Section 2.2.4.3.1 APSME-BIND.request Bind a source entry to one or more...
void NldeDataIndication(NldeDataIndicationParams params, Ptr< Packet > nsdu)
Zigbee Specification r22.1.0, Section 3.2.1.3 NLDE-DATA.indication Used to report to the APS the rece...
ApsmeAddGroupConfirmCallback m_apsmeAddGroupConfirmCallback
This callback is used to to notify the result of endpoint addition request in the APS to the Applicat...
Definition zigbee-aps.h:582
void SetApsmeUnbindConfirmCallback(ApsmeUnbindConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
SequenceNumber8 m_apsCounter
The sequence number used in packet Tx with APS headers.
Definition zigbee-aps.h:614
void SetApsdeDataConfirmCallback(ApsdeDataConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
void SetApsmeBindConfirmCallback(ApsmeBindConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
Ptr< ZigbeeGroupTable > m_apsGroupTable
The group table used by this Zigbee APS.
Definition zigbee-aps.h:608
ZigbeeAps()
Default constructor.
Definition zigbee-aps.cc:41
void DoInitialize() override
Initialize() implementation.
Definition zigbee-aps.cc:58
Ptr< ZigbeeNwk > m_nwk
The underlying Zigbee NWK connected to this Zigbee APS.
Definition zigbee-aps.h:601
void SendDataWithBindingTable(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Send a Groupcast or IEEE address destination from a list of destination in the binding table.
void SetApsmeRemoveGroupConfirmCallback(ApsmeRemoveGroupConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
ApsmeRemoveGroupConfirmCallback m_apsmeRemoveGroupConfirmCallback
This callback is used to to notify the result of a endpoint removal request in the APS to the Applica...
Definition zigbee-aps.h:589
void ReceiveData(const ZigbeeApsHeader &apsHeader, const NldeDataIndicationParams &params, Ptr< Packet > nsdu)
Zigbee Specification r22.1.0, Section 2.2.8.4.2 Reception and Rejection of data from the NWK.
ApsdeDataConfirmCallback m_apsdeDataConfirmCallback
This callback is used to to notify the results of a data transmission request to the Application fram...
Definition zigbee-aps.h:554
void SetGroupTable(Ptr< ZigbeeGroupTable > groupTable)
Get the group table used by this Zigbee APS.
Definition zigbee-aps.cc:81
void SetApsdeDataIndicationCallback(ApsdeDataIndicationCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
static TypeId GetTypeId()
Get the type ID.
Definition zigbee-aps.cc:26
ApsdeDataIndicationCallback m_apsdeDataIndicationCallback
This callback is used to to notify the reception of data to the Application framework (AF).
Definition zigbee-aps.h:561
void SendDataUcstBcst(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Send a regular UCST or BCST data transmission to a known 16-bit address destination.
void DoDispose() override
Destructor implementation.
Definition zigbee-aps.cc:65
ApsmeBindConfirmCallback m_apsmeBindConfirmCallback
This callback is used to to notify the result of a binding request in the APS to the Application fram...
Definition zigbee-aps.h:568
void SetApsmeRemoveAllGroupsConfirmCallback(ApsmeRemoveAllGroupsConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
void ApsmeUnbindRequest(ApsmeBindRequestParams params)
Zigbee Specification r22.1.0, Section 2.2.4.3.3 APSME-BIND.request Unbind a destination entry from a ...
void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
Definition zigbee-aps.cc:47
void ApsmeRemoveGroupRequest(ApsmeGroupRequestParams params)
Zigbee Specification r22.1.0, Section 2.2.4.5.3 APSME-REMOVE-GROUP.request Request that group members...
uint8_t m_apsNonMemberRadius
The APS non-member radius, used to limit the number of hops for non-member multicast group devices wh...
Definition zigbee-aps.h:628
ApsmeRemoveAllGroupsConfirmCallback m_apsmeRemoveAllGroupsConfirmCallback
This callback is used to to notify the result of a endpoint removal request in the APS to the Applica...
Definition zigbee-aps.h:596
void ApsmeAddGroupRequest(ApsmeGroupRequestParams params)
Zigbee Specification r22.1.0, Section 2.2.4.5.1 APSME-ADD-GROUP.request Request that group membership...
void ApsmeRemoveAllGroupsRequest(uint8_t endPoint)
Zigbee Specification r22.1.0, Section 2.2.4.5.5 APSME-REMOVE-ALL-GROUPS.request Remove membership in ...
void SetApsmeAddGroupConfirmCallback(ApsmeAddGroupConfirmCallback c)
Set the callback as part of the interconnections between the APS and the next layer or service (typic...
void SendDataGroup(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Send a Groupcast to a group address destination.
Ptr< ZigbeeNwk > GetNwk() const
Get the underlying NWK used by the current Zigbee APS.
Definition zigbee-aps.cc:87
BindingTable m_apsBindingTable
The binding table used by this Zigbee APS.
Definition zigbee-aps.h:620
void ApsdeDataRequest(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Zigbee Specification r22.1.0, Section 2.2.4.1.1 APSDE-DATA.request Request the transmission of data t...
Definition zigbee-aps.cc:93
void SetNwk(Ptr< ZigbeeNwk > nwk)
Set the underlying NWK to use in this Zigbee APS.
Definition zigbee-aps.cc:75
ApsmeUnbindConfirmCallback m_apsmeUnbindConfirmCallback
This callback is used to to notify the result of a unbinding request in the APS to the Application fr...
Definition zigbee-aps.h:575
void NldeDataConfirm(NldeDataConfirmParams params)
Zigbee Specification r22.1.0, Section 3.2.1.2 NLDE-DATA.confirm Used to report to the APS the transmi...
bool GetBit(int pos) const
Get the value of the bit at the position indicated.
bool IsSecurityEnabled() const
Show if the security enable bit of the Tx options is present.
void SetUseNwkKey(bool enable)
Set the use network key bit of the TX options.
bool IsIncludeExtendedNonce() const
Show if the include extended nonce bit of the Tx options is present.
uint8_t m_txOptions
the bitmap representing the Tx options
Definition zigbee-aps.h:741
uint8_t GetTxOptions() const
Get the complete bitmap containing the Tx options.
void SetAckRequired(bool enable)
Set the Acknowledgement required bit of the Tx options.
void SetIncludeExtendedNonce(bool enable)
Set the include extended nonce bit of the Tx options.
void SetFragmentationPermitted(bool enable)
Set the fragmentation bit of the Tx options.
void SetSecurityEnabled(bool enable)
Set the security enable bit of the TX options.
ZigbeeApsTxOptions(uint8_t value=0)
The constructor of the Tx options class.
bool IsUseNwkKey() const
Show if the use network key bit of the Tx options is present.
void SetBit(int pos, bool value)
Set a bit value into a position in the uint8_t representint the Tx options.
bool IsAckRequired() const
Show if the ACK bit of the Tx options is present.
bool IsFragmentationPermitted() const
Show if the fragmentation permitted bit of the Tx options is present.
SequenceNumber< uint8_t, int8_t > SequenceNumber8
8 bit Sequence number.
Callback< void, ApsmeGroupConfirmParams > ApsmeRemoveGroupConfirmCallback
This callback is called to confirm a successfully removal of a group address and or endPoint from the...
Definition zigbee-aps.h:313
ApsStatus
APS Sub-layer Status Values See Zigbee Specification r22.1.0, Table 2-27.
Definition zigbee-aps.h:95
ApsDstAddressMode
APS Destination Address Mode, Zigbee Specification r22.1.0 Table 2-2 APSDE-DATA.request Parameters Se...
Definition zigbee-aps.h:46
Callback< void, ApsmeBindConfirmParams > ApsmeBindConfirmCallback
This callback is called to confirm a successfully addition of a destination into the binding table.
Definition zigbee-aps.h:289
Callback< void, ApsdeDataConfirmParams > ApsdeDataConfirmCallback
This callback is called to confirm a successfully transmission of an ASDU.
Definition zigbee-aps.h:273
Callback< void, ApsmeRemoveAllGroupsConfirmParams > ApsmeRemoveAllGroupsConfirmCallback
This callback is called to confirm a successfully removal of an endpoint from all the the groups.
Definition zigbee-aps.h:321
ApsSrcAddressMode
APS Source Address Mode, Zigbee Specification r22.1.0 See Table 2-4 APSDE-DATA.indication Parameters.
Definition zigbee-aps.h:67
Callback< void, ApsmeBindConfirmParams > ApsmeUnbindConfirmCallback
This callback is called to confirm a successfully unbind request performed into the binding table.
Definition zigbee-aps.h:297
ApsSecurityStatus
APS Security status See Zigbee Specification r22.1.0, Table 2-4 APSDE-DATA.indication Parameters.
Definition zigbee-aps.h:82
Callback< void, ApsmeGroupConfirmParams > ApsmeAddGroupConfirmCallback
This callback is called to confirm a successfully addition of a group address and or endPoint into th...
Definition zigbee-aps.h:305
Callback< void, ApsdeDataIndicationParams, Ptr< Packet > > ApsdeDataIndicationCallback
This callback is called after a ASDU has successfully received and APS push it to deliver it to the n...
Definition zigbee-aps.h:281
@ ILLEGAL_REQUEST
Illegal request.
Definition zigbee-aps.h:101
@ UNSUPPORTED_ATTRIBUTE
Unsupported attribute.
Definition zigbee-aps.h:114
@ INVALID_GROUP
Invalid group.
Definition zigbee-aps.h:103
@ ASDU_TOO_LONG
A received fragmented frame could not be defragmented at the current time.
Definition zigbee-aps.h:97
@ INVALID_BINDING
Invalid binding.
Definition zigbee-aps.h:102
@ NOT_SUPPORTED
Not supported in APS.
Definition zigbee-aps.h:108
@ DEFRAG_DEFERRED
Defragmentation deferred.
Definition zigbee-aps.h:99
@ SECURITY_FAIL
Security failed.
Definition zigbee-aps.h:111
@ NO_BOUND_DEVICE
No bound device.
Definition zigbee-aps.h:106
@ DEFRAG_UNSUPPORTED
Defragmentation is not supported.
Definition zigbee-aps.h:100
@ SUCCESS
A request has been executed successfully.
Definition zigbee-aps.h:96
@ INVALID_PARAMETER
A parameter value was invalid or out of range.
Definition zigbee-aps.h:104
@ DST_ADDR16_DST_ENDPOINT_PRESENT
16-bit destination address and destination endpoint present.
Definition zigbee-aps.h:51
@ DST_ADDR_AND_DST_ENDPOINT_NOT_PRESENT
Destination address and destination endpoint not present.
Definition zigbee-aps.h:47
@ DST_ADDR64_DST_ENDPOINT_NOT_PRESENT
64-bit address present but destination endpoint not present.
Definition zigbee-aps.h:55
@ SRC_ADDR64_SRC_ENDPOINT_PRESENT
64-bit source address and source endpoint present
Definition zigbee-aps.h:69
@ SRC_ADDR16_SRC_ENDPOINT_PRESENT
16-bit source address and source endpoint present
Definition zigbee-aps.h:68
@ SRC_ADDR64_SRC_ENDPOINT_NOT_PRESENT
64-bit source address present but source endpoint not present
Definition zigbee-aps.h:70
@ SECURED_LINK_KEY
Use link secure key.
Definition zigbee-aps.h:85
@ UNSECURED
Unsecured status.
Definition zigbee-aps.h:83
@ SECURED_NWK_KEY
Use NWK secure key.
Definition zigbee-aps.h:84
@ TABLE_FULL
Either the routing or neighbor table are full.
Definition zigbee-nwk.h:127
@ UNSUPPORTED_ATTRIBUTE
Unsupported attribute (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:198
@ SUCCESS
The operation was completed successfully.
Definition zigbee-nwk.h:154
@ NO_SHORT_ADDRESS
Failure due to unallocated 16-bit short address.
Definition zigbee-nwk.h:174
@ INVALID_PARAMETER
Invalid Parameter (Zigbee specification r22.1.0)
Definition zigbee-nwk.h:190
@ NO_ACK
No acknowledgment was received after macMaxFrameRetries.
Definition zigbee-nwk.h:171
ApsDstAddressModeBind
APS Destination Address Mode for Binding Zigbee Specification r22.1.0, Table 2-6 APSME-BIND....
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Zigbee Specification r22.1.0, Section 2.2.4.1.2 APSDE-DATA.confirm params.
Definition zigbee-aps.h:148
Mac16Address m_dstAddr16
The destination 16-bit address.
Definition zigbee-aps.h:151
uint8_t m_srcEndPoint
The source endpoint.
Definition zigbee-aps.h:154
ApsDstAddressMode m_dstAddrMode
Destination address mode.
Definition zigbee-aps.h:149
uint8_t m_dstEndPoint
The destination endpoint.
Definition zigbee-aps.h:153
Time m_txTime
The transmission timestamp.
Definition zigbee-aps.h:156
Mac64Address m_dstAddr64
The destination IEEE address (64-bit address).
Definition zigbee-aps.h:152
ApsStatus m_status
The confirmation status.
Definition zigbee-aps.h:155
Zigbee Specification r22.1.0, Section 2.2.4.1.3 APSDE-DATA.indications params.
Definition zigbee-aps.h:166
Mac64Address m_srcAddress64
The IEEE source address (64-bit address)
Definition zigbee-aps.h:178
Time m_rxTime
The reception timestamp.
Definition zigbee-aps.h:186
Mac64Address m_dstAddr64
The destination IEEE address (64-bit address)
Definition zigbee-aps.h:171
Mac16Address m_dstAddr16
The destination 16-bit address.
Definition zigbee-aps.h:170
uint8_t m_dstEndPoint
The destination endpoint.
Definition zigbee-aps.h:172
uint8_t asduLength
The size of the the ASDU packet.
Definition zigbee-aps.h:182
uint8_t m_srcEndpoint
The application source endpoint.
Definition zigbee-aps.h:179
ApsSrcAddressMode m_srcAddrMode
The source address mode.
Definition zigbee-aps.h:173
ApsDstAddressMode m_dstAddrMode
The destination address mode.
Definition zigbee-aps.h:167
ApsStatus m_status
The data indication status.
Definition zigbee-aps.h:183
uint8_t m_linkQuality
The link quality indication value.
Definition zigbee-aps.h:185
Mac16Address m_srcAddress16
The 16-bit address.
Definition zigbee-aps.h:177
uint16_t m_clusterId
The application cluster ID.
Definition zigbee-aps.h:181
ApsSecurityStatus m_securityStatus
Security status.
Definition zigbee-aps.h:184
uint16_t m_profileId
The application profile ID.
Definition zigbee-aps.h:180
Zigbee Specification r22.1.0, Section 2.2.4.1.1 APSDE-DATA.request params.
Definition zigbee-aps.h:124
uint16_t m_profileId
The application profile ID.
Definition zigbee-aps.h:130
Mac16Address m_aliasSrcAddr
Alias source address.
Definition zigbee-aps.h:136
uint16_t m_clusterId
The application cluster ID.
Definition zigbee-aps.h:131
Mac16Address m_dstAddr16
The destination 16-bit address.
Definition zigbee-aps.h:127
uint8_t m_txOptions
Transmission options.
Definition zigbee-aps.h:134
uint8_t m_srcEndPoint
The source endpoint.
Definition zigbee-aps.h:132
uint32_t m_asduLength
The ASDU length.
Definition zigbee-aps.h:133
bool m_useAlias
Indicates if alias is used in this transmission.
Definition zigbee-aps.h:135
uint8_t m_aliasSeqNumb
Alias sequence number.
Definition zigbee-aps.h:137
ApsDstAddressMode m_dstAddrMode
Destination address mode.
Definition zigbee-aps.h:125
uint8_t m_dstEndPoint
The destination endpoint.
Definition zigbee-aps.h:129
uint8_t m_radius
Radius (Number of hops this message travels)
Definition zigbee-aps.h:138
Mac64Address m_dstAddr64
The destination 64-bit address.
Definition zigbee-aps.h:128
Zigbee Specification r22.1.0, Sections 2.2.4.3.2 and 2.2.4.3.4 APSME-BIND.confirm and APSME-UNBIND....
Definition zigbee-aps.h:214
ApsDstAddressModeBind m_dstAddrMode
Destination address mode.
Definition zigbee-aps.h:219
uint16_t m_clusterId
The application cluster ID.
Definition zigbee-aps.h:218
ApsStatus m_status
The status of the bind request.
Definition zigbee-aps.h:215
uint8_t m_srcEndPoint
The application source endpoint.
Definition zigbee-aps.h:217
Mac64Address m_srcAddr
The application source address.
Definition zigbee-aps.h:216
Mac16Address m_dstAddr16
The destination 16-bit address.
Definition zigbee-aps.h:221
Mac64Address m_dstAddr64
The destination 64-bit address.
Definition zigbee-aps.h:222
uint8_t m_dstEndPoint
The application destination endpoint.
Definition zigbee-aps.h:223
Zigbee Specification r22.1.0, Sections 2.2.4.3.1 and 2.2.4.3.3 APSME-BIND.request and APSME-UNBIND....
Definition zigbee-aps.h:196
Mac64Address m_srcAddr
The source IEEE address (64-bit address)
Definition zigbee-aps.h:197
ApsDstAddressModeBind m_dstAddrMode
Destination address mode.
Definition zigbee-aps.h:200
uint16_t m_clusterId
The application cluster ID.
Definition zigbee-aps.h:199
uint8_t m_srcEndPoint
The application source endpoint.
Definition zigbee-aps.h:198
uint8_t m_dstEndPoint
The application destination endpoint.
Definition zigbee-aps.h:204
Mac64Address m_dstAddr64
The destination 64-bit address.
Definition zigbee-aps.h:203
Mac16Address m_dstAddr16
The destination 16-bit address.
Definition zigbee-aps.h:202
Zigbee Specification r22.1.0, Section 2.2.4.5.2 and 2.2.4.5.4 APSME-ADD-GROUP.confirm and APSME-REMOV...
Definition zigbee-aps.h:245
ApsStatus m_status
The status of the add group request.
Definition zigbee-aps.h:246
uint8_t m_endPoint
The endpoint to which the given group is being added.
Definition zigbee-aps.h:248
Mac16Address m_groupAddress
The group address being added.
Definition zigbee-aps.h:247
Zigbee Specification r22.1.0, Section 2.2.4.5.1 and 2.2.4.5.3 APSME-ADD-GROUP.request and APSME-REMOV...
Definition zigbee-aps.h:233
uint8_t m_endPoint
The endpoint to which the group address is associated.
Definition zigbee-aps.h:235
Mac16Address m_groupAddress
The group address to add.
Definition zigbee-aps.h:234
Zigbee Specification r22.1.0, Section 2.2.4.5.6 APSME-REMOVE-ALL-GROUPS.request params.
Definition zigbee-aps.h:258
uint8_t m_endPoint
The endpoint from which all groups are being removed.
Definition zigbee-aps.h:261
ApsStatus m_status
The status of the remove all groups request.
Definition zigbee-aps.h:259
NLDE-DATA.confirm params.
Definition zigbee-nwk.h:292
NLDE-DATA.indication params.
Definition zigbee-nwk.h:306