View | Details | Raw Unified | Return to bug 1084
Collapse All | Expand All

(-)a/src/mesh/model/dot11s/peer-link-frame.cc (-6 / +12 lines)
119
    }
119
    }
120
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
120
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
121
    {
121
    {
122
      size += m_rates.GetSerializedSize ();
122
      SupportedRatesIE srIE(&m_rates);
123
      size += m_rates.extended.GetSerializedSize ();
123
      size += srIE.GetSerializedSize ();
124
      ExtendedSupportedRatesIE esrIE(&m_rates);
125
      size += esrIE.GetSerializedSize ();
124
    }
126
    }
125
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
127
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
126
    {
128
    {
152
    }
154
    }
153
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
155
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
154
    {
156
    {
155
      i = m_rates.Serialize (i);
157
      SupportedRatesIE srIE(&m_rates);
156
      i = m_rates.extended.Serialize (i);
158
      i = srIE.Serialize (i);
159
      ExtendedSupportedRatesIE esrIE(&m_rates);
160
      i = esrIE.Serialize (i);
157
    }
161
    }
158
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
162
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
159
    {
163
    {
193
    }
197
    }
194
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
198
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
195
    {
199
    {
196
      i = m_rates.Deserialize (i);
200
      SupportedRatesIE srIE(&m_rates);
197
      i = m_rates.extended.DeserializeIfPresent (i);
201
      i = srIE.Deserialize (i);
202
      ExtendedSupportedRatesIE esrIE(&m_rates);
203
      i = esrIE.DeserializeIfPresent (i);
198
    }
204
    }
199
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
205
  if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
200
    {
206
    {
(-)a/src/wifi/model/mgt-headers.cc (-24 / +48 lines)
 Lines 61-68    Link Here 
61
{
61
{
62
  uint32_t size = 0;
62
  uint32_t size = 0;
63
  size += m_ssid.GetSerializedSize ();
63
  size += m_ssid.GetSerializedSize ();
64
  size += m_rates.GetSerializedSize ();
64
  SupportedRatesIE srIE(&m_rates);
65
  size += m_rates.extended.GetSerializedSize ();
65
  size += srIE.GetSerializedSize ();
66
  ExtendedSupportedRatesIE esrIE(&m_rates);
67
  size += esrIE.GetSerializedSize ();
66
  return size;
68
  return size;
67
}
69
}
68
TypeId
70
TypeId
 Lines 90-105    Link Here 
90
{
92
{
91
  Buffer::Iterator i = start;
93
  Buffer::Iterator i = start;
92
  i = m_ssid.Serialize (i);
94
  i = m_ssid.Serialize (i);
93
  i = m_rates.Serialize (i);
95
  SupportedRatesIE srIE(&m_rates);
94
  i = m_rates.extended.Serialize (i);
96
  i = srIE.Serialize (i);
97
  ExtendedSupportedRatesIE esrIE(&m_rates);
98
  i = esrIE.Serialize (i);
95
}
99
}
96
uint32_t
100
uint32_t
97
MgtProbeRequestHeader::Deserialize (Buffer::Iterator start)
101
MgtProbeRequestHeader::Deserialize (Buffer::Iterator start)
98
{
102
{
99
  Buffer::Iterator i = start;
103
  Buffer::Iterator i = start;
100
  i = m_ssid.Deserialize (i);
104
  i = m_ssid.Deserialize (i);
101
  i = m_rates.Deserialize (i);
105
  SupportedRatesIE srIE(&m_rates);
102
  i = m_rates.extended.DeserializeIfPresent (i);
106
  i = srIE.Deserialize (i);
107
  ExtendedSupportedRatesIE esrIE(&m_rates);
108
  i = esrIE.DeserializeIfPresent (i);
103
  return i.GetDistanceFrom (start);
109
  return i.GetDistanceFrom (start);
104
}
110
}
105
111
 Lines 174-182    Link Here 
174
  size += 2; // beacon interval
180
  size += 2; // beacon interval
175
  size += m_capability.GetSerializedSize ();
181
  size += m_capability.GetSerializedSize ();
176
  size += m_ssid.GetSerializedSize ();
182
  size += m_ssid.GetSerializedSize ();
177
  size += m_rates.GetSerializedSize ();
183
  SupportedRatesIE srIE(&m_rates);
184
  size += srIE.GetSerializedSize ();
178
  //size += 3; // ds parameter set
185
  //size += 3; // ds parameter set
179
  size += m_rates.extended.GetSerializedSize ();
186
  ExtendedSupportedRatesIE esrIE(&m_rates);
187
  size += esrIE.GetSerializedSize ();
180
  // xxx
188
  // xxx
181
  return size;
189
  return size;
182
}
190
}
 Lines 204-212    Link Here 
