14#include "ns3/packet.h"
15#include "ns3/simulator.h"
30 .SetGroupName(
"Zigbee")
104 NS_LOG_WARN(
"Security is not currently supported");
118 switch (params.m_dstAddrMode)
123 NS_ABORT_MSG(
"Binded destination groupcast not supported");
148 NS_LOG_WARN(
"Extended address mode not supported");
182 nwkParams.
m_radius = params.m_radius;
188 std::vector<DstBindingEntry> dstEntries;
192 for (
const auto& dst : dstEntries)
198 NS_LOG_WARN(
"Bound destination found but 64bit destination not supported");
204 nwkParams.
m_dstAddr = dst.GetDstAddr16();
208 p->AddHeader(apsHeader);
256 nwkParams.
m_radius = params.m_radius;
261 if (params.m_dstAddr16 ==
"FF:FF" || params.m_dstAddr16 ==
"FF:FD" ||
262 params.m_dstAddr16 ==
"FF:FC" || params.m_dstAddr16 ==
"FF:FB")
273 if (params.m_useAlias)
299 nwkParams.
m_dstAddr = params.m_dstAddr16;
302 asdu->AddHeader(apsHeader);
311 confirmParams.
m_srcAddr = params.m_srcAddr;
323 if ((params.m_srcEndPoint < 0x01 || params.m_srcEndPoint > 0xfe) ||
324 (params.m_dstEndPoint < 0x01))
334 SrcBindingEntry srcEntry(params.m_srcAddr, params.m_srcEndPoint, params.m_clusterId);
388 nsdu->RemoveHeader(apsHeader);
410 NS_LOG_WARN(
"Extended Header (Fragmentation) not supported");
430 indicationParams.
asduLength = nsdu->GetSize();
bool IsNull() const
Check for null implementation.
A base class which provides memory management and object aggregation.
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
static Time Now()
Return the current simulation virtual time.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool LookUpEntries(const SrcBindingEntry &src, std::vector< DstBindingEntry > &dstEntries)
Look for destination entries binded to an specific source entry portion in the binding table.
BindingTableStatus Bind(const SrcBindingEntry &src, const DstBindingEntry &dst)
Add an entry to the binding table.
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.
Zigbee Specification r22.1.0, Section 2.2.3 Class that implements the Zigbee Specification Applicatio...
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...
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.
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...
ZigbeeAps()
Default constructor.
void DoInitialize() override
Initialize() implementation.
Ptr< ZigbeeNwk > m_nwk
Pointer to the underlying NWK connected to this Zigbee APS.
void SendDataWithBindingTable(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Send a Groupcast or IEEE address destination from a list of destination in the binding table.
ApsdeDataConfirmCallback m_apsdeDataConfirmCallback
This callback is used to to notify the results of a data transmission request to the Application fram...
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.
ApsdeDataIndicationCallback m_apsdeDataIndicationCallback
This callback is used to to notify the reception of data to the Application framework (AF).
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.
ApsmeBindConfirmCallback m_apsmeBindConfirmCallback
This callback is used to to notify the result of a binding request in the APS to the Application fram...
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.
Ptr< ZigbeeNwk > GetNwk() const
Get the underlying NWK used by the current Zigbee APS.
BindingTable m_apsBindingTable
The binding table associated to this APS layer.
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...
void SetNwk(Ptr< ZigbeeNwk > nwk)
Set the underlying NWK to use in this Zigbee APS.
ApsmeUnbindConfirmCallback m_apsmeUnbindConfirmCallback
This callback is used to to notify the result of a unbinding request in the APS to the Application fr...
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....
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
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.
Callback< R, Args... > MakeNullCallback()
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
@ ILLEGAL_REQUEST
Illegal request.
@ NO_SHORT_ADDRESS
No short address present.
@ INVALID_BINDING
Invalid binding.
@ NOT_SUPPORTED
Not supported in APS.
@ TABLE_FULL
Binding table or group table is full.
@ SECURITY_FAIL
Security failed.
@ NO_BOUND_DEVICE
No bound device.
@ DEFRAG_UNSUPPORTED
Defragmentation is not supported.
@ SUCCESS
A request has been executed successfully.
@ GROUP_ADDR_DST_ENDPOINT_NOT_PRESENT
Group address or 16-bit destination address present but destination endpoint not present.
@ DST_ADDR16_DST_ENDPOINT_PRESENT
16-bit destination address and destination endpoint present.
@ DST_ADDR_AND_DST_ENDPOINT_NOT_PRESENT
Destination address and destination endpoint not present.
@ DST_ADDR64_DST_ENDPOINT_PRESENT
64-bit destination address and destination endpoint present.
@ UCST_BCST
Unicast or Broadcast address mode.
@ SRC_ADDR16_SRC_ENDPOINT_PRESENT
16-bit source address and source endpoint present
@ UNSECURED
Unsecured status.
@ GROUP_ADDR_DST_ENDPOINT_NOT_PRESENT
@ DST_ADDR64_DST_ENDPOINT_PRESENT
@ ENABLE_ROUTE_DISCOVERY
Enable route discovery.
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.
Mac16Address m_dstAddr16
The destination 16-bit address.
uint8_t m_srcEndPoint
The source endpoint.
ApsDstAddressMode m_dstAddrMode
Destination address mode.
uint8_t m_dstEndPoint
The destination endpoint.
Time m_txTime
The transmission timestamp.
Mac64Address m_dstAddr64
The destination IEEE address (64-bit address).
ApsStatus m_status
The confirmation status.
Zigbee Specification r22.1.0, Section 2.2.4.1.3 APSDE-DATA.indications params.
Time m_rxTime
The reception timestamp.
Mac16Address m_dstAddr16
The destination 16-bit address.
uint8_t m_dstEndPoint
The destination endpoint.
uint8_t asduLength
The size of the the ASDU packet.
uint8_t m_srcEndpoint
The application source endpoint.
ApsSrcAddressMode m_srcAddrMode
The source address mode.
ApsDstAddressMode m_dstAddrMode
The destination address mode.
ApsStatus m_status
The data indication status.
uint8_t m_linkQuality
The link quality indication value.
Mac16Address m_srcAddress16
The 16-bit address.
uint16_t m_clusterId
The application cluster ID.
ApsSecurityStatus m_securityStatus
Security status.
uint16_t m_profileId
The application profile ID.
Zigbee Specification r22.1.0, Section 2.2.4.1.1 APSDE-DATA.request params.
Zigbee Specification r22.1.0, Sections 2.2.4.3.2 and 2.2.4.3.4 APSME-BIND.confirm and APSME-UNBIND....
ApsDstAddressModeBind m_dstAddrMode
Destination address mode.
uint16_t m_clusterId
The application cluster ID.
ApsStatus m_status
The status of the bind request.
uint8_t m_srcEndPoint
The application source endpoint.
Mac64Address m_srcAddr
The application source address.
Mac16Address m_dstAddr16
The destination 16-bit address.
Mac64Address m_dstAddr64
The destination 64-bit address.
uint8_t m_dstEndPoint
The application destination endpoint.
Zigbee Specification r22.1.0, Sections 2.2.4.3.1 and 2.2.4.3.3 APSME-BIND.request and APSME-UNBIND....
NLDE-DATA.confirm params.
NLDE-DATA.indication params.
NLDE-DATA.request params.
SequenceNumber8 m_aliasSeqNumber
The sequence number used by this NSDU (ignored if useAlias = false).
Mac16Address m_dstAddr
The destination address.
bool m_securityEnable
Enable NWK layer security for the current frame.
bool m_useAlias
Indicates if next higher layer use an alias for the current frame.
Mac16Address m_aliasSrcAddr
The source address to be used by this NSDU (ignored ifuseAlias = false).
uint8_t m_radius
Distance in hops that the frame is allowed to travel through the network.
AddressMode m_dstAddrMode
Destination address mode.
uint8_t m_discoverRoute
0x01 Enable Route Discovery | 0x00: Suppress Route discovery