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

(-)a/src/network/utils/radiotap-header.cc (-2 / +296 lines)
 Lines 38-44    Link Here 
38
    m_channelFreq (0),
38
    m_channelFreq (0),
39
    m_channelFlags (CHANNEL_FLAG_NONE),
39
    m_channelFlags (CHANNEL_FLAG_NONE),
40
    m_antennaSignal (0),
40
    m_antennaSignal (0),
41
    m_antennaNoise (0)
41
    m_antennaNoise (0),
42
    m_ampduStatusRef (0),
43
    m_ampduStatusFlags (0),
44
    m_ampduStatusCRC (0)
42
{
45
{
43
  NS_LOG_FUNCTION (this);
46
  NS_LOG_FUNCTION (this);
44
}
47
}
 Lines 128-133    Link Here 
128
    {
131
    {
129
      start.WriteU8 (m_antennaNoise);
132
      start.WriteU8 (m_antennaNoise);
130
    }
133
    }
134
135
  //
136
  // Quality of Barker code lock.
137
  //
138
  if (m_present & RADIOTAP_LOCK_QUALITY) // bit 7
139
    {
140
      start.WriteU16 (0);
141
    }
142
143
  //
144
  // Transmit power expressed as unitless distance from max power 
145
  // set at factory calibration (0 is max power).
146
  //
147
  if (m_present & RADIOTAP_TX_ATTENUATION) // bit 8
148
    {
149
      start.WriteU16 (0);
150
    }
151
152
  //
153
  // Transmit power expressed as decibel distance from max power 
154
  // set at factory calibration (0 is max power).
155
  //
156
  if (m_present & RADIOTAP_DB_TX_ATTENUATION) // bit 9
157
    {
158
      start.WriteU16 (0);
159
    }
160
161
  //
162
  // Transmit power expressed as dBm (decibels from a 1 milliwatt reference). 
163
  // This is the absolute power level measured at the antenna port.
164
  //
165
  if (m_present & RADIOTAP_DBM_TX_POWER) // bit 10
166
    {
167
      start.WriteU8 (0);
168
    }
169
170
  //
171
  // Unitless indication of the Rx/Tx antenna for this packet. 
172
  // The first antenna is antenna 0.
173
  //
174
  if (m_present & RADIOTAP_ANTENNA) // bit 11
175
    {
176
      start.WriteU8 (0);
177
    }
178
179
  //
180
  // RF signal power at the antenna (decibel difference from an arbitrary fixed reference).
181
  //
182
  if (m_present & RADIOTAP_DB_ANTSIGNAL) // bit 12
183
    {
184
      start.WriteU8 (0);
185
    }
186
187
  //
188
  // RF noise power at the antenna (decibel difference from an arbitrary fixed reference).
189
  //
190
  if (m_present & RADIOTAP_DB_ANTNOISE) // bit 13
191
    {
192
      start.WriteU8 (0);
193
    }
194
195
  //
196
  // Properties of received frames.
197
  //
198
  if (m_present & RADIOTAP_RX_FLAGS) // bit 14
199
    {
200
      start.WriteU16 (0);
201
    }
202
203
  //
204
  // MCS field.
205
  //
206
  if (m_present & RADIOTAP_MCS) // bit 19
207
    {
208
      start.WriteU8 (m_mcsKnown);
209
      start.WriteU8 (m_mcsFlags);
210
      start.WriteU8 (m_mcsRate);
211
    }
212
213
  //
214
  // A-MPDU Status, information about the received or transmitted A-MPDU.
215
  //
216
  if (m_present & RADIOTAP_AMPDU_STATUS) // bit 20
217
    {
218
      start.WriteU8(0, m_ampduStatusPad);
219
      start.WriteU32 (m_ampduStatusRef);
220
      start.WriteU16 (m_ampduStatusFlags);
221
      start.WriteU8 (m_ampduStatusCRC);
222
      start.WriteU8 (0);
223
    }
224
225
  //
226
  // Information about the received or transmitted VHT frame.
227
  //
228
  if (m_present & RADIOTAP_VHT) // bit 21
229
    {
230
      start.WriteU16 (0);
231
      start.WriteU8 (0);
232
      start.WriteU8 (0);
233
      start.WriteU8 (0);
234
      start.WriteU8 (0);
235
      start.WriteU8 (0);
236
      start.WriteU16 (0);
237
    }
131
}
238
}
132
239
133
uint32_t
240
uint32_t
 Lines 211-216    Link Here 
211
      ++bytesRead;
318
      ++bytesRead;
212
    }
319
    }
213
320
321
  //
322
  // Quality of Barker code lock.
323
  //
324
  if (m_present & RADIOTAP_LOCK_QUALITY) // bit 7
325
    {
326
      start.ReadU16 ();
327
      bytesRead += 2;
328
    }
329
330
  //
331
  // Transmit power expressed as unitless distance from max power 
332
  // set at factory calibration (0 is max power).
333
  //
334
  if (m_present & RADIOTAP_TX_ATTENUATION) // bit 8
335
    {
336
      start.ReadU16 ();
337
      bytesRead += 2;
338
    }
339
340
  //
341
  // Transmit power expressed as decibel distance from max power 
342
  // set at factory calibration (0 is max power).
343
  //
344
  if (m_present & RADIOTAP_DB_TX_ATTENUATION) // bit 9
345
    {
346
      start.ReadU16 ();
347
      bytesRead += 2;
348
    }
349
350
  //
351
  // Transmit power expressed as dBm (decibels from a 1 milliwatt reference). 
352
  // This is the absolute power level measured at the antenna port.
353
  //
354
  if (m_present & RADIOTAP_DBM_TX_POWER) // bit 10
355
    {
356
      start.ReadU8 ();
357
      ++bytesRead;
358
    }
359
360
  //
361
  // Unitless indication of the Rx/Tx antenna for this packet. 
362
  // The first antenna is antenna 0.
363
  //
364
  if (m_present & RADIOTAP_ANTENNA) // bit 11
365
    {
366
      start.ReadU8 ();
367
      ++bytesRead;
368
    }
369
370
  //
371
  // RF signal power at the antenna (decibel difference from an arbitrary fixed reference).
372
  //
373
  if (m_present & RADIOTAP_DB_ANTSIGNAL) // bit 12
374
    {
375
      start.ReadU8 ();
376
      ++bytesRead;
377
    }
378
379
  //
380
  // RF noise power at the antenna (decibel difference from an arbitrary fixed reference).
381
  //
382
  if (m_present & RADIOTAP_DB_ANTNOISE) // bit 13
383
    {
384
      start.ReadU8 ();
385
      ++bytesRead;
386
    }
387
388
  //
389
  // Properties of received frames.
390
  //
391
  if (m_present & RADIOTAP_RX_FLAGS) // bit 14
392
    {
393
      start.ReadU16 ();
394
      bytesRead += 2;
395
    }
396
397
  //
398
  // MCS field.
399
  //
400
  if (m_present & RADIOTAP_MCS) // bit 19
401
    {
402
      m_mcsKnown = start.ReadU8 ();
403
      m_mcsFlags = start.ReadU8 ();
404
      m_mcsRate = start.ReadU8 ();
405
      bytesRead += 3;
406
    }
407
408
  //
409
  // A-MPDU Status, information about the received or transmitted A-MPDU.
410
  //
411
  if (m_present & RADIOTAP_AMPDU_STATUS) // bit 20
412
    {
413
      m_ampduStatusPad = ((4 - bytesRead % 4) % 4);
414
      start.Next (m_ampduStatusPad);
415
      m_ampduStatusRef = start.ReadU32 ();
416
      m_ampduStatusFlags = start.ReadU16 ();
417
      m_ampduStatusCRC = start.ReadU8 ();
418
      start.ReadU8 ();
419
      bytesRead += (8 + m_ampduStatusPad);
420
    }
421
422
  //
423
  // Information about the received or transmitted VHT frame.
424
  //
425
  if (m_present & RADIOTAP_VHT) // bit 21
426
    {
427
      start.ReadU16 ();
428
      start.ReadU8 ();
429
      start.ReadU8 ();
430
      start.ReadU8 ();
431
      start.ReadU8 ();
432
      start.ReadU8 ();
433
      start.ReadU16 ();
434
    }
435
214
  NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent");
436
  NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent");
215
  return bytesRead;
437
  return bytesRead;
216
}
438
}
 Lines 225-231    Link Here 
225
     << " freq=" << m_channelFreq
447
     << " freq=" << m_channelFreq
226
     << " chflags=" << std::hex << (uint32_t)m_channelFlags << std::dec
448
     << " chflags=" << std::hex << (uint32_t)m_channelFlags << std::dec
227
     << " signal=" << (int16_t) m_antennaSignal
449
     << " signal=" << (int16_t) m_antennaSignal
228
     << " noise=" << (int16_t) m_antennaNoise;
450
     << " noise=" << (int16_t) m_antennaNoise
451
     << " mcsKnown=" << m_mcsKnown
452
     << " mcsFlags=" << m_mcsFlags
453
     << " mcsRate=" << m_mcsRate
454
     << " ampduStatusFlags=" << (int16_t) m_ampduStatusFlags;
229
}
455
}
230
456
231
void
457
void
 Lines 390-393    Link Here 
390
  return m_antennaNoise;
616
  return m_antennaNoise;