204
  i.WriteHtolsbU16 (m_beaconInterval / 1024);
212
  i.WriteHtolsbU16 (m_beaconInterval / 1024);
205
  i = m_capability.Serialize (i);
213
  i = m_capability.Serialize (i);
206
  i = m_ssid.Serialize (i);
214
  i = m_ssid.Serialize (i);
207
  i = m_rates.Serialize (i);
215
  SupportedRatesIE srIE(&m_rates);
216
  i = srIE.Serialize (i);
208
  //i.WriteU8 (0, 3); // ds parameter set.
217
  //i.WriteU8 (0, 3); // ds parameter set.
209
  i = m_rates.extended.Serialize (i);
218
  ExtendedSupportedRatesIE esrIE(&m_rates);
219
  i = esrIE.Serialize (i);
210
}
220
}
211
uint32_t
221
uint32_t
212
MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
222
MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
 Lines 217-225    Link Here 
217
  m_beaconInterval *= 1024;
227
  m_beaconInterval *= 1024;
218
  i = m_capability.Deserialize (i);
228
  i = m_capability.Deserialize (i);
219
  i = m_ssid.Deserialize (i);
229
  i = m_ssid.Deserialize (i);
220
  i = m_rates.Deserialize (i);
230
  SupportedRatesIE srIE(&m_rates);
231
  i = srIE.Deserialize (i);
221
  //i.Next (3); // ds parameter set
232
  //i.Next (3); // ds parameter set
222
  i = m_rates.extended.DeserializeIfPresent (i);
233
  ExtendedSupportedRatesIE esrIE(&m_rates);
234
  i = esrIE.DeserializeIfPresent (i);
223
  return i.GetDistanceFrom (start);
235
  return i.GetDistanceFrom (start);
224
}
236
}
225
237
 Lines 289-296    Link Here 
289
  size += m_capability.GetSerializedSize ();
301
  size += m_capability.GetSerializedSize ();
290
  size += 2;
302
  size += 2;
291
  size += m_ssid.GetSerializedSize ();
303
  size += m_ssid.GetSerializedSize ();
292
  size += m_rates.GetSerializedSize ();
304
  SupportedRatesIE srIE(&m_rates);
293
  size += m_rates.extended.GetSerializedSize ();
305
  size += srIE.GetSerializedSize ();
306
  ExtendedSupportedRatesIE esrIE(&m_rates);
307
  size += esrIE.GetSerializedSize ();
294
  return size;
308
  return size;
295
}
309
}
296
void
310
void
 Lines 306-313    Link Here 
306
  i = m_capability.Serialize (i);
320
  i = m_capability.Serialize (i);
307
  i.WriteHtolsbU16 (m_listenInterval);
321
  i.WriteHtolsbU16 (m_listenInterval);
308
  i = m_ssid.Serialize (i);
322
  i = m_ssid.Serialize (i);
309
  i = m_rates.Serialize (i);
323
  SupportedRatesIE srIE(&m_rates);
310
  i = m_rates.extended.Serialize (i);
324
  i = srIE.Serialize (i);
