replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2009 IITP RAS
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;
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.
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
18 * Authors: Kirill Andreev <andreev@iitp.ru>
19 * Pavel Boyko <boyko.iitp.ru>
25 #include "ns3/header.h"
26 #include "ns3/simple-ref-count.h"
33 * \brief Enum of all known information element id (aka tags).
35 * For now only 802.11s (mesh) related elements are supported here (so 11S prefix),
36 * but this can change in future.
38 * Note that 802.11s element ids are not yet officially assigned, we use ones
39 * compatible with open80211s (http://o11s.org/) implementation.
42 /* begin of open80211s-compatible IDs */
43 IE11S_MESH_CONFIGURATION = 51,
45 /* end of open80211s-compatible IDs */
46 IE11S_LINK_METRIC_REPORT = 20,
47 IE11S_CONGESTION_NOTIFICATION,
48 /* begin of open80211s-compatible IDs */
49 IE11S_PEERING_MANAGEMENT = 55,
50 /* end of open80211s-compatible IDs */
51 IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS = 23,
52 IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
56 IE11S_MCCAOP_SETUP_REQUEST,
57 IE11S_MCCAOP_SETUP_REPLY,
58 IE11S_MCCAOP_ADVERTISEMENT,
59 IE11S_MCCAOP_RESERVATION_TEARDOWN,
60 IE11S_PORTAL_ANNOUNCEMENT,
62 /* begin of open80211s-compatible IDs */
66 /* end of open80211s-compatible IDs */
67 IE11S_PROXY_UPDATE = 37,
68 IE11S_PROXY_UPDATE_CONFIRMATION,
69 IE11S_ABBREVIATED_HANDSHAKE,
70 IE11S_MESH_PEERING_PROTOCOL_VERSION = 74,
76 * \brief Information element, as defined in 802.11-2007 standard
78 * Elements are defined to have a common general format consisting of a 1 octet Element ID field, a 1 octet
79 * length field, and a variable-length element-specific information field. Each element is assigned a unique
80 * Element ID as defined in this standard. The Length field specifies the number of octets in the Information
83 class WifiInformationElement : public SimpleRefCount<WifiInformationElement>
86 virtual ~WifiInformationElement ();
87 ///\name Each subclass must implement
89 virtual void Print (std::ostream &os) const = 0;
90 /// Own unique Element ID
91 virtual WifiElementId ElementId () const = 0;
92 /// Length of serialized information
93 virtual uint8_t GetInformationSize () const = 0;
94 /// Serialize information
95 virtual void SerializeInformation (Buffer::Iterator start) const = 0;
96 /// Deserialize information
97 virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
100 /// Compare information elements using Element ID
101 friend bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
103 virtual bool operator== (WifiInformationElement const & a) { return false; }
106 /// Compare information elements using Element ID
107 bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
112 * \brief Information element vector
114 * Implements a vector of WifiInformationElement's
116 class WifiInformationElementVector : public Header
119 WifiInformationElementVector ();
120 ~WifiInformationElementVector ();
121 ///\name Inherited from Header
123 static TypeId GetTypeId ();
124 TypeId GetInstanceTypeId () const;
125 virtual uint32_t GetSerializedSize () const;
126 virtual void Serialize (Buffer::Iterator start) const;
128 * \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
129 * all buffer consists of information elements
133 virtual uint32_t Deserialize (Buffer::Iterator start);
134 virtual void Print (std::ostream &os) const;
137 * \brief Needed when you try to deserialize a lonely IE inside other header
138 * \param start is the start of the buffer
139 * \return deserialized bytes
141 virtual uint32_t DeserializeSingleIe (Buffer::Iterator start);
142 ///Set maximum size to control overflow of the max packet length
143 void SetMaxSize (uint16_t size);
144 typedef std::vector<Ptr<WifiInformationElement> >::iterator Iterator;
147 bool AddInformationElement (Ptr<WifiInformationElement> element);
148 Ptr<WifiInformationElement> FindFirst (enum WifiElementId id) const;
150 typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
151 uint32_t GetSize () const;
152 IE_VECTOR m_elements;
153 /// Size in bytes (actually, max packet length)
155 friend bool operator== (const WifiInformationElementVector & a, const WifiInformationElementVector & b);
157 bool operator== (const WifiInformationElementVector & a, const WifiInformationElementVector & b);