A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::zigbee::ZigbeeZdo Class Reference

#include "zigbee-zdo.h"

Inheritance diagram for ns3::zigbee::ZigbeeZdo:
Collaboration diagram for ns3::zigbee::ZigbeeZdo:

Public Types

using ZdoNwkAddrRspIndCallback = Callback<void, NwkAddrRespIndParams>
 This callback is called after a ASDU has successfully received and APS push it to deliver it to the next higher layer (typically the application framework).

Public Member Functions

 ZigbeeZdo ()
 ~ZigbeeZdo () override
void ApsDataIndication (ApsdeDataIndicationParams params, Ptr< Packet > p)
 This function is called when the Zigbee Stack receives an APSDE-DATA.indication with destination endpoint 0, which is the endpoint used by the Zigbee Device Object (ZDO).
Ptr< ZigbeeAps > GetAps () const
 Get the underlying APS used by the current Zigbee ZDO.
Ptr< ZigbeeNwk > GetNwk () const
 Get the underlying APS used by the current Zigbee ZDO.
void HandleNwkAddrRequest (Ptr< Packet > asdu, ApsdeDataIndicationParams dataParams)
 Effect on Receipt (NWK_addr_req) See Zigbee Specification 2017, Section 2.4.3.1.1.
void HandleNwkAddrResponse (Ptr< Packet > asdu, ApsdeDataIndicationParams dataParams)
 Effect on Receipt (NWK_addr_rsp) See Zigbee Specification 2017, Section 2.4.4.2.1.
void NwkAddrRequest (NwkAddrRequestParams params)
 This function is used to send a Network Address (16-bit address)Request to a remote device when the IEEE address (64-bit address) of the device is known.
void NwkAddrResponse (NwkAddrResponseParams params)
 This function is used to send a Network Address (16-bit address) Response to a remote device in reply to a previously received NWK_addr_req.
void SetAps (Ptr< ZigbeeAps > aps)
 Set the underlying APS to use in this Zigbee ZDO.
void SetNwk (Ptr< ZigbeeNwk > nwk)
 Set the underlying NWK to use in this Zigbee ZDO.
void SetZdoNwkAddrRspIndCallback (ZdoNwkAddrRspIndCallback c)
 Set the indication callback to be called when a response (NWK_addr_rsp) to an NWK_addr_req is received.
Public Member Functions inherited from ns3::Object
 Object ()
 Caller graph was not generated because of its size.
 ~Object () override
 Destructor.
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
void Dispose ()
 Dispose of this Object.
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
TypeId GetInstanceTypeId () const final
 Get the most derived TypeId for this Object.
template<>
Ptr< Object > GetObject () const
 Specialization of () for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
template<>
Ptr< Object > GetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
bool IsInitialized () const
 Check if the object has been initialized.
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
uint32_t GetReferenceCount () const
 Get the reference count of the object.
SimpleRefCount & operator= (const SimpleRefCount &o)
 Assignment operator.
void Ref () const
 Increment the reference count.
void Unref () const
 Decrement the reference count.
Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.

Static Public Member Functions

static TypeId GetTypeId ()
 Get the TypeId of ZigbeeZdo class.
Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.

Protected Member Functions

void DoDispose () override
 Destructor implementation.
void DoInitialize () override
 Initialize() implementation.
void NotifyConstructionCompleted () override
 Notifier called once the ObjectBase is fully constructed.
Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.

Private Attributes

Ptr< ZigbeeAps > m_aps
 Pointer to the Zigbee Application Support Sub-layer (APS) object.
Ptr< ZigbeeNwk > m_nwk
 Pointer to the Zigbee Network Layer (NWK) object.
SequenceNumber8 m_tsn
 The transaction sequence number.
ZdoNwkAddrRspIndCallback m_zdoNwkAddrRspIndCallback
 This callback is used to to notify the result of a NWK_addr_req request in the ZDO to the Application framework (AF).

Additional Inherited Members

Detailed Description

Definition at line 140 of file zigbee-zdo.h.

Member Typedef Documentation

◆ ZdoNwkAddrRspIndCallback

This callback is called after a ASDU has successfully received and APS push it to deliver it to the next higher layer (typically the application framework).

Definition at line 156 of file zigbee-zdo.h.