325
  ExtendedSupportedRatesIE esrIE(&m_rates);
326
  i = esrIE.Serialize (i);
311
}
327
}
312
uint32_t
328
uint32_t
313
MgtAssocRequestHeader::Deserialize (Buffer::Iterator start)
329
MgtAssocRequestHeader::Deserialize (Buffer::Iterator start)
 Lines 316-323    Link Here 
316
  i = m_capability.Deserialize (i);
332
  i = m_capability.Deserialize (i);
317
  m_listenInterval = i.ReadLsbtohU16 ();
333
  m_listenInterval = i.ReadLsbtohU16 ();
318
  i = m_ssid.Deserialize (i);
334
  i = m_ssid.Deserialize (i);
319
  i = m_rates.Deserialize (i);
335
  SupportedRatesIE srIE(&m_rates);
320
  i = m_rates.extended.DeserializeIfPresent (i);
336
  i = srIE.Deserialize (i);
337
  ExtendedSupportedRatesIE esrIE(&m_rates);
338
  i = esrIE.DeserializeIfPresent (i);
321
  return i.GetDistanceFrom (start);
339
  return i.GetDistanceFrom (start);
322
}
340
}
323
341
 Lines 377-384    Link Here 
377
  size += m_capability.GetSerializedSize ();
395
  size += m_capability.GetSerializedSize ();
378
  size += m_code.GetSerializedSize ();
396
  size += m_code.GetSerializedSize ();
379
  size += 2; // aid
397
  size += 2; // aid
380
  size += m_rates.GetSerializedSize ();
398
  SupportedRatesIE srIE(&m_rates);
381
  size += m_rates.extended.GetSerializedSize ();
399
  size += srIE.GetSerializedSize ();
400
  ExtendedSupportedRatesIE esrIE(&m_rates);
401
  size += esrIE.GetSerializedSize ();
382
  return size;
402
  return size;
383
}
403
}
384
404
 Lines 395-402    Link Here 
395
  i = m_capability.Serialize (i);
415
  i = m_capability.Serialize (i);
396
  i = m_code.Serialize (i);
416
  i = m_code.Serialize (i);
397
  i.WriteHtolsbU16 (m_aid);
417
  i.WriteHtolsbU16 (m_aid);
398
  i = m_rates.Serialize (i);
418
  SupportedRatesIE srIE(&m_rates);
399
  i = m_rates.extended.Serialize (i);
419
  i = srIE.Serialize (i);
420
  ExtendedSupportedRatesIE esrIE(&m_rates);
421
  i = esrIE.Serialize (i);
400
}
422
}
401
uint32_t
423
uint32_t
402
MgtAssocResponseHeader::Deserialize (Buffer::Iterator start)
424
MgtAssocResponseHeader::Deserialize (Buffer::Iterator start)
 Lines 405-412    Link Here 
405
  i = m_capability.Deserialize (i);
427
  i = m_capability.Deserialize (i);
406
  i = m_code.Deserialize (i);
428
  i = m_code.Deserialize (i);
407
  m_aid = i.ReadLsbtohU16 ();
429
  m_aid = i.ReadLsbtohU16 ();
408
  i = m_rates.Deserialize (i);
430
  SupportedRatesIE srIE(&m_rates);
409
  i = m_rates.extended.DeserializeIfPresent (i);
431
  i = srIE.Deserialize (i);
432
  ExtendedSupportedRatesIE esrIE(&m_rates);
433
  i = esrIE.DeserializeIfPresent (i);
410
  return i.GetDistanceFrom (start);
434
  return i.GetDistanceFrom (start);