391
}
617
}
392
618
619
void
620
RadiotapHeader::SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs)
621
{
622
  NS_LOG_FUNCTION (this << known << flags << mcs);
623
  m_mcsKnown = known;
624
  m_mcsFlags = flags;
625
  m_mcsRate = mcs;
626
  if (!(m_present & RADIOTAP_MCS))
627
    {
628
      m_present |= RADIOTAP_MCS;
629
      m_length += 3;
630
    }
631
632
  NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec);
633
}
634
635
uint8_t
636
RadiotapHeader::GetMcsKnown () const
637
{
638
  NS_LOG_FUNCTION (this);
639
  return m_mcsKnown;
640
}
641
642
uint8_t
643
RadiotapHeader::GetMcsFlags () const
644
{
645
  NS_LOG_FUNCTION (this);
646
  return m_mcsFlags;
647
}
648
649
uint8_t
650
RadiotapHeader::GetMcsRate () const
651
{
652
  NS_LOG_FUNCTION (this);
653
  return m_mcsRate;
654
}
655
656
void
657
RadiotapHeader::SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc)
658
{
659
  NS_LOG_FUNCTION (this << referenceNumber << flags);
660
  m_ampduStatusRef = referenceNumber;
661
  m_ampduStatusFlags = flags;
662
  m_ampduStatusCRC = crc;
663
  if (!(m_present & RADIOTAP_AMPDU_STATUS))
664
    {
665
      m_ampduStatusPad = (4 - m_length % 4) % 4;
666
      m_present |= RADIOTAP_AMPDU_STATUS;
667
      m_length += 8 + m_ampduStatusPad;
668
    }
669
670
  NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec);
671
}
672
673
uint32_t
674
RadiotapHeader::GetAmpduStatusRef () const
675
{
676
  NS_LOG_FUNCTION (this);
677
  return m_ampduStatusRef;
678
}
679
680
uint16_t
681
RadiotapHeader::GetAmpduStatusFlags () const
682
{
683
  NS_LOG_FUNCTION (this);
684
  return m_ampduStatusFlags;
685
}
686
393
} // namespace ns3
687
} // namespace ns3
(-)a/src/network/utils/radiotap-header.h (-4 / +102 lines)
 Lines 226-231    Link Here 
226
   *          from an arbitrary, fixed reference. 
226
   *          from an arbitrary, fixed reference. 
227
   */
227
   */
228
  uint8_t GetAntennaNoisePower (void) const;
228
  uint8_t GetAntennaNoisePower (void) const;
229
  
230
  enum {
231
    MCS_KNOWN_NONE           = 0x00, /**< No flags set */
232
    MCS_KNOWN_BANDWIDTH      = 0x01, /**< Bandwidth */
233
    MCS_KNOWN_INDEX          = 0x02, /**< MCS index known */
234
    MCS_KNOWN_GUARD_INTERVAL = 0x04, /**< Guard interval */
235
    MCS_KNOWN_HT_FORMAT      = 0x08, /**< HT format */
236
    MCS_KNOWN_FEC_TYPE       = 0x10, /**< FEC type */
237
    MCS_KNOWN_STBC           = 0x20, /**< STBC known */
238
    MCS_KNOWN_NESS           = 0x40, /**< Ness known (Number of extension spatial streams) */
239
    MCS_KNOWN_NESS_BIT_1     = 0x80, /**< Ness data - bit 1 (MSB) of Number of extension spatial streams */
240
  };
241
  
242
  enum {
243
    MCS_FLAGS_NONE           = 0x00, /**< Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type */
244
    MCS_FLAGS_BANDWIDTH_40   = 0x01, /**< 40 MHz */
245
    MCS_FLAGS_BANDWIDTH_20L  = 0x02, /**< 20L (20 MHz in lower half of 40 MHz channel) */
246
    MCS_FLAGS_BANDWIDTH_20U  = 0x03, /**< 20U (20 MHz in upper half of 40 MHz channel) */
247
    MCS_FLAGS_GUARD_INTERVAL = 0x04, /**< Short guard interval */
248
    MCS_FLAGS_HT_GREENFIELD  = 0x08, /**< Greenfield HT format */
249
    MCS_FLAGS_FEC_TYPE       = 0x10, /**< LDPC FEC type */
250
    MCS_FLAGS_STBC_STREAMS   = 0x60, /**< STBC enabled */
251
    MCS_FLAGS_NESS_BIT_0     = 0x80, /**< Ness - bit 0 (LSB) of Number of extension spatial streams */
252
  };
253
 
254
  /**
255
   * @brief Set the MCS fields
256
   *
257
   * @param known The kwown flags.
258
   * @param flags The flags to set.
259
   * @param mcs The MCS index value.
260
   */
261
  void SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs);
262
263
  /**
264
   * @brief Get the MCS known bitmap.
265
   *
266
   * @returns The MCS known bitmap.
267
   */
268
  uint8_t GetMcsKnown (void) const;
269
  /**
270
   * @brief Get the MCS flags.
271
   *
272
   * @returns The MCS flags.
273
   */
274
  uint8_t GetMcsFlags (void) const;
275
  /**
276
   * @brief Get the MCS index value.
277
   *
278
   * @returns The MCS index value.
279
   */
280
  uint8_t GetMcsRate (void) const;
281
282
  enum {
283
    A_MPDU_STATUS_NONE                = 0x00, /**< No flags set */
284
    A_MPDU_STATUS_REPORT_ZERO_LENGTH  = 0x01, /**< Driver reports 0-length subframes */
285
    A_MPDU_STATUS_IS_ZERO_LENGTH      = 0x02, /**< Frame is 0-length subframe (valid only if 0x0001 is set) */
286
    A_MPDU_STATUS_LAST_KNOWN          = 0x04, /**< Last subframe is known (should be set for all subframes in an A-MPDU) */
287
    A_MPDU_STATUS_LAST                = 0x08, /**< This frame is the last subframe */
288
    A_MPDU_STATUS_DELIMITER_CRC_ERROR = 0x10, /**< Delimiter CRC error */
289
    A_MPDU_STATUS_DELIMITER_CRC_KNOWN = 0x20  /**< Delimiter CRC value known: the delimiter CRC value field is valid */
290
  };
291
292
  /**
293
   * @brief Set the A-MPDU status fields
294
   *
295
   * @param referenceNumber The A-MPDU reference number to identify all subframes belonging to the same A-MPDU.
296
   * @param flags The flags to set.
297
   * @param crc The CRC value value.
298
   */
299
  void SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc);
300
301
  /**
302
   * @brief Get the A-MPDU reference number.
303
   *
304
   * @returns The A-MPDU reference number.
305
   */
306
  uint32_t GetAmpduStatusRef (void) const;
307
  /**
308
   * @brief Get the A-MPDU status flags.
309
   *
310
   * @returns The A-MPDU status flags.
311
   */
312
  uint16_t GetAmpduStatusFlags (void) const;
313
229
314
230
private:
315
private:
231
  enum {
316
  enum {
 Lines 239-248    Link Here 
239
    RADIOTAP_LOCK_QUALITY      = 0x00000080,
324
    RADIOTAP_LOCK_QUALITY      = 0x00000080,
240
    RADIOTAP_TX_ATTENUATION    = 0x00000100,
325
    RADIOTAP_TX_ATTENUATION    = 0x00000100,
241
    RADIOTAP_DB_TX_ATTENUATION = 0x00000200,
326
    RADIOTAP_DB_TX_ATTENUATION = 0x00000200,
242
    RADIOTAP_DBM_TX_POWER      = 0x00000200,
327
    RADIOTAP_DBM_TX_POWER      = 0x00000400,
243
    RADIOTAP_ANTENNA           = 0x00000400,
328
    RADIOTAP_ANTENNA           = 0x00000800,
244
    RADIOTAP_DB_ANTSIGNAL      = 0x00000800,
329
    RADIOTAP_DB_ANTSIGNAL      = 0x00001000,
245
    RADIOTAP_DB_ANTNOISE       = 0x00001000,
330
    RADIOTAP_DB_ANTNOISE       = 0x00002000,
331
    RADIOTAP_RX_FLAGS          = 0x00004000,
332
    RADIOTAP_MCS               = 0x00080000,
333
    RADIOTAP_AMPDU_STATUS      = 0x00100000,
334
    RADIOTAP_VHT               = 0x00200000,
246
    RADIOTAP_EXT               = 0x10000000
335
    RADIOTAP_EXT               = 0x10000000
247
  };
336
  };
248
 
337
 
 Lines 256-261    Link Here 
256
  uint16_t m_channelFlags;  //!< Tx/Rx channel flags.
345
  uint16_t m_channelFlags;  //!< Tx/Rx channel flags.
257
  int8_t m_antennaSignal;   //!< RF signal power at the antenna, dB difference from an arbitrary, fixed reference.
346
  int8_t m_antennaSignal;   //!< RF signal power at the antenna, dB difference from an arbitrary, fixed reference.
258
  int8_t m_antennaNoise;    //!< RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
347
  int8_t m_antennaNoise;    //!< RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
348
  
349
  uint8_t m_mcsKnown; //!< MCS Flags, known information field.
350
  uint8_t m_mcsFlags; //!< MCS Flags, flags field.
351
  uint8_t m_mcsRate; //!< MCS Flags, mcs rate index.
352
353
  uint8_t m_ampduStatusPad;       //!< A-MPDU Status Flags, Padding before A-MPDU Status Field.
354
  uint32_t m_ampduStatusRef;      //!< A-MPDU Status Flags, reference number.
