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-zdo-client-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2026 Tokushima University, Japan
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors:
7
*
8
* Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
9
*/
10
11
#include "
zigbee-zdo-client-header.h
"
12
13
#include "ns3/address-utils.h"
14
15
namespace
ns3
16
{
17
namespace
zigbee
18
{
19
20
NwkAddrRequestCmd::NwkAddrRequestCmd
()
21
:
m_tsn
(0),
22
m_requestType
(0),
23
m_startIndex
(0)
24
{
25
}
26
27
NwkAddrRequestCmd::~NwkAddrRequestCmd
()
28
{
29
}
30
31
void
32
NwkAddrRequestCmd::SetTsn
(uint8_t tsn)
33
{
34
m_tsn
= tsn;
35
}
36
37
uint8_t
38
NwkAddrRequestCmd::GetTsn
()
const
39
{
40
return
m_tsn
;
41
}
42
43
void
44
NwkAddrRequestCmd::SetIeeeAddress
(
Mac64Address
ieeeAddress)
45
{
46
m_ieeeAddress
= ieeeAddress;
47
}
48
49
Mac64Address
50
NwkAddrRequestCmd::GetIeeeAddress
()
51
{
52
return
m_ieeeAddress
;
53
}
54
55
void
56
NwkAddrRequestCmd::SetRequestType
(uint8_t type)
57
{
58
m_requestType
= type;
59
}
60
61
uint8_t
62
NwkAddrRequestCmd::GetRequestType
()
const
63
{
64
return
m_requestType
;
65
}
66
67
void
68
NwkAddrRequestCmd::SetStartIndex
(uint8_t index)
69
{
70
m_startIndex
= index;
71
}
72
73
uint8_t
74
NwkAddrRequestCmd::GetStartIndex
()
const
75
{
76
return
m_startIndex
;
77
}
78
79
void
80
NwkAddrRequestCmd::Serialize
(
Buffer::Iterator
start)
const
81
{
82
Buffer::Iterator
i = start;
83
84
i.
WriteU8
(
m_tsn
);
85
WriteTo
(i,
m_ieeeAddress
);
86
i.
WriteU8
(
m_requestType
);
87
i.
WriteU8
(
m_startIndex
);
88
}
89
90
void
91
NwkAddrRequestCmd::Print
(std::ostream& os)
const
92
{
93
os <<
"NwkAddrRequestCmd: "
94
<<
"TSN: "
<<
static_cast<
uint32_t
>
(
m_tsn
) <<
", "
95
<<
"IEEE Address: "
<<
m_ieeeAddress
<<
", "
96
<<
"Extended Response: "
<<
m_requestType
<<
", "
97
<<
"Start Index: "
<<
static_cast<
uint32_t
>
(
m_startIndex
);
98
}
99
100
uint32_t
101
NwkAddrRequestCmd::GetSerializedSize
()
const
102
{
103
return
11;
// TSN (1) + IEEE address (8) + request type (1) + start index (1)
104
}
105
106
uint32_t
107
NwkAddrRequestCmd::Deserialize
(
Buffer::Iterator
start)
108
{
109
Buffer::Iterator
i = start;
110
111
m_tsn
= i.
ReadU8
();
112
ReadFrom
(i,
m_ieeeAddress
);
113
m_requestType
= i.
ReadU8
();
114
m_startIndex
= i.
ReadU8
();
115
return
i.
GetDistanceFrom
(start);
116
}
117
118
TypeId
119
NwkAddrRequestCmd::GetTypeId
()
120
{
121
static
TypeId
tid =
TypeId
(
"ns3::zigbee::NwkAddrRequestCmd"
)
122
.
SetParent
<
Header
>()
123
.SetGroupName(
"Zigbee"
)
124
.AddConstructor<
NwkAddrRequestCmd
>();
125
return
tid;
126
}
127
128
TypeId
129
NwkAddrRequestCmd::GetInstanceTypeId
()
const
130
{
131
return
GetTypeId
();
132
}
133
134
}
// namespace zigbee
135
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:109
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8()
Definition
buffer.h:1090
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition
buffer.h:944
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(const Iterator &o) const
Definition
buffer.cc:767
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:36
ns3::Mac64Address
an EUI-64 address
Definition
mac64-address.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:50
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1003
ns3::zigbee::NwkAddrRequestCmd::NwkAddrRequestCmd
NwkAddrRequestCmd()
Definition
zigbee-zdo-client-header.cc:20
ns3::zigbee::NwkAddrRequestCmd::m_requestType
uint8_t m_requestType
Single device or extended response type.
Definition
zigbee-zdo-client-header.h:145
ns3::zigbee::NwkAddrRequestCmd::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
zigbee-zdo-client-header.cc:119
ns3::zigbee::NwkAddrRequestCmd::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
zigbee-zdo-client-header.cc:80
ns3::zigbee::NwkAddrRequestCmd::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
zigbee-zdo-client-header.cc:129
ns3::zigbee::NwkAddrRequestCmd::Print
void Print(std::ostream &os) const override
Definition
zigbee-zdo-client-header.cc:91
ns3::zigbee::NwkAddrRequestCmd::SetRequestType
void SetRequestType(uint8_t type)
Set the request type, either single device or extended response.
Definition
zigbee-zdo-client-header.cc:56
ns3::zigbee::NwkAddrRequestCmd::~NwkAddrRequestCmd
~NwkAddrRequestCmd() override
Definition
zigbee-zdo-client-header.cc:27
ns3::zigbee::NwkAddrRequestCmd::SetTsn
void SetTsn(uint8_t tsn)
Set the transaction sequence number.
Definition
zigbee-zdo-client-header.cc:32
ns3::zigbee::NwkAddrRequestCmd::m_ieeeAddress
Mac64Address m_ieeeAddress
The IEEE address of the device to be queried.
Definition
zigbee-zdo-client-header.h:144
ns3::zigbee::NwkAddrRequestCmd::m_startIndex
uint8_t m_startIndex
The starting index for the response, used for pagination.
Definition
zigbee-zdo-client-header.h:146
ns3::zigbee::NwkAddrRequestCmd::m_tsn
uint8_t m_tsn
The transaction sequence number for the request.
Definition
zigbee-zdo-client-header.h:143
ns3::zigbee::NwkAddrRequestCmd::GetTsn
uint8_t GetTsn() const
Get the transaction sequence number.
Definition
zigbee-zdo-client-header.cc:38
ns3::zigbee::NwkAddrRequestCmd::GetStartIndex
uint8_t GetStartIndex() const
Get the start index.
Definition
zigbee-zdo-client-header.cc:74
ns3::zigbee::NwkAddrRequestCmd::GetRequestType
uint8_t GetRequestType() const
Get the request type previously set for the network address request.
Definition
zigbee-zdo-client-header.cc:62
ns3::zigbee::NwkAddrRequestCmd::SetIeeeAddress
void SetIeeeAddress(Mac64Address ieeeAddress)
Set the IEEE address used as base for the network address request.
Definition
zigbee-zdo-client-header.cc:44
ns3::zigbee::NwkAddrRequestCmd::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
zigbee-zdo-client-header.cc:107
ns3::zigbee::NwkAddrRequestCmd::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
zigbee-zdo-client-header.cc:101
ns3::zigbee::NwkAddrRequestCmd::SetStartIndex
void SetStartIndex(uint8_t index)
Set the start index.
Definition
zigbee-zdo-client-header.cc:68
ns3::zigbee::NwkAddrRequestCmd::GetIeeeAddress
Mac64Address GetIeeeAddress()
Get the IEEE address set for the network address request.
Definition
zigbee-zdo-client-header.cc:50
uint32_t
ns3::zigbee
Definition
zigbee-stack-container.cc:17
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition
address-utils.cc:21
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition
address-utils.cc:74
zigbee-zdo-client-header.h
src
zigbee
model
zdo
zigbee-zdo-client-header.cc
Generated on
for ns-3 by
1.16.1