A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mesh-information-element-vector.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 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 * Authors: Kirill Andreev <andreev@iitp.ru>
18 * Pavel Boyko <boyko.iitp.ru>
19 */
20
21#ifndef MESH_INFORMATION_ELEMENT_VECTOR_H
22#define MESH_INFORMATION_ELEMENT_VECTOR_H
23
24#include "ns3/wifi-information-element.h"
25
26namespace ns3
27{
28
29#define IE11S_MESH_PEERING_PROTOCOL_VERSION \
30 ((WifiInformationElementId)74) // to be removed (Protocol ID should be part of the Mesh Peering
31 // Management IE)
32
33/**
34 * \brief Information element vector
35 * \ingroup wifi
36 *
37 * Implements a vector of WifiInformationElements.
38 * Information elements typically come in groups, and the
39 * WifiInformationElementVector class provides a representation of a
40 * series of IEs, and the facility for serialisation to and
41 * deserialisation from the over-the-air format.
42 */
44{
45 public:
48
49 /**
50 * \brief Get the type ID.
51 * \return the object TypeId
52 */
53 static TypeId GetTypeId();
54
55 TypeId GetInstanceTypeId() const override;
56 uint32_t GetSerializedSize() const override;
57 void Serialize(Buffer::Iterator start) const override;
58 /**
59 * \attention This variant should not be used but is implemented due to
60 * backward compatibility reasons
61 *
62 * \param start buffer location to start deserializing from
63 * \return number of bytes deserialized
64 */
66 /**
67 * Deserialize a number of WifiInformationElements
68 *
69 * The size of this Header should equal start.GetDistanceFrom (end).
70 *
71 * \param start starting buffer location
72 * \param end ending buffer location
73 * \return number of bytes deserialized
74 */
76 void Print(std::ostream& os) const override;
77
78 /**
79 * \brief Needed when you try to deserialize a lonely IE inside other header
80 *
81 * \param start is the start of the buffer
82 *
83 * \return deserialized bytes
84 */
86
87 /// As soon as this is a vector, we define an Iterator
88 typedef std::vector<Ptr<WifiInformationElement>>::iterator Iterator;
89 /**
90 * Returns Begin of the vector
91 * \returns the begin of the vector
92 */
94 /**
95 * Returns End of the vector
96 * \returns the end of the vector
97 */
98 Iterator End();
99 /**
100 * add an IE, if maxSize has exceeded, returns false
101 *
102 * \param element wifi information element to add
103 * \returns true is added
104 */
106 /**
107 * vector of pointers to information elements is the body of IeVector
108 *
109 * \param id the element id to find
110 * \returns the information element
111 */
113
114 /**
115 * Check if the given WifiInformationElementVectors are equivalent.
116 *
117 * \param a another WifiInformationElementVector
118 *
119 * \return true if the given WifiInformationElementVectors are equivalent,
120 * false otherwise
121 */
122 virtual bool operator==(const MeshInformationElementVector& a) const;
123
124 protected:
125 /**
126 * typedef for a vector of WifiInformationElements.
127 */
128 typedef std::vector<Ptr<WifiInformationElement>> IE_VECTOR;
129 /**
130 * Current number of bytes
131 * \returns the number of bytes
132 */
133 uint32_t GetSize() const;
134 IE_VECTOR m_elements; //!< Information element vector
135 uint16_t m_maxSize; //!< Size in bytes (actually, max packet length)
136};
137
138} // namespace ns3
139
140#endif
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
Iterator End()
Returns End of the vector.
uint32_t Deserialize(Buffer::Iterator start) override
bool AddInformationElement(Ptr< WifiInformationElement > element)
add an IE, if maxSize has exceeded, returns false
IE_VECTOR m_elements
Information element vector.
uint32_t GetSize() const
Current number of bytes.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint16_t m_maxSize
Size in bytes (actually, max packet length)
std::vector< Ptr< WifiInformationElement > >::iterator Iterator
As soon as this is a vector, we define an Iterator.
Ptr< WifiInformationElement > FindFirst(WifiInformationElementId id) const
vector of pointers to information elements is the body of IeVector
std::vector< Ptr< WifiInformationElement > > IE_VECTOR
typedef for a vector of WifiInformationElements.
Iterator Begin()
Returns Begin of the vector.
void Serialize(Buffer::Iterator start) const override
void Print(std::ostream &os) const override
virtual bool operator==(const MeshInformationElementVector &a) const
Check if the given WifiInformationElementVectors are equivalent.
uint32_t DeserializeSingleIe(Buffer::Iterator start)
Needed when you try to deserialize a lonely IE inside other header.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.