A Discrete-Event Network Simulator
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
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
37namespace ns3 {
38
39NS_OBJECT_ENSURE_REGISTERED (MeshInformationElementVector);
40
42{
43}
44
46{
47}
48
49
52{
53 static TypeId tid = TypeId ("ns3::MeshInformationElementVector")
55 .SetGroupName ("Mesh")
56 .AddConstructor<MeshInformationElementVector> ();
57 return tid;
58}
59
62{
63 return GetTypeId ();
64}
65
68{
70 uint8_t id = i.ReadU8 ();
71 uint8_t length = i.ReadU8 ();
72 i.Prev (2);
74 switch (id)
75 {
77 newElement = Create<dot11s::IeConfiguration> ();
78 break;
79 case IE_MESH_ID:
80 newElement = Create<dot11s::IeMeshId> ();
81 break;
83 newElement = Create<dot11s::IeLinkMetricReport> ();
84 break;
86 newElement = Create<dot11s::IePeerManagement> ();
87 break;
89 newElement = Create<dot11s::IeBeaconTiming> ();
90 break;
91 case IE_RANN:
92 newElement = Create<dot11s::IeRann> ();
93 break;
94 case IE_PREQ:
95 newElement = Create<dot11s::IePreq> ();
96 break;
97 case IE_PREP:
98 newElement = Create<dot11s::IePrep> ();
99 break;
100 case IE_PERR:
101 newElement = Create<dot11s::IePerr> ();
102 break;
104 newElement = Create<dot11s::IePeeringProtocol> ();
105 break;
106 default:
108 }
109 if (GetSize () + length > m_maxSize)
110 {
111 NS_FATAL_ERROR ("Check max size for information element!");
112 }
113 i = newElement->Deserialize (i);
114 m_elements.push_back (newElement);
115 return i.GetDistanceFrom (start);
116}
117
118
119} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:99
uint8_t ReadU8(void)
Definition: buffer.h:1021
void Prev(void)
go backward by one byte
Definition: buffer.h:851
uint32_t GetDistanceFrom(Iterator const &o) const
Definition: buffer.cc:788
Introspection did not find any typical Config paths.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
virtual uint32_t DeserializeSingleIe(Buffer::Iterator start)
Needed when you try to deserialize a lonely IE inside other header.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize entire IE (which may possibly be fragmented into multiple elements), which must be presen...
IE_VECTOR m_elements
Information element vector.
virtual uint32_t DeserializeSingleIe(Buffer::Iterator start)
Needed when you try to deserialize a lonely IE inside other header.
uint32_t GetSize() const
Current number of bytes.
uint16_t m_maxSize
Size in bytes (actually, max packet length)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
#define IE11S_MESH_PEERING_PROTOCOL_VERSION
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1852
#define IE_PREQ
#define IE_RANN
#define IE_MESH_CONFIGURATION
#define IE_PREP
#define IE_BEACON_TIMING
#define IE_MESH_LINK_METRIC_REPORT
#define IE_MESH_PEERING_MANAGEMENT
#define IE_MESH_ID
#define IE_PERR