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
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
uint32_t
40
MeshInformationElementVector::DeserializeSingleIe
(
Buffer::Iterator
start
)
41
{
42
Buffer::Iterator
i =
start
;
43
uint8_t
id
= i.
ReadU8
();
44
uint8_t length = i.
ReadU8
();
45
Ptr<WifiInformationElement>
newElement;
46
switch
(
id
)
47
{
48
case
IE11S_MESH_CONFIGURATION
:
49
newElement = Create<dot11s::IeConfiguration> ();
50
break
;
51
case
IE11S_MESH_ID
:
52
newElement = Create<dot11s::IeMeshId> ();
53
break
;
54
case
IE11S_LINK_METRIC_REPORT
:
55
newElement = Create<dot11s::IeLinkMetricReport> ();
56
break
;
57
case
IE11S_PEERING_MANAGEMENT
:
58
newElement = Create<dot11s::IePeerManagement> ();
59
break
;
60
case
IE11S_BEACON_TIMING
:
61
newElement = Create<dot11s::IeBeaconTiming> ();
62
break
;
63
case
IE11S_RANN
:
64
newElement = Create<dot11s::IeRann> ();
65
break
;
66
case
IE11S_PREQ
:
67
newElement = Create<dot11s::IePreq> ();
68
break
;
69
case
IE11S_PREP
:
70
newElement = Create<dot11s::IePrep> ();
71
break
;
72
case
IE11S_PERR
:
73
newElement = Create<dot11s::IePerr> ();
74
break
;
75
case
IE11S_MESH_PEERING_PROTOCOL_VERSION
:
76
newElement = Create<dot11s::IePeeringProtocol> ();
77
break
;
78
default
:
79
// We peeked at the ID and length, so we need to back up the
80
// pointer before deferring to our parent.
81
i.
Prev
(2);
82
return
WifiInformationElementVector::DeserializeSingleIe
(i);
83
}
84
if
(
GetSize
() + length >
m_maxSize
)
85
{
86
NS_FATAL_ERROR
(
"Check max size for information element!"
);
87
}
88
newElement->
DeserializeInformationField
(i, length);
89
i.
Next
(length);
90
m_elements
.push_back (newElement);
91
return
i.
GetDistanceFrom
(start);
92
}
93
94
95
}
// namespace ns3
ns3::Ptr< WifiInformationElement >
ns3::WifiInformationElementVector::m_elements
IE_VECTOR m_elements
Information element vector.
Definition:
wifi-information-element-vector.h:96
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) ...
IE11S_MESH_CONFIGURATION
#define IE11S_MESH_CONFIGURATION
Definition:
mesh-information-element.h:44
IE11S_MESH_PEERING_PROTOCOL_VERSION
#define IE11S_MESH_PEERING_PROTOCOL_VERSION
Definition:
mesh-information-element.h:54
IE11S_MESH_ID
#define IE11S_MESH_ID
Definition:
mesh-information-element.h:45
visualizer.core.start
def start
Definition:
core.py:1482
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(Iterator const &o) const
Definition:
buffer.cc:807
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition:
fatal-error.h:72
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::Buffer::Iterator::Prev
void Prev(void)
go backward by one byte
Definition:
buffer.h:672
IE11S_PERR
#define IE11S_PERR
Definition:
mesh-information-element.h:52
IE11S_PREQ
#define IE11S_PREQ
Definition:
mesh-information-element.h:50
IE11S_PREP
#define IE11S_PREP
Definition:
mesh-information-element.h:51
ns3::Buffer::Iterator::Next
void Next(void)
go forward by one byte
Definition:
buffer.h:666
IE11S_BEACON_TIMING
#define IE11S_BEACON_TIMING
Definition:
mesh-information-element.h:34
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:82
ns3::WifiInformationElementVector::m_maxSize
uint16_t m_maxSize
Size in bytes (actually, max packet length)
Definition:
wifi-information-element-vector.h:98
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:40
mesh-information-element-vector.h
IE11S_RANN
#define IE11S_RANN
Definition:
mesh-information-element.h:48
IE11S_LINK_METRIC_REPORT
#define IE11S_LINK_METRIC_REPORT
Definition:
mesh-information-element.h:28
IE11S_PEERING_MANAGEMENT
#define IE11S_PEERING_MANAGEMENT
Definition:
mesh-information-element.h:46
ns3::WifiInformationElementVector::GetSize
uint32_t GetSize() const
Current number of bytes.
Definition:
wifi-information-element-vector.cc:160
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8(void)
Definition:
buffer.h:819
src
mesh
model
mesh-information-element-vector.cc
Generated on Sat Apr 19 2014 14:07:03 for ns-3 by
1.8.6