129 */ |
129 */ |
130 class WifiInformationElement : public SimpleRefCount<WifiInformationElement> |
130 class WifiInformationElement : public SimpleRefCount<WifiInformationElement> |
131 { |
131 { |
132 public: |
132 public: |
133 virtual ~WifiInformationElement (); |
133 virtual ~WifiInformationElement (); |
134 /// Serialize entire IE including Element ID and length fields |
134 /** |
|
135 * Serialize entire IE including Element ID and length fields |
|
136 * |
|
137 * \param i an iterator which points to where the IE should |
|
138 * be written. |
|
139 * \return an iterator |
|
140 */ |
135 Buffer::Iterator Serialize (Buffer::Iterator i) const; |
141 Buffer::Iterator Serialize (Buffer::Iterator i) const; |
136 /// Deserialize entire IE, which must be present. The iterator |
142 /** |
137 /// passed in must be pointing at the Element ID (i.e., the very |
143 * Deserialize entire IE, which must be present. The iterator |
138 /// first octet) of the correct type of information element, |
144 * passed in must be pointing at the Element ID (i.e., the very |
139 /// otherwise this method will generate a fatal error. |
145 * first octet) of the correct type of information element, |
|
146 * otherwise this method will generate a fatal error. |
|
147 * |
|
148 * \param i an iterator which points to where the IE should be read. |
|
149 * \return an iterator |
|
150 */ |
140 Buffer::Iterator Deserialize (Buffer::Iterator i); |
151 Buffer::Iterator Deserialize (Buffer::Iterator i); |
141 /// Deserialize entire IE if it is present. The iterator passed in |
152 /** |
142 /// must be pointing at the Element ID of an information element. If |
153 * Deserialize entire IE if it is present. The iterator passed in |
143 /// the Element ID is not the one that the given class is interested |
154 * must be pointing at the Element ID of an information element. If |
144 /// in then it will return the same iterator. |
155 * the Element ID is not the one that the given class is interested |
|
156 * in then it will return the same iterator. |
|
157 * |
|
158 * \param i an iterator which points to where the IE should be read. |
|
159 * \return an iterator |
|
160 */ |
145 Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i); |
161 Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i); |
146 /// Get the size of the serialized IE including Element ID and |
162 /** |
147 /// length fields. |
163 * Get the size of the serialized IE including Element ID and |
|
164 * length fields. |
|
165 * |
|
166 * \return the size of the serialized IE |
|
167 */ |
148 uint16_t GetSerializedSize () const; |
168 uint16_t GetSerializedSize () const; |
149 |
169 |
150 ///\name Each subclass must implement |
170 ///\name Each subclass must implement |
151 //\{ |
171 //\{ |
152 /// Own unique Element ID |
172 /// Own unique Element ID |
153 virtual WifiInformationElementId ElementId () const = 0; |
173 virtual WifiInformationElementId ElementId () const = 0; |
154 /// Length of serialized information (i.e., the length of the body |
174 /** |
155 /// of the IE, not including the Element ID and length octets. This |
175 * Length of serialized information (i.e., the length of the body |
156 /// is the value that will appear in the second octet of the entire |
176 * of the IE, not including the Element ID and length octets. This |
157 /// IE - the length field) |
177 * is the value that will appear in the second octet of the entire |
|
178 * IE - the length field) |
|
179 * |
|
180 * \return the length of serialized information |
|
181 */ |
158 virtual uint8_t GetInformationFieldSize () const = 0; |
182 virtual uint8_t GetInformationFieldSize () const = 0; |
159 /// Serialize information (i.e., the body of the IE, not including |
183 /** |
160 /// the Element ID and length octets) |
184 * Serialize information (i.e., the body of the IE, not including |
|
185 * the Element ID and length octets) |
|
186 * |
|
187 * \param start an iterator which points to where the information should |
|
188 * be written. |
|
189 */ |
161 virtual void SerializeInformationField (Buffer::Iterator start) const = 0; |
190 virtual void SerializeInformationField (Buffer::Iterator start) const = 0; |
162 /// Deserialize information (i.e., the body of the IE, not including |
191 /** |
163 /// the Element ID and length octets) |
192 * Deserialize information (i.e., the body of the IE, not including |
|
193 * the Element ID and length octets) |
|
194 * |
|
195 * \param start an iterator which points to where the information should |
|
196 * be written. |
|
197 * \param length |
|
198 * \return the number of bytes read |
|
199 */ |
164 virtual uint8_t DeserializeInformationField (Buffer::Iterator start, |
200 virtual uint8_t DeserializeInformationField (Buffer::Iterator start, |
165 uint8_t length) = 0; |
201 uint8_t length) = 0; |
166 //\} |
202 //\} |
167 |
203 |
168 /// In addition, a subclass may optionally override the following... |
204 /// In addition, a subclass may optionally override the following... |
169 //\{ |
205 //\{ |
170 /// Generate human-readable form of IE |
206 /** |
|
207 * Generate human-readable form of IE |
|
208 * |
|
209 * \param os output stream |
|
210 */ |
171 virtual void Print (std::ostream &os) const; |
211 virtual void Print (std::ostream &os) const; |
172 /// Compare information elements using Element ID |
212 /** |
|
213 * Compare information elements using Element ID |
|
214 * |
|
215 * \param a another information element to compare with |
|
216 * \return true if the Element ID is less than the other IE Element ID, |
|
217 * false otherwise |
|
218 */ |
173 virtual bool operator< (WifiInformationElement const & a) const; |
219 virtual bool operator< (WifiInformationElement const & a) const; |
174 /// Compare two IEs for equality by ID & Length, and then through |
220 /** |
175 /// memcmp of serialised version |
221 * Compare two IEs for equality by ID & Length, and then through |
|
222 * memcmp of serialised version |
|
223 * |
|
224 * \param a another information element to compare with |
|
225 * \return true if the two IEs are equal, false otherwise |
|
226 */ |
176 virtual bool operator== (WifiInformationElement const & a) const; |
227 virtual bool operator== (WifiInformationElement const & a) const; |
177 //\} |
228 //\} |
178 }; |
229 }; |
179 |
230 |
180 } |
231 } |