A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
zigbee-aps-header.h
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
* Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
8
*/
9
10
#ifndef ZIGBEE_APS_HEADER_H
11
#define ZIGBEE_APS_HEADER_H
12
13
#include "ns3/header.h"
14
#include "ns3/mac16-address.h"
15
#include "ns3/mac64-address.h"
16
17
namespace
ns3
18
{
19
namespace
zigbee
20
{
21
22
/**
23
* @ingroup zigbee
24
*
25
* Values of the Frame Type Sub-Field.
26
* Zigbee Specification r22.1.0, Table 2-20
27
*/
28
enum
ApsFrameType
: uint8_t
29
{
30
APS_DATA
= 0x00,
31
APS_COMMAND
= 0x01,
32
APS_ACK
= 0x02,
33
APS_INTERPAN_APS
= 0x03
34
};
35
36
/**
37
* @ingroup zigbee
38
*
39
* Values of the Delivery Mode Sub-Field.
40
* Zigbee Specification r22.1.0, Table 2-21
41
*/
42
enum
ApsDeliveryMode
: uint8_t
43
{
44
APS_UCST
= 0x00,
45
APS_BCST
= 0x02,
46
APS_GROUP_ADDRESSING
= 0x03
47
};
48
49
/**
50
* @ingroup zigbee
51
*
52
* Table 2-22 Values of the Fragmentation Sub-Field
53
* Zigbee Specification r22.1.0, Table 2-22
54
*/
55
enum
ApsFragmentation
: uint8_t
56
{
57
NOT_FRAGMENTED
= 0x00,
58
FIRST_FRAGMENT
= 0x01,
59
OTHER_FRAGMENT
= 0x02
60
};
61
62
/**
63
* @ingroup zigbee
64
*
65
* Defines the APS header use by data transfer and commands issued from
66
* the APS layer. Zigbee Specification r22.1.0, Section 2.2.5.1.
67
*
68
*/
69
class
ZigbeeApsHeader
:
public
Header
70
{
71
public
:
72
ZigbeeApsHeader
();
73
~ZigbeeApsHeader
()
override
;
74
75
/**
76
* Set the Frame type defined in the APS layer
77
*
78
* @param frameType The frame type to set on the header
79
*/
80
void
SetFrameType
(
enum
ApsFrameType
frameType);
81
82
/**
83
* Get the frame time present in the header
84
*
85
* @return ApsFrameType
86
*/
87
ApsFrameType
GetFrameType
()
const
;
88
89
/**
90
* Defines the mode in which this frame should be transmitted.
91
*
92
* @param mode The delivery mode to set on the APS header
93
*/
94
void
SetDeliveryMode
(
enum
ApsDeliveryMode
mode);
95
96
/**
97
* Get the transmission mode set on the header.
98
*
99
* @return ApsDeliveryMode The delivery mode of the header
100
*/
101
ApsDeliveryMode
GetDeliveryMode
()
const
;
102
103
/**
104
* Set whether or not security should be used to transmit
105
* the frame.
106
*
107
* @param enabled True if security should be used
108
*/
109
void
SetSecurity
(
bool
enabled);
110
111
/**
112
* Returns whether or not security is enabled for the present frame.alignas
113
*
114
* @return True if security is enabled for the frame.
115
*/
116
bool
IsSecurityEnabled
()
const
;
117
118
/**
119
* Set the acknowledment flag in the APS header.
120
*
121
* @param request True if the frame should be acknowledged
122
*/
123
void
SetAckRequest
(
bool
request);
124
125
/**
126
* Indicates if the present frame requires acknowledgment.
127
*
128
* @return True if the frame requires acknowledgment
129
*/
130
bool
IsAckRequested
()
const
;
131
132
/**
133
* Enables or disables the usage of the extended header.
134
* Only used when fragmentation is used.
135
*
136
* @param present True if the extended header (fragmentation) is present.
137
*/
138
void
SetExtHeaderPresent
(
bool
present);
139
140
/**
141
* Indicates whether or not the extended header is present in the frame.
142
* @return True if the extended header is present.
143
*/
144
bool
IsExtHeaderPresent
()
const
;
145
146
/**
147
* Set the Bitmap representing the framecontrol portion of the APS header.
148
*
149
* @param frameControl The bitmap representing the framecontrol portion.
150
*/
151
void
SetFrameControl
(uint8_t frameControl);
152
153
/**
154
* Get the frame control portion (bitmap) of the APS header.
155
*
156
* @return The frame control portion of the APS header.
157
*/
158
uint8_t
GetFrameControl
()
const
;
159
160
/**
161
* Set the destination endpoint in the APS header.
162
*
163
* @param endpoint The destination endpoint.
164
*/
165
void
SetDstEndpoint
(uint8_t endpoint);
166
167
/**
168
* Get the destination endpoint in the APS header.
169
*
170
* @return The destination endpoint.
171
*/
172
uint8_t
GetDstEndpoint
()
const
;
173
174
/**
175
* Set the cluster id in the APS header.
176
*
177
* @param clusterId The cluster id
178
*/
179
void
SetClusterId
(uint16_t clusterId);
180
181
/**
182
* Get the cluster id in the APS header.
183
* @return The cluster id.
184
*/
185
uint16_t
GetClusterId
()
const
;
186
187
/**
188
* Set the profile ID in the APS header.
189
*
190
* @param profileId The profile ID.
191
*/
192
void
SetProfileId
(uint16_t profileId);
193
194
/**
195
* Get the profile ID in the APS header.
196
* @return The profile ID.
197
*/
198
uint16_t
GetProfileId
()
const
;
199
200
/**
201
* Set the source endpoint in the APS header.
202
*
203
* @param endpoint The source endpoint.
204
*/
205
void
SetSrcEndpoint
(uint8_t endpoint);
206
207
/**
208
* Get the source endpoint in the APS header.
209
* @return The source endpoint.
210
*/
211
uint8_t
GetSrcEndpoint
()
const
;
212
213
/**
214
* Set the value of the APS counter in the APS header.
215
* @param counter The APS counter value.
216
*/
217
void
SetApsCounter
(uint8_t counter);
218
219
/**
220
* Get the APS counter value present in the APS header.
221
* @return The APS counter value.
222
*/
223
uint8_t
GetApsCounter
()
const
;
224
225
/**
226
* @brief Get the type ID.
227
* @return the object TypeId
228
*/
229
static
TypeId
GetTypeId
();
230
TypeId
GetInstanceTypeId
()
const override
;
231
232
void
Serialize
(
Buffer::Iterator
start)
const override
;
233
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
234
uint32_t
GetSerializedSize
()
const override
;
235
void
Print
(std::ostream& os)
const override
;
236
237
private
:
238
// Frame Control field bits
239
ApsFrameType
m_frameType
;
//!< Frame control field: Frame type
240
ApsDeliveryMode
m_deliveryMode
;
//!< Frame control field: Delivery mode
241
bool
m_ackFormat
;
//!< Frame control field: Acknowledgment format
242
bool
m_security
;
//!< Frame control field: Security
243
bool
m_ackRequest
;
//!< Frame control field: Acknowledge requested
244
bool
m_extHeaderPresent
;
//!< Frame control field: Extended header present
245
246
// Addressing fields
247
uint8_t
m_dstEndpoint
;
//!< Addressing field: Destination endpoint.
248
uint16_t
m_groupAddress
;
//!< Addressing field: Group or 16-bit address.
249
uint16_t
m_clusterId
;
//!< Addressing field: Cluster ID.
250
uint16_t
m_profileId
;
//!< Addressing field: Profile ID.
251
uint8_t
m_srcEndpoint
;
//!< Addressing field: Source endpoint.
252
253
uint8_t
m_apsCounter
;
//!< APS counter field
254
255
// Extended header fields
256
ApsFragmentation
m_fragmentation
;
//!< Extended header field: Fragmentation block type
257
uint8_t
m_blockNumber
;
//!< Extended header field: Block number
258
uint8_t
m_ackBitfield
;
//!< Extended header field: Acknowledgement bit field
259
};
260
261
}
// namespace zigbee
262
}
// namespace ns3
263
264
#endif
// ZIGBEE_APS_HEADER_H
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
ns3::zigbee::ZigbeeApsHeader
Defines the APS header use by data transfer and commands issued from the APS layer.
Definition
zigbee-aps-header.h:70
ns3::zigbee::ZigbeeApsHeader::SetSecurity
void SetSecurity(bool enabled)
Set whether or not security should be used to transmit the frame.
Definition
zigbee-aps-header.cc:58
ns3::zigbee::ZigbeeApsHeader::SetDstEndpoint
void SetDstEndpoint(uint8_t endpoint)
Set the destination endpoint in the APS header.
Definition
zigbee-aps-header.cc:94
ns3::zigbee::ZigbeeApsHeader::GetClusterId
uint16_t GetClusterId() const
Get the cluster id in the APS header.
Definition
zigbee-aps-header.cc:112
ns3::zigbee::ZigbeeApsHeader::GetFrameControl
uint8_t GetFrameControl() const
Get the frame control portion (bitmap) of the APS header.
ns3::zigbee::ZigbeeApsHeader::SetDeliveryMode
void SetDeliveryMode(enum ApsDeliveryMode mode)
Defines the mode in which this frame should be transmitted.
Definition
zigbee-aps-header.cc:46
ns3::zigbee::ZigbeeApsHeader::IsExtHeaderPresent
bool IsExtHeaderPresent() const
Indicates whether or not the extended header is present in the frame.
Definition
zigbee-aps-header.cc:88
ns3::zigbee::ZigbeeApsHeader::SetFrameType
void SetFrameType(enum ApsFrameType frameType)
Set the Frame type defined in the APS layer.
Definition
zigbee-aps-header.cc:34
ns3::zigbee::ZigbeeApsHeader::m_blockNumber
uint8_t m_blockNumber
Extended header field: Block number.
Definition
zigbee-aps-header.h:257
ns3::zigbee::ZigbeeApsHeader::IsSecurityEnabled
bool IsSecurityEnabled() const
Returns whether or not security is enabled for the present frame.alignas.
Definition
zigbee-aps-header.cc:64
ns3::zigbee::ZigbeeApsHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
zigbee-aps-header.cc:340
ns3::zigbee::ZigbeeApsHeader::m_groupAddress
uint16_t m_groupAddress
Addressing field: Group or 16-bit address.
Definition
zigbee-aps-header.h:248
ns3::zigbee::ZigbeeApsHeader::m_fragmentation
ApsFragmentation m_fragmentation
Extended header field: Fragmentation block type.
Definition
zigbee-aps-header.h:256
ns3::zigbee::ZigbeeApsHeader::SetSrcEndpoint
void SetSrcEndpoint(uint8_t endpoint)
Set the source endpoint in the APS header.
Definition
zigbee-aps-header.cc:130
ns3::zigbee::ZigbeeApsHeader::SetExtHeaderPresent
void SetExtHeaderPresent(bool present)
Enables or disables the usage of the extended header.
Definition
zigbee-aps-header.cc:82
ns3::zigbee::ZigbeeApsHeader::m_srcEndpoint
uint8_t m_srcEndpoint
Addressing field: Source endpoint.
Definition
zigbee-aps-header.h:251
ns3::zigbee::ZigbeeApsHeader::~ZigbeeApsHeader
~ZigbeeApsHeader() override
Definition
zigbee-aps-header.cc:29
ns3::zigbee::ZigbeeApsHeader::m_clusterId
uint16_t m_clusterId
Addressing field: Cluster ID.
Definition
zigbee-aps-header.h:249
ns3::zigbee::ZigbeeApsHeader::m_deliveryMode
ApsDeliveryMode m_deliveryMode
Frame control field: Delivery mode.
Definition
zigbee-aps-header.h:240
ns3::zigbee::ZigbeeApsHeader::m_profileId
uint16_t m_profileId
Addressing field: Profile ID.
Definition
zigbee-aps-header.h:250
ns3::zigbee::ZigbeeApsHeader::GetDeliveryMode
ApsDeliveryMode GetDeliveryMode() const
Get the transmission mode set on the header.
Definition
zigbee-aps-header.cc:52
ns3::zigbee::ZigbeeApsHeader::SetFrameControl
void SetFrameControl(uint8_t frameControl)
Set the Bitmap representing the framecontrol portion of the APS header.
ns3::zigbee::ZigbeeApsHeader::ZigbeeApsHeader
ZigbeeApsHeader()
Definition
zigbee-aps-header.cc:19
ns3::zigbee::ZigbeeApsHeader::m_extHeaderPresent
bool m_extHeaderPresent
Frame control field: Extended header present.
Definition
zigbee-aps-header.h:244
ns3::zigbee::ZigbeeApsHeader::GetApsCounter
uint8_t GetApsCounter() const
Get the APS counter value present in the APS header.
Definition
zigbee-aps-header.cc:148
ns3::zigbee::ZigbeeApsHeader::SetApsCounter
void SetApsCounter(uint8_t counter)
Set the value of the APS counter in the APS header.
Definition
zigbee-aps-header.cc:142
ns3::zigbee::ZigbeeApsHeader::SetAckRequest
void SetAckRequest(bool request)
Set the acknowledment flag in the APS header.
Definition
zigbee-aps-header.cc:70
ns3::zigbee::ZigbeeApsHeader::SetClusterId
void SetClusterId(uint16_t clusterId)
Set the cluster id in the APS header.
Definition
zigbee-aps-header.cc:106
ns3::zigbee::ZigbeeApsHeader::m_ackFormat
bool m_ackFormat
Frame control field: Acknowledgment format.
Definition
zigbee-aps-header.h:241
ns3::zigbee::ZigbeeApsHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
zigbee-aps-header.cc:273
ns3::zigbee::ZigbeeApsHeader::GetSrcEndpoint
uint8_t GetSrcEndpoint() const
Get the source endpoint in the APS header.
Definition
zigbee-aps-header.cc:136
ns3::zigbee::ZigbeeApsHeader::m_dstEndpoint
uint8_t m_dstEndpoint
Addressing field: Destination endpoint.
Definition
zigbee-aps-header.h:247
ns3::zigbee::ZigbeeApsHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
zigbee-aps-header.cc:212
ns3::zigbee::ZigbeeApsHeader::GetDstEndpoint
uint8_t GetDstEndpoint() const
Get the destination endpoint in the APS header.
Definition
zigbee-aps-header.cc:100
ns3::zigbee::ZigbeeApsHeader::GetFrameType
ApsFrameType GetFrameType() const
Get the frame time present in the header.
Definition
zigbee-aps-header.cc:40
ns3::zigbee::ZigbeeApsHeader::m_ackRequest
bool m_ackRequest
Frame control field: Acknowledge requested.
Definition
zigbee-aps-header.h:243
ns3::zigbee::ZigbeeApsHeader::m_apsCounter
uint8_t m_apsCounter
APS counter field.
Definition
zigbee-aps-header.h:253
ns3::zigbee::ZigbeeApsHeader::Print
void Print(std::ostream &os) const override
Definition
zigbee-aps-header.cc:346
ns3::zigbee::ZigbeeApsHeader::m_security
bool m_security
Frame control field: Security.
Definition
zigbee-aps-header.h:242
ns3::zigbee::ZigbeeApsHeader::m_ackBitfield
uint8_t m_ackBitfield
Extended header field: Acknowledgement bit field.
Definition
zigbee-aps-header.h:258
ns3::zigbee::ZigbeeApsHeader::IsAckRequested
bool IsAckRequested() const
Indicates if the present frame requires acknowledgment.
Definition
zigbee-aps-header.cc:76
ns3::zigbee::ZigbeeApsHeader::SetProfileId
void SetProfileId(uint16_t profileId)
Set the profile ID in the APS header.
Definition
zigbee-aps-header.cc:118
ns3::zigbee::ZigbeeApsHeader::m_frameType
ApsFrameType m_frameType
Frame control field: Frame type.
Definition
zigbee-aps-header.h:239
ns3::zigbee::ZigbeeApsHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
zigbee-aps-header.cc:154
ns3::zigbee::ZigbeeApsHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
zigbee-aps-header.cc:330
ns3::zigbee::ZigbeeApsHeader::GetProfileId
uint16_t GetProfileId() const
Get the profile ID in the APS header.
Definition
zigbee-aps-header.cc:124
uint32_t
ns3::zigbee::ApsFrameType
ApsFrameType
Values of the Frame Type Sub-Field.
Definition
zigbee-aps-header.h:29
ns3::zigbee::ApsDeliveryMode
ApsDeliveryMode
Values of the Delivery Mode Sub-Field.
Definition
zigbee-aps-header.h:43
ns3::zigbee::ApsFragmentation
ApsFragmentation
Table 2-22 Values of the Fragmentation Sub-Field Zigbee Specification r22.1.0, Table 2-22.
Definition
zigbee-aps-header.h:56
ns3::zigbee::APS_DATA
@ APS_DATA
Definition
zigbee-aps-header.h:30
ns3::zigbee::APS_COMMAND
@ APS_COMMAND
Definition
zigbee-aps-header.h:31
ns3::zigbee::APS_ACK
@ APS_ACK
Definition
zigbee-aps-header.h:32
ns3::zigbee::APS_INTERPAN_APS
@ APS_INTERPAN_APS
Definition
zigbee-aps-header.h:33
ns3::zigbee::APS_UCST
@ APS_UCST
Definition
zigbee-aps-header.h:44
ns3::zigbee::APS_BCST
@ APS_BCST
Definition
zigbee-aps-header.h:45
ns3::zigbee::APS_GROUP_ADDRESSING
@ APS_GROUP_ADDRESSING
Definition
zigbee-aps-header.h:46
ns3::zigbee::FIRST_FRAGMENT
@ FIRST_FRAGMENT
Definition
zigbee-aps-header.h:58
ns3::zigbee::OTHER_FRAGMENT
@ OTHER_FRAGMENT
Definition
zigbee-aps-header.h:59
ns3::zigbee::NOT_FRAGMENTED
@ NOT_FRAGMENTED
Definition
zigbee-aps-header.h:57
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
zigbee
model
zigbee-aps-header.h
Generated on Mon Jun 16 2025 11:07:25 for ns-3 by
1.11.0