411
}
435
}
412
/**********************************************************
436
/**********************************************************
(-)a/src/wifi/model/supported-rates.cc (-24 / +67 lines)
 Lines 27-34    Link Here 
27
namespace ns3 {
27
namespace ns3 {
28
28
29
SupportedRates::SupportedRates ()
29
SupportedRates::SupportedRates ()
30
  : extended (this),
30
  : m_nRates (0)
31
    m_nRates (0)
32
{
31
{
33
}
32
}
34
33
 Lines 102-145    Link Here 
102
  return (m_rates[i] & 0x7f) * 500000;
101
  return (m_rates[i] & 0x7f) * 500000;
103
}
102
}
104
103
104
SupportedRatesIE::SupportedRatesIE (SupportedRates *rates)
105
{
106
  m_supportedRatesStore = rates;
107
  m_supportedRatesStoreReadOnly = rates;
108
}
109
110
SupportedRatesIE::SupportedRatesIE (const SupportedRates *rates)
111
{
112
  m_supportedRatesStoreReadOnly = rates;
113
  m_supportedRatesStore = NULL;
114
}
115
105
WifiInformationElementId
116
WifiInformationElementId
106
SupportedRates::ElementId () const
117
SupportedRatesIE::ElementId () const
107
{
118
{
108
  return IE_SUPPORTED_RATES;
119
  return IE_SUPPORTED_RATES;
109
}
120
}
110
uint8_t
121
uint8_t
111
SupportedRates::GetInformationFieldSize () const
122
SupportedRatesIE::GetInformationFieldSize () const
112
{
123
{
124
  // Confirm that we have a pointer to a SupportedRates object. We're
125
  // happy to treat it as const in this method.
126
  NS_ASSERT (m_supportedRatesStoreReadOnly);
113
  // The Supported Rates Information Element contains only the first 8
127
  // The Supported Rates Information Element contains only the first 8
114
  // supported rates - the remainder appear in the Extended Supported
128
  // supported rates - the remainder appear in the Extended Supported
115
  // Rates Information Element.
129
  // Rates Information Element.
116
  return m_nRates > 8 ? 8 : m_nRates;
130
  return std::max((int)m_supportedRatesStoreReadOnly->m_nRates, 8);
117
}
131
}
118
void
132
void
119
SupportedRates::SerializeInformationField (Buffer::Iterator start) const
133
SupportedRatesIE::SerializeInformationField (Buffer::Iterator start) const
120
{
134
{
135
  // Confirm that we have a pointer to a SupportedRates object. We're
136
  // happy to treat it as const in this method.
137
  NS_ASSERT (m_supportedRatesStoreReadOnly);
121
  // The Supported Rates Information Element contains only the first 8
138
  // The Supported Rates Information Element contains only the first 8
122
  // supported rates - the remainder appear in the Extended Supported
139
  // supported rates - the remainder appear in the Extended Supported
123
  // Rates Information Element.
140
  // Rates Information Element.
124
  start.Write (m_rates, m_nRates > 8 ? 8 : m_nRates);
141
  start.Write (m_supportedRatesStoreReadOnly->m_rates,
142
               std::max((int)m_supportedRatesStoreReadOnly->m_nRates, 8));
125
}
143
}
126
uint8_t
144
uint8_t
127
SupportedRates::DeserializeInformationField (Buffer::Iterator start,
145
SupportedRatesIE::DeserializeInformationField (Buffer::Iterator start,
128
                                             uint8_t length)
146
                                               uint8_t length)
129
{
147
{
148
  // Confirm that we have a pointer to a SupportedRates object that we
149
  // can modify (as opposed to one we have to treat as const).
150
  NS_ASSERT (m_supportedRatesStore);
130
  NS_ASSERT (length <= 8);
151
  NS_ASSERT (length <= 8);
131
  m_nRates = length;
152
  m_supportedRatesStore->m_nRates = length;
132
  start.Read (m_rates, m_nRates);
153
  start.Read (m_supportedRatesStore->m_rates, m_supportedRatesStore->m_nRates);
133
  return m_nRates;
154
  return m_supportedRatesStore->m_nRates;
134
}
155
}
135
156
136
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE ()
157
158
159
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE (SupportedRates *rates)
137
{
160
{
161
  m_supportedRatesStore = rates;
162
  m_supportedRatesStoreReadOnly = rates;
138
}
163
}
139
164
140
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE (SupportedRates *sr)
165
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE (const SupportedRates *rates)
141
{
166
{
142
  m_supportedRates = sr;
167
  m_supportedRatesStoreReadOnly = rates;
168
  m_supportedRatesStore = NULL;
143
}
169
}
144
170
145
WifiInformationElementId
171
WifiInformationElementId
 Lines 151-171    Link Here 
151
uint8_t
177
uint8_t
152
ExtendedSupportedRatesIE::GetInformationFieldSize () const
178
ExtendedSupportedRatesIE::GetInformationFieldSize () const
153
{
179
{
180
  // Confirm that we have a pointer to a SupportedRates object. We're
181
  // happy to treat it as const in this method.
182
  NS_ASSERT (m_supportedRatesStoreReadOnly);
154
  // If there are 8 or fewer rates then we don't need an Extended
183
  // If there are 8 or fewer rates then we don't need an Extended
155
  // Supported Rates IE and so could return zero here, but we're
184
  // Supported Rates IE and so could return zero here, but we're
156
  // overriding the GetSerializedSize() method, so if this function is
185
  // overriding the GetSerializedSize() method, so if this function is
157
  // invoked in that case then it indicates a programming error. Hence
186
  // invoked in that case then it indicates a programming error. Hence
158
  // we have an assertion on that condition.
187
  // we have an assertion on that condition.
159
  NS_ASSERT (m_supportedRates->m_nRates > 8);
188
  NS_ASSERT (m_supportedRatesStoreReadOnly->m_nRates > 8);
160
189
161
  // The number of rates we have beyond the initial 8 is the size of
190
  // The number of rates we have beyond the initial 8 is the size of
162
  // the information field.
191
  // the information field.
163
  return (m_supportedRates->m_nRates - 8);
192
  return (m_supportedRatesStoreReadOnly->m_nRates - 8);
164
}
193
}
165
194
166
void
195
void
167
ExtendedSupportedRatesIE::SerializeInformationField (Buffer::Iterator start) const
196
ExtendedSupportedRatesIE::SerializeInformationField (Buffer::Iterator start) const
168
{
197
{
198
  // Confirm that we have a pointer to a SupportedRates object. We're
199
  // happy to treat it as const in this method.
200
  NS_ASSERT (m_supportedRatesStoreReadOnly);
169
  // If there are 8 or fewer rates then there should be no Extended
201
  // If there are 8 or fewer rates then there should be no Extended
170
  // Supported Rates Information Element at all so being here would
202
  // Supported Rates Information Element at all so being here would
171
  // seemingly indicate a programming error.
203
  // seemingly indicate a programming error.
 Lines 173-188    Link Here 
173
  // Our overridden version of the Serialize() method should ensure
205
  // Our overridden version of the Serialize() method should ensure
174
  // that this routine is never invoked in that case (by ensuring that
206
  // that this routine is never invoked in that case (by ensuring that
175
  // WifiInformationElement::Serialize() is not invoked).
207
  // WifiInformationElement::Serialize() is not invoked).
176
  NS_ASSERT (m_supportedRates->m_nRates > 8);
208
  NS_ASSERT (m_supportedRatesStoreReadOnly->m_nRates > 8);
177
  start.Write (m_supportedRates->m_rates + 8, m_supportedRates->m_nRates - 8);
209
  start.Write (m_supportedRatesStoreReadOnly->m_rates + 8,
210
               m_supportedRatesStoreReadOnly->m_nRates - 8);
178
}
211
}
179
212
180
Buffer::Iterator
213
Buffer::Iterator
181
ExtendedSupportedRatesIE::Serialize (Buffer::Iterator start) const
214
ExtendedSupportedRatesIE::Serialize (Buffer::Iterator start) const
182
{
215
{
216
  // Confirm that we have a pointer to a SupportedRates object. We're
217
  // happy to treat it as const in this method.
218
  NS_ASSERT (m_supportedRatesStoreReadOnly);
183
  // If there are 8 or fewer rates then we don't need an Extended
219
  // If there are 8 or fewer rates then we don't need an Extended
184
  // Supported Rates IE, so we don't serialise anything.
220
  // Supported Rates IE, so we don't serialise anything.
185
  if (m_supportedRates->m_nRates <= 8)
221
  if (m_supportedRatesStoreReadOnly->m_nRates <= 8)
186
    {
222
    {
187
      return start;
223
      return start;
188
    }
224
    }
 Lines 194-202    Link Here 
194
uint16_t
230
uint16_t
195
ExtendedSupportedRatesIE::GetSerializedSize () const
231
ExtendedSupportedRatesIE::GetSerializedSize () const
196
{
232
{
233
  // Confirm that we have a pointer to a SupportedRates object. We're
234
  // happy to treat it as const in this method.
235
  NS_ASSERT (m_supportedRatesStoreReadOnly);
197
  // If there are 8 or fewer rates then we don't need an Extended
236
  // If there are 8 or fewer rates then we don't need an Extended
198
  // Supported Rates IE, so it's serialised length will be zero.
237
  // Supported Rates IE, so it's serialised length will be zero.
199
  if (m_supportedRates->m_nRates <= 8)
238
  if (m_supportedRatesStoreReadOnly->m_nRates <= 8)
200
    {
239
    {
201
      return 0;
240
      return 0;
202
    }
241
    }
 Lines 210-219    Link Here 
210
ExtendedSupportedRatesIE::DeserializeInformationField (Buffer::Iterator start,
249
ExtendedSupportedRatesIE::DeserializeInformationField (Buffer::Iterator start,
211
                                                       uint8_t length)
250
                                                       uint8_t length)
212
{
251
{
252
  // Confirm that we have a pointer to a SupportedRates object that we
253
  // can modify (as opposed to one we have to treat as const).
254
  NS_ASSERT (m_supportedRatesStore);
213
  NS_ASSERT (length > 0);
255
  NS_ASSERT (length > 0);
214
  NS_ASSERT (m_supportedRates->m_nRates + length <= MAX_SUPPORTED_RATES);
256
  NS_ASSERT (m_supportedRatesStore->m_nRates + length <= MAX_SUPPORTED_RATES);
215
  start.Read (m_supportedRates->m_rates + m_supportedRates->m_nRates, length);
257
  start.Read (m_supportedRatesStore->m_rates + m_supportedRatesStore->m_nRates,
216
  m_supportedRates->m_nRates += length;
258
              length);
259
  m_supportedRatesStore->m_nRates += length;
217
  return length;
260
  return length;
218
}
261
}
219
262
(-)a/src/wifi/model/supported-rates.h (-58 / +115 lines)
 Lines 22-28    Link Here 
22
22
23
#include <stdint.h>
23
#include <stdint.h>
24
#include <ostream>
24
#include <ostream>
25
#include "ns3/buffer.h"
26
#include "ns3/wifi-information-element.h"
25
#include "ns3/wifi-information-element.h"
27
26
28
namespace ns3 {
27
namespace ns3 {
 Lines 35-41    Link Here 
35
 */