355
  uint16_t m_ampduStatusFlags;    //!< A-MPDU Status Flags, information about the received A-MPDU.
356
  uint8_t m_ampduStatusCRC;       //!< A-MPDU Status Flags, delimiter CRC value.
259
};
357
};
260
358
261
} // namespace ns3
359
} // namespace ns3
(-)a/src/wifi/examples/test-interference-helper.cc (-2 / +2 lines)
 Lines 106-112    Link Here 
106
  WifiTxVector txVector;
106
  WifiTxVector txVector;
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
108
  txVector.SetMode (WifiMode (m_input.txModeA));
108
  txVector.SetMode (WifiMode (m_input.txModeA));
109
  m_txA->SendPacket (p, txVector, m_input.preamble, 0);
109
  m_txA->SendPacket (p, txVector, m_input.preamble, 0, 0);
110
}
110
}
111
111
112
void
112
void
 Lines 116-122    Link Here 
116
  WifiTxVector txVector;
116
  WifiTxVector txVector;
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
118
  txVector.SetMode (WifiMode (m_input.txModeB));
118
  txVector.SetMode (WifiMode (m_input.txModeB));
119
  m_txB->SendPacket (p, txVector, m_input.preamble, 0);
119
  m_txB->SendPacket (p, txVector, m_input.preamble, 0, 0);
120
}
120
}
121
121
122
InterferenceExperiment::InterferenceExperiment ()
122
InterferenceExperiment::InterferenceExperiment ()
(-)a/src/wifi/examples/wifi-phy-test.cc (-3 / +3 lines)
 Lines 74-80    Link Here 
74
  WifiTxVector txVector;
74
  WifiTxVector txVector;
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
76
  txVector.SetMode (mode);
76
  txVector.SetMode (mode);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
78
}
78
}
79
79
80
void
80
void
 Lines 182-188    Link Here 
182
  WifiTxVector txVector;
182
  WifiTxVector txVector;
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
184
  txVector.SetMode (WifiMode (m_input.txModeA));
184
  txVector.SetMode (WifiMode (m_input.txModeA));
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
186
}
186
}
187
187
188
void
188
void
 Lines 193-199    Link Here 
193
  WifiTxVector txVector;
193
  WifiTxVector txVector;
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
195
  txVector.SetMode (WifiMode (m_input.txModeB));
195
  txVector.SetMode (WifiMode (m_input.txModeB));
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
197
}
197
}
198
198
199
void
199
void
(-)a/src/wifi/helper/yans-wifi-helper.cc (-84 / +218 lines)
 Lines 25-30    Link Here 
25
#include "ns3/propagation-delay-model.h"
25
#include "ns3/propagation-delay-model.h"
26
#include "ns3/yans-wifi-channel.h"
26
#include "ns3/yans-wifi-channel.h"
27
#include "ns3/yans-wifi-phy.h"
27
#include "ns3/yans-wifi-phy.h"
28
#include "ns3/ampdu-subframe-header.h"
28
#include "ns3/wifi-net-device.h"
29
#include "ns3/wifi-net-device.h"
29
#include "ns3/radiotap-header.h"
30
#include "ns3/radiotap-header.h"
30
#include "ns3/pcap-file-wrapper.h"
31
#include "ns3/pcap-file-wrapper.h"
 Lines 253-260    Link Here 
253
  uint16_t             channelFreqMhz,
254
  uint16_t             channelFreqMhz,
254
  uint16_t             channelNumber,
255
  uint16_t             channelNumber,
255
  uint32_t             rate,
256
  uint32_t             rate,
256
  bool                 isShortPreamble,
257
  WifiPreamble         preamble,
257
  WifiTxVector         txvector)
258
  WifiTxVector         txvector,
259
  struct mpduInfo      aMpdu)
258
{
260
{
259
  uint32_t dlt = file->GetDataLinkType ();
261
  uint32_t dlt = file->GetDataLinkType ();
260
262
 Lines 278-284    Link Here 
278
        //Our capture includes the FCS, so we set the flag to say so.
280
        //Our capture includes the FCS, so we set the flag to say so.
279
        frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
281
        frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
280
282
281
        if (isShortPreamble)
283
        if (preamble == WIFI_PREAMBLE_SHORT)
284
          {
285
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
286
          }
287
288
        if (txvector.IsShortGuardInterval ())
289
          {
290
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
291
          }
292
293
        header.SetFrameFlags (frameFlags);
294
        header.SetRate (rate);
295
296
        uint16_t channelFlags = 0;
297
        switch (rate)
298
          {
299
          case 2:  //1Mbps
300
          case 4:  //2Mbps
301
          case 10: //5Mbps
302
          case 22: //11Mbps
303
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
304
            break;
305
306
          default:
307
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
308
            break;
309
          }
310
311
        if (channelFreqMhz < 2500)
312
          {
313
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;
314
          }
315
        else
316
          {
317
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;
318
          }
319
320
        header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
321
        
322
        if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF || preamble == WIFI_PREAMBLE_NONE)
323
          {
324
            uint8_t mcsRate = 0;
325
            uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
326
            uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
327
            
328
            mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX;
329
            mcsRate = rate - 128;
330
            
331
            mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH;
332
            if (txvector.GetMode ().GetBandwidth () == 40000000)
333
              {
334
                mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40;
335
              }
336
              
337
            mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL;
338
            if (txvector.IsShortGuardInterval ())
339
              {
340
                mcsFlags |= RadiotapHeader::MCS_FLAGS_GUARD_INTERVAL;
341
              }
342
343
            mcsKnown |= RadiotapHeader::MCS_KNOWN_HT_FORMAT;
344
            if (preamble == WIFI_PREAMBLE_HT_GF)
345
              {
346
                mcsFlags |= RadiotapHeader::MCS_FLAGS_HT_GREENFIELD;
347
              }
348
              
349
            mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS;
350
            if (txvector.GetNess () & 0x01) //bit 1
351
              {
352
                mcsFlags |= RadiotapHeader::MCS_FLAGS_NESS_BIT_0;
353
              }
354
            if (txvector.GetNess () & 0x02) //bit 2
355
              {
356
                mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS_BIT_1;
357
              }
358
              
359
            mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; //TODO
360
              
361
            mcsKnown |= RadiotapHeader::MCS_KNOWN_STBC;
362
            if (txvector.IsStbc ())
363
              {
364
                mcsFlags |= RadiotapHeader::MCS_FLAGS_STBC_STREAMS;
365
              }
366
              
367
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
368
          }
369
        
370
        if (txvector.IsAggregation ())
371
          {
372
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
373
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
374
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
375
            if (aMpdu.packetType == 2)
376
              {
377
               ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
378
              }
379
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
380
            AmpduSubframeHeader hdr;
381
            uint32_t extractedLength;
382
            p->RemoveHeader (hdr);
383
            extractedLength = hdr.GetLength ();
384
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
385
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
386
          }
387
388
        p->AddHeader (header);
389
        file->Write (Simulator::Now (), p);
390
        return;
391
      }
392
    default:
393
      NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
394
    }
395
}
396
397
static void
398
PcapSniffRxEvent (
399
  Ptr<PcapFileWrapper> file,
400
  Ptr<const Packet>    packet,
401
  uint16_t             channelFreqMhz,
402
  uint16_t             channelNumber,
403
  uint32_t             rate,
404
  WifiPreamble         preamble,
405
  WifiTxVector         txvector,
406
  struct mpduInfo      aMpdu,
407
  struct snrDbm        snr)
408
{
409
  uint32_t dlt = file->GetDataLinkType ();
410
411
  switch (dlt)
412
    {
413
    case PcapHelper::DLT_IEEE802_11:
414
      file->Write (Simulator::Now (), packet);
415
      return;
416
    case PcapHelper::DLT_PRISM_HEADER:
417
      {
418
        NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
419
        return;
420
      }
421
    case PcapHelper::DLT_IEEE802_11_RADIO:
422
      {
423
        Ptr<Packet> p = packet->Copy ();
424
        RadiotapHeader header;
425
        uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
426
        header.SetTsft (Simulator::Now ().GetMicroSeconds ());
427
428
        //Our capture includes the FCS, so we set the flag to say so.
429
        frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
430
431
        if (preamble == WIFI_PREAMBLE_SHORT)
282
          {
432
          {
283
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
433
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
284
          }
434
          }
 Lines 317-407    Link Here 
317
467
318
        header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
468
        header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
319
469
320
        p->AddHeader (header);
470
        header.SetAntennaSignalPower (snr.signal);
321
        file->Write (Simulator::Now (), p);
471
        header.SetAntennaNoisePower (snr.noise);
322
        return;
472
        
323
      }
473
        if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF || preamble == WIFI_PREAMBLE_NONE)
324
    default:
474
          {
325
      NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
475
            uint8_t mcsRate = 0;
326
    }
476
            uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
327
}
477
            uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
478
            
479
            mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX;
480
            mcsRate = rate - 128;
481
            
482
            mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH;
483
            if (txvector.GetMode ().GetBandwidth () == 40000000)
484
              {
485
                mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40;
486
              }
487
              
488
            mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL;
489
            if (txvector.IsShortGuardInterval ())
490
              {
491
                mcsFlags |= RadiotapHeader::MCS_FLAGS_GUARD_INTERVAL;
492
              }
328
493
329
static void
494
            mcsKnown |= RadiotapHeader::MCS_KNOWN_HT_FORMAT;
