A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
zigbee-aps.cc
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#include "zigbee-aps.h"
12
13#include "ns3/log.h"
14#include "ns3/packet.h"
15#include "ns3/simulator.h"
16
17namespace ns3
18{
19namespace zigbee
20{
21
22NS_LOG_COMPONENT_DEFINE("ZigbeeAps");
24
25TypeId
27{
28 static TypeId tid = TypeId("ns3::zigbee::ZigbeeAps")
30 .SetGroupName("Zigbee")
31 .AddConstructor<ZigbeeAps>()
32 .AddAttribute("ApsNonMemberRadius",
33 "The value to be used for the NonmemberRadius parameter"
34 " when using NWK layer multicast",
35 UintegerValue(0x02),
38 return tid;
39}
40
45
46void
51
56
57void
63
64void
66{
67 m_nwk = nullptr;
68 // m_apsBindingTable.Dispose();
70
72}
73
74void
76{
77 m_nwk = nwk;
78}
79
80void
85
88{
89 return m_nwk;
90}
91
92void
94{
95 NS_LOG_FUNCTION(this);
96
97 // Fill APSDE-data.confirm parameters in case we need to return an error
98 ApsdeDataConfirmParams confirmParams;
99 confirmParams.m_dstAddrMode = params.m_dstAddrMode;
100 confirmParams.m_dstAddr16 = params.m_dstAddr16;
101 confirmParams.m_dstAddr64 = params.m_dstAddr64;
102 confirmParams.m_dstEndPoint = params.m_dstEndPoint;
103 confirmParams.m_srcEndPoint = params.m_srcEndPoint;
104
105 ZigbeeApsTxOptions txOptions(params.m_txOptions);
106
107 if (txOptions.IsSecurityEnabled())
108 {
109 // TODO: Add support for security options
110 if (!m_apsdeDataConfirmCallback.IsNull())
111 {
112 confirmParams.m_status = ApsStatus::SECURITY_FAIL;
113 confirmParams.m_txTime = Simulator::Now();
114 m_apsdeDataConfirmCallback(confirmParams);
115 }
116 NS_LOG_WARN("Security is not currently supported");
117 return;
118 }
119
120 // TODO: Fragmentation
121
122 // TODO: Add ACK support
123 if (txOptions.IsAckRequired())
124 {
125 NS_ABORT_MSG("Transmission with ACK not supported");
126 return;
127 }
128
129 // See See 2.2.4.1.1
130 switch (params.m_dstAddrMode)
131 {
133 // Use BINDING TABLE to send data to one or more destinations
134 // (Groupcast or IEEE address destination transmission)
135 NS_ABORT_MSG("Binded destination groupcast not supported");
136 // SendDataWithBindingTable(params, asdu);
137 break;
138 }
140 // Groupcast (a kind of multicast) support
141 SendDataGroup(params, asdu);
142 break;
143 }
145 // Regular UCST or BCST transmission with the 16 bit destination address
146 SendDataUcstBcst(params, asdu);
147 break;
148 }
150 // TODO: Add Extended address transmission support.
151 // The NWK do not accept direct extended address transmissions,
152 // therefore, the APS must translate the extended address
153 // to a short address using the nwkAddressMap NIB.
154 if (!m_apsdeDataConfirmCallback.IsNull())
155 {
157 confirmParams.m_txTime = Simulator::Now();
158 m_apsdeDataConfirmCallback(confirmParams);
159 }
160 NS_LOG_WARN("Extended address mode not supported");
161 break;
162 }
163 default:
164 NS_ABORT_MSG("Invalid Option");
165 break;
166 }
167}
168
169void
171{
172 NS_LOG_FUNCTION(this);
173
174 // Fill APSDE-data.confirm parameters in case we need to return an error
175 ApsdeDataConfirmParams confirmParams;
176 confirmParams.m_dstAddrMode = params.m_dstAddrMode;
177 confirmParams.m_dstAddr16 = params.m_dstAddr16;
178 confirmParams.m_dstAddr64 = params.m_dstAddr64;
179 confirmParams.m_dstEndPoint = params.m_dstEndPoint;
180 confirmParams.m_srcEndPoint = params.m_srcEndPoint;
181
182 // APS Header
183 ZigbeeApsTxOptions txOptions(params.m_txOptions);
184 ZigbeeApsHeader apsHeader;
186 apsHeader.SetSrcEndpoint(params.m_srcEndPoint);
187 apsHeader.SetProfileId(params.m_profileId);
188 apsHeader.SetClusterId(params.m_clusterId);
189 apsHeader.SetExtHeaderPresent(false);
191
192 // NLDE-data.request params
193 NldeDataRequestParams nwkParams;
194 nwkParams.m_radius = params.m_radius;
196 nwkParams.m_securityEnable = txOptions.IsSecurityEnabled();
198
199 SrcBindingEntry srcEntry;
200 std::vector<DstBindingEntry> dstEntries;
201
202 if (m_apsBindingTable.LookUpEntries(srcEntry, dstEntries))
203 {
204 for (const auto& dst : dstEntries)
205 {
207 {
208 // We must look into the nwkAddressMap to transform the
209 // 64 bit address destination to a 16 bit destination
210 NS_LOG_WARN("Bound destination found but 64bit destination not supported");
211 // TODO: drop trace here
212 }
213 else
214 {
215 // Send a UCST message to each destination
216 nwkParams.m_dstAddr = dst.GetDstAddr16();
217 apsHeader.SetApsCounter(m_apsCounter.GetValue());
218 m_apsCounter++;
219 Ptr<Packet> p = asdu->Copy();
220 p->AddHeader(apsHeader);
222 }
223 }
224
225 if (!m_apsdeDataConfirmCallback.IsNull())
226 {
227 confirmParams.m_status = ApsStatus::SUCCESS;
228 confirmParams.m_txTime = Simulator::Now();
229 m_apsdeDataConfirmCallback(confirmParams);
230 }
231 }
232 else
233 {
234 if (!m_apsdeDataConfirmCallback.IsNull())
235 {
236 confirmParams.m_status = ApsStatus::NO_BOUND_DEVICE;
237 confirmParams.m_txTime = Simulator::Now();
238 m_apsdeDataConfirmCallback(confirmParams);
239 }
240 }
241}
242
243void
245{
246 NS_LOG_FUNCTION(this);
247
248 // Fill APSDE-data.confirm parameters in case we need to return an error
249 ApsdeDataConfirmParams confirmParams;
250 confirmParams.m_dstAddrMode = params.m_dstAddrMode;
251 confirmParams.m_dstAddr16 = params.m_dstAddr16;
252 confirmParams.m_dstAddr64 = params.m_dstAddr64;
253 confirmParams.m_dstEndPoint = params.m_dstEndPoint;
254 confirmParams.m_srcEndPoint = params.m_srcEndPoint;
255
256 // APS Header
257 ZigbeeApsTxOptions txOptions(params.m_txOptions);
258 ZigbeeApsHeader apsHeader;
260 apsHeader.SetSrcEndpoint(params.m_srcEndPoint);
261 apsHeader.SetProfileId(params.m_profileId);
262 apsHeader.SetClusterId(params.m_clusterId);
263 apsHeader.SetExtHeaderPresent(false);
265
266 // NLDE-data.request params
267 NldeDataRequestParams nwkParams;
268 nwkParams.m_radius = params.m_radius;
270 nwkParams.m_securityEnable = txOptions.IsSecurityEnabled();
272
273 if (params.m_dstAddr16 == "FF:FF" || params.m_dstAddr16 == "FF:FD" ||
274 params.m_dstAddr16 == "FF:FC" || params.m_dstAddr16 == "FF:FB")
275 {
276 // Destination is a broadcast address
278 }
279 else
280 {
281 // Destination is a unicast address
283 }
284
285 if (params.m_useAlias)
286 {
287 if (txOptions.IsAckRequired()) // 0b1 = 00000001 = 1 dec
288 {
289 if (!m_apsdeDataConfirmCallback.IsNull())
290 {
291 confirmParams.m_status = ApsStatus::NOT_SUPPORTED;
292 confirmParams.m_txTime = Simulator::Now();
293 m_apsdeDataConfirmCallback(confirmParams);
294 }
295 return;
296 }
297
298 nwkParams.m_useAlias = params.m_useAlias;
299 nwkParams.m_aliasSeqNumber = params.m_aliasSeqNumb;
300 nwkParams.m_aliasSrcAddr = params.m_aliasSrcAddr;
301
302 apsHeader.SetApsCounter(params.m_aliasSeqNumb);
303 }
304 else
305 {
306 apsHeader.SetApsCounter(m_apsCounter.GetValue());
307 m_apsCounter++;
308 }
309
311 nwkParams.m_dstAddr = params.m_dstAddr16;
312 apsHeader.SetDstEndpoint(params.m_dstEndPoint);
313
314 asdu->AddHeader(apsHeader);
315
317}
318
319void
321{
322 NS_LOG_FUNCTION(this);
323
324 // Fill APSDE-data.confirm parameters in case we need to return an error
325 ApsdeDataConfirmParams confirmParams;
326 confirmParams.m_dstAddrMode = params.m_dstAddrMode;
327 confirmParams.m_dstAddr16 = params.m_dstAddr16;
328 confirmParams.m_dstAddr64 = params.m_dstAddr64;
329 confirmParams.m_dstEndPoint = params.m_dstEndPoint;
330 confirmParams.m_srcEndPoint = params.m_srcEndPoint;
331
332 if (params.m_dstAddr16 == Mac16Address("00:00"))
333 {
334 if (!m_apsdeDataConfirmCallback.IsNull())
335 {
336 confirmParams.m_status = ApsStatus::INVALID_GROUP;
337 confirmParams.m_txTime = Simulator::Now();
338 m_apsdeDataConfirmCallback(confirmParams);
339 }
340 return;
341 }
342
343 // APS Header
344 ZigbeeApsTxOptions txOptions(params.m_txOptions);
345 ZigbeeApsHeader apsHeader;
347 apsHeader.SetSrcEndpoint(params.m_srcEndPoint);
348 apsHeader.SetProfileId(params.m_profileId);
349 apsHeader.SetClusterId(params.m_clusterId);
350 apsHeader.SetExtHeaderPresent(false);
352 apsHeader.SetGroupAddress(params.m_dstAddr16.ConvertToInt());
353
354 // NLDE-data.request params
355 NldeDataRequestParams nwkParams;
356 nwkParams.m_radius = params.m_radius;
358 nwkParams.m_securityEnable = txOptions.IsSecurityEnabled();
360 nwkParams.m_dstAddr = params.m_dstAddr16;
362
363 asdu->AddHeader(apsHeader);
364
366}
367
368void
370{
371 ApsmeBindConfirmParams confirmParams;
372 confirmParams.m_srcAddr = params.m_srcAddr;
373 confirmParams.m_srcEndPoint = params.m_srcEndPoint;
374 confirmParams.m_clusterId = params.m_clusterId;
375 confirmParams.m_dstAddr16 = params.m_dstAddr16;
376 confirmParams.m_dstAddr64 = params.m_dstAddr64;
377 confirmParams.m_dstAddrMode = params.m_dstAddrMode;
378 confirmParams.m_dstEndPoint = params.m_dstEndPoint;
379
380 // TODO: confirm the device has joined the network
381 // How? APS have no access to join information.
382
383 // Verify params are in valid range (2.2.4.3.1)
384 if ((params.m_srcEndPoint < 0x01 || params.m_srcEndPoint > 0xfe) ||
385 (params.m_dstEndPoint < 0x01))
386 {
387 if (!m_apsmeBindConfirmCallback.IsNull())
388 {
389 confirmParams.m_status = ApsStatus::ILLEGAL_REQUEST;
390 m_apsmeBindConfirmCallback(confirmParams);
391 }
392 return;
393 }
394
395 SrcBindingEntry srcEntry(params.m_srcAddr, params.m_srcEndPoint, params.m_clusterId);
396
397 DstBindingEntry dstEntry;
398
400 {
401 // Group Addressing binding
403 dstEntry.SetDstAddr16(params.m_dstAddr16);
404 }
405 else
406 {
407 // Unicast binding
409 dstEntry.SetDstEndPoint(params.m_dstEndPoint);
410 }
411
412 switch (m_apsBindingTable.Bind(srcEntry, dstEntry))
413 {
415 confirmParams.m_status = ApsStatus::SUCCESS;
416 break;
418 confirmParams.m_status = ApsStatus::INVALID_BINDING;
419 break;
421 confirmParams.m_status = ApsStatus::TABLE_FULL;
422 break;
423 default:
424 NS_LOG_ERROR("Invalid binding option");
425 }
426
427 if (!m_apsmeBindConfirmCallback.IsNull())
428 {
429 m_apsmeBindConfirmCallback(confirmParams);
430 }
431}
432
433void
437
438void
440{
441 NS_LOG_FUNCTION(this);
442
443 ApsmeGroupConfirmParams confirmParams;
444 confirmParams.m_status = ApsStatus::SUCCESS;
445 confirmParams.m_groupAddress = params.m_groupAddress;
446 confirmParams.m_endPoint = params.m_endPoint;
447
448 if (!m_apsGroupTable->AddEntry(params.m_groupAddress.ConvertToInt(), params.m_endPoint))
449 {
450 confirmParams.m_status = ApsStatus::TABLE_FULL;
451 }
452
453 if (!m_apsmeAddGroupConfirmCallback.IsNull())
454 {
455 m_apsmeAddGroupConfirmCallback(confirmParams);
456 }
457}
458
459void
461{
462 NS_LOG_FUNCTION(this);
463
464 ApsmeGroupConfirmParams confirmParams;
465 confirmParams.m_status = ApsStatus::SUCCESS;
466 confirmParams.m_groupAddress = params.m_groupAddress;
467 confirmParams.m_endPoint = params.m_endPoint;
468
469 if (!m_apsGroupTable->RemoveEntry(params.m_groupAddress.ConvertToInt(), params.m_endPoint))
470 {
471 confirmParams.m_status = ApsStatus::INVALID_GROUP;
472 }
473
475 {
477 }
478}
479
480void
482{
483 NS_LOG_FUNCTION(this);
484
486 confirmParams.m_status = ApsStatus::SUCCESS;
487 confirmParams.m_endPoint = endPoint;
488
489 if (!m_apsGroupTable->RemoveMembership(endPoint))
490 {
492 }
493
495 {
497 }
498}
499
500void
502{
503 // TODO: Handle the confirmation of the data request
504}
505
506void
508{
509 NS_LOG_FUNCTION(this);
510
511 // See section 2.2.4.1.3.
512 // - TODO: Handle Security
513 // - Handle groupcast (MCST) delivery (Note group table shared by NWK and APS)
514 // - Handle UCST, BCST delivery
515 // - TODO: Handle binding
516 // - TODO: Handle fragmentation
517 // - TODO: Detect Duplicates
518 // - TODO: Handle ACK
519 // - TODO: Handle other frame types (APS Command, APS Inter-PAN)
520
521 ZigbeeApsHeader apsHeader;
522 nsdu->RemoveHeader(apsHeader);
523
524 // Check if packet is fragmented
525 if (apsHeader.IsExtHeaderPresent())
526 {
527 if (!m_apsdeDataIndicationCallback.IsNull())
528 {
529 ApsdeDataIndicationParams indicationParams;
530 indicationParams.m_status = ApsStatus::DEFRAG_UNSUPPORTED;
531 m_apsdeDataIndicationCallback(indicationParams, nsdu);
532 }
533
534 NS_LOG_WARN("Extended Header (Fragmentation) not supported");
535 return;
536 // TODO: Handle fragmentation See 2.2.8.4.5
537 }
538
539 // TODO: IF security is present, remove as described in Section 4.4.
540 if (params.m_securityUse)
541 {
542 NS_LOG_ERROR("Security is not currently supported");
543 }
544
545 // TODO: Duplicate detection here
546 // See last paragraph of section 2.2.8.4.2
547
548 switch (apsHeader.GetFrameType())
549 {
551 // Zigbee Specification, Section 2.2.8.4.2
552 // Reception and Rejection
553 ReceiveData(apsHeader, params, nsdu);
554 break;
556 NS_LOG_ERROR("APS ACK frames are not supported");
557 break;
559 NS_LOG_ERROR("APS Command frames are not supported");
560 break;
562 NS_LOG_ERROR("APS Inter-PAN frames are not supported");
563 break;
564 }
565}
566
567void
569 const NldeDataIndicationParams& params,
570 Ptr<Packet> nsdu)
571{
572 NS_LOG_FUNCTION(this);
573
574 ApsdeDataIndicationParams indicationParams;
575 indicationParams.m_status = ApsStatus::SUCCESS;
576 indicationParams.m_srcAddress16 = params.m_srcAddr;
577 indicationParams.m_srcEndpoint = apsHeader.GetSrcEndpoint();
578 indicationParams.m_profileId = apsHeader.GetProfileId();
579 indicationParams.m_clusterId = apsHeader.GetClusterId();
580 indicationParams.asduLength = nsdu->GetSize();
582 indicationParams.m_linkQuality = params.m_linkQuality;
583 indicationParams.m_rxTime = Simulator::Now();
584
585 // UNICAST or BROADCAST delivery
586
587 if (apsHeader.GetDeliveryMode() == ApsDeliveryMode::APS_UCST ||
589 {
590 if (!m_apsdeDataIndicationCallback.IsNull())
591 {
592 // Note: Extracting the Address directly from the NWK, creates a dependency on this NWK
593 // implementation. This is not a very good design, but in practice, it is unavoidable
594 // due to the quasi cross-layer design of the specification
595 //(tigly coupled design of the APS in respect to the NWK).
596 indicationParams.m_dstAddr16 = m_nwk->GetNetworkAddress();
598 indicationParams.m_dstEndPoint = apsHeader.GetDstEndpoint();
600 m_apsdeDataIndicationCallback(indicationParams, nsdu);
601 }
602 return;
603 }
604
605 // GROUPCAST delivery
606
608 params.m_dstAddrMode == AddressMode::MCST)
609 {
610 std::vector<uint8_t> endPoints;
611 if (m_apsGroupTable->LookUpEndPoints(apsHeader.GetGroupAddress(), endPoints))
612 {
613 // Give a copy of the packet to each endpoint associated with the group ID.
614 for (const auto& endPoint : endPoints)
615 {
616 if (!m_apsdeDataIndicationCallback.IsNull())
617 {
618 indicationParams.m_dstAddr16 = Mac16Address(apsHeader.GetGroupAddress());
619 indicationParams.m_dstAddrMode =
621 indicationParams.m_dstEndPoint = endPoint;
622 indicationParams.m_srcAddrMode =
624 m_apsdeDataIndicationCallback(indicationParams, nsdu->Copy());
625 }
626 }
627 }
628 return;
629 }
630}
631
632void
637
638void
643
644void
649
650void
655
656void
661
662void
667
668void
673
674//////////////////////////
675// ZigbeeApsTxOptions //
676//////////////////////////
677
679 : m_txOptions(value)
680{
681}
682
683void
685{
686 SetBit(0, enable);
687}
688
689void
691{
692 SetBit(1, enable);
693}
694
695void
697{
698 SetBit(2, enable);
699}
700
701void
703{
704 SetBit(3, enable);
705}
706
707void
709{
710 SetBit(4, enable);
711}
712
713bool
715{
716 return GetBit(0);
717}
718
719bool
721{
722 return GetBit(1);
723}
724
725bool
727{
728 return GetBit(2);
729}
730
731bool
736
737bool
739{
740 return GetBit(4);
741}
742
743uint8_t
745{
746 return m_txOptions;
747}
748
749void
750ZigbeeApsTxOptions::SetBit(int pos, bool value)
751{
752 if (value)
753 {
754 m_txOptions |= (1 << pos);
755 }
756 else
757 {
758 m_txOptions &= ~(1 << pos);
759 }
760}
761
762bool
764{
765 return (m_txOptions >> pos) & 1;
766}
767
768} // namespace zigbee
769} // namespace ns3
This class can contain 16 bit addresses.
virtual void DoInitialize()
Initialize() implementation.
Definition object.cc:440
Object()
Constructor.
Definition object.cc:96
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:595
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
Binding Table entry: Destination portion of the table.
void SetDstAddrMode(ApsDstAddressModeBind mode)
Set the destination address mode of the destination binding entry.
void SetDstEndPoint(uint8_t endPoint)
Set the destination endppoint to the destination binding entry.
void SetDstAddr16(Mac16Address address)
Set the destination 16-bit address of the destination binding entry.
Binding Table entry: Source portion of the table.
Defines the APS header use by data transfer and commands issued from the APS layer.
void SetDstEndpoint(uint8_t endpoint)
Set the destination endpoint in the APS header.
uint16_t GetClusterId() const
Get the cluster id in the APS header.
void SetDeliveryMode(enum ApsDeliveryMode mode)
Defines the mode in which this frame should be transmitted.
bool IsExtHeaderPresent() const
Indicates whether or not the extended header is present in the frame.
void SetGroupAddress(uint16_t groupAddress)
Set the group address in the APS header.
void SetFrameType(enum ApsFrameType frameType)
Set the Frame type defined in the APS layer.
uint16_t GetGroupAddress() const
Get the group address in the APS header.
void SetSrcEndpoint(uint8_t endpoint)
Set the source endpoint in the APS header.
void SetExtHeaderPresent(bool present)
Enables or disables the usage of the extended header.
ApsDeliveryMode GetDeliveryMode() const
Get the transmission mode set on the header.
void SetApsCounter(uint8_t counter)
Set the value of the APS counter in the APS header.
void SetClusterId(uint16_t clusterId)
Set the cluster id in the APS header.
uint8_t GetSrcEndpoint() const
Get the source endpoint in the APS header.
uint8_t GetDstEndpoint() const
Get the destination endpoint in the APS header.
ApsFrameType GetFrameType() const
Get the frame time present in the header.
void SetProfileId(uint16_t profileId)
Set the profile ID in the APS header.
uint16_t GetProfileId() const
Get the profile ID in the APS header.
Zigbee Specification r22.1.0, Section 2.2.3 Class that implements the Zigbee Specification Applicatio...
Definition zigbee-aps.h:330
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...
Helper class used to craft the transmission options bitmap used by the APSDE-DATA....
Definition zigbee-aps.h:638
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.
void NldeDataRequest(NldeDataRequestParams params, Ptr< Packet > packet)
Zigbee Specification r22.1.0, Section 3.2.1.1 NLDE-DATA.request Request to transfer a NSDU.
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition uinteger.h:35
Callback< R, Args... > MakeNullCallback()
Definition callback.h:727
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition log.h:243
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition log.h:250
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
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
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
Callback< void, ApsmeBindConfirmParams > ApsmeUnbindConfirmCallback
This callback is called to confirm a successfully unbind request performed into the binding table.
Definition zigbee-aps.h:297
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
@ NO_SHORT_ADDRESS
No short address present.
Definition zigbee-aps.h:107
@ INVALID_GROUP
Invalid group.
Definition zigbee-aps.h:103
@ INVALID_BINDING
Invalid binding.
Definition zigbee-aps.h:102
@ NOT_SUPPORTED
Not supported in APS.
Definition zigbee-aps.h:108
@ TABLE_FULL
Binding table or group table is full.
Definition zigbee-aps.h:112
@ 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
@ GROUP_ADDR_DST_ENDPOINT_NOT_PRESENT
Group address or 16-bit destination address present but destination endpoint not present.
Definition zigbee-aps.h:49
@ 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_PRESENT
64-bit destination address and destination endpoint present.
Definition zigbee-aps.h:53
@ SRC_ADDR16_SRC_ENDPOINT_PRESENT
16-bit source address and source endpoint present
Definition zigbee-aps.h:68
@ UNSECURED
Unsecured status.
Definition zigbee-aps.h:83
@ ENABLE_ROUTE_DISCOVERY
Enable route discovery.
@ MCST
Multicast Address mode.
Definition zigbee-nwk.h:78
@ UCST_BCST
Unicast or Broadcast address mode.
Definition zigbee-nwk.h:79
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
Time m_rxTime
The reception timestamp.
Definition zigbee-aps.h:186
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
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
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
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
NLDE-DATA.request params.
Definition zigbee-nwk.h:324
uint8_t m_nonMemberRadius
Distance in hops that a multicast frame will be relayed by nodes not a member of the group.
Definition zigbee-nwk.h:337
SequenceNumber8 m_aliasSeqNumber
The sequence number used by this NSDU (ignored if useAlias = false).
Definition zigbee-nwk.h:333
Mac16Address m_dstAddr
The destination address.
Definition zigbee-nwk.h:327
bool m_securityEnable
Enable NWK layer security for the current frame.
Definition zigbee-nwk.h:340
bool m_useAlias
Indicates if next higher layer use an alias for the current frame.
Definition zigbee-nwk.h:330
Mac16Address m_aliasSrcAddr
The source address to be used by this NSDU (ignored ifuseAlias = false).
Definition zigbee-nwk.h:331
uint8_t m_radius
Distance in hops that the frame is allowed to travel through the network.
Definition zigbee-nwk.h:335
AddressMode m_dstAddrMode
Destination address mode.
Definition zigbee-nwk.h:325
uint8_t m_discoverRoute
0x01 Enable Route Discovery | 0x00: Suppress Route discovery
Definition zigbee-nwk.h:339