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-aps.h"
14#include "zigbee-nwk.h"
15
16#include "ns3/lr-wpan-mac-base.h"
17#include "ns3/lr-wpan-net-device.h"
18#include "ns3/traced-callback.h"
19
20#include <stdint.h>
21#include <string>
22
23namespace ns3
24{
25
26class Node;
27
28namespace zigbee
29{
30
31class ZigbeeNwk;
32class ZigbeeAps;
33
34/**
35 * @ingroup zigbee
36 *
37 * Zigbee protocol stack to device interface.
38 *
39 * This class is an encapsulating class representing the protocol stack as described
40 * by the Zigbee Specification. In the current implementation only the Zigbee
41 * network layer (NWK) is included. However, this class is meant be later
42 * be extended to include other layer and sublayers part of the Zigbee Specification.
43 * The implementation is analogous to a NetDevice which encapsulates PHY and
44 * MAC layers and provide the necessary hooks. Zigbee Stack is meant to encapsulate
45 * NWK, APS, ZLC layers (and others if applicable).
46 */
47class ZigbeeStack : public Object
48{
49 public:
50 /**
51 * Get the type ID.
52 *
53 * @return the object TypeId
54 */
55 static TypeId GetTypeId();
56
57 /**
58 * Default constructor
59 */
61 ~ZigbeeStack() override;
62
63 /**
64 * Get the Channel object of the underlying LrWpanNetDevice
65 * @return The LrWpanNetDevice Channel Object
66 */
68
69 /**
70 * Get the node currently using this ZigbeeStack.
71 * @return The reference to the node object using this ZigbeeStack.
72 */
73 Ptr<Node> GetNode() const;
74
75 /**
76 * Get the NWK layer used by this ZigbeeStack.
77 *
78 * @return the NWK object
79 */
80 Ptr<ZigbeeNwk> GetNwk() const;
81
82 /**
83 * Set the NWK layer used by this ZigbeeStack.
84 *
85 * @param nwk The NWK layer object
86 */
87 void SetNwk(Ptr<ZigbeeNwk> nwk);
88
89 /**
90 * Get the APS layer used by this ZigbeeStack.
91 *
92 * @return the APS object
93 */
94 Ptr<ZigbeeAps> GetAps() const;
95
96 /**
97 * Set the APS layer used by this ZigbeeStack.
98 *
99 * @param aps The APS layer object
100 */
101 void SetAps(Ptr<ZigbeeAps> aps);
102
103 /**
104 * Returns a smart pointer to the underlying NetDevice.
105 *
106 * @return A smart pointer to the underlying NetDevice.
107 */
109
110 /**
111 * Setup Zigbee to be the next set of higher layers for the specified NetDevice.
112 * All the packets incoming and outgoing from the NetDevice will be
113 * processed by ZigbeeStack.
114 *
115 * @param netDevice A smart pointer to the NetDevice used by Zigbee.
116 */
117 void SetNetDevice(Ptr<NetDevice> netDevice);
118
119 /**
120 * Inticates to the Zigbee stack that only the NWK layer should be present.
121 */
122 void SetOnlyNwkLayer();
123
124 protected:
125 /**
126 * Dispose of the Objects used by the ZigbeeStack
127 */
128 void DoDispose() override;
129
130 /**
131 * Initialize of the Objects used by the ZigbeeStack
132 */
133 void DoInitialize() override;
134
135 private:
136 Ptr<lrwpan::LrWpanMacBase> m_mac; //!< The underlying LrWpan MAC connected to this Zigbee Stack.
137 Ptr<ZigbeeNwk> m_nwk; //!< The Zigbee Network layer.
138 Ptr<ZigbeeAps> m_aps; //!< The Zigbee Application Support Sub-layer
139 Ptr<Node> m_node; //!< The node associated with this NetDevice.
140 Ptr<NetDevice> m_netDevice; //!< Smart pointer to the underlying NetDevice.
141 bool m_nwkOnly; //!< Indicates that only the NWK layer is present in the Zigbee stack
142};
143
144} // namespace zigbee
145} // namespace ns3
146
147#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.
void SetAps(Ptr< ZigbeeAps > aps)
Set the APS layer used by this ZigbeeStack.
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.
bool m_nwkOnly
Indicates that only the NWK layer is present in the Zigbee stack.
ZigbeeStack()
Default constructor.
Ptr< ZigbeeAps > GetAps() const
Get the APS layer used by this ZigbeeStack.
Ptr< ZigbeeNwk > GetNwk() const
Get the NWK layer used by this ZigbeeStack.
Ptr< Node > GetNode() const
Get the node currently using this ZigbeeStack.
Ptr< ZigbeeAps > m_aps
The Zigbee Application Support Sub-layer.
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 SetOnlyNwkLayer()
Inticates to the Zigbee stack that only the NWK layer should be present.
void DoInitialize() override
Initialize of the Objects used by the ZigbeeStack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.