A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ie-dot11s-metric-report.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008,2009 IITP RAS
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Kirill Andreev <andreev@iitp.ru>
19
*/
20
21
#include "
ie-dot11s-metric-report.h
"
22
#include "ns3/assert.h"
23
24
namespace
ns3 {
25
namespace
dot11s {
26
IeLinkMetricReport::IeLinkMetricReport
() :
27
m_metric (0)
28
{
29
}
30
IeLinkMetricReport::IeLinkMetricReport
(uint32_t metric)
31
{
32
m_metric
= metric;
33
}
34
WifiInformationElementId
35
IeLinkMetricReport::ElementId
()
const
36
{
37
return
IE11S_LINK_METRIC_REPORT
;
38
}
39
uint8_t
40
IeLinkMetricReport::GetInformationFieldSize
(
void
)
const
41
{
42
return
sizeof
(uint32_t);
43
}
44
uint32_t
45
IeLinkMetricReport::GetMetric
()
46
{
47
return
m_metric
;
48
}
49
void
50
IeLinkMetricReport::SetMetric
(uint32_t metric)
51
{
52
m_metric
= metric;
53
}
54
void
55
IeLinkMetricReport::SerializeInformationField
(
Buffer::Iterator
i)
const
56
{
57
i.
WriteHtolsbU32
(
m_metric
);
58
}
59
uint8_t
60
IeLinkMetricReport::DeserializeInformationField
(
Buffer::Iterator
start
, uint8_t length)
61
{
62
Buffer::Iterator
i =
start
;
63
m_metric
= i.
ReadLsbtohU32
();
64
return
i.
GetDistanceFrom
(start);
65
}
66
void
67
IeLinkMetricReport::Print
(std::ostream& os)
const
68
{
69
os << std::endl <<
"<information_element id="
<<
ElementId
() <<
">"
<< std::endl;
70
os <<
"Metric = "
<<
m_metric
;
71
os <<
"</information_element>"
<< std::endl;
72
}
73
bool
74
operator==
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
75
{
76
return
(a.
m_metric
== b.
m_metric
);
77
}
78
bool
79
operator<
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
80
{
81
return
(a.
m_metric
< b.
m_metric
);
82
}
83
bool
84
operator>
(
const
IeLinkMetricReport
& a,
const
IeLinkMetricReport
& b)
85
{
86
return
(a.
m_metric
> b.
m_metric
);
87
}
88
std::ostream &
89
operator <<
(std::ostream &os,
const
IeLinkMetricReport
&a)
90
{
91
a.
Print
(os);
92
return
os;
93
}
94
}
// namespace dot11s
95
}
// namespace ns3
src
mesh
model
dot11s
ie-dot11s-metric-report.cc
Generated on Fri Dec 21 2012 19:00:41 for ns-3 by
1.8.1.2