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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Kirill Andreev <andreev@iitp.ru>
7 * Pavel Boyko <boyko.iitp.ru>
8 */
9
10#ifndef MESH_INFORMATION_ELEMENT_VECTOR_H
11#define MESH_INFORMATION_ELEMENT_VECTOR_H
12
13#include "ns3/wifi-information-element.h"
14
15namespace ns3
16{
17
18#define IE11S_MESH_PEERING_PROTOCOL_VERSION \
19 ((WifiInformationElementId)74) // to be removed (Protocol ID should be part of the Mesh Peering
20 // Management IE)
21
22/**
23 * @brief Information element vector
24 * @ingroup wifi
25 *
26 * Implements a vector of WifiInformationElements.
27 * Information elements typically come in groups, and the
28 * WifiInformationElementVector class provides a representation of a
29 * series of IEs, and the facility for serialisation to and
30 * deserialisation from the over-the-air format.
31 */
33{
34 public:
37
38 /**
39 * @brief Get the type ID.
40 * @return the object TypeId
41 */
42 static TypeId GetTypeId();
43
44 TypeId GetInstanceTypeId() const override;
45 uint32_t GetSerializedSize() const override;
46 void Serialize(Buffer::Iterator start) const override;
47 /**
48 * @attention This variant should not be used but is implemented due to
49 * backward compatibility reasons
50 *
51 * @param start buffer location to start deserializing from
52 * @return number of bytes deserialized
53 */
55 /**
56 * Deserialize a number of WifiInformationElements
57 *
58 * The size of this Header should equal start.GetDistanceFrom (end).
59 *
60 * @param start starting buffer location
61 * @param end ending buffer location
62 * @return number of bytes deserialized
63 */
65 void Print(std::ostream& os) const override;
66
67 /**
68 * @brief Needed when you try to deserialize a lonely IE inside other header
69 *
70 * @param start is the start of the buffer
71 *
72 * @return deserialized bytes
73 */
75
76 /// As soon as this is a vector, we define an Iterator
77 typedef std::vector<Ptr<WifiInformationElement>>::iterator Iterator;
78 /**
79 * Returns Begin of the vector
80 * @returns the begin of the vector
81 */
83 /**
84 * Returns End of the vector
85 * @returns the end of the vector
86 */
87 Iterator End();
88 /**
89 * add an IE, if maxSize has exceeded, returns false
90 *
91 * @param element wifi information element to add
92 * @returns true is added
93 */
95 /**
96 * vector of pointers to information elements is the body of IeVector
97 *
98 * @param id the element id to find
99 * @returns the information element
100 */
102
103 /**
104 * Check if the given WifiInformationElementVectors are equivalent.
105 *
106 * @param a another WifiInformationElementVector
107 *
108 * @return true if the given WifiInformationElementVectors are equivalent,
109 * false otherwise
110 */
111 virtual bool operator==(const MeshInformationElementVector& a) const;
112
113 protected:
114 /**
115 * typedef for a vector of WifiInformationElements.
116 */
117 typedef std::vector<Ptr<WifiInformationElement>> IE_VECTOR;
118 /**
119 * Current number of bytes
120 * @returns the number of bytes
121 */
122 uint32_t GetSize() const;
123 IE_VECTOR m_elements; //!< Information element vector
124 uint16_t m_maxSize; //!< Size in bytes (actually, max packet length)
125};
126
127} // namespace ns3
128
129#endif
iterator in a Buffer instance
Definition buffer.h:89
Protocol header serialization and deserialization.
Definition header.h:33
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.
a unique identifier for an interface.
Definition type-id.h:48
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.