A Discrete-Event Network Simulator
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
12
13#include "ns3/address-utils.h"
14
15namespace ns3
16{
17namespace zigbee
18{
19
26
30
31void
33{
34 m_tsn = tsn;
35}
36
37uint8_t
39{
40 return m_tsn;
41}
42
43void
45{
46 m_ieeeAddress = ieeeAddress;
47}
48
54
55void
57{
58 m_requestType = type;
59}
60
61uint8_t
66
67void
69{
70 m_startIndex = index;
71}
72
73uint8_t
78
79void
89
90void
91NwkAddrRequestCmd::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
102{
103 return 11; // TSN (1) + IEEE address (8) + request type (1) + start index (1)
104}
105
108{
109 Buffer::Iterator i = start;
110
111 m_tsn = i.ReadU8();
113 m_requestType = i.ReadU8();
114 m_startIndex = i.ReadU8();
115 return i.GetDistanceFrom(start);
116}
117
118TypeId
120{
121 static TypeId tid = TypeId("ns3::zigbee::NwkAddrRequestCmd")
122 .SetParent<Header>()
123 .SetGroupName("Zigbee")
124 .AddConstructor<NwkAddrRequestCmd>();
125 return tid;
126}
127
128TypeId
130{
131 return GetTypeId();
132}
133
134} // namespace zigbee
135} // namespace ns3
iterator in a Buffer instance
Definition buffer.h:109
void WriteU8(uint8_t data)
Definition buffer.h:944
uint32_t GetDistanceFrom(const Iterator &o) const
Definition buffer.cc:767
Protocol header serialization and deserialization.
Definition header.h:36
an EUI-64 address
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1003
uint8_t m_requestType
Single device or extended response type.
static TypeId GetTypeId()
Get the type ID.
void Serialize(Buffer::Iterator start) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Print(std::ostream &os) const override
void SetRequestType(uint8_t type)
Set the request type, either single device or extended response.
void SetTsn(uint8_t tsn)
Set the transaction sequence number.
Mac64Address m_ieeeAddress
The IEEE address of the device to be queried.
uint8_t m_startIndex
The starting index for the response, used for pagination.
uint8_t m_tsn
The transaction sequence number for the request.
uint8_t GetTsn() const
Get the transaction sequence number.
uint8_t GetStartIndex() const
Get the start index.
uint8_t GetRequestType() const
Get the request type previously set for the network address request.
void SetIeeeAddress(Mac64Address ieeeAddress)
Set the IEEE address used as base for the network address request.
uint32_t Deserialize(Buffer::Iterator start) override
uint32_t GetSerializedSize() const override
void SetStartIndex(uint8_t index)
Set the start index.
Mac64Address GetIeeeAddress()
Get the IEEE address set for the network address request.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.