330
PcapSniffRxEvent (
495
            if (preamble == WIFI_PREAMBLE_HT_GF)
331
  Ptr<PcapFileWrapper> file,
496
              {
332
  Ptr<const Packet>    packet,
497
                mcsFlags |= RadiotapHeader::MCS_FLAGS_HT_GREENFIELD;
333
  uint16_t             channelFreqMhz,
498
              }
334
  uint16_t             channelNumber,
499
              
335
  uint32_t             rate,
500
            mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS;
336
  bool                 isShortPreamble,
501
            if (txvector.GetNess () & 0x01) //bit 1
337
  WifiTxVector         txvector,
502
              {
338
  double               signalDbm,
503
                mcsFlags |= RadiotapHeader::MCS_FLAGS_NESS_BIT_0;
339
  double               noiseDbm)
504
              }
340
{
505
            if (txvector.GetNess () & 0x02) //bit 2
341
  uint32_t dlt = file->GetDataLinkType ();
506
              {
342
507
                mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS_BIT_1;
343
  switch (dlt)
508
              }
344
    {
509
              
345
    case PcapHelper::DLT_IEEE802_11:
510
            mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; //TODO
346
      file->Write (Simulator::Now (), packet);
511
              
347
      return;
512
            mcsKnown |= RadiotapHeader::MCS_KNOWN_STBC;
348
    case PcapHelper::DLT_PRISM_HEADER:
513
            if (txvector.IsStbc ())
349
      {
514
              {
350
        NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
515
                mcsFlags |= RadiotapHeader::MCS_FLAGS_STBC_STREAMS;
351
        return;
516
              }
352
      }
517
            
353
    case PcapHelper::DLT_IEEE802_11_RADIO:
518
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
354
      {
519
          }
355
        Ptr<Packet> p = packet->Copy ();
520
        
356
        RadiotapHeader header;
521
        if (txvector.IsAggregation())
357
        uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
358
        header.SetTsft (Simulator::Now ().GetMicroSeconds ());
359
360
        //Our capture includes the FCS, so we set the flag to say so.
361
        frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
362
363
        if (isShortPreamble)
364
          {
522
          {
365
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
523
            uint16_t ampduStatus_Flags = 0;
524
            ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
525
            ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
526
            if (aMpdu.packetType == 2)
527
              {
528
                ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST;
529
              }
530
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
531
            AmpduSubframeHeader hdr;
532
            uint32_t extractedLength;
533
            p->RemoveHeader (hdr);
534
            extractedLength = hdr.GetLength ();
535
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
536
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatus_Flags, hdr.GetCrc ());
366
          }
537
          }
367
538
368
        if (txvector.IsShortGuardInterval ())
369
          {
370
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
371
          }
372
373
        header.SetFrameFlags (frameFlags);
374
        header.SetRate (rate);
375
376
        uint16_t channelFlags = 0;
377
        switch (rate)
378
          {
379
          case 2:  //1Mbps
380
          case 4:  //2Mbps
381
          case 10: //5Mbps
382
          case 22: //11Mbps
383
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
384
            break;
385
386
          default:
387
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
388
            break;
389
          }
390
391
        if (channelFreqMhz < 2500)
392
          {
393
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;
394
          }
395
        else
396
          {
397
            channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;
398
          }
399
400
        header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
401
402
        header.SetAntennaSignalPower (signalDbm);
403
        header.SetAntennaNoisePower (noiseDbm);
404
405
        p->AddHeader (header);
539
        p->AddHeader (header);
406
        file->Write (Simulator::Now (), p);
540
        file->Write (Simulator::Now (), p);
407
        return;
541
        return;
(-)a/src/wifi/model/aarf-wifi-manager.cc (-2 / +2 lines)
 Lines 232-238    Link Here 
232
{
232
{
233
  NS_LOG_FUNCTION (this << st << size);
233
  NS_LOG_FUNCTION (this << st << size);
234
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
234
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
235
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
235
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
236
}
236
}
237
237
238
WifiTxVector
238
WifiTxVector
 Lines 242-248    Link Here 
242
  /// \todo we could/should implement the Aarf algorithm for
242
  /// \todo we could/should implement the Aarf algorithm for
243
  /// RTS only by picking a single rate within the BasicRateSet.
243
  /// RTS only by picking a single rate within the BasicRateSet.
244
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
244
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
245
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
245
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
246
}
246
}
247
247
248
bool
248
bool
(-)a/src/wifi/model/aarfcd-wifi-manager.cc (-2 / +2 lines)
 Lines 304-310    Link Here 
304
{
304
{
305
  NS_LOG_FUNCTION (this << st << size);
305
  NS_LOG_FUNCTION (this << st << size);
306
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
306
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
307
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
307
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
308
}
308
}
309
WifiTxVector
309
WifiTxVector
310
AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
310
AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
 Lines 313-319    Link Here 
313
  /// \todo we could/should implement the Aarf algorithm for
313
  /// \todo we could/should implement the Aarf algorithm for
314
  /// RTS only by picking a single rate within the BasicRateSet.
314
  /// RTS only by picking a single rate within the BasicRateSet.
315
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
315
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
316
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
316
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
317
}
317
}
318
318
319
bool
319
bool
(-)a/src/wifi/model/amrr-wifi-manager.cc (-2 / +2 lines)
 Lines 336-342    Link Here 
336
        }
336
        }
337
    }
337
    }
338
338
339
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
339
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
340
}
340
}
341
341
342
WifiTxVector
342
WifiTxVector
 Lines 346-352    Link Here 
346
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
346
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
347
  UpdateMode (station);
347
  UpdateMode (station);
348
  /// \todo can we implement something smarter ?
348
  /// \todo can we implement something smarter ?
349
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
349
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
350
}
350
}
351
351
352
bool
352
bool
(-)a/src/wifi/model/aparf-wifi-manager.cc (-2 / +2 lines)
 Lines 322-328    Link Here 
322
  NS_LOG_FUNCTION (this << st << size);
322
  NS_LOG_FUNCTION (this << st << size);
323
  AparfWifiRemoteStation *station = (AparfWifiRemoteStation *) st;
323
  AparfWifiRemoteStation *station = (AparfWifiRemoteStation *) st;
324
  CheckInit (station);
324
  CheckInit (station);
325
  return WifiTxVector (GetSupported (station, station->m_rate), station->m_power, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
325
  return WifiTxVector (GetSupported (station, station->m_rate), station->m_power, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetAggregation (station), GetStbc (station));
326
}
326
}
327
327
328
WifiTxVector
328
WifiTxVector
 Lines 332-338    Link Here 
332
  /// \todo we could/should implement the Arf algorithm for
332
  /// \todo we could/should implement the Arf algorithm for
333
  /// RTS only by picking a single rate within the BasicRateSet.
333
  /// RTS only by picking a single rate within the BasicRateSet.
334
  AparfWifiRemoteStation *station = (AparfWifiRemoteStation *) st;
334
  AparfWifiRemoteStation *station = (AparfWifiRemoteStation *) st;
335
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
335
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetAggregation (station), GetStbc (station));
336
}
336
}
337
337
338
bool
338
bool
(-)a/src/wifi/model/arf-wifi-manager.cc (-2 / +2 lines)
 Lines 208-214    Link Here 
208
{
208
{
209
  NS_LOG_FUNCTION (this << st << size);
209
  NS_LOG_FUNCTION (this << st << size);
210
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
210
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
211
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
211
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
212
}
212
}
213
213
214
WifiTxVector
214
WifiTxVector
 Lines 218-224    Link Here 
218
  /// \todo we could/should implement the Arf algorithm for
218
  /// \todo we could/should implement the Arf algorithm for
219
  /// RTS only by picking a single rate within the BasicRateSet.
219
  /// RTS only by picking a single rate within the BasicRateSet.
220
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
220
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
221
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
221
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
222
}
222
}
223
223
224
bool
224
bool
(-)a/src/wifi/model/cara-wifi-manager.cc (-2 / +2 lines)
 Lines 183-189    Link Here 
183
{
183
{
184
  NS_LOG_FUNCTION (this << st << size);
184
  NS_LOG_FUNCTION (this << st << size);
185
  CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
185
  CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
186
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
186
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
187
}
187
}
188
188
189
WifiTxVector
189
WifiTxVector
 Lines 192-198    Link Here 
192
  NS_LOG_FUNCTION (this << st);
192
  NS_LOG_FUNCTION (this << st);
193
  /// \todo we could/should implement the Arf algorithm for
193
  /// \todo we could/should implement the Arf algorithm for
194
  /// RTS only by picking a single rate within the BasicRateSet.
194
  /// RTS only by picking a single rate within the BasicRateSet.
195
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
195
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetAggregation (st), GetStbc (st));
196
}
196
}
197
197
198
bool
198
bool
(-)a/src/wifi/model/constant-rate-wifi-manager.cc (-2 / +2 lines)
 Lines 117-130    Link Here 
117
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
117
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
118
{
118
{
119
  NS_LOG_FUNCTION (this << st << size);
119
  NS_LOG_FUNCTION (this << st << size);
120
  return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
120
  return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetAggregation (st), GetStbc (st));
121
}
121
}
122
122
123
WifiTxVector
123
WifiTxVector
124
ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
124
ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
125
{
125
{
126
  NS_LOG_FUNCTION (this << st);
126
  NS_LOG_FUNCTION (this << st);
127
  return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
127
  return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetAggregation (st), GetStbc (st));
128
}
128
}
129
129
130
bool
130
bool
(-)a/src/wifi/model/ideal-wifi-manager.cc (-2 / +2 lines)
 Lines 169-175    Link Here 