Constructor & Destructor Documentation

◆ ZigbeeZdo()

ns3::zigbee::ZigbeeZdo::ZigbeeZdo ( )

Definition at line 39 of file zigbee-zdo.cc.

References NS_LOG_FUNCTION.

Referenced by GetTypeId().

Here is the caller graph for this function:

◆ ~ZigbeeZdo()

ns3::zigbee::ZigbeeZdo::~ZigbeeZdo ( )
override

Definition at line 50 of file zigbee-zdo.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ ApsDataIndication()

void ns3::zigbee::ZigbeeZdo::ApsDataIndication ( ApsdeDataIndicationParams params,
Ptr< Packet > p )

This function is called when the Zigbee Stack receives an APSDE-DATA.indication with destination endpoint 0, which is the endpoint used by the Zigbee Device Object (ZDO).

Parameters
paramsThe parameters of the APSDE-DATA.indication.
pThe packet received.

Definition at line 93 of file zigbee-zdo.cc.

References HandleNwkAddrRequest(), HandleNwkAddrResponse(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION, ns3::zigbee::NWK_ADDR_REQ, ns3::zigbee::NWK_ADDR_RSP, and ns3::zigbee::ZDP_PROFILE.

Here is the call graph for this function:

◆ DoDispose()

void ns3::zigbee::ZigbeeZdo::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Caller graph was not generated because of its size.

Reimplemented from ns3::Object.

Definition at line 63 of file zigbee-zdo.cc.

References ns3::Object::DoDispose().

Here is the call graph for this function:

◆ DoInitialize()

void ns3::zigbee::ZigbeeZdo::DoInitialize ( )
overrideprotectedvirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 56 of file zigbee-zdo.cc.

References ns3::Object::DoInitialize(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ GetAps()

Ptr< ZigbeeAps > ns3::zigbee::ZigbeeZdo::GetAps ( ) const

Get the underlying APS used by the current Zigbee ZDO.

Returns
The pointer to the underlying APS object currently connected to the Zigbee ZDO.

Definition at line 75 of file zigbee-zdo.cc.

References m_aps.

◆ GetNwk()

Ptr< ZigbeeNwk > ns3::zigbee::ZigbeeZdo::GetNwk ( ) const

Get the underlying APS used by the current Zigbee ZDO.

Returns
The pointer to the underlying NWK object currently connected to the Zigbee ZDO.

Definition at line 87 of file zigbee-zdo.cc.

References m_nwk.

◆ GetTypeId()

TypeId ns3::zigbee::ZigbeeZdo::GetTypeId ( )
static

Get the TypeId of ZigbeeZdo class.

Returns
The TypeId of ZigbeeZdo class.

Definition at line 30 of file zigbee-zdo.cc.

References ns3::Object::Object(), ZigbeeZdo(), and ns3::TypeId::SetParent().

Here is the call graph for this function:

◆ HandleNwkAddrRequest()

void ns3::zigbee::ZigbeeZdo::HandleNwkAddrRequest ( Ptr< Packet > asdu,
ApsdeDataIndicationParams dataParams )

Effect on Receipt (NWK_addr_req) See Zigbee Specification 2017, Section 2.4.3.1.1.

Parameters
asduThe received packet containing the NWK_addr_req command.
dataParamsAPSDE-DATA.indication parameters that carried the NWK_addr_req command.

Definition at line 199 of file zigbee-zdo.cc.

References ns3::zigbee::DEVICE_NOT_FOUND, ns3::zigbee::EXTENDED_RESPONSE, ns3::zigbee::NwkAddrRequestCmd::GetIeeeAddress(), ns3::zigbee::NwkAddrRequestCmd::GetRequestType(), ns3::zigbee::NwkAddrRequestCmd::GetTsn(), ns3::zigbee::INV_REQUESTTYPE, ns3::zigbee::NwkAddrResponseParams::m_dstAddr, ns3::zigbee::ApsdeDataIndicationParams::m_dstAddr16, ns3::zigbee::NwkAddrResponseParams::m_ieeeAddrRemoteDev, m_nwk, ns3::zigbee::NwkAddrResponseParams::m_nwkAddrRemoteDev, ns3::zigbee::ApsdeDataIndicationParams::m_srcAddress16, ns3::zigbee::NwkAddrResponseParams::m_status, ns3::zigbee::NwkAddrResponseParams::m_tsn, NS_LOG_FUNCTION, NwkAddrResponse(), ns3::zigbee::SINGLE_DEVICE_RESPONSE, and ns3::zigbee::SUCCESS.

Referenced by ApsDataIndication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleNwkAddrResponse()

void ns3::zigbee::ZigbeeZdo::HandleNwkAddrResponse ( Ptr< Packet > asdu,
ApsdeDataIndicationParams dataParams )

Effect on Receipt (NWK_addr_rsp) See Zigbee Specification 2017, Section 2.4.4.2.1.

Parameters
asduThe received packet containing the NWK_addr_rsp command.
dataParamsAPSDE-DATA.indication parameters that carried the NWK_addr_rsp command.

Definition at line 283 of file zigbee-zdo.cc.

References ns3::zigbee::NwkAddrResponseCmd::GetIeeeAddrRemoteDev(), ns3::zigbee::NwkAddrResponseCmd::GetNwkAddrRemoteDev(), ns3::zigbee::NwkAddrResponseCmd::GetStatus(), ns3::zigbee::NwkAddrRespIndParams::m_ieeeAddrRemoteDev, m_nwk, ns3::zigbee::NwkAddrRespIndParams::m_nwkAddrRemoteDev, ns3::zigbee::NwkAddrRespIndParams::m_status, m_zdoNwkAddrRspIndCallback, NS_LOG_FUNCTION, and ns3::zigbee::SUCCESS.

Referenced by ApsDataIndication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyConstructionCompleted()

void ns3::zigbee::ZigbeeZdo::NotifyConstructionCompleted ( )
overrideprotectedvirtual

Notifier called once the ObjectBase is fully constructed.

This method is invoked once all member attributes have been initialized. Subclasses can override this method to be notified of this event but if they do this, they must chain up to their parent's NotifyConstructionCompleted method.

Reimplemented from ns3::ObjectBase.

Definition at line 45 of file zigbee-zdo.cc.

References NS_LOG_FUNCTION.

◆ NwkAddrRequest()

void ns3::zigbee::ZigbeeZdo::NwkAddrRequest ( NwkAddrRequestParams params)

This function is used to send a Network Address (16-bit address)Request to a remote device when the IEEE address (64-bit address) of the device is known.

Parameters
paramsThe parameters of the Network Address Request.

Definition at line 132 of file zigbee-zdo.cc.

References ns3::Create(), ns3::zigbee::DST_ADDR16_DST_ENDPOINT_PRESENT, ns3::zigbee::EXTENDED_RESPONSE, m_aps, ns3::zigbee::ApsdeDataRequestParams::m_asduLength, ns3::zigbee::ApsdeDataRequestParams::m_clusterId, ns3::zigbee::ApsdeDataRequestParams::m_dstAddr16, ns3::zigbee::ApsdeDataRequestParams::m_dstAddrMode, ns3::zigbee::ApsdeDataRequestParams::m_dstEndPoint, ns3::zigbee::ApsdeDataRequestParams::m_profileId, ns3::zigbee::ApsdeDataRequestParams::m_radius, ns3::zigbee::ApsdeDataRequestParams::m_srcEndPoint, m_tsn, ns3::zigbee::ApsdeDataRequestParams::m_txOptions, ns3::zigbee::ApsdeDataRequestParams::m_useAlias, NS_LOG_FUNCTION, ns3::zigbee::NWK_ADDR_REQ, ns3::zigbee::NwkAddrRequestCmd::SetIeeeAddress(), ns3::zigbee::NwkAddrRequestCmd::SetRequestType(), ns3::zigbee::NwkAddrRequestCmd::SetStartIndex(), ns3::zigbee::NwkAddrRequestCmd::SetTsn(), and ns3::zigbee::ZDP_PROFILE.

Referenced by ZigbeeZdoCommandsTestCase::DoRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NwkAddrResponse()

void ns3::zigbee::ZigbeeZdo::NwkAddrResponse ( NwkAddrResponseParams params)

This function is used to send a Network Address (16-bit address) Response to a remote device in reply to a previously received NWK_addr_req.

Parameters
paramsThe parameters of the Network Address Response.

Definition at line 169 of file zigbee-zdo.cc.

References ns3::Create(), ns3::zigbee::DST_ADDR16_DST_ENDPOINT_PRESENT, m_aps, ns3::zigbee::ApsdeDataRequestParams::m_asduLength, ns3::zigbee::ApsdeDataRequestParams::m_clusterId, ns3::zigbee::ApsdeDataRequestParams::m_dstAddr16, ns3::zigbee::ApsdeDataRequestParams::m_dstAddrMode, ns3::zigbee::ApsdeDataRequestParams::m_dstEndPoint, ns3::zigbee::ApsdeDataRequestParams::m_profileId, ns3::zigbee::ApsdeDataRequestParams::m_radius, ns3::zigbee::ApsdeDataRequestParams::m_srcEndPoint, ns3::zigbee::ApsdeDataRequestParams::m_txOptions, ns3::zigbee::ApsdeDataRequestParams::m_useAlias, NS_LOG_FUNCTION, ns3::zigbee::NWK_ADDR_RSP, ns3::zigbee::NwkAddrResponseCmd::SetIeeeAddrRemoteDev(), ns3::zigbee::NwkAddrResponseCmd::SetNwkAddrRemoteDev(), ns3::zigbee::NwkAddrResponseCmd::SetStatus(), ns3::zigbee::NwkAddrResponseCmd::SetTsn(), and ns3::zigbee::ZDP_PROFILE.

Referenced by HandleNwkAddrRequest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAps()

void ns3::zigbee::ZigbeeZdo::SetAps ( Ptr< ZigbeeAps > aps)

Set the underlying APS to use in this Zigbee ZDO.

Parameters
apsThe pointer to the underlying Zigbee APS to set to this Zigbee ZDO

Definition at line 69 of file zigbee-zdo.cc.

References m_aps.

◆ SetNwk()

void ns3::zigbee::ZigbeeZdo::SetNwk ( Ptr< ZigbeeNwk > nwk)

Set the underlying NWK to use in this Zigbee ZDO.

Parameters
nwkThe pointer to the underlying Zigbee APS to set to this Zigbee ZDO

Definition at line 81 of file zigbee-zdo.cc.

References m_nwk.

◆ SetZdoNwkAddrRspIndCallback()

void ns3::zigbee::ZigbeeZdo::SetZdoNwkAddrRspIndCallback ( ZdoNwkAddrRspIndCallback c)

Set the indication callback to be called when a response (NWK_addr_rsp) to an NWK_addr_req is received.

Parameters
cThe callback to be called when a NWK_addr_rsp is received.

Definition at line 311 of file zigbee-zdo.cc.

References m_zdoNwkAddrRspIndCallback.

Member Data Documentation

◆ m_aps

Ptr<ZigbeeAps> ns3::zigbee::ZigbeeZdo::m_aps
private

Pointer to the Zigbee Application Support Sub-layer (APS) object.

Definition at line 252 of file zigbee-zdo.h.

Referenced by GetAps(), NwkAddrRequest(), NwkAddrResponse(), and SetAps().

◆ m_nwk

Ptr<ZigbeeNwk> ns3::zigbee::ZigbeeZdo::m_nwk
private

Pointer to the Zigbee Network Layer (NWK) object.

Definition at line 251 of file zigbee-zdo.h.

Referenced by GetNwk(), HandleNwkAddrRequest(), HandleNwkAddrResponse(), and SetNwk().

◆ m_tsn

SequenceNumber8 ns3::zigbee::ZigbeeZdo::m_tsn
private

The transaction sequence number.

Definition at line 253 of file zigbee-zdo.h.

Referenced by NwkAddrRequest().

◆ m_zdoNwkAddrRspIndCallback

ZdoNwkAddrRspIndCallback ns3::zigbee::ZigbeeZdo::m_zdoNwkAddrRspIndCallback
private

This callback is used to to notify the result of a NWK_addr_req request in the ZDO to the Application framework (AF).

This callback is not standardized in the Zigbee Specification, but similar solutions are often used in ZDO implementations.

Definition at line 249 of file zigbee-zdo.h.

Referenced by HandleNwkAddrResponse(), and SetZdoNwkAddrRspIndCallback().


The documentation for this class was generated from the following files: