A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
mesh-information-element-vector.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 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: Pavel Boyko <boyko@iitp.ru>
19
*/
20
21
#include "
mesh-information-element-vector.h
"
22
#include "ns3/packet.h"
23
#include <algorithm>
24
#include "ns3/hwmp-protocol.h"
25
// All information elements:
26
#include "ns3/ie-dot11s-beacon-timing.h"
27
#include "ns3/ie-dot11s-configuration.h"
28
#include "ns3/ie-dot11s-id.h"
29
#include "ns3/ie-dot11s-metric-report.h"
30
#include "ns3/ie-dot11s-peer-management.h"
31
#include "ns3/ie-dot11s-peering-protocol.h"
32
#include "ns3/ie-dot11s-perr.h"
33
#include "ns3/ie-dot11s-prep.h"
34
#include "ns3/ie-dot11s-preq.h"
35
#include "ns3/ie-dot11s-rann.h"
36
37
namespace
ns3
{
38
39
NS_OBJECT_ENSURE_REGISTERED
(MeshInformationElementVector);
40
41
MeshInformationElementVector::MeshInformationElementVector
()
42
{
43
}
44
45
MeshInformationElementVector::~MeshInformationElementVector
()
46
{
47
}
48
49
50
TypeId
51
MeshInformationElementVector::GetTypeId
()
52
{
53
static
TypeId
tid =
TypeId
(
"ns3::MeshInformationElementVector"
)
54
.
SetParent
<
WifiInformationElementVector
> ()
55
.SetGroupName (
"Mesh"
)
56
.AddConstructor<
MeshInformationElementVector
> ();
57
return
tid;
58
}
59
60
TypeId
61
MeshInformationElementVector::GetInstanceTypeId
()
const
62
{
63
return
GetTypeId
();
64
}
65
66
uint32_t
67
MeshInformationElementVector::DeserializeSingleIe
(
Buffer::Iterator
start
)
68
{
69
Buffer::Iterator
i =
start
;
70
uint8_t
id
= i.
ReadU8
();
71
uint8_t length = i.
ReadU8
();
72
Ptr<WifiInformationElement>
newElement;
73
switch
(
id
)
74
{
75
case
IE_MESH_CONFIGURATION
:
76
newElement = Create<dot11s::IeConfiguration> ();
77
break
;
78
case
IE_MESH_ID
:
79
newElement = Create<dot11s::IeMeshId> ();
80
break
;
81
case
IE_MESH_LINK_METRIC_REPORT
:
82
newElement = Create<dot11s::IeLinkMetricReport> ();
83
break
;
84
case
IE_MESH_PEERING_MANAGEMENT
:
85
newElement = Create<dot11s::IePeerManagement> ();
86
break
;
87
case
IE_BEACON_TIMING
:
88
newElement = Create<dot11s::IeBeaconTiming> ();
89
break
;
90
case
IE_RANN
:
91
newElement = Create<dot11s::IeRann> ();
92
break
;
93
case
IE_PREQ
:
94
newElement = Create<dot11s::IePreq> ();
95
break
;
96
case
IE_PREP
:
97
newElement = Create<dot11s::IePrep> ();
98
break
;
99
case
IE_PERR
:
100
newElement = Create<dot11s::IePerr> ();
101
break
;
102
case
IE11S_MESH_PEERING_PROTOCOL_VERSION
:
103
newElement = Create<dot11s::IePeeringProtocol> ();
104
break
;
105
default
:
106
// We peeked at the ID and length, so we need to back up the
107
// pointer before deferring to our parent.
108
i.
Prev
(2);
109
return
WifiInformationElementVector::DeserializeSingleIe
(i);
110
}
111
if
(
GetSize
() + length >
m_maxSize
)
112
{
113
NS_FATAL_ERROR
(
"Check max size for information element!"
);
114
}
115
newElement->
DeserializeInformationField
(i, length);
116
i.
Next
(length);
117
m_elements
.push_back (newElement);
118
return
i.
GetDistanceFrom
(
start
);
119
}
120
121
122
}
// namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::MeshInformationElementVector::MeshInformationElementVector
MeshInformationElementVector()
Definition:
mesh-information-element-vector.cc:41
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
IE_RANN
#define IE_RANN
Definition:
wifi-information-element.h:160
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(Iterator const &o) const
Definition:
buffer.cc:788
ns3::MeshInformationElementVector::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
mesh-information-element-vector.cc:61
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8(void)
Definition:
buffer.h:1021
IE11S_MESH_PEERING_PROTOCOL_VERSION
#define IE11S_MESH_PEERING_PROTOCOL_VERSION
Definition:
mesh-information-element-vector.h:29
ns3::MeshInformationElementVector::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
mesh-information-element-vector.cc:51
ns3::WifiInformationElement::DeserializeInformationField
virtual uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length)=0
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
ns3::MeshInformationElementVector::~MeshInformationElementVector
~MeshInformationElementVector()
Definition:
mesh-information-element-vector.cc:45
ns3::WifiInformationElementVector::GetSize
uint32_t GetSize() const
Current number of bytes.
Definition:
wifi-information-element-vector.cc:171
ns3::Buffer::Iterator::Next
void Next(void)
go forward by one byte
Definition:
buffer.h:845
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::Ptr< WifiInformationElement >
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:165
visualizer.core.start
def start()
Definition:
core.py:1855
IE_BEACON_TIMING
#define IE_BEACON_TIMING
Definition:
wifi-information-element.h:154
ns3::WifiInformationElementVector::m_maxSize
uint16_t m_maxSize
Size in bytes (actually, max packet length)
Definition:
wifi-information-element-vector.h:131
ns3::WifiInformationElementVector::DeserializeSingleIe
virtual uint32_t DeserializeSingleIe(Buffer::Iterator start)
Needed when you try to deserialize a lonely IE inside other header.
Definition:
wifi-information-element-vector.cc:96
IE_MESH_CONFIGURATION
#define IE_MESH_CONFIGURATION
Definition:
wifi-information-element.h:147
IE_PREQ
#define IE_PREQ
Definition:
wifi-information-element.h:164
IE_MESH_ID
#define IE_MESH_ID
Definition:
wifi-information-element.h:148
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:99
ns3::MeshInformationElementVector::DeserializeSingleIe
virtual uint32_t DeserializeSingleIe(Buffer::Iterator start)
Needed when you try to deserialize a lonely IE inside other header.
Definition:
mesh-information-element-vector.cc:67
IE_PERR
#define IE_PERR
Definition:
wifi-information-element.h:166
ns3::WifiInformationElementVector::m_elements
IE_VECTOR m_elements
Information element vector.
Definition:
wifi-information-element-vector.h:130
IE_PREP
#define IE_PREP
Definition:
wifi-information-element.h:165
IE_MESH_LINK_METRIC_REPORT
#define IE_MESH_LINK_METRIC_REPORT
Definition:
wifi-information-element.h:149
IE_MESH_PEERING_MANAGEMENT
#define IE_MESH_PEERING_MANAGEMENT
Definition:
wifi-information-element.h:151
ns3::MeshInformationElementVector
Introspection did not find any typical Config paths.
Definition:
mesh-information-element-vector.h:32
mesh-information-element-vector.h
ns3::Buffer::Iterator::Prev
void Prev(void)
go backward by one byte
Definition:
buffer.h:851
ns3::WifiInformationElementVector
Information element vector.
Definition:
wifi-information-element-vector.h:40
src
mesh
model
mesh-information-element-vector.cc
Generated on Fri Oct 1 2021 17:03:27 for ns-3 by
1.8.20