diff --git a/src/mesh/model/mesh-information-element-vector.cc b/src/mesh/model/mesh-information-element-vector.cc index 86b1bb5d5..f4b119424 100644 --- a/src/mesh/model/mesh-information-element-vector.cc +++ b/src/mesh/model/mesh-information-element-vector.cc @@ -69,6 +69,7 @@ MeshInformationElementVector::DeserializeSingleIe (Buffer::Iterator start) Buffer::Iterator i = start; uint8_t id = i.ReadU8 (); uint8_t length = i.ReadU8 (); + i.Prev (2); Ptr newElement; switch (id) { @@ -103,17 +104,13 @@ MeshInformationElementVector::DeserializeSingleIe (Buffer::Iterator start) newElement = Create (); break; default: - // We peeked at the ID and length, so we need to back up the - // pointer before deferring to our parent. - i.Prev (2); return WifiInformationElementVector::DeserializeSingleIe (i); } if (GetSize () + length > m_maxSize) { NS_FATAL_ERROR ("Check max size for information element!"); } - newElement->DeserializeInformationField (i, length); - i.Next (length); + i = newElement->Deserialize (i); m_elements.push_back (newElement); return i.GetDistanceFrom (start); } diff --git a/src/wifi/model/wifi-information-element.h b/src/wifi/model/wifi-information-element.h index 514cc609f..bef8b204d 100644 --- a/src/wifi/model/wifi-information-element.h +++ b/src/wifi/model/wifi-information-element.h @@ -292,25 +292,6 @@ public: * \return the length of serialized information */ virtual uint8_t GetInformationFieldSize () const = 0; - /** - * Serialize information (i.e., the body of the IE, not including - * the Element ID and length octets) - * - * \param start an iterator which points to where the information should - * be written. - */ - virtual void SerializeInformationField (Buffer::Iterator start) const = 0; - /** - * Deserialize information (i.e., the body of the IE, not including - * the Element ID and length octets) - * - * \param start an iterator which points to where the information should be written. - * \param length - * - * \return the number of bytes read - */ - virtual uint8_t DeserializeInformationField (Buffer::Iterator start, - uint8_t length) = 0; /** * Get the wifi information element ID extension @@ -336,6 +317,26 @@ public: */ virtual bool operator== (WifiInformationElement const & a) const; +private: + /** + * Serialize information (i.e., the body of the IE, not including + * the Element ID and length octets) + * + * \param start an iterator which points to where the information should + * be written. + */ + virtual void SerializeInformationField (Buffer::Iterator start) const = 0; + /** + * Deserialize information (i.e., the body of the IE, not including + * the Element ID and length octets) + * + * \param start an iterator which points to where the information should be written. + * \param length + * + * \return the number of bytes read + */ + virtual uint8_t DeserializeInformationField (Buffer::Iterator start, + uint8_t length) = 0; }; } //namespace ns3