34
 */
36
#define MAX_SUPPORTED_RATES (12)
35
#define MAX_SUPPORTED_RATES (12)
37
36
38
class SupportedRates;
37
/**
38
 * \brief A storage class for supported rates
39
 * \ingroup wifi
40
 */
41
class SupportedRates
42
{
43
public:
44
  SupportedRates ();
45
46
  void AddSupportedRate (uint32_t bs);
47
  void SetBasicRate (uint32_t bs);
48
49
  bool IsSupportedRate (uint32_t bs) const;
50
  bool IsBasicRate (uint32_t bs) const;
51
52
  uint8_t GetNRates (void) const;
53
  uint32_t GetRate (uint8_t i) const;
54
55
  /*
56
   * The classes which serialise and deserialise Supported Rates and
57
   * Extended Supported Rates Information Elements need access to our
58
   * internals and thus need to be our friends
59
   */
60
  friend class SupportedRatesIE;
61
  friend class ExtendedSupportedRatesIE;
62
private:
63
  uint8_t m_nRates;
64
  uint8_t m_rates[MAX_SUPPORTED_RATES];
65
};
66
67
std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
68
69
/**
70
 * \brief The Supported Rates Information Element
71
 * \ingroup wifi
72
 *
73
 * This class knows how to serialise and deserialise the Supported
74
 * Rates Element that holds the first 8 (non-HT) supported rates.
75
 *
76
 * The \c ExtendedSupportedRatesIE class deals with rates beyond the
77
 * first 8.
78
 */
