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
hwmp-tag.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008,2009 IITP RAS
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Kirill Andreev <andreev@iitp.ru>
7
*/
8
9
#include "
hwmp-tag.h
"
10
11
namespace
ns3
12
{
13
namespace
dot11s
14
{
15
16
NS_OBJECT_ENSURE_REGISTERED
(HwmpTag);
17
18
// Class HwmpTag:
19
HwmpTag::HwmpTag
()
20
: m_address(
Mac48Address
::GetBroadcast()),
21
m_ttl(0),
22
m_metric(0),
23
m_seqno(0)
24
{
25
}
26
27
HwmpTag::~HwmpTag
()
28
{
29
}
30
31
void
32
HwmpTag::SetAddress
(
Mac48Address
retransmitter)
33
{
34
m_address
= retransmitter;
35
}
36
37
Mac48Address
38
HwmpTag::GetAddress
()
39
{
40
return
m_address
;
41
}
42
43
void
44
HwmpTag::SetTtl
(uint8_t ttl)
45
{
46
m_ttl
= ttl;
47
}
48
49
uint8_t
50
HwmpTag::GetTtl
()
const
51
{
52
return
m_ttl
;
53
}
54
55
void
56
HwmpTag::SetMetric
(
uint32_t
metric)
57
{
58
m_metric
= metric;
59
}
60
61
uint32_t
62
HwmpTag::GetMetric
()
const
63
{
64
return
m_metric
;
65
}
66
67
void
68
HwmpTag::SetSeqno
(
uint32_t
seqno)
69
{
70
m_seqno
= seqno;
71
}
72
73
uint32_t
74
HwmpTag::GetSeqno
()
const
75
{
76
return
m_seqno
;
77
}
78
79
/**
80
* \brief Get the type ID.
81
* \return the object TypeId
82
*/
83
TypeId
84
HwmpTag::GetTypeId
()
85
{
86
static
TypeId
tid =
TypeId
(
"ns3::dot11s::HwmpTag"
)
87
.
SetParent
<
Tag
>()
88
.SetGroupName(
"Mesh"
)
89
.AddConstructor<
HwmpTag
>();
90
return
tid;
91
}
92
93
TypeId
94
HwmpTag::GetInstanceTypeId
()
const
95
{
96
return
GetTypeId
();
97
}
98
99
uint32_t
100
HwmpTag::GetSerializedSize
()
const
101
{
102
return
6
// address
103
+ 1
// ttl
104
+ 4
// metric
105
+ 4;
// seqno
106
}
107
108
void
109
HwmpTag::Serialize
(
TagBuffer
i)
const
110
{
111
uint8_t address[6];
112
int
j;
113
m_address
.
CopyTo
(address);
114
i.
WriteU8
(
m_ttl
);
115
i.
WriteU32
(
m_metric
);
116
i.
WriteU32
(
m_seqno
);
117
for
(j = 0; j < 6; j++)
118
{
119
i.
WriteU8
(address[j]);
120
}
121
}
122
123
void
124
HwmpTag::Deserialize
(
TagBuffer
i)
125
{
126
uint8_t address[6];
127
int
j;
128
m_ttl
= i.
ReadU8
();
129
m_metric
= i.
ReadU32
();
130
m_seqno
= i.
ReadU32
();
131
for
(j = 0; j < 6; j++)
132
{
133
address[j] = i.
ReadU8
();
134
}
135
m_address
.
CopyFrom
(address);
136
}
137
138
void
139
HwmpTag::Print
(std::ostream& os)
const
140
{
141
os <<
"address="
<<
m_address
;
142
os <<
"ttl="
<<
m_ttl
;
143
os <<
"metrc="
<<
m_metric
;
144
os <<
"seqno="
<<
m_seqno
;
145
}
146
147
void
148
HwmpTag::DecrementTtl
()
149
{
150
m_ttl
--;
151
}
152
}
// namespace dot11s
153
}
// namespace ns3
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::Mac48Address::CopyFrom
void CopyFrom(const uint8_t buffer[6])
Definition
mac48-address.cc:51
ns3::Mac48Address::CopyTo
void CopyTo(uint8_t buffer[6]) const
Definition
mac48-address.cc:58
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32()
Definition
tag-buffer.h:206
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition
tag-buffer.h:161
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition
tag-buffer.h:185
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition
tag-buffer.h:176
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
ns3::dot11s::HwmpTag
Hwmp tag implements interaction between HWMP protocol and MeshWifiMac.
Definition
hwmp-tag.h:40
ns3::dot11s::HwmpTag::SetTtl
void SetTtl(uint8_t ttl)
Set the TTL value.
Definition
hwmp-tag.cc:44
ns3::dot11s::HwmpTag::GetSeqno
uint32_t GetSeqno() const
Get the sequence number.
Definition
hwmp-tag.cc:74
ns3::dot11s::HwmpTag::SetMetric
void SetMetric(uint32_t metric)
Set the metric value.
Definition
hwmp-tag.cc:56
ns3::dot11s::HwmpTag::SetSeqno
void SetSeqno(uint32_t seqno)
Set sequence number.
Definition
hwmp-tag.cc:68
ns3::dot11s::HwmpTag::GetTtl
uint8_t GetTtl() const
Get the TTL value.
Definition
hwmp-tag.cc:50
ns3::dot11s::HwmpTag::GetAddress
Mac48Address GetAddress()
Get address from tag.
Definition
hwmp-tag.cc:38
ns3::dot11s::HwmpTag::~HwmpTag
~HwmpTag() override
Definition
hwmp-tag.cc:27
ns3::dot11s::HwmpTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
hwmp-tag.cc:94
ns3::dot11s::HwmpTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
hwmp-tag.cc:84
ns3::dot11s::HwmpTag::Serialize
void Serialize(TagBuffer i) const override
Definition
hwmp-tag.cc:109
ns3::dot11s::HwmpTag::m_address
Mac48Address m_address
address
Definition
hwmp-tag.h:99
ns3::dot11s::HwmpTag::m_ttl
uint8_t m_ttl
TTL.
Definition
hwmp-tag.h:100
ns3::dot11s::HwmpTag::Deserialize
void Deserialize(TagBuffer i) override
Definition
hwmp-tag.cc:124
ns3::dot11s::HwmpTag::m_metric
uint32_t m_metric
metric
Definition
hwmp-tag.h:101
ns3::dot11s::HwmpTag::HwmpTag
HwmpTag()
Definition
hwmp-tag.cc:19
ns3::dot11s::HwmpTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
hwmp-tag.cc:100
ns3::dot11s::HwmpTag::Print
void Print(std::ostream &os) const override
Definition
hwmp-tag.cc:139
ns3::dot11s::HwmpTag::SetAddress
void SetAddress(Mac48Address retransmitter)
Set address.
Definition
hwmp-tag.cc:32
ns3::dot11s::HwmpTag::m_seqno
uint32_t m_seqno
sequence no
Definition
hwmp-tag.h:102
ns3::dot11s::HwmpTag::GetMetric
uint32_t GetMetric() const
Get the metric value.
Definition
hwmp-tag.cc:62
ns3::dot11s::HwmpTag::DecrementTtl
void DecrementTtl()
Decrement TTL.
Definition
hwmp-tag.cc:148
uint32_t
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
hwmp-tag.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mesh
model
dot11s
hwmp-tag.cc
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0