A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ie-dot11s-metric-report.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008,2009 IITP RAS
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Kirill Andreev <andreev@iitp.ru>
18
*/
19
20
#include "
ie-dot11s-metric-report.h
"
21
22
#include "ns3/assert.h"
23
24
namespace
ns3
25
{
26
namespace
dot11s
27
{
28
IeLinkMetricReport::IeLinkMetricReport
()
29
: m_metric(0)
30
{
31
}
32
33
IeLinkMetricReport::IeLinkMetricReport
(uint32_t metric)
34
{
35
m_metric
= metric;
36
}
37
38
WifiInformationElementId
39
IeLinkMetricReport::ElementId
()
const
40
{
41
return
IE_MESH_LINK_METRIC_REPORT
;
42
}
43
44
uint16_t
45
IeLinkMetricReport::GetInformationFieldSize
()
const
46
{
47
return
sizeof
(uint32_t);
48
}
49
50
uint32_t
51
IeLinkMetricReport::GetMetric
()
const
52
{
53
return
m_metric
;
54
}
55
56
void
57
IeLinkMetricReport::SetMetric
(uint32_t metric)
58
{
59
m_metric
= metric;
60
}
61
62
void
63
IeLinkMetricReport::SerializeInformationField
(
Buffer::Iterator
i)
const
64
{
65
i.
WriteHtolsbU32
(
m_metric
);
66
}
67
68
uint16_t
69
IeLinkMetricReport::DeserializeInformationField
(
Buffer::Iterator
start
, uint16_t length)
70
{
71
Buffer::Iterator
i =
start
;
72
m_metric
= i.
ReadLsbtohU32
();
73
return
i.
GetDistanceFrom
(
start
);
74
}
75
76
void
77
IeLinkMetricReport::Print
(std::ostream& os)
const
78
{
79
os <<
"Metric="
<<
m_metric
;
80
}
81
82
bool
83
operator==
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
84
{
85
return
(a.
m_metric
== b.
m_metric
);
86
}
87
88
bool
89
operator<
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
90
{
91
return
(a.
m_metric
< b.
m_metric
);
92
}
93
94
bool
95
operator>
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
96
{
97
return
(a.
m_metric
> b.
m_metric
);
98
}
99
100
std::ostream&
101
operator<<
(std::ostream& os,
const
IeLinkMetricReport
& a)
102
{
103
a.
Print
(os);
104
return
os;
105
}
106
}
// namespace dot11s
107
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Buffer::Iterator::WriteHtolsbU32
void WriteHtolsbU32(uint32_t data)
Definition:
buffer.cc:910
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(const Iterator &o) const
Definition:
buffer.cc:780
ns3::Buffer::Iterator::ReadLsbtohU32
uint32_t ReadLsbtohU32()
Definition:
buffer.cc:1076
ns3::dot11s::IeLinkMetricReport
a IEEE 802.11s Mesh ID 7.3.2.88 of 802.11s draft 3.0
Definition:
ie-dot11s-metric-report.h:37
ns3::dot11s::IeLinkMetricReport::operator<
friend bool operator<(const IeLinkMetricReport &a, const IeLinkMetricReport &b)
less than operator
Definition:
ie-dot11s-metric-report.cc:89
ns3::dot11s::IeLinkMetricReport::m_metric
uint32_t m_metric
metric
Definition:
ie-dot11s-metric-report.h:65
ns3::dot11s::IeLinkMetricReport::ElementId
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
Definition:
ie-dot11s-metric-report.cc:39
ns3::dot11s::IeLinkMetricReport::Print
void Print(std::ostream &os) const override
Generate human-readable form of IE.
Definition:
ie-dot11s-metric-report.cc:77
ns3::dot11s::IeLinkMetricReport::GetMetric
uint32_t GetMetric() const
Get metric value.
Definition:
ie-dot11s-metric-report.cc:51
ns3::dot11s::IeLinkMetricReport::GetInformationFieldSize
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
Definition:
ie-dot11s-metric-report.cc:45
ns3::dot11s::IeLinkMetricReport::SetMetric
void SetMetric(uint32_t metric)
Set metric value.
Definition:
ie-dot11s-metric-report.cc:57
ns3::dot11s::IeLinkMetricReport::IeLinkMetricReport
IeLinkMetricReport()
Definition:
ie-dot11s-metric-report.cc:28
ns3::dot11s::IeLinkMetricReport::SerializeInformationField
void SerializeInformationField(Buffer::Iterator i) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
Definition:
ie-dot11s-metric-report.cc:63
ns3::dot11s::IeLinkMetricReport::DeserializeInformationField
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
Definition:
ie-dot11s-metric-report.cc:69
ie-dot11s-metric-report.h
ns3::dot11s::operator>
bool operator>(const IeLinkMetricReport &a, const IeLinkMetricReport &b)
Definition:
ie-dot11s-metric-report.cc:95
ns3::dot11s::operator==
bool operator==(const MeshHeader &a, const MeshHeader &b)
Definition:
dot11s-mac-header.cc:198
ns3::dot11s::operator<<
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
Definition:
ie-dot11s-beacon-timing.cc:242
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiInformationElementId
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
Definition:
wifi-information-element.h:45
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
IE_MESH_LINK_METRIC_REPORT
#define IE_MESH_LINK_METRIC_REPORT
Definition:
wifi-information-element.h:153
src
mesh
model
dot11s
ie-dot11s-metric-report.cc
Generated on Sun Mar 3 2024 17:11:04 for ns-3 by
1.9.1