79
class SupportedRatesIE : public WifiInformationElement
80
{
81
public:
82
  /**
83
   * This constructor is used when non-const access is available to
84
   * the SupportedRates object that stores the list of supported
85
   * rates. This is a requirement if a non-const method of this class
86
   * (e.g., Deserialize ()) is to be called.
87
   */
88
  SupportedRatesIE (SupportedRates *rates);
89
  /**
90
   * This constructor is used when the SupportedRates object that
91
   * stores the list of supported rates must be treated as const -
92
   * perhaps because the method that creates an instance of this class
93
   * only has const access to the SupportedRates object. This level of
94
   * access is sufficient (and appropriate) for determining the size
95
   * of the IE, and serialising it.
96
   */
97
  SupportedRatesIE (const SupportedRates *rates);
98
99
  WifiInformationElementId ElementId () const;
100
  uint8_t GetInformationFieldSize () const;
101
  void SerializeInformationField (Buffer::Iterator start) const;
102
  uint8_t DeserializeInformationField (Buffer::Iterator start,
103
                                       uint8_t length);
104
105
private:
106
  /**
107
   * Pointer to a supported rates store which this instance of this
108
   * class is allowed to modify (e.g., deserialise to). It is NULL if
109
   * no such privileges have been granted during object construction,
110
   * and if not NULL will point to the same object as \c
111
   * m_supportedRatesStoreReadOnly.
112
   */
113
  SupportedRates *m_supportedRatesStore;
114
  /**
115
   * Pointer to a supported rates store which this class is to treat
116
   * as read only (perhaps because the method that creates an instance
117
   * of this class is a const member of the class in which the
118
   * SupportedRates object is a member).
119
   */
120
  const SupportedRates *m_supportedRatesStoreReadOnly;
121
};
122
39
123
40
/**
124
/**
41
 * \brief The Extended Supported Rates Information Element
125
 * \brief The Extended Supported Rates Information Element
 Lines 44-59    Link Here 
44
 * This class knows how to serialise and deserialise the Extended
128
 * This class knows how to serialise and deserialise the Extended
45
 * Supported Rates Element that holds (non-HT) rates beyond the 8 that
129
 * Supported Rates Element that holds (non-HT) rates beyond the 8 that
46
 * the original Supported Rates element can carry.
130
 * the original Supported Rates element can carry.
47
 *
48
 * The \c SupportedRates class still records all the rates, and an
49
 * instance of \c ExtendedSupportedRatesIE lies within \c
50
 * SupportedRates.
51
 */