169
          maxMode = mode;
169
          maxMode = mode;
170
        }
170
        }
171
    }
171
    }
172
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
172
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
173
}
173
}
174
174
175
WifiTxVector
175
WifiTxVector
 Lines 192-198    Link Here 
192
          maxMode = mode;
192
          maxMode = mode;
193
        }
193
        }
194
    }
194
    }
195
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
195
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
196
}
196
}
197
197
198
bool
198
bool
(-)a/src/wifi/model/mac-low.cc (-6 / +12 lines)
 Lines 366-372    Link Here 
366
    m_listener (0),
366
    m_listener (0),
367
    m_phyMacLowListener (0),
367
    m_phyMacLowListener (0),
368
    m_ctsToSelfSupported (false),
368
    m_ctsToSelfSupported (false),
369
    m_receivedAtLeastOneMpdu (false)
369
    m_receivedAtLeastOneMpdu (false),
370
    m_mpduReferenceNumber (0)
370
{
371
{
371
  NS_LOG_FUNCTION (this);
372
  NS_LOG_FUNCTION (this);
372
  m_lastNavDuration = Seconds (0);
373
  m_lastNavDuration = Seconds (0);
 Lines 1556-1562    Link Here 
1556
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1557
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1557
  if (!m_ampdu || hdr->IsRts ())
1558
  if (!m_ampdu || hdr->IsRts ())
1558
    {
1559
    {
1559
      m_phy->SendPacket (packet, txVector, preamble, 0);
1560
      m_phy->SendPacket (packet, txVector, preamble, 0, 0);
1560
    }
1561
    }
1561
  else
1562
  else
1562
    {
1563
    {
 Lines 1571-1576    Link Here 
1571
      AmpduTag ampdutag;
1572
      AmpduTag ampdutag;
1572
      ampdutag.SetAmpdu (true);
1573
      ampdutag.SetAmpdu (true);
1573
      Time delay = Seconds (0);
1574
      Time delay = Seconds (0);
1575
      if (queueSize > 1)
1576
        {
1577
          txVector.SetAggregation (true);
1578
        }
1574
      for (; queueSize > 0; queueSize--)
1579
      for (; queueSize > 0; queueSize--)
1575
        {
1580
        {
1576
          dequeuedPacket = m_aggregateQueue->Dequeue (&newHdr);
1581
          dequeuedPacket = m_aggregateQueue->Dequeue (&newHdr);
 Lines 1591-1601    Link Here 
1591
            {
1596
            {
1592
              NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1597
              NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1593
              packetType = 1;
1598
              packetType = 1;
1594
              m_phy->SendPacket (newPacket, txVector, preamble, packetType);
1599
              m_phy->SendPacket (newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1595
            }
1600
            }
1596
          else
1601
          else
1597
            {
1602
            {
1598
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType);
1603
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1599
            }
1604
            }
1600
          if (queueSize > 1)
1605
          if (queueSize > 1)
1601
            {
1606
            {
 Lines 1603-1616    Link Here 
1603
            }
1608
            }
1604
          preamble = WIFI_PREAMBLE_NONE;
1609
          preamble = WIFI_PREAMBLE_NONE;
1605
        }
1610
        }
1611
        m_mpduReferenceNumber = ((m_mpduReferenceNumber + 1) % 4294967296);
1606
    }
1612
    }
1607
}
1613
}
1608
1614
1609
void
1615
void
1610
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
1616
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
1611
{
1617
{
1612
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1618
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1613
  m_phy->SendPacket (packet, txVector, preamble, packetType);
1619
  m_phy->SendPacket (packet, txVector, preamble, packetType, mpduReferenceNumber);
1614
}
1620
}
1615
1621
1616
void
1622
void
(-)a/src/wifi/model/mac-low.h (-1 / +4 lines)
 Lines 886-893    Link Here 
886
   * \param hdr
886
   * \param hdr
887
   * \param txVector
887
   * \param txVector
888
   * \param preamble
888
   * \param preamble
889
   * \param packetType
890
   * \param mpduReferenceNumber
889
   */
891
   */
890
  void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType);
892
  void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
891
  /**
893
  /**
892
   * Return a TXVECTOR for the RTS frame given the destination.
894
   * Return a TXVECTOR for the RTS frame given the destination.
893
   * The function consults WifiRemoteStationManager, which controls the rate
895
   * The function consults WifiRemoteStationManager, which controls the rate
 Lines 1367-1372    Link Here 
1367
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1369
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1368
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1370
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1369
  std::vector<Item> m_txPackets;      //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
1371
  std::vector<Item> m_txPackets;      //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
1372
  uint32_t m_mpduReferenceNumber;       //!< A-MPDU reference number to identify all subframes belonging to the same A-MPDU
1370
};
1373
};
1371
1374
1372
} //namespace ns3
1375
} //namespace ns3
(-)a/src/wifi/model/minstrel-wifi-manager.cc (-2 / +2 lines)
 Lines 482-488    Link Here 
482
      station->m_txrate = m_nsupported / 2;
482
      station->m_txrate = m_nsupported / 2;
483
    }
483
    }
484
  UpdateStats (station);
484
  UpdateStats (station);
485
  return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
485
  return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
486
}
486
}
487
487
488
WifiTxVector
488
WifiTxVector
 Lines 491-497    Link Here 
491
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
491
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
492
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
492
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
493
493
494
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
494
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
495
}
495
}
496
496
497
bool
497
bool
(-)a/src/wifi/model/onoe-wifi-manager.cc (-2 / +2 lines)
 Lines 278-284    Link Here 
278
          rateIndex = station->m_txrate;
278
          rateIndex = station->m_txrate;
279
        }
279
        }
280
    }
280
    }
281
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
281
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
282
}
282
}
283
283
284
WifiTxVector
284
WifiTxVector
 Lines 287-293    Link Here 
287
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
287
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
288
  UpdateMode (station);
288
  UpdateMode (station);
289
  /// \todo can we implement something smarter ?
289
  /// \todo can we implement something smarter ?
290
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
290
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
291
}
291
}
292
292
293
bool
293
bool
(-)a/src/wifi/model/parf-wifi-manager.cc (-2 / +2 lines)
 Lines 294-300    Link Here 
294
  NS_LOG_FUNCTION (this << st << size);
294
  NS_LOG_FUNCTION (this << st << size);
295
  ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
295
  ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
296
  CheckInit (station);
296
  CheckInit (station);
297
  return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
297
  return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetAggregation (station), GetStbc (station));
298
}
298
}
299
299
300
WifiTxVector
300
WifiTxVector
 Lines 304-310    Link Here 
304
  /// \todo we could/should implement the Arf algorithm for
304
  /// \todo we could/should implement the Arf algorithm for
305
  /// RTS only by picking a single rate within the BasicRateSet.
305
  /// RTS only by picking a single rate within the BasicRateSet.
306
  ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
306
  ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
307
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
307
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetAggregation (station), GetStbc (station));
308
}
308
}
309
309
310
bool
310
bool
(-)a/src/wifi/model/rraa-wifi-manager.cc (-2 / +2 lines)
 Lines 290-302    Link Here 
290
    {
290
    {
291
      ResetCountersBasic (station);
291
      ResetCountersBasic (station);
292
    }
292
    }
293
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
293
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetAggregation (station), GetStbc (station));
294
}
294
}
295
295
296
WifiTxVector
296
WifiTxVector
297
RraaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
297
RraaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
298
{
298
{
299
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
299
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetAggregation (st), GetStbc (st));
300
}
300
}
301
301
302
bool
302
bool
(-)a/src/wifi/model/wifi-phy.cc (-4 / +4 lines)
 Lines 592-606    Link Here 
592
}
592
}
593
593
594
void
594
void
595
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, double signalDbm, double noiseDbm)
595
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txvector, struct mpduInfo aMpdu, struct snrDbm snr)
596
{
596
{
597
  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, signalDbm, noiseDbm);
597
  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txvector, aMpdu, snr);
598
}
598
}
599
599
600
void
600
void
601
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector)
601
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txvector, struct mpduInfo aMpdu)
602
{
602
{
603
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector);
603
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txvector, aMpdu);
604
}
604
}
605
605
606
606
(-)a/src/wifi/model/wifi-phy.h (-21 / +38 lines)
 Lines 38-43    Link Here 
38
class WifiChannel;
38
class WifiChannel;
39
class NetDevice;
39
class NetDevice;
40
40
41
struct snrDbm
42
{
43
  double signal;
44
  double noise;
45
};
46
47
struct mpduInfo
48
{
49
  uint8_t packetType;
50
  uint32_t referenceNumber;
51
};
52
41
/**
53
/**
42
 * \brief receive notifications about phy events.
54
 * \brief receive notifications about phy events.
43
 */
55
 */
 Lines 209-216    Link Here 
209
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
221
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
210
   * \param preamble the type of preamble to use to send this packet.
222
   * \param preamble the type of preamble to use to send this packet.
211
   * \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
223
   * \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
224
   * \param mpduReferenceNumber the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
212
   */
225
   */
