A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
zigbee-stack.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Tokushima University, Japan
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author:
7 * Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
8 */
9
10#ifndef ZIGBEE_STACK_H
11#define ZIGBEE_STACK_H
12
13#include "zigbee-nwk.h"
14
15#include "ns3/lr-wpan-mac-base.h"
16#include "ns3/lr-wpan-net-device.h"
17#include "ns3/traced-callback.h"
18
19#include <stdint.h>
20#include <string>
21
22namespace ns3
23{
24
25class Node;
26
27namespace zigbee
28{
29
30class ZigbeeNwk;
31
32/**
33 * @ingroup zigbee
34 *
35 * Zigbee protocol stack to device interface.
36 *
37 * This class is an encapsulating class representing the protocol stack as described
38 * by the Zigbee Specification. In the current implementation only the Zigbee
39 * network layer (NWK) is included. However, this class is meant be later
40 * be extended to include other layer and sublayers part of the Zigbee Specification.
41 * The implementation is analogous to a NetDevice which encapsulates PHY and
42 * MAC layers and provide the necessary hooks. Zigbee Stack is meant to encapsulate
43 * NWK, APS, ZLC layers (and others if applicable).
44 */
45class ZigbeeStack : public Object
46{
47 public:
48 /**
49 * Get the type ID.
50 *
51 * @return the object TypeId
52 */
53 static TypeId GetTypeId();
54
55 /**
56 * Default constructor
57 */
59 ~ZigbeeStack() override;
60
61 /**
62 * Get the Channel object of the underlying LrWpanNetDevice
63 * @return The LrWpanNetDevice Channel Object
64 */
66
67 /**
68 * Get the node currently using this ZigbeeStack.
69 * @return The reference to the node object using this ZigbeeStack.
70 */
71 Ptr<Node> GetNode() const;
72
73 /**
74 * Get the NWK layer used by this ZigbeeStack.
75 *
76 * @return the NWK object
77 */
78 Ptr<ZigbeeNwk> GetNwk() const;
79
80 /**
81 * Set the NWK layer used by this ZigbeeStack.
82 *
83 * @param nwk The NWK layer object
84 */
85 void SetNwk(Ptr<ZigbeeNwk> nwk);
86
87 /**
88 * Returns a smart pointer to the underlying NetDevice.
89 *
90 * @return A smart pointer to the underlying NetDevice.
91 */
93
94 /**
95 * Setup Zigbee to be the next set of higher layers for the specified NetDevice.
96 * All the packets incoming and outgoing from the NetDevice will be
97 * processed by ZigbeeStack.
98 *
99 * @param netDevice A smart pointer to the NetDevice used by Zigbee.
100 */
101 void SetNetDevice(Ptr<NetDevice> netDevice);
102
103 protected:
104 /**
105 * Dispose of the Objects used by the ZigbeeStack
106 */
107 void DoDispose() override;
108
109 /**
110 * Initialize of the Objects used by the ZigbeeStack
111 */
112 void DoInitialize() override;
113
114 private:
115 Ptr<lrwpan::LrWpanMacBase> m_mac; //!< The underlying LrWpan MAC connected to this Zigbee Stack.
116 Ptr<ZigbeeNwk> m_nwk; //!< The Zigbee Network layer.
117 Ptr<Node> m_node; //!< The node associated with this NetDevice.
118 Ptr<NetDevice> m_netDevice; //!< Smart pointer to the underlying NetDevice.
119};
120
121} // namespace zigbee
122} // namespace ns3
123
124#endif /* ZIGBEE_STACK_H */
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:49
Zigbee protocol stack to device interface.
static TypeId GetTypeId()
Get the type ID.
void SetNwk(Ptr< ZigbeeNwk > nwk)
Set the NWK layer used by this ZigbeeStack.
Ptr< NetDevice > m_netDevice
Smart pointer to the underlying NetDevice.
Ptr< lrwpan::LrWpanMacBase > m_mac
The underlying LrWpan MAC connected to this Zigbee Stack.
void SetNetDevice(Ptr< NetDevice > netDevice)
Setup Zigbee to be the next set of higher layers for the specified NetDevice.
Ptr< Channel > GetChannel() const
Get the Channel object of the underlying LrWpanNetDevice.
ZigbeeStack()
Default constructor.
Ptr< ZigbeeNwk > GetNwk() const
Get the NWK layer used by this ZigbeeStack.
Ptr< Node > GetNode() const
Get the node currently using this ZigbeeStack.
Ptr< ZigbeeNwk > m_nwk
The Zigbee Network layer.
Ptr< Node > m_node
The node associated with this NetDevice.
void DoDispose() override
Dispose of the Objects used by the ZigbeeStack.
Ptr< NetDevice > GetNetDevice() const
Returns a smart pointer to the underlying NetDevice.
void DoInitialize() override
Initialize of the Objects used by the ZigbeeStack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.