131
 */
52
class ExtendedSupportedRatesIE : public WifiInformationElement
132
class ExtendedSupportedRatesIE : public WifiInformationElement
53
{
133
{
54
public:
134
public:
55
  ExtendedSupportedRatesIE ();
135
  /**
136
   * This constructor is used when non-const access is available to
137
   * the SupportedRates object that stores the list of supported
138
   * rates. This is a requirement if a non-const method of this class
139
   * (e.g., Deserialize ()) is to be called.
140
   */
56
  ExtendedSupportedRatesIE (SupportedRates *rates);
141
  ExtendedSupportedRatesIE (SupportedRates *rates);
142
  /**
143
   * This constructor is used when the SupportedRates object that
144
   * stores the list of supported rates must be treated as const -
145
   * perhaps because the method that creates an instance of this class
146
   * only has const access to the SupportedRates object. This level of
147
   * access is sufficient (and appropriate) for determining the size
148
   * of the IE, and serialising it.
149
   */
150
  ExtendedSupportedRatesIE (const SupportedRates *rates);
57
151
58
  WifiInformationElementId ElementId () const;
152
  WifiInformationElementId ElementId () const;
59
  uint8_t GetInformationFieldSize () const;
153
  uint8_t GetInformationFieldSize () const;
 Lines 69-130    Link Here 
69
   */
163
   */
70
  Buffer::Iterator Serialize (Buffer::Iterator start) const;
164
  Buffer::Iterator Serialize (Buffer::Iterator start) const;
71
  uint16_t GetSerializedSize () const;
165
  uint16_t GetSerializedSize () const;
166
72
private:
167
private:
73
  /**
168
  /**
74
   * This member points to the SupportedRates object that contains the
169
   * Pointer to a supported rates store which this instance of this
75
   * actual rate details. This class is a friend of that, so we have
170
   * class is allowed to modify (e.g., deserialise to). It is NULL if
76
   * access to all the private data we need.
171
   * no such privileges have been granted during object construction,
172
   * and if not NULL will point to the same object as \c
173
   * m_supportedRatesStoreReadOnly.
77
   */
174
   */
78
  SupportedRates *m_supportedRates;
175
  SupportedRates *m_supportedRatesStore;
176
  /**
177
   * Pointer to a supported rates store which this class is to treat
178
   * as read only (perhaps because the method that creates an instance
179
   * of this class is a const member of the class in which the
180
   * SupportedRates object is a member).
181
   */
182
  const SupportedRates *m_supportedRatesStoreReadOnly;
79
};
183
};
80
184
81
82
/**
83
 * \brief The Supported Rates Information Element
84
 * \ingroup wifi
85
 *
86
 * This class knows how to serialise and deserialise the Supported
87
 * Rates Element that holds the first 8 (non-HT) supported rates.
88
 *
89
 * The \c ExtendedSupportedRatesIE class (of which an instance exists
90
 * in objects of this class) deals with rates beyond the first 8.
91
 */