213
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txvector, enum WifiPreamble preamble, uint8_t packetType) = 0;
226
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txvector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber) = 0;
214
227
215
  /**
228
  /**
216
   * \param listener the new listener
229
   * \param listener the new listener
 Lines 997-1011    Link Here 
997
   * \param channelNumber the channel on which the packet is received
1010
   * \param channelNumber the channel on which the packet is received
998
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1011
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
999
   *        units used both for the radiotap and for the prism header)
1012
   *        units used both for the radiotap and for the prism header)
1000
   * \param isShortPreamble true if short preamble is used, false otherwise
1013
   * \param preamble the preamble of the packet
1001
   * \param txVector the txvector that holds rx parameters
1014
   * \param txVector the txvector that holds rx parameters
1002
   * \param signalDbm signal power in dBm
1015
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1003
   * \param noiseDbm  noise power in dBm
1016
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1017
   * \param snr signal power and noise power in dBm
1004
   */
1018
   */
1005
  void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1019
  void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1006
                             uint16_t channelNumber, uint32_t rate,
1020
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1007
                             bool isShortPreamble, WifiTxVector txvector,
1021
                             WifiTxVector txvector, struct mpduInfo aMpdu, struct snrDbm snr);
1008
                             double signalDbm, double noiseDbm);
1009
1022
1010
  /**
1023
  /**
1011
   * TracedCallback signature for monitor mode receive events.
1024
   * TracedCallback signature for monitor mode receive events.
 Lines 1022-1036    Link Here 
1022
   * \param channelNumber the channel on which the packet is received
1035
   * \param channelNumber the channel on which the packet is received
1023
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1036
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1024
   *        units used both for the radiotap and for the prism header)
1037
   *        units used both for the radiotap and for the prism header)
1025
   * \param isShortPreamble true if short preamble is used, false otherwise
1038
   * \param preamble the preamble of the packet
1026
   * \param txVector the txvector that holds rx parameters
1039
   * \param txVector the txvector that holds rx parameters
1027
   * \param signalDbm signal power in dBm
1040
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1028
   * \param noiseDbm noise power in dBm
1041
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1042
   * \param snr signal power and noise power in dBm
1029
   */
1043
   */
1030
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
1044
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
1031
                                            uint16_t channelNumber, uint32_t rate,
1045
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1032
                                            bool isShortPreamble, WifiTxVector txvector,
1046
                                            WifiTxVector txvector, struct mpduInfo aMpdu, struct snrDbm snr);
1033
                                            double signalDbm, double noiseDbm);
1034
1047
1035
  /**
1048
  /**
1036
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
1049
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
 Lines 1042-1053    Link Here 
1042
   * \param channelNumber the channel on which the packet is transmitted
1055
   * \param channelNumber the channel on which the packet is transmitted
1043
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1056
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1044
   *        units used both for the radiotap and for the prism header)
1057
   *        units used both for the radiotap and for the prism header)
1045
   * \param isShortPreamble true if short preamble is used, false otherwise
1058
   * \param preamble the preamble of the packet
1046
   * \param txVector the txvector that holds tx parameters
1059
   * \param txVector the txvector that holds tx parameters
1060
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1061
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1047
   */
1062
   */
1048
  void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1063
  void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1049
                             uint16_t channelNumber, uint32_t rate,
1064
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1050
                             bool isShortPreamble, WifiTxVector txvector);
1065
                             WifiTxVector txvector, struct mpduInfo aMpdu);
1051
1066
1052
  /**
1067
  /**
1053
   * TracedCallback signature for monitor mode transmit events.
1068
   * TracedCallback signature for monitor mode transmit events.
 Lines 1058-1069    Link Here 
1058
   * \param channelNumber the channel on which the packet is transmitted
1073
   * \param channelNumber the channel on which the packet is transmitted
1059
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1074
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1060
   *        units used both for the radiotap and for the prism header)
1075
   *        units used both for the radiotap and for the prism header)
1061
   * \param isShortPreamble true if short preamble is used, false otherwise
1076
   * \param preamble the preamble of the packet
1062
   * \param txVector the txvector that holds tx parameters
1077
   * \param txVector the txvector that holds tx parameters
1078
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1079
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1063
   */
1080
   */
1064
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
1081
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
1065
                                            uint16_t channelNumber, uint32_t rate,
1082
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1066
                                            bool isShortPreamble, WifiTxVector txvector);
1083
                                            WifiTxVector txvector, struct mpduInfo aMpdu);
1067
1084
1068
  /**
1085
  /**
1069
   * Assign a fixed random variable stream number to the random variables
1086
   * Assign a fixed random variable stream number to the random variables
 Lines 1199-1205    Link Here 
1199
   *
1216
   *
1200
   * \see class CallBackTraceSource
1217
   * \see class CallBackTraceSource
1201
   */
1218
   */
1202
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, double, double> m_phyMonitorSniffRxTrace;
1219
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo, struct snrDbm> m_phyMonitorSniffRxTrace;
1203
1220
1204
  /**
1221
  /**
1205
   * A trace source that emulates a wifi device in monitor mode
1222
   * A trace source that emulates a wifi device in monitor mode
 Lines 1211-1217    Link Here 
1211
   *
1228
   *
1212
   * \see class CallBackTraceSource
1229
   * \see class CallBackTraceSource
1213
   */
1230
   */
1214
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, WifiTxVector> m_phyMonitorSniffTxTrace;
1231
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo> m_phyMonitorSniffTxTrace;
1215
1232
1216
  uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1233
  uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1217
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1234
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
(-)a/src/wifi/model/wifi-remote-station-manager.cc (+8 lines)
 Lines 661-666    Link Here 
661
                       m_wifiPhy->GetGuardInterval (),
661
                       m_wifiPhy->GetGuardInterval (),
662
                       GetNumberOfTransmitAntennas (),
662
                       GetNumberOfTransmitAntennas (),
663
                       GetNumberOfTransmitAntennas (),
663
                       GetNumberOfTransmitAntennas (),
664
                       false,
664
                       false);
665
                       false);
665
}
666
}
666
667
 Lines 1271-1276    Link Here 
1271
  state->m_rx = 1;
1272
  state->m_rx = 1;
1272
  state->m_tx = 1;
1273
  state->m_tx = 1;
1273
  state->m_ness = 0;
1274
  state->m_ness = 0;
1275
  state->m_aggregation = false;
1274
  state->m_stbc = false;
1276
  state->m_stbc = false;
1275
  const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state);
1277
  const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state);
1276
  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
1278
  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
 Lines 1488-1493    Link Here 
1488
}
1490
}
1489
1491
1490
bool
1492
bool
1493
WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) const
1494
{
1495
  return station->m_state->m_aggregation;
1496
}
1497
1498
bool
1491
WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const
1499
WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const
1492
{
1500
{
1493
  return station->m_state->m_stbc;
1501
  return station->m_state->m_stbc;
(-)a/src/wifi/model/wifi-remote-station-manager.h (+10 lines)
 Lines 636-641    Link Here 
636
   */
636
   */
637
  bool GetShortGuardInterval (const WifiRemoteStation *station) const;
637
  bool GetShortGuardInterval (const WifiRemoteStation *station) const;
638
  /**
638
  /**
639
   * Return whether the given station supports A-MPDU.
640
   *
641
   * \param station the station being queried
642
   *
643
   * \return true if the station supports MPDU aggregation,
644
   *         false otherwise
645
   */
646
  bool GetAggregation (const WifiRemoteStation *station) const;
647
  /**
639
   * Return whether the given station supports space-time block coding (STBC).
648
   * Return whether the given station supports space-time block coding (STBC).
640
   *
649
   *
641
   * \param station the station being queried
650
   * \param station the station being queried
 Lines 1049-1054    Link Here 
1049
  uint32_t m_tx;              //!< Number of TX antennas of the remote station
1058
  uint32_t m_tx;              //!< Number of TX antennas of the remote station
1050
  uint32_t m_ness;            //!< Number of streams in beamforming of the remote station
1059
  uint32_t m_ness;            //!< Number of streams in beamforming of the remote station
1051
  bool m_stbc;                //!< Flag if STBC is used by the remote station
1060
  bool m_stbc;                //!< Flag if STBC is used by the remote station
1061
  bool m_aggregation;         //!< Flag if MPDU aggregation is used by the remote station
1052
  bool m_greenfield;          //!< Flag if green field is used by the remote station
1062
  bool m_greenfield;          //!< Flag if green field is used by the remote station
1053
};
1063
};
1054
1064
(-)a/src/wifi/model/wifi-tx-vector.cc (-1 / +17 lines)
 Lines 29-34    Link Here 
29
    m_shortGuardInterval (false),
29
    m_shortGuardInterval (false),
30
    m_nss (1),
30
    m_nss (1),
31
    m_ness (0),
31
    m_ness (0),
32
    m_aggregation (false),
32
    m_stbc (false),
33
    m_stbc (false),
33
    m_modeInitialized (false),
34
    m_modeInitialized (false),
34
    m_txPowerLevelInitialized (false)
35
    m_txPowerLevelInitialized (false)
 Lines 36-48    Link Here 
36
}
37
}
37
38
38
WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries,
39
WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries,
39
                            bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc)
40
                            bool shortGuardInterval, uint8_t nss, uint8_t ness,
41
                            bool aggregation, bool stbc)
40
  : m_mode (mode),
42
  : m_mode (mode),
41
    m_txPowerLevel (powerLevel),
43
    m_txPowerLevel (powerLevel),
42
    m_retries (retries),
44
    m_retries (retries),
43
    m_shortGuardInterval (shortGuardInterval),
45
    m_shortGuardInterval (shortGuardInterval),
44
    m_nss (nss),
46
    m_nss (nss),
45
    m_ness (ness),
47
    m_ness (ness),
48
    m_aggregation (aggregation),
46
    m_stbc (stbc),
49
    m_stbc (stbc),
47
    m_modeInitialized (true),
50
    m_modeInitialized (true),
48
    m_txPowerLevelInitialized (true)
51
    m_txPowerLevelInitialized (true)
 Lines 94-99    Link Here 
94
}
97
}
95
98
96
bool
99
bool
100
WifiTxVector::IsAggregation (void) const
101
{
102
  return m_aggregation;
103
}
104
105
bool
97
WifiTxVector::IsStbc (void) const
106
WifiTxVector::IsStbc (void) const
98
{
107
{
99
  return m_stbc;
108
  return m_stbc;
 Lines 138-143    Link Here 
138
}
147
}
139
148
140
void
149
void
150
WifiTxVector::SetAggregation (bool aggregation)
151
{
152
  m_aggregation = aggregation;
153
}
154
155
void
141
WifiTxVector::SetStbc (bool stbc)
156
WifiTxVector::SetStbc (bool stbc)
142
{
157
{
143
  m_stbc = stbc;
158
  m_stbc = stbc;
 Lines 151-156    Link Here 
151
    " Short GI: " << v.IsShortGuardInterval () <<
166
    " Short GI: " << v.IsShortGuardInterval () <<
152
    " Nss: " << (uint32_t)v.GetNss () <<
167
    " Nss: " << (uint32_t)v.GetNss () <<
153
    " Ness: " << (uint32_t)v.GetNess () <<
168
    " Ness: " << (uint32_t)v.GetNess () <<
169
    " MPDU aggregation" << v.IsAggregation () <<
154
    " STBC: " << v.IsStbc ();
170
    " STBC: " << v.IsStbc ();
155
  return os;
171
  return os;
156
}
172
}
(-)a/src/wifi/model/wifi-tx-vector.h (-1 / +21 lines)
 Lines 73-79    Link Here 
73
   * \param ness the number of extension spatial streams (NESS)
73
   * \param ness the number of extension spatial streams (NESS)
74
   * \param stbc enable or disable STBC
74
   * \param stbc enable or disable STBC
75
   */
75
   */
76
  WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc);
76
  WifiTxVector (WifiMode mode,
77
                uint8_t powerLevel,
78
                uint8_t retries,
79
                bool shortGuardInterval,
80
                uint8_t nss,
81
                uint8_t ness,
82
                bool aggregation,
83
                bool stbc);
77
  /**
84
  /**
78
   * \returns the txvector payload mode
85
   * \returns the txvector payload mode
79
   */
86
   */
 Lines 135-140    Link Here 
135
   */
142
   */
136
  void SetNess (uint8_t ness);
143
  void SetNess (uint8_t ness);
137
  /**
144
  /**
145
   * Checks whether the PSDU contains A-MPDU.
146
   *  \returns true if this PSDU has A-MPDU aggregation,
147
   *           false otherwise.
148
   */
149
  bool IsAggregation (void) const;
150
  /**
151
   * Sets if PSDU contains A-MPDU.
152
   *
153
   * \param aggregated whether the PSDU contains A-MPDU or not.
154
   */
155
  void SetAggregation(bool aggregation);
156
  /**
138
   * Check if STBC is used or not
157
   * Check if STBC is used or not
139
   *
158
   *
140
   * \returns true if STBC is used,
159
   * \returns true if STBC is used,
 Lines 162-167    Link Here 
162
  bool     m_shortGuardInterval; /**< true if short GI is going to be used */
181
  bool     m_shortGuardInterval; /**< true if short GI is going to be used */
163
  uint8_t  m_nss;                /**< number of streams */
182
  uint8_t  m_nss;                /**< number of streams */
164
  uint8_t  m_ness;               /**< number of streams in beamforming */
183
  uint8_t  m_ness;               /**< number of streams in beamforming */
184
  bool     m_aggregation;        /** Flag whether the PSDU contains A-MPDU. */
165
  bool     m_stbc;               /**< STBC used or not */
185
  bool     m_stbc;               /**< STBC used or not */
166
186
167
  bool     m_modeInitialized;         //*< Internal initialization flag */
187
  bool     m_modeInitialized;         //*< Internal initialization flag */
(-)a/src/wifi/model/yans-wifi-channel.cc (-11 / +10 lines)
 Lines 27-33    Link Here 
27
#include "ns3/pointer.h"
27
#include "ns3/pointer.h"
28
#include "ns3/object-factory.h"
28
#include "ns3/object-factory.h"
29
#include "yans-wifi-channel.h"
29
#include "yans-wifi-channel.h"
30
#include "yans-wifi-phy.h"
31
#include "ns3/propagation-loss-model.h"
30
#include "ns3/propagation-loss-model.h"
32
#include "ns3/propagation-delay-model.h"
31
#include "ns3/propagation-delay-model.h"
33
32
 Lines 80-86    Link Here 
80
79
81
void
80
void
82
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
81
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
83
                       WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const
82
                       WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const
84
{
83
{
85
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
84
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
86
  NS_ASSERT (senderMobility != 0);
85
  NS_ASSERT (senderMobility != 0);
 Lines 112-135    Link Here 
112
              dstNode = dstNetDevice->GetObject<NetDevice> ()->GetNode ()->GetId ();
111
              dstNode = dstNetDevice->GetObject<NetDevice> ()->GetNode ()->GetId ();
113
            }
112
            }
114
113
115
          double *atts = new double[3];
114
          struct Parameters parameters;
116
          *atts = rxPowerDbm;
115
          parameters.rxPowerDbm = rxPowerDbm;
117
          *(atts + 1) = packetType;
116
          parameters.aMpdu = aMpdu;
118
          *(atts + 2) = duration.GetNanoSeconds ();
117
          parameters.duration = duration;
118
          parameters.txVector = txVector;
119
          parameters.preamble = preamble;
119
120
120
          Simulator::ScheduleWithContext (dstNode,
121
          Simulator::ScheduleWithContext (dstNode,
121
                                          delay, &YansWifiChannel::Receive, this,
122
                                          delay, &YansWifiChannel::Receive, this,
122
                                          j, copy, atts, txVector, preamble);
123
                                          j, copy, parameters);
123
        }
124
        }
124
    }
125
    }
125
}
126
}
126
127
127
void
128
void
128
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double *atts,
129
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, struct Parameters parameters) const
129
                          WifiTxVector txVector, WifiPreamble preamble) const
130
{
130
{
131
  m_phyList[i]->StartReceivePreambleAndHeader (packet, *atts, txVector, preamble, *(atts + 1), NanoSeconds (*(atts + 2)));
131
  m_phyList[i]->StartReceivePreambleAndHeader (packet, parameters.rxPowerDbm, parameters.txVector, parameters.preamble, parameters.aMpdu, parameters.duration);
132
  delete[] atts;
133
}
132
}
134
133
135
uint32_t
134
uint32_t
(-)a/src/wifi/model/yans-wifi-channel.h (-6 / +15 lines)
 Lines 28-33    Link Here 
28
#include "wifi-mode.h"
28
#include "wifi-mode.h"
29
#include "wifi-preamble.h"
29
#include "wifi-preamble.h"
30
#include "wifi-tx-vector.h"
30
#include "wifi-tx-vector.h"
31
#include "yans-wifi-phy.h"
31
#include "ns3/nstime.h"
32
#include "ns3/nstime.h"
32
33
33
namespace ns3 {
34
namespace ns3 {
 Lines 35-41    Link Here 
35
class NetDevice;
36
class NetDevice;
36
class PropagationLossModel;
37
class PropagationLossModel;
37
class PropagationDelayModel;
38
class PropagationDelayModel;
38
class YansWifiPhy;
39
40
struct Parameters
41
{
42
  double rxPowerDbm;
43
  struct mpduInfo aMpdu;
44
  Time duration;
45
  WifiTxVector txVector;
46
  WifiPreamble preamble;
47
};
39
48
40
/**
49
/**
41
 * \brief A Yans wifi channel
50
 * \brief A Yans wifi channel
 Lines 83-89    Link Here 
83
   * \param txPowerDbm the tx power associated to the packet
92
   * \param txPowerDbm the tx power associated to the packet
84
   * \param txVector the TXVECTOR associated to the packet
93
   * \param txVector the TXVECTOR associated to the packet
85
   * \param preamble the preamble associated to the packet
94
   * \param preamble the preamble associated to the packet
86
   * \param packetType the type of packet, used for A-MPDU to say whether it's the last MPDU or not
95
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
96
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
87
   * \param duration the transmission duration associated to the packet
97
   * \param duration the transmission duration associated to the packet
88
   *
98
   *
89
   * This method should not be invoked by normal users. It is
99
   * This method should not be invoked by normal users. It is
 Lines 92-98    Link Here 
92
   * e.g. PHYs that are operating on the same channel.
102
   * e.g. PHYs that are operating on the same channel.
93
   */
103
   */
94
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
104
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
95
             WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const;
105
             WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const;
96
106
97
  /**
107
  /**
98
   * Assign a fixed random variable stream number to the random variables
108
   * Assign a fixed random variable stream number to the random variables
 Lines 111-116    Link Here 
111
   * A vector of pointers to YansWifiPhy.
121
   * A vector of pointers to YansWifiPhy.
112
   */
122
   */
113
  typedef std::vector<Ptr<YansWifiPhy> > PhyList;
123
  typedef std::vector<Ptr<YansWifiPhy> > PhyList;
124
  
114
  /**
125
  /**
115
   * This method is scheduled by Send for each associated YansWifiPhy.
126
   * This method is scheduled by Send for each associated YansWifiPhy.
116
   * The method then calls the corresponding YansWifiPhy that the first
127
   * The method then calls the corresponding YansWifiPhy that the first
 Lines 122-130    Link Here 
122
   * \param txVector the TXVECTOR of the packet
133
   * \param txVector the TXVECTOR of the packet
123
   * \param preamble the type of preamble being used to send the packet
134
   * \param preamble the type of preamble being used to send the packet
124
   */
135
   */
125
  void Receive (uint32_t i, Ptr<Packet> packet, double *atts,
136
  void Receive (uint32_t i, Ptr<Packet> packet, struct Parameters parameters) const;
126
                WifiTxVector txVector, WifiPreamble preamble) const;
127
128
137
129
  PhyList m_phyList;                   //!< List of YansWifiPhys connected to this YansWifiChannel
138
  PhyList m_phyList;                   //!< List of YansWifiPhys connected to this YansWifiChannel
130
  Ptr<PropagationLossModel> m_loss;    //!< Propagation loss model
139
  Ptr<PropagationLossModel> m_loss;    //!< Propagation loss model
(-)a/src/wifi/model/yans-wifi-phy.cc (-16 / +18 lines)
 Lines 562-572    Link Here 
562
                                            double rxPowerDbm,
562
                                            double rxPowerDbm,
563
                                            WifiTxVector txVector,
563
                                            WifiTxVector txVector,
564
                                            enum WifiPreamble preamble,
564
                                            enum WifiPreamble preamble,
565
                                            uint8_t packetType, Time rxDuration)
565
                                            struct mpduInfo aMpdu, Time rxDuration)