92
class SupportedRates : public WifiInformationElement
93
{
94
public:
95
  SupportedRates ();
96
97
  void AddSupportedRate (uint32_t bs);
98
  void SetBasicRate (uint32_t bs);
99
100
  bool IsSupportedRate (uint32_t bs) const;
101
  bool IsBasicRate (uint32_t bs) const;
102
103
  uint8_t GetNRates (void) const;
104
  uint32_t GetRate (uint8_t i) const;
105
106
  WifiInformationElementId ElementId () const;
107
  uint8_t GetInformationFieldSize () const;
108
  void SerializeInformationField (Buffer::Iterator start) const;
109
  uint8_t DeserializeInformationField (Buffer::Iterator start,
110
                                       uint8_t length);
111
112
  /*
113
   * We support the Extended Supported Rates Information Element
114
   * through the ExtendedSupportedRatesIE object which is declared
115
   * above. We allow this class to be a friend so that it can access
116
   * our private data detailing the rates, and create an instance as
117
   * extended.
118
   */
119
  friend class ExtendedSupportedRatesIE;
120
  ExtendedSupportedRatesIE extended;
121
private:
122
  uint8_t m_nRates;
123
  uint8_t m_rates[MAX_SUPPORTED_RATES];
124
};
125
126
std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
127
128
} // namespace ns3
185
} // namespace ns3
129
186
130
#endif /* SUPPORTED_RATES_H */
187
#endif /* SUPPORTED_RATES_H */

Return to bug 1084