566
{
566
{
567
  //This function should be later split to check separately wether plcp preamble and plcp header can be successfully received.
567
  //This function should be later split to check separately wether plcp preamble and plcp header can be successfully received.
568
  //Note: plcp preamble reception is not yet modeled.
568
  //Note: plcp preamble reception is not yet modeled.
569
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)packetType);
569
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
570
  AmpduTag ampduTag;
570
  AmpduTag ampduTag;
571
  rxPowerDbm += m_rxGainDb;
571
  rxPowerDbm += m_rxGainDb;
572
  double rxPowerW = DbmToW (rxPowerDbm);
572
  double rxPowerW = DbmToW (rxPowerDbm);
 Lines 674-685    Link Here 
674
            {
674
            {
675
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
675
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
676
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
676
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
677
                                                      packet, txVector, preamble, packetType, event);
677
                                                      packet, txVector, preamble, aMpdu, event);
678
            }
678
            }
679
679
680
          NS_ASSERT (m_endRxEvent.IsExpired ());
680
          NS_ASSERT (m_endRxEvent.IsExpired ());
681
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
681
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
682
                                              packet, preamble, packetType, event);
682
                                              packet, preamble, aMpdu, event);
683
        }
683
        }
684
      else
684
      else
685
        {
685
        {
 Lines 716-725    Link Here 
716
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
716
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
717
                                 WifiTxVector txVector,
717
                                 WifiTxVector txVector,
718
                                 enum WifiPreamble preamble,
718
                                 enum WifiPreamble preamble,
719
                                 uint8_t packetType,
719
                                 struct mpduInfo aMpdu,
720
                                 Ptr<InterferenceHelper::Event> event)
720
                                 Ptr<InterferenceHelper::Event> event)
721
{
721
{
722
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)packetType);
722
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
723
  NS_ASSERT (IsStateRx ());
723
  NS_ASSERT (IsStateRx ());
724
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
724
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
725
  AmpduTag ampduTag;
725
  AmpduTag ampduTag;
 Lines 753-759    Link Here 
753
}
753
}
754
754
755
void
755
void
756
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
756
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
757
{
757
{
758
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
758
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
759
  /* Transmission can happen if:
759
  /* Transmission can happen if:
 Lines 788-797    Link Here 
788
    {
788
    {
789
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate () * txVector.GetNss () / 500000;
789
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate () * txVector.GetNss () / 500000;
790
    }
790
    }
791
  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
791
  struct mpduInfo aMpdu;
792
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector);
792
  aMpdu.packetType = packetType;
793
  aMpdu.referenceNumber = mpduReferenceNumber;
794
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
793
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
795
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
794
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, packetType, txDuration);
796
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, aMpdu, txDuration);
795
}
797
}
796
798
797
uint32_t
799
uint32_t
 Lines 1079-1085    Link Here 
1079
}
1081
}
1080
1082
1081
void
1083
void
1082
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event)
1084
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event)
1083
{
1085
{
1084
  NS_LOG_FUNCTION (this << packet << event);
1086
  NS_LOG_FUNCTION (this << packet << event);
1085
  NS_ASSERT (IsStateRx ());
1087
  NS_ASSERT (IsStateRx ());
 Lines 1106-1115    Link Here 
1106
            {
1108
            {
1107
              dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector ().GetNss () / 500000;
1109
              dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector ().GetNss () / 500000;
1108
            }
1110
            }
1109
          bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
1111
          struct snrDbm snr;
1110
          double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
1112
          snr.signal = RatioToDb (event->GetRxPowerW ()) + 30;
1111
          double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1113
          snr.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1112
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, event->GetTxVector (), signalDbm, noiseDbm);
1114
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, snr);
1113
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1115
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1114
        }
1116
        }
1115
      else
1117
      else
 Lines 1125-1131    Link Here 
1125
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1127
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1126
    }
1128
    }
1127
1129
1128
  if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
1130
  if (preamble == WIFI_PREAMBLE_NONE && aMpdu.packetType == 2)
1129
    {
1131
    {
1130
      m_plcpSuccess = false;
1132
      m_plcpSuccess = false;
1131
    }
1133
    }
(-)a/src/wifi/model/yans-wifi-phy.h (-7 / +10 lines)
 Lines 105-118    Link Here 
105
   * \param rxPowerDbm the receive power in dBm
105
   * \param rxPowerDbm the receive power in dBm
106
   * \param txVector the TXVECTOR of the arriving packet
106
   * \param txVector the TXVECTOR of the arriving packet
107
   * \param preamble the preamble of the arriving packet
107
   * \param preamble the preamble of the arriving packet
108
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
108
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
109
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
109
   * \param rxDuration the duration needed for the reception of the packet
110
   * \param rxDuration the duration needed for the reception of the packet
110
   */
111
   */
111
  void StartReceivePreambleAndHeader (Ptr<Packet> packet,
112
  void StartReceivePreambleAndHeader (Ptr<Packet> packet,
112
                                      double rxPowerDbm,
113
                                      double rxPowerDbm,
113
                                      WifiTxVector txVector,
114
                                      WifiTxVector txVector,
114
                                      WifiPreamble preamble,
115
                                      WifiPreamble preamble,
115
                                      uint8_t packetType,
116
                                      struct mpduInfo aMpdu,
116
                                      Time rxDuration);
117
                                      Time rxDuration);
117
  /**
118
  /**
118
   * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
119
   * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
 Lines 120-132    Link Here 
120
   * \param packet the arriving packet
121
   * \param packet the arriving packet
121
   * \param txVector the TXVECTOR of the arriving packet
122
   * \param txVector the TXVECTOR of the arriving packet
122
   * \param preamble the preamble of the arriving packet
123
   * \param preamble the preamble of the arriving packet
123
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
124
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
125
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
124
   * \param event the corresponding event of the first time the packet arrives
126
   * \param event the corresponding event of the first time the packet arrives
125
   */
127
   */
126
  void StartReceivePacket (Ptr<Packet> packet,
128
  void StartReceivePacket (Ptr<Packet> packet,
127
                           WifiTxVector txVector,
129
                           WifiTxVector txVector,
128
                           WifiPreamble preamble,
130
                           WifiPreamble preamble,
129
                           uint8_t packetType,
131
                           struct mpduInfo aMpdu,
130
                           Ptr<InterferenceHelper::Event> event);
132
                           Ptr<InterferenceHelper::Event> event);
131
133
132
  /**
134
  /**
 Lines 277-283    Link Here 
277
279
278
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
280
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
279
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
281
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
280
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txvector, enum WifiPreamble preamble, uint8_t packetType);
282
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txvector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
281
  virtual void RegisterListener (WifiPhyListener *listener);
283
  virtual void RegisterListener (WifiPhyListener *listener);
282
  virtual void UnregisterListener (WifiPhyListener *listener);
284
  virtual void UnregisterListener (WifiPhyListener *listener);
283
  virtual void SetSleepMode (void);
285
  virtual void SetSleepMode (void);
 Lines 496-505    Link Here 
496
   *
498
   *
497
   * \param packet the packet that the last bit has arrived
499
   * \param packet the packet that the last bit has arrived
498
   * \param preamble the preamble of the arriving packet
500
   * \param preamble the preamble of the arriving packet
499
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
501
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
502
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
500
   * \param event the corresponding event of the first time the packet arrives
503
   * \param event the corresponding event of the first time the packet arrives
501
   */
504
   */
502
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
505
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event);
503
506
504
  bool     m_initialized;         //!< Flag for runtime initialization
507
  bool     m_initialized;         //!< Flag for runtime initialization
505
  double   m_edThresholdW;        //!< Energy detection threshold in watts
508
  double   m_edThresholdW;        //!< Energy detection threshold in watts

Return to bug 2096