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

(-)a/examples/wireless/power-adaptation-distance.cc (-1 / +2 lines)
 Lines 172-178    Link Here 
172
      WifiMode mode = phy->GetMode (i);
172
      WifiMode mode = phy->GetMode (i);
173
      WifiTxVector txVector;
173
      WifiTxVector txVector;
174
      txVector.SetMode (mode);
174
      txVector.SetMode (mode);
175
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode));
175
      txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
176
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, phy->GetFrequency ()), mode));
176
    }
177
    }
177
}
178
}
178
179
(-)a/examples/wireless/power-adaptation-interference.cc (-1 / +2 lines)
 Lines 168-174    Link Here 
168
      WifiMode mode = phy->GetMode (i);
168
      WifiMode mode = phy->GetMode (i);
169
      WifiTxVector txVector;
169
      WifiTxVector txVector;
170
      txVector.SetMode (mode);
170
      txVector.SetMode (mode);
171
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode));
171
      txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
172
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, phy->GetFrequency ()), mode));
172
    }
173
    }
173
}
174
}
174
175
(-)a/examples/wireless/wifi-spectrum-per-example.cc (-6 / +2 lines)
 Lines 89-106    Link Here 
89
double g_noiseDbmAvg;
89
double g_noiseDbmAvg;
90
uint32_t g_samples;
90
uint32_t g_samples;
91
uint16_t g_channelNumber;
91
uint16_t g_channelNumber;
92
uint32_t g_rate;
93
92
94
void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
93
void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
95
                     uint16_t channelNumber, uint32_t rate,
94
                     uint16_t channelNumber, WifiTxVector txVector,
96
                     WifiPreamble preamble, WifiTxVector txVector,
95
                     MpduInfo aMpdu, SignalNoiseDbm signalNoise)
97
                     struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
98
96
99
{
97
{
100
  g_samples++;
98
  g_samples++;
101
  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
99
  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
102
  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
100
  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
103
  g_rate = rate;
104
  g_channelNumber = channelNumber;
101
  g_channelNumber = channelNumber;
105
}
102
}
106
103
 Lines 523-529    Link Here 
523
      g_noiseDbmAvg = 0;
520
      g_noiseDbmAvg = 0;
524
      g_samples = 0;
521
      g_samples = 0;
525
      g_channelNumber = 0;
522
      g_channelNumber = 0;
526
      g_rate = 0;
527
523
528
      Simulator::Stop (Seconds (simulationTime + 1));
524
      Simulator::Stop (Seconds (simulationTime + 1));
529
      Simulator::Run ();
525
      Simulator::Run ();
(-)a/examples/wireless/wifi-spectrum-per-interference.cc (-6 / +2 lines)
 Lines 96-113    Link Here 
96
double g_noiseDbmAvg;
96
double g_noiseDbmAvg;
97
uint32_t g_samples;
97
uint32_t g_samples;
98
uint16_t g_channelNumber;
98
uint16_t g_channelNumber;
99
uint32_t g_rate;
100
99
101
void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
100
void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
102
                     uint16_t channelNumber, uint32_t rate,
101
                     uint16_t channelNumber, WifiTxVector txVector,
103
                     WifiPreamble preamble, WifiTxVector txVector,
102
                     MpduInfo aMpdu, SignalNoiseDbm signalNoise)
104
                     struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
105
103
106
{
104
{
107
  g_samples++;
105
  g_samples++;
108
  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
106
  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
109
  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
107
  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
110
  g_rate = rate;
111
  g_channelNumber = channelNumber;
108
  g_channelNumber = channelNumber;
112
}
109
}
113
110
 Lines 574-580    Link Here 
574
      g_noiseDbmAvg = 0;
571
      g_noiseDbmAvg = 0;
575
      g_samples = 0;
572
      g_samples = 0;
576
      g_channelNumber = 0;
573
      g_channelNumber = 0;
577
      g_rate = 0;
578
574
579
      // Make sure we are tuned to 5180 MHz; if not, the example will
575
      // Make sure we are tuned to 5180 MHz; if not, the example will
580
      // not work properly
576
      // not work properly
(-)a/src/mesh/model/dot11s/airtime-metric.cc (-1 / +2 lines)
 Lines 93-102    Link Here 
93
  NS_ASSERT (failAvg < 1.0);
93
  NS_ASSERT (failAvg < 1.0);
94
  WifiTxVector txVector;
94
  WifiTxVector txVector;
95
  txVector.SetMode (mode);
95
  txVector.SetMode (mode);
96
  txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
96
  //calculate metric
97
  //calculate metric
97
  uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
98
  uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
98
                                 mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
99
                                 mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
99
                                 mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, WIFI_PREAMBLE_LONG, mac->GetWifiPhy ()->GetFrequency())
100
                                 mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, mac->GetWifiPhy ()->GetFrequency())
100
                                 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
101
                                 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
101
  return metric;
102
  return metric;
102
}
103
}
(-)a/src/network/model/packet-tag-list.h (-1 / +1 lines)
 Lines 158-164    Link Here 
158
     */
158
     */
159
    enum TagData_e
159
    enum TagData_e
160
    {
160
    {
161
      MAX_SIZE = 21           /**< Size of serialization buffer #data */
161
      MAX_SIZE = 26           /**< Size of serialization buffer #data */
162
  };
162
  };
163
163
164
    uint8_t data[MAX_SIZE];   /**< Serialization buffer */
164
    uint8_t data[MAX_SIZE];   /**< Serialization buffer */
(-)a/src/wave/model/channel-manager.cc (+7 lines)
 Lines 161-166    Link Here 
161
  return m_channels[channelNumber]->dataRate;
161
  return m_channels[channelNumber]->dataRate;
162
}
162
}
163
163
164
WifiPreamble
165
ChannelManager::GetManagementPreamble (uint32_t channelNumber)
166
{
167
  NS_LOG_FUNCTION (this << channelNumber);
168
  return m_channels[channelNumber]->preamble;
169
}
170
164
uint32_t
171
uint32_t
165
ChannelManager::GetManagementPowerLevel (uint32_t channelNumber)
172
ChannelManager::GetManagementPowerLevel (uint32_t channelNumber)
166
{
173
{
(-)a/src/wave/model/channel-manager.h (+8 lines)
 Lines 21-26    Link Here 
21
#include <vector>
21
#include <vector>
22
#include "ns3/object.h"
22
#include "ns3/object.h"
23
#include "ns3/wifi-mode.h"
23
#include "ns3/wifi-mode.h"
24
#include "ns3/wifi-preamble.h"
24
25
25
namespace ns3 {
26
namespace ns3 {
26
27
 Lines 116-121    Link Here 
116
  WifiMode GetManagementDataRate (uint32_t channelNumber);
117
  WifiMode GetManagementDataRate (uint32_t channelNumber);
117
  /**
118
  /**
118
   * \param channelNumber the specific channel
119
   * \param channelNumber the specific channel
120
   * \return the preamble for management frames
121
   */
122
  WifiPreamble GetManagementPreamble (uint32_t channelNumber);
123
  /**
124
   * \param channelNumber the specific channel
119
   * \return the tx power level for management frames
125
   * \return the tx power level for management frames
120
   */
126
   */
121
  uint32_t GetManagementPowerLevel (uint32_t channelNumber);
127
  uint32_t GetManagementPowerLevel (uint32_t channelNumber);
 Lines 130-135    Link Here 
130
    uint32_t operatingClass;
136
    uint32_t operatingClass;
131
    bool adaptable;
137
    bool adaptable;
132
    WifiMode dataRate;
138
    WifiMode dataRate;
139
    WifiPreamble preamble;
133
    uint32_t txPowerLevel;
140
    uint32_t txPowerLevel;
134
141
135
    WaveChannel (uint32_t channel)
142
    WaveChannel (uint32_t channel)
 Lines 137-142    Link Here 
137
        operatingClass (DEFAULT_OPERATING_CLASS),
144
        operatingClass (DEFAULT_OPERATING_CLASS),
138
        adaptable (true),
145
        adaptable (true),
139
        dataRate (WifiMode ("OfdmRate6MbpsBW10MHz")),
146
        dataRate (WifiMode ("OfdmRate6MbpsBW10MHz")),
147
        preamble (WIFI_PREAMBLE_LONG),
140
        txPowerLevel (4)
148
        txPowerLevel (4)
141
    {
149
    {
142
    }
150
    }
(-)a/src/wave/model/vsa-manager.cc (+1 lines)
 Lines 178-183    Link Here 
178
  txVector.SetChannelWidth (10);
178
  txVector.SetChannelWidth (10);
179
  txVector.SetTxPowerLevel (manager->GetManagementPowerLevel (channel));
179
  txVector.SetTxPowerLevel (manager->GetManagementPowerLevel (channel));
180
  txVector.SetMode (manager->GetManagementDataRate (channel));
180
  txVector.SetMode (manager->GetManagementDataRate (channel));
181
  txVector.SetPreambleType (manager->GetManagementPreamble (channel));
181
  HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, manager->GetManagementAdaptable (channel));
182
  HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, manager->GetManagementAdaptable (channel));
182
  vsc->AddPacketTag (tag);
183
  vsc->AddPacketTag (tag);
183
184
(-)a/src/wave/model/wave-mac-low.cc (+2 lines)
 Lines 88-97    Link Here 
88
  if (txHigher.GetMode ().GetDataRate (txHigher.GetChannelWidth (), txHigher.IsShortGuardInterval (), 1) > txMac.GetMode ().GetDataRate (txMac.GetChannelWidth (), txMac.IsShortGuardInterval (), 1))
88
  if (txHigher.GetMode ().GetDataRate (txHigher.GetChannelWidth (), txHigher.IsShortGuardInterval (), 1) > txMac.GetMode ().GetDataRate (txMac.GetChannelWidth (), txMac.IsShortGuardInterval (), 1))
89
    {
89
    {
90
      txAdapter.SetMode (txHigher.GetMode ());
90
      txAdapter.SetMode (txHigher.GetMode ());
91
      txAdapter.SetPreambleType (txHigher.GetPreambleType ());
91
    }
92
    }
92
  else
93
  else
93
    {
94
    {
94
      txAdapter.SetMode (txMac.GetMode ());
95
      txAdapter.SetMode (txMac.GetMode ());
96
      txAdapter.SetPreambleType (txMac.GetPreambleType ());
95
    }
97
    }
96
  // the TxPwr_Level set by higher layer is the maximum transmit
98
  // the TxPwr_Level set by higher layer is the maximum transmit
97
  // power which is the upper bound for the actual transmit power;
99
  // power which is the upper bound for the actual transmit power;
(-)a/src/wave/model/wave-net-device.cc (+2 lines)
 Lines 411-416    Link Here 
411
      txVector.SetChannelWidth (10);
411
      txVector.SetChannelWidth (10);
412
      txVector.SetTxPowerLevel (txInfo.txPowerLevel);
412
      txVector.SetTxPowerLevel (txInfo.txPowerLevel);
413
      txVector.SetMode (txInfo.dataRate);
413
      txVector.SetMode (txInfo.dataRate);
414
      txVector.SetPreambleType (txInfo.preamble);
414
      HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, false);
415
      HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, false);
415
      packet->AddPacketTag (tag);
416
      packet->AddPacketTag (tag);
416
    }
417
    }
 Lines 618-623    Link Here 
618
      WifiTxVector txVector;
619
      WifiTxVector txVector;
619
      txVector.SetTxPowerLevel (m_txProfile->txPowerLevel);
620
      txVector.SetTxPowerLevel (m_txProfile->txPowerLevel);
620
      txVector.SetMode (m_txProfile->dataRate);
621
      txVector.SetMode (m_txProfile->dataRate);
622
      txVector.SetPreambleType (m_txProfile->preamble);
621
      HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, m_txProfile->adaptable);
623
      HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, m_txProfile->adaptable);
622
      packet->AddPacketTag (tag);
624
      packet->AddPacketTag (tag);
623
    }
625
    }
(-)a/src/wave/model/wave-net-device.h (-2 / +6 lines)
 Lines 58-63    Link Here 
58
  uint32_t channelNumber;
58
  uint32_t channelNumber;
59
  uint32_t priority;
59
  uint32_t priority;
60
  WifiMode dataRate;
60
  WifiMode dataRate;
61
  WifiPreamble preamble;
61
  uint32_t txPowerLevel;
62
  uint32_t txPowerLevel;
62
  // Time expiryTime;   // unsupported
63
  // Time expiryTime;   // unsupported
63
  TxInfo ()
64
  TxInfo ()
 Lines 67-73    Link Here 
67
  {
68
  {
68
69
69
  }
70
  }
70
  TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), uint32_t powerLevel = 8)
71
  TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), WifiPreamble preamble = WIFI_PREAMBLE_NONE, uint32_t powerLevel = 8)
71
    : channelNumber (channel),
72
    : channelNumber (channel),
72
      priority (prio),
73
      priority (prio),
73
      dataRate (rate),
74
      dataRate (rate),
 Lines 95-104    Link Here 
95
  bool adaptable;
96
  bool adaptable;
96
  uint32_t txPowerLevel;
97
  uint32_t txPowerLevel;
97
  WifiMode dataRate;
98
  WifiMode dataRate;
99
  WifiPreamble preamble;
98
  TxProfile (void)
100
  TxProfile (void)
99
    : channelNumber (SCH1),
101
    : channelNumber (SCH1),
100
      adaptable (false),
102
      adaptable (false),
101
      txPowerLevel (4)
103
      txPowerLevel (4),
104
      preamble (WIFI_PREAMBLE_LONG)
102
  {
105
  {
103
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
106
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
104
  }
107
  }
 Lines 108-113    Link Here 
108
      txPowerLevel (powerLevel)
111
      txPowerLevel (powerLevel)
109
  {
112
  {
110
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
113
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
114
      preamble = WIFI_PREAMBLE_LONG;
111
  }
115
  }
112
};
116
};
113
117
(-)a/src/wave/test/mac-extension-test-suite.cc (-6 / +6 lines)
 Lines 347-357    Link Here 
347
    // invalid user priority
347
    // invalid user priority
348
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 8));
348
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 8));
349
    // invalid tx parameters
349
    // invalid tx parameters
350
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate6Mbps"),  7));
350
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate6Mbps"), WIFI_PREAMBLE_LONG, 7));
351
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), 10));
351
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 10));
352
    // valid tx parameters
352
    // valid tx parameters
353
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"),  7));
353
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 7));
354
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode (),  8));
354
    Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode (), WIFI_PREAMBLE_LONG, 8));
355
355
356
    // release channel access at 0.6s
356
    // release channel access at 0.6s
357
    Simulator::Schedule (Seconds (0.5), &WaveNetDevice::StopSch, m_sender, SCH1);
357
    Simulator::Schedule (Seconds (0.5), &WaveNetDevice::StopSch, m_sender, SCH1);
 Lines 1019-1025    Link Here 
1019
  SchInfo infoSender = SchInfo (SCH1, false, EXTENDED_ALTERNATING);
1019
  SchInfo infoSender = SchInfo (SCH1, false, EXTENDED_ALTERNATING);
1020
  Simulator::Schedule (MilliSeconds (0), &WaveNetDevice::StartSch, m_sender, infoSender);
1020
  Simulator::Schedule (MilliSeconds (0), &WaveNetDevice::StartSch, m_sender, infoSender);
1021
1021
1022
  TxInfo txInfo = TxInfo (CCH, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), 0);
1022
  TxInfo txInfo = TxInfo (CCH, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 0);
1023
  // the packet size with 2312 bytes costs 6.42s, which will cancel this transmission in the CCH Interval
1023
  // the packet size with 2312 bytes costs 6.42s, which will cancel this transmission in the CCH Interval
1024
  // so the receiver will receive this packet in next CCH Interval
1024
  // so the receiver will receive this packet in next CCH Interval
1025
  Simulator::Schedule (MilliSeconds (45), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 1);
1025
  Simulator::Schedule (MilliSeconds (45), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 1);
 Lines 1028-1034    Link Here 
1028
  // so the receiver can this packet is this CCH Interval
1028
  // so the receiver can this packet is this CCH Interval
1029
  Simulator::Schedule (MilliSeconds (145), &AnnexC_TestCase::SendPacket, this, 312, txInfo, 2);
1029
  Simulator::Schedule (MilliSeconds (145), &AnnexC_TestCase::SendPacket, this, 312, txInfo, 2);
1030
1030
1031
  txInfo = TxInfo (SCH1, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), 0);
1031
  txInfo = TxInfo (SCH1, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 0);
1032
  // the packet size with 2312 bytes costs 6.42ms, which will cancel this transmission in the SCH Interval
1032
  // the packet size with 2312 bytes costs 6.42ms, which will cancel this transmission in the SCH Interval
1033
  // so the receiver will receive this packet in next SCH Interval
1033
  // so the receiver will receive this packet in next SCH Interval
1034
  Simulator::Schedule (MilliSeconds (295), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 3);
1034
  Simulator::Schedule (MilliSeconds (295), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 3);
(-)a/src/wifi/examples/test-interference-helper.cc (-4 / +6 lines)
 Lines 84-91    Link Here 
84
    uint32_t txPowerLevelB;
84
    uint32_t txPowerLevelB;
85
    uint32_t packetSizeA;
85
    uint32_t packetSizeA;
86
    uint32_t packetSizeB;
86
    uint32_t packetSizeB;
87
    enum WifiPhyStandard standard;
87
    WifiPhyStandard standard;
88
    enum WifiPreamble preamble;
88
    WifiPreamble preamble;
89
  };
89
  };
90
90
91
  InterferenceExperiment ();
91
  InterferenceExperiment ();
 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);
109
  txVector.SetPreambleType (m_input.preamble);
110
  m_txA->SendPacket (p, txVector);
110
}
111
}
111
112
112
void
113
void
 Lines 116-122    Link Here 
116
  WifiTxVector txVector;
117
  WifiTxVector txVector;
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
118
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
118
  txVector.SetMode (WifiMode (m_input.txModeB));
119
  txVector.SetMode (WifiMode (m_input.txModeB));
119
  m_txB->SendPacket (p, txVector, m_input.preamble);
120
  txVector.SetPreambleType (m_input.preamble);
121
  m_txB->SendPacket (p, txVector);
120
}
122
}
121
123
122
InterferenceExperiment::InterferenceExperiment ()
124
InterferenceExperiment::InterferenceExperiment ()
(-)a/src/wifi/examples/wifi-phy-test.cc (-7 / +10 lines)
 Lines 60-66    Link Here 
60
60
61
private:
61
private:
62
  void Send (void);
62
  void Send (void);
63
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
63
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector);
64
  Ptr<WifiPhy> m_tx;
64
  Ptr<WifiPhy> m_tx;
65
  struct Input m_input;
65
  struct Input m_input;
66
  struct Output m_output;
66
  struct Output m_output;
 Lines 74-84    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);
77
  txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
78
  m_tx->SendPacket (p, txVector);
78
}
79
}
79
80
80
void
81
void
81
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
82
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector)
82
{
83
{
83
  m_output.received++;
84
  m_output.received++;
84
}
85
}
 Lines 165-171    Link Here 
165
private:
166
private:
166
  void SendA (void) const;
167
  void SendA (void) const;
167
  void SendB (void) const;
168
  void SendB (void) const;
168
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
169
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector);
169
  Ptr<WifiPhy> m_txA;
170
  Ptr<WifiPhy> m_txA;
170
  Ptr<WifiPhy> m_txB;
171
  Ptr<WifiPhy> m_txB;
171
  uint32_t m_flowIdA;
172
  uint32_t m_flowIdA;
 Lines 182-188    Link Here 
182
  WifiTxVector txVector;
183
  WifiTxVector txVector;
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
184
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
184
  txVector.SetMode (WifiMode (m_input.txModeA));
185
  txVector.SetMode (WifiMode (m_input.txModeA));
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG);
186
  txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
187
  m_txA->SendPacket (p, txVector);
186
}
188
}
187
189
188
void
190
void
 Lines 193-203    Link Here 
193
  WifiTxVector txVector;
195
  WifiTxVector txVector;
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
196
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
195
  txVector.SetMode (WifiMode (m_input.txModeB));
197
  txVector.SetMode (WifiMode (m_input.txModeB));
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG);
198
  txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
199
  m_txB->SendPacket (p, txVector);
197
}
200
}
198
201
199
void
202
void
200
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
203
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector)
201
{
204
{
202
  FlowIdTag tag;
205
  FlowIdTag tag;
203
  if (p->FindFirstMatchingByteTag (tag))
206
  if (p->FindFirstMatchingByteTag (tag))
(-)a/src/wifi/helper/wifi-helper.cc (-7 / +25 lines)
 Lines 143-154    Link Here 
143
  Ptr<const Packet>    packet,
143
  Ptr<const Packet>    packet,
144
  uint16_t             channelFreqMhz,
144
  uint16_t             channelFreqMhz,
145
  uint16_t             channelNumber,
145
  uint16_t             channelNumber,
146
  uint32_t             rate,
147
  WifiPreamble         preamble,
148
  WifiTxVector         txVector,
146
  WifiTxVector         txVector,
149
  struct mpduInfo      aMpdu)
147
  MpduInfo             aMpdu)
150
{
148
{
151
  uint32_t dlt = file->GetDataLinkType ();
149
  uint32_t dlt = file->GetDataLinkType ();
150
  WifiPreamble preamble = txVector.GetPreambleType ();
152
151
153
  switch (dlt)
152
  switch (dlt)
154
    {
153
    {
 Lines 181-186    Link Here 
181
          }
180
          }
182
181
183
        header.SetFrameFlags (frameFlags);
182
        header.SetFrameFlags (frameFlags);
183
        
184
        uint32_t rate;
185
        if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
186
          {
187
            rate = 128 + txVector.GetMode ().GetMcsValue ();
188
          }
189
        else
190
          {
191
            rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
192
          }
184
        header.SetRate (rate);
193
        header.SetRate (rate);
185
194
186
        uint16_t channelFlags = 0;
195
        uint16_t channelFlags = 0;
 Lines 335-347    Link Here 
335
  Ptr<const Packet>     packet,
344
  Ptr<const Packet>     packet,
336
  uint16_t              channelFreqMhz,
345
  uint16_t              channelFreqMhz,
337
  uint16_t              channelNumber,
346
  uint16_t              channelNumber,
338
  uint32_t              rate,
339
  WifiPreamble          preamble,
340
  WifiTxVector          txVector,
347
  WifiTxVector          txVector,
341
  struct mpduInfo       aMpdu,
348
  MpduInfo              aMpdu,
342
  struct signalNoiseDbm signalNoise)
349
  SignalNoiseDbm        signalNoise)
343
{
350
{
344
  uint32_t dlt = file->GetDataLinkType ();
351
  uint32_t dlt = file->GetDataLinkType ();
352
  WifiPreamble preamble = txVector.GetPreambleType ();
345
353
346
  switch (dlt)
354
  switch (dlt)
347
    {
355
    {
 Lines 374-379    Link Here 
374
          }
382
          }
375
383
376
        header.SetFrameFlags (frameFlags);
384
        header.SetFrameFlags (frameFlags);
385
        
386
        uint32_t rate;
387
        if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
388
          {
389
            rate = 128 + txVector.GetMode ().GetMcsValue ();
390
          }
391
        else
392
          {
393
            rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
394
          }
377
        header.SetRate (rate);
395
        header.SetRate (rate);
378
396
379
        uint16_t channelFlags = 0;
397
        uint16_t channelFlags = 0;
(-)a/src/wifi/helper/wifi-helper.h (-11 / +3 lines)
 Lines 143-150    Link Here 
143
   * \param packet the packet
143
   * \param packet the packet
144
   * \param channelFreqMhz the channel frequency
144
   * \param channelFreqMhz the channel frequency
145
   * \param channelNumber the channel number
145
   * \param channelNumber the channel number
146
   * \param rate the PHY bitrate
147
   * \param preamble the preamble type
148
   * \param txVector the TXVECTOR
146
   * \param txVector the TXVECTOR
149
   * \param aMpdu the A-MPDU information
147
   * \param aMpdu the A-MPDU information
150
   *
148
   *
 Lines 154-170    Link Here 
154
                                Ptr<const Packet> packet,
152
                                Ptr<const Packet> packet,
155
                                uint16_t channelFreqMhz,
153
                                uint16_t channelFreqMhz,
156
                                uint16_t channelNumber,
154
                                uint16_t channelNumber,
157
                                uint32_t rate,
158
                                WifiPreamble preamble,
159
                                WifiTxVector txVector,
155
                                WifiTxVector txVector,
160
                                struct mpduInfo aMpdu);
156
                                MpduInfo aMpdu);
161
  /**
157
  /**
162
   * \param file the pcap file wrapper
158
   * \param file the pcap file wrapper
163
   * \param packet the packet
159
   * \param packet the packet
164
   * \param channelFreqMhz the channel frequency
160
   * \param channelFreqMhz the channel frequency
165
   * \param channelNumber the channel number
161
   * \param channelNumber the channel number
166
   * \param rate the PHY bitrate
167
   * \param preamble the preamble type
168
   * \param txVector the TXVECTOR
162
   * \param txVector the TXVECTOR
169
   * \param aMpdu the A-MPDU information
163
   * \param aMpdu the A-MPDU information
170
   * \param signalNoise the rx signal and noise information
164
   * \param signalNoise the rx signal and noise information
 Lines 175-185    Link Here 
175
                                Ptr<const Packet> packet,
169
                                Ptr<const Packet> packet,
176
                                uint16_t channelFreqMhz,
170
                                uint16_t channelFreqMhz,
177
                                uint16_t channelNumber,
171
                                uint16_t channelNumber,
178
                                uint32_t rate,
179
                                WifiPreamble preamble,
180
                                WifiTxVector txVector,
172
                                WifiTxVector txVector,
181
                                struct mpduInfo aMpdu,
173
                                MpduInfo aMpdu,
182
                                struct signalNoiseDbm signalNoise);
174
                                SignalNoiseDbm signalNoise);
183
    
175
    
184
  ObjectFactory m_phy;
176
  ObjectFactory m_phy;
185
  ObjectFactory m_errorRateModel;
177
  ObjectFactory m_errorRateModel;
(-)a/src/wifi/model/aarf-wifi-manager.cc (-3 / +6 lines)
 Lines 238-244    Link Here 
238
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
238
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
239
      channelWidth = 20;
239
      channelWidth = 20;
240
    }
240
    }
241
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
241
  WifiMode mode = GetSupported (station, station->m_rate);
242
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
242
}
243
}
243
244
244
WifiTxVector
245
WifiTxVector
 Lines 255-268    Link Here 
255
      channelWidth = 20;
256
      channelWidth = 20;
256
    }
257
    }
257
  WifiTxVector rtsTxVector;
258
  WifiTxVector rtsTxVector;
259
  WifiMode mode;
258
  if (GetUseNonErpProtection () == false)
260
  if (GetUseNonErpProtection () == false)
259
    {
261
    {
260
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
262
      mode = GetSupported (station, 0);
261
    }
263
    }
262
  else
264
  else
263
    {
265
    {
264
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
266
      mode = GetNonErpSupported (station, 0);
265
    }
267
    }
268
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
266
  return rtsTxVector;
269
  return rtsTxVector;
267
}
270
}
268
271
(-)a/src/wifi/model/aarfcd-wifi-manager.cc (-3 / +6 lines)
 Lines 310-316    Link Here 
310
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
310
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
311
      channelWidth = 20;
311
      channelWidth = 20;
312
    }
312
    }
313
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
313
  WifiMode mode = GetSupported (station, station->m_rate);
314
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
314
}
315
}
315
316
316
WifiTxVector
317
WifiTxVector
 Lines 327-340    Link Here 
327
      channelWidth = 20;
328
      channelWidth = 20;
328
    }
329
    }
329
  WifiTxVector rtsTxVector;
330
  WifiTxVector rtsTxVector;
331
  WifiMode mode;
330
  if (GetUseNonErpProtection () == false)
332
  if (GetUseNonErpProtection () == false)
331
    {
333
    {
332
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
334
      mode = GetSupported (station, 0);
333
    }
335
    }
334
  else
336
  else
335
    {
337
    {
336
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
338
      mode = GetNonErpSupported (station, 0);
337
    }
339
    }
340
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
338
  return rtsTxVector;
341
  return rtsTxVector;
339
}
342
}
340
343
(-)a/src/wifi/model/amrr-wifi-manager.cc (-3 / +6 lines)
 Lines 341-347    Link Here 
341
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
341
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
342
      channelWidth = 20;
342
      channelWidth = 20;
343
    }
343
    }
344
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
344
  WifiMode mode = GetSupported (station, rateIndex);
345
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
345
}
346
}
346
347
347
WifiTxVector
348
WifiTxVector
 Lines 357-370    Link Here 
357
    }
358
    }
358
  UpdateMode (station);
359
  UpdateMode (station);
359
  WifiTxVector rtsTxVector;
360
  WifiTxVector rtsTxVector;
361
  WifiMode mode;
360
  if (GetUseNonErpProtection () == false)
362
  if (GetUseNonErpProtection () == false)
361
    {
363
    {
362
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
364
      mode = GetSupported (station, 0);
363
    }
365
    }
364
  else
366
  else
365
    {
367
    {
366
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
368
      mode = GetNonErpSupported (station, 0);
367
    }
369
    }
370
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
368
  return rtsTxVector;
371
  return rtsTxVector;
369
}
372
}
370
373
(-)a/src/wifi/model/aparf-wifi-manager.cc (-3 / +6 lines)
 Lines 329-335    Link Here 
329
      channelWidth = 20;
329
      channelWidth = 20;
330
    }
330
    }
331
  CheckInit (station);
331
  CheckInit (station);
332
  return WifiTxVector (GetSupported (station, station->m_rate), station->m_power, GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
332
  WifiMode mode = GetSupported (station, station->m_rate);
333
  return WifiTxVector (mode, station->m_power, GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false);
333
}
334
}
334
335
335
WifiTxVector
336
WifiTxVector
 Lines 346-359    Link Here 
346
      channelWidth = 20;
347
      channelWidth = 20;
347
    }
348
    }
348
  WifiTxVector rtsTxVector;
349
  WifiTxVector rtsTxVector;
350
  WifiMode mode;
349
  if (GetUseNonErpProtection () == false)
351
  if (GetUseNonErpProtection () == false)
350
    {
352
    {
351
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
353
      mode = GetSupported (station, 0);
352
    }
354
    }
353
  else
355
  else
354
    {
356
    {
355
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
357
      mode = GetNonErpSupported (station, 0);
356
    }
358
    }
359
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false);
357
  return rtsTxVector;
360
  return rtsTxVector;
358
}
361
}
359
362
(-)a/src/wifi/model/arf-wifi-manager.cc (-3 / +6 lines)
 Lines 214-220    Link Here 
214
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
214
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
215
      channelWidth = 20;
215
      channelWidth = 20;
216
    }
216
    }
217
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 1, channelWidth, GetAggregation (station), false);
217
  WifiMode mode = GetSupported (station, station->m_rate);
218
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 1, channelWidth, GetAggregation (station), false);
218
}
219
}
219
220
220
WifiTxVector
221
WifiTxVector
 Lines 231-244    Link Here 
231
      channelWidth = 20;
232
      channelWidth = 20;
232
    }
233
    }
233
  WifiTxVector rtsTxVector;
234
  WifiTxVector rtsTxVector;
235
  WifiMode mode;
234
  if (GetUseNonErpProtection () == false)
236
  if (GetUseNonErpProtection () == false)
235
    {
237
    {
236
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
238
      mode = GetSupported (station, 0);
237
    }
239
    }
238
  else
240
  else
239
    {
241
    {
240
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
242
      mode = GetNonErpSupported (station, 0);
241
    }
243
    }
244
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
242
  return rtsTxVector;
245
  return rtsTxVector;
243
}
246
}
244
247
(-)a/src/wifi/model/block-ack-manager.cc (-4 / +4 lines)
 Lines 85-91    Link Here 
85
85
86
bool
86
bool
87
BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
87
BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
88
                                         enum OriginatorBlockAckAgreement::State state) const
88
                                         OriginatorBlockAckAgreement::State state) const
89
{
89
{
90
  NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << state);
90
  NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << state);
91
  AgreementsCI it;
91
  AgreementsCI it;
 Lines 471-477    Link Here 
471
}
471
}
472
472
473
bool
473
bool
474
BlockAckManager::HasBar (struct Bar &bar)
474
BlockAckManager::HasBar (Bar &bar)
475
{
475
{
476
  NS_LOG_FUNCTION (this << &bar);
476
  NS_LOG_FUNCTION (this << &bar);
477
  if (m_bars.size () > 0)
477
  if (m_bars.size () > 0)
 Lines 695-701    Link Here 
695
}
695
}
696
696
697
void
697
void
698
BlockAckManager::SetBlockAckType (enum BlockAckType bAckType)
698
BlockAckManager::SetBlockAckType (BlockAckType bAckType)
699
{
699
{
700
  NS_LOG_FUNCTION (this << bAckType);
700
  NS_LOG_FUNCTION (this << bAckType);
701
  m_blockAckType = bAckType;
701
  m_blockAckType = bAckType;
 Lines 773-779    Link Here 
773
}
773
}
774
774
775
void
775
void
776
BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, enum WifiMacHeader::QosAckPolicy policy)
776
BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, WifiMacHeader::QosAckPolicy policy)
777
{
777
{
778
  NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << nextSeqNumber);
778
  NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << nextSeqNumber);
779
  Ptr<Packet> bar = 0;
779
  Ptr<Packet> bar = 0;
(-)a/src/wifi/model/block-ack-manager.h (-4 / +4 lines)
 Lines 110-116    Link Here 
110
   * station addressed by <i>recipient</i> for tid <i>tid</i>.
110
   * station addressed by <i>recipient</i> for tid <i>tid</i>.
111
   */
111
   */
112
  bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
112
  bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
113
                               enum OriginatorBlockAckAgreement::State state) const;
113
                               OriginatorBlockAckAgreement::State state) const;
114
  /**
114
  /**
115
   * \param reqHdr Relative Add block ack request (action frame).
115
   * \param reqHdr Relative Add block ack request (action frame).
116
   * \param recipient Address of peer station involved in block ack mechanism.
116
   * \param recipient Address of peer station involved in block ack mechanism.
 Lines 161-167    Link Here 
161
   * corresponding block ack bitmap. This method doesn't remove the packet from this queue.
161
   * corresponding block ack bitmap. This method doesn't remove the packet from this queue.
162
   */
162
   */
163
  Ptr<const Packet> PeekNextPacket (WifiMacHeader &hdr);
163
  Ptr<const Packet> PeekNextPacket (WifiMacHeader &hdr);
164
  bool HasBar (struct Bar &bar);
164
  bool HasBar (Bar &bar);
165
  /**
165
  /**
166
   * Returns true if there are packets that need of retransmission or at least a
166
   * Returns true if there are packets that need of retransmission or at least a
167
   * BAR is scheduled. Returns false otherwise.
167
   * BAR is scheduled. Returns false otherwise.
 Lines 258-264    Link Here 
258
   *
258
   *
259
   * See ctrl-headers.h for more details.
259
   * See ctrl-headers.h for more details.
260
   */
260
   */
261
  void SetBlockAckType (enum BlockAckType bAckType);
261
  void SetBlockAckType (BlockAckType bAckType);
262
  /**
262
  /**
263
   * \param recipient Address of station involved in block ack mechanism.
263
   * \param recipient Address of station involved in block ack mechanism.
264
   * \param tid Traffic ID.
264
   * \param tid Traffic ID.
 Lines 450-456    Link Here 
450
  std::list<Bar> m_bars;
450
  std::list<Bar> m_bars;
451
451
452
  uint8_t m_blockAckThreshold;
452
  uint8_t m_blockAckThreshold;
453
  enum BlockAckType m_blockAckType;
453
  BlockAckType m_blockAckType;
454
  Time m_maxDelay;
454
  Time m_maxDelay;
455
  MacTxMiddle* m_txMiddle;
455
  MacTxMiddle* m_txMiddle;
456
  Mac48Address m_address;
456
  Mac48Address m_address;
(-)a/src/wifi/model/cara-wifi-manager.cc (-3 / +6 lines)
 Lines 188-194    Link Here 
188
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
188
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
189
      channelWidth = 20;
189
      channelWidth = 20;
190
    }
190
    }
191
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
191
  WifiMode mode = GetSupported (station, station->m_rate);
192
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
192
}
193
}
193
194
194
WifiTxVector
195
WifiTxVector
 Lines 205-218    Link Here 
205
      channelWidth = 20;
206
      channelWidth = 20;
206
    }
207
    }
207
  WifiTxVector rtsTxVector;
208
  WifiTxVector rtsTxVector;
209
  WifiMode mode;
208
  if (GetUseNonErpProtection () == false)
210
  if (GetUseNonErpProtection () == false)
209
    {
211
    {
210
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
212
      mode = GetSupported (station, 0);
211
    }
213
    }
212
  else
214
  else
213
    {
215
    {
214
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
216
      mode = GetNonErpSupported (station, 0);
215
    }
217
    }
218
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
216
  return rtsTxVector;
219
  return rtsTxVector;
217
}
220
}
218
221
(-)a/src/wifi/model/constant-rate-wifi-manager.cc (-2 / +2 lines)
 Lines 117-130    Link Here 
117
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
117
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
118
{
118
{
119
  NS_LOG_FUNCTION (this << st);
119
  NS_LOG_FUNCTION (this << st);
120
  return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min(GetNumberOfTransmitAntennas (), GetNumberOfSupportedRxAntennas (st)), 0, GetChannelWidth (st), GetAggregation (st), false);
120
  return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetPreambleForTransmission (m_dataMode, GetAddress (st)), GetShortGuardInterval (st), Min(GetNumberOfTransmitAntennas (), GetNumberOfSupportedRxAntennas (st)), 0, GetChannelWidth (st), GetAggregation (st), false);
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), 1, 0, GetChannelWidth (st), GetAggregation (st), false);
127
  return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetPreambleForTransmission (m_ctlMode, GetAddress (st)), GetShortGuardInterval (st), 1, 0, GetChannelWidth (st), GetAggregation (st), false);
128
}
128
}
129
129
130
bool
130
bool
(-)a/src/wifi/model/ctrl-headers.cc (-2 / +2 lines)
 Lines 195-201    Link Here 
195
}
195
}
196
196
197
void
197
void
198
CtrlBAckRequestHeader::SetType (enum BlockAckType type)
198
CtrlBAckRequestHeader::SetType (BlockAckType type)
199
{
199
{
200
  NS_LOG_FUNCTION (this << type);
200
  NS_LOG_FUNCTION (this << type);
201
  switch (type)
201
  switch (type)
 Lines 408-414    Link Here 
408
}
408
}
409
409
410
void
410
void
411
CtrlBAckResponseHeader::SetType (enum BlockAckType type)
411
CtrlBAckResponseHeader::SetType (BlockAckType type)
412
{
412
{
413
  NS_LOG_FUNCTION (this << type);
413
  NS_LOG_FUNCTION (this << type);
414
  switch (type)
414
  switch (type)
(-)a/src/wifi/model/ctrl-headers.h (-2 / +2 lines)
 Lines 70-76    Link Here 
70
   *
70
   *
71
   * \param type
71
   * \param type
72
   */
72
   */
73
  void SetType (enum BlockAckType type);
73
  void SetType (BlockAckType type);
74
  /**
74
  /**
75
   * Set Traffic ID (TID).
75
   * Set Traffic ID (TID).
76
   *
76
   *
 Lines 206-212    Link Here 
206
   *
206
   *
207
   * \param type
207
   * \param type
208
   */
208
   */
209
  void SetType (enum BlockAckType type);
209
  void SetType (BlockAckType type);
210
  /**
210
  /**
211
   * Set Traffic ID (TID).
211
   * Set Traffic ID (TID).
212
   *
212
   *
(-)a/src/wifi/model/edca-txop-n.cc (-4 / +4 lines)
 Lines 368-380    Link Here 
368
}
368
}
369
369
370
void
370
void
371
EdcaTxopN::SetTypeOfStation (enum TypeOfStation type)
371
EdcaTxopN::SetTypeOfStation (TypeOfStation type)
372
{
372
{
373
  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
373
  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
374
  m_typeOfStation = type;
374
  m_typeOfStation = type;
375
}
375
}
376
376
377
enum TypeOfStation
377
TypeOfStation
378
EdcaTxopN::GetTypeOfStation (void) const
378
EdcaTxopN::GetTypeOfStation (void) const
379
{
379
{
380
  NS_LOG_FUNCTION (this);
380
  NS_LOG_FUNCTION (this);
 Lines 1451-1457    Link Here 
1451
}
1451
}
1452
1452
1453
void
1453
void
1454
EdcaTxopN::SetAccessCategory (enum AcIndex ac)
1454
EdcaTxopN::SetAccessCategory (AcIndex ac)
1455
{
1455
{
1456
  NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
1456
  NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
1457
  m_ac = ac;
1457
  m_ac = ac;
 Lines 1647-1653    Link Here 
1647
}
1647
}
1648
1648
1649
void
1649
void
1650
EdcaTxopN::SendBlockAckRequest (const struct Bar &bar)
1650
EdcaTxopN::SendBlockAckRequest (const Bar &bar)
1651
{
1651
{
1652
  NS_LOG_FUNCTION (this << &bar);
1652
  NS_LOG_FUNCTION (this << &bar);
1653
  WifiMacHeader hdr;
1653
  WifiMacHeader hdr;
(-)a/src/wifi/model/edca-txop-n.h (-7 / +7 lines)
 Lines 141-159    Link Here 
141
   *
141
   *
142
   * \param type
142
   * \param type
143
   */
143
   */
144
  void SetTypeOfStation (enum TypeOfStation type);
144
  void SetTypeOfStation (TypeOfStation type);
145
  /**
145
  /**
146
   * Return type of station.
146
   * Return type of station.
147
   *
147
   *
148
   * \return type of station
148
   * \return type of station
149
   */
149
   */
150
  enum TypeOfStation GetTypeOfStation (void) const;
150
  TypeOfStation GetTypeOfStation (void) const;
151
  /**
151
  /**
152
   * Return the packet queue associated with this EdcaTxopN.
152
   * Return the packet queue associated with this EdcaTxopN.
153
   *
153
   *
154
   * \return WifiMacQueue
154
   * \return WifiMacQueue
155
   */
155
   */
156
  Ptr<WifiMacQueue > GetEdcaQueue () const;
156
  Ptr<WifiMacQueue> GetEdcaQueue () const;
157
157
158
  virtual void SetMinCw (uint32_t minCw);
158
  virtual void SetMinCw (uint32_t minCw);
159
  virtual void SetMaxCw (uint32_t maxCw);
159
  virtual void SetMaxCw (uint32_t maxCw);
 Lines 383-389    Link Here 
383
   *
383
   *
384
   * \param ac
384
   * \param ac
385
   */
385
   */
386
  void SetAccessCategory (enum AcIndex ac);
386
  void SetAccessCategory (AcIndex ac);
387
387
388
  /**
388
  /**
389
   * \param packet packet to send
389
   * \param packet packet to send
 Lines 523-529    Link Here 
523
   *
523
   *
524
   * \param bar
524
   * \param bar
525
   */
525
   */
526
  void SendBlockAckRequest (const struct Bar &bar);
526
  void SendBlockAckRequest (const Bar &bar);
527
  /**
527
  /**
528
   * For now is typically invoked to complete transmission of a packets sent with ack policy
528
   * For now is typically invoked to complete transmission of a packets sent with ack policy
529
   * Block Ack: the packet is buffered and dcf is reset.
529
   * Block Ack: the packet is buffered and dcf is reset.
 Lines 586-595    Link Here 
586
   * Represents the minimum number of packets for use of block ack.
586
   * Represents the minimum number of packets for use of block ack.
587
   */
587
   */
588
  uint8_t m_blockAckThreshold;
588
  uint8_t m_blockAckThreshold;
589
  enum BlockAckType m_blockAckType;
589
  BlockAckType m_blockAckType;
590
  Time m_currentPacketTimestamp;
590
  Time m_currentPacketTimestamp;
591
  uint16_t m_blockAckInactivityTimeout;
591
  uint16_t m_blockAckInactivityTimeout;
592
  struct Bar m_currentBar;
592
  Bar m_currentBar;
593
  Time m_startTxop;
593
  Time m_startTxop;
594
  bool m_isAccessRequestedForRts;
594
  bool m_isAccessRequestedForRts;
595
  TracedValue<uint32_t> m_backoffTrace;
595
  TracedValue<uint32_t> m_backoffTrace;
(-)a/src/wifi/model/ideal-wifi-manager.cc (-2 / +2 lines)
 Lines 370-376    Link Here 
370
      NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss));
370
      NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss));
371
      m_currentRate = maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss);
371
      m_currentRate = maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss);
372
    }
372
    }
373
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, nss, 0, channelWidth, GetAggregation (station), false);
373
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, nss, 0, channelWidth, GetAggregation (station), false);
374
}
374
}
375
375
376
WifiTxVector
376
WifiTxVector
 Lines 402-408    Link Here 
402
          maxMode = mode;
402
          maxMode = mode;
403
        }
403
        }
404
    }
404
    }
405
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, nss, 0, GetChannelWidthForMode (maxMode), GetAggregation (station), false);
405
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, nss, 0, GetChannelWidthForMode (maxMode), GetAggregation (station), false);
406
}
406
}
407
407
408
bool
408
bool
(-)a/src/wifi/model/interference-helper.cc (-28 / +13 lines)
 Lines 34-45    Link Here 
34
 *       Phy event class
34
 *       Phy event class
35
 ****************************************************************/
35
 ****************************************************************/
36
36
37
InterferenceHelper::Event::Event (uint32_t size, WifiTxVector txVector,
37
InterferenceHelper::Event::Event (uint32_t size, WifiTxVector txVector, Time duration, double rxPower)
38
                                  enum WifiPreamble preamble,
39
                                  Time duration, double rxPower)
40
  : m_size (size),
38
  : m_size (size),
41
    m_txVector (txVector),
39
    m_txVector (txVector),
42
    m_preamble (preamble),
43
    m_startTime (Simulator::Now ()),
40
    m_startTime (Simulator::Now ()),
44
    m_endTime (m_startTime + duration),
41
    m_endTime (m_startTime + duration),
45
    m_rxPowerW (rxPower)
42
    m_rxPowerW (rxPower)
 Lines 92-103    Link Here 
92
  return m_txVector.GetMode ();
89
  return m_txVector.GetMode ();
93
}
90
}
94
91
95
enum WifiPreamble
96
InterferenceHelper::Event::GetPreambleType (void) const
97
{
98
  return m_preamble;
99
}
100
101
92
102
/****************************************************************
93
/****************************************************************
103
 *       Class which records SNIR change events for a
94
 *       Class which records SNIR change events for a
 Lines 147-163    Link Here 
147
}
138
}
148
139
149
Ptr<InterferenceHelper::Event>
140
Ptr<InterferenceHelper::Event>
150
InterferenceHelper::Add (uint32_t size, WifiTxVector txVector,
141
InterferenceHelper::Add (uint32_t size, WifiTxVector txVector, Time duration, double rxPowerW)
151
                         enum WifiPreamble preamble,
152
                         Time duration, double rxPowerW)
153
{
142
{
154
  Ptr<InterferenceHelper::Event> event;
143
  Ptr<InterferenceHelper::Event> event;
155
144
156
  event = Create<InterferenceHelper::Event> (size,
145
  event = Create<InterferenceHelper::Event> (size, txVector, duration, rxPowerW);
157
                                             txVector,
158
                                             preamble,
159
                                             duration,
160
                                             rxPowerW);
161
  AppendEvent (event);
146
  AppendEvent (event);
162
  return event;
147
  return event;
163
}
148
}
 Lines 168-174    Link Here 
168
  // Parameters other than duration and rxPowerW are unused for this type
153
  // Parameters other than duration and rxPowerW are unused for this type
169
  // of signal, so we provide dummy versions
154
  // of signal, so we provide dummy versions
170
  WifiTxVector fakeTxVector;
155
  WifiTxVector fakeTxVector;
171
  Add (0, fakeTxVector, WIFI_PREAMBLE_NONE, duration, rxPowerW);
156
  Add (0, fakeTxVector, duration, rxPowerW);
172
}
157
}
173
158
174
void
159
void
 Lines 295-305    Link Here 
295
  NiChanges::iterator j = ni->begin ();
280
  NiChanges::iterator j = ni->begin ();
296
  Time previous = (*j).GetTime ();
281
  Time previous = (*j).GetTime ();
297
  WifiMode payloadMode = event->GetPayloadMode ();
282
  WifiMode payloadMode = event->GetPayloadMode ();
298
  WifiPreamble preamble = event->GetPreambleType ();
283
  WifiPreamble preamble = event->GetTxVector ().GetPreambleType ();
299
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector (), preamble); //packet start time + preamble
284
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector ()); //packet start time + preamble
300
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector (), preamble); //packet start time + preamble + L-SIG
285
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector ()); //packet start time + preamble + L-SIG
301
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2)
286
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2)
302
  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B
287
  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B
303
  double noiseInterferenceW = (*j).GetDelta ();
288
  double noiseInterferenceW = (*j).GetDelta ();
304
  double powerW = event->GetRxPowerW ();
289
  double powerW = event->GetRxPowerW ();
305
  j++;
290
  j++;
 Lines 347-353    Link Here 
347
  NiChanges::iterator j = ni->begin ();
332
  NiChanges::iterator j = ni->begin ();
348
  Time previous = (*j).GetTime ();
333
  Time previous = (*j).GetTime ();
349
  WifiMode payloadMode = event->GetPayloadMode ();
334
  WifiMode payloadMode = event->GetPayloadMode ();
350
  WifiPreamble preamble = event->GetPreambleType ();
335
  WifiPreamble preamble = event->GetTxVector ().GetPreambleType ();
351
  WifiMode htHeaderMode;
336
  WifiMode htHeaderMode;
352
  if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF)
337
  if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF)
353
    {
338
    {
 Lines 359-369    Link Here 
359
      //mode for PLCP header fields sent with VHT modulation
344
      //mode for PLCP header fields sent with VHT modulation
360
      htHeaderMode = WifiPhy::GetVhtPlcpHeaderMode (payloadMode);
345
      htHeaderMode = WifiPhy::GetVhtPlcpHeaderMode (payloadMode);
361
    }
346
    }
362
  WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble, event->GetTxVector ());
347
  WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (event->GetTxVector ());
363
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector (), preamble); //packet start time + preamble
348
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector ()); //packet start time + preamble
364
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector (), preamble); //packet start time + preamble + L-SIG
349
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector ()); //packet start time + preamble + L-SIG
365
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2)
350
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2)
366
  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B
351
  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B
367
  double noiseInterferenceW = (*j).GetDelta ();
352
  double noiseInterferenceW = (*j).GetDelta ();
368
  double powerW = event->GetRxPowerW ();
353
  double powerW = event->GetRxPowerW ();
369
  j++;
354
  j++;
(-)a/src/wifi/model/interference-helper.h (-16 / +2 lines)
 Lines 25-31    Link Here 
25
#include <vector>
25
#include <vector>
26
#include <list>
26
#include <list>
27
#include "wifi-mode.h"
27
#include "wifi-mode.h"
28
#include "wifi-preamble.h"
29
#include "wifi-phy-standard.h"
28
#include "wifi-phy-standard.h"
30
#include "ns3/nstime.h"
29
#include "ns3/nstime.h"
31
#include "ns3/simple-ref-count.h"
30
#include "ns3/simple-ref-count.h"
 Lines 52-64    Link Here 
52
     *
51
     *
53
     * \param size packet size
52
     * \param size packet size
54
     * \param txVector TXVECTOR of the packet
53
     * \param txVector TXVECTOR of the packet
55
     * \param preamble preamble type
56
     * \param duration duration of the signal
54
     * \param duration duration of the signal
57
     * \param rxPower the receive power (w)
55
     * \param rxPower the receive power (w)
58
     */
56
     */
59
    Event (uint32_t size, WifiTxVector txVector,
57
    Event (uint32_t size, WifiTxVector txVector, Time duration, double rxPower);
60
           enum WifiPreamble preamble,
61
           Time duration, double rxPower);
62
    ~Event ();
58
    ~Event ();
63
59
64
    /**
60
    /**
 Lines 103-120    Link Here 
103
     * \return the Wi-Fi mode used for the payload
99
     * \return the Wi-Fi mode used for the payload
104
     */
100
     */
105
    WifiMode GetPayloadMode (void) const;
101
    WifiMode GetPayloadMode (void) const;
106
    /**
107
     * Return the preamble type of the packet.
108
     *
109
     * \return the preamble type of the packet
110
     */
111
    enum WifiPreamble GetPreambleType (void) const;
112
102
113
103
114
private:
104
private:
115
    uint32_t m_size;
105
    uint32_t m_size;
116
    WifiTxVector m_txVector;
106
    WifiTxVector m_txVector;
117
    enum WifiPreamble m_preamble;
118
    Time m_startTime;
107
    Time m_startTime;
119
    Time m_endTime;
108
    Time m_endTime;
120
    double m_rxPowerW;
109
    double m_rxPowerW;
 Lines 172-186    Link Here 
172
   *
161
   *
173
   * \param size packet size
162
   * \param size packet size
174
   * \param txVector TXVECTOR of the packet
163
   * \param txVector TXVECTOR of the packet
175
   * \param preamble Wi-Fi preamble for the packet
176
   * \param duration the duration of the signal
164
   * \param duration the duration of the signal
177
   * \param rxPower receive power (W)
165
   * \param rxPower receive power (W)
178
   *
166
   *
179
   * \return InterferenceHelper::Event
167
   * \return InterferenceHelper::Event
180
   */
168
   */
181
  Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiTxVector txVector,
169
  Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiTxVector txVector, Time duration, double rxPower);
182
                                      enum WifiPreamble preamble,
183
                                      Time duration, double rxPower);
184
170
185
  /**
171
  /**
186
   * Add a non-Wifi signal to interference helper.
172
   * Add a non-Wifi signal to interference helper.
(-)a/src/wifi/model/mac-low.cc (-275 / +48 lines)
 Lines 533-539    Link Here 
533
void
533
void
534
MacLow::ResetPhy (void)
534
MacLow::ResetPhy (void)
535
{
535
{
536
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ());
536
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector> ());
537
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double> ());
537
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double> ());
538
  RemovePhyMacLowListener (m_phy);
538
  RemovePhyMacLowListener (m_phy);
539
  m_phy = 0;
539
  m_phy = 0;
 Lines 887-895    Link Here 
887
}
887
}
888
888
889
void
889
void
890
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe)
890
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe)
891
{
891
{
892
  NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << preamble);
892
  NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << txVector.GetPreambleType ());
893
  /* A packet is received from the PHY.
893
  /* A packet is received from the PHY.
894
   * When we have handled this packet,
894
   * When we have handled this packet,
895
   * we handle any packet present in the
895
   * we handle any packet present in the
 Lines 901-907    Link Here 
901
901
902
  bool isPrevNavZero = IsNavZero ();
902
  bool isPrevNavZero = IsNavZero ();
903
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
903
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
904
  NotifyNav (packet, hdr, preamble);
904
  NotifyNav (packet, hdr, txVector.GetPreambleType ());
905
  if (hdr.IsRts ())
905
  if (hdr.IsRts ())
906
    {
906
    {
907
      /* see section 9.2.5.7 802.11-1999
907
      /* see section 9.2.5.7 802.11-1999
 Lines 1242-1248    Link Here 
1242
}
1242
}
1243
1243
1244
uint32_t
1244
uint32_t
1245
MacLow::GetBlockAckSize (enum BlockAckType type) const
1245
MacLow::GetBlockAckSize (BlockAckType type) const
1246
{
1246
{
1247
  WifiMacHeader hdr;
1247
  WifiMacHeader hdr;
1248
  hdr.SetType (WIFI_MAC_CTL_BACKRESP);
1248
  hdr.SetType (WIFI_MAC_CTL_BACKRESP);
 Lines 1282-1320    Link Here 
1282
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1282
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1283
{
1283
{
1284
  NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
1284
  NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
1285
  WifiPreamble preamble;
1285
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetFrequency ());
1286
  if (m_stationManager->GetShortPreambleEnabled ())
1287
    {
1288
      preamble = WIFI_PREAMBLE_SHORT;
1289
    }
1290
  else
1291
    {
1292
      preamble = WIFI_PREAMBLE_LONG;
1293
    }
1294
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, preamble, m_phy->GetFrequency ());
1295
}
1286
}
1296
1287
1297
Time
1288
Time
1298
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const
1289
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const
1299
{
1290
{
1300
  /*
1291
  /*
1301
   * For immediate Basic BlockAck we should transmit the frame with the same WifiMode
1292
   * For immediate Basic BlockAck we should transmit the frame with the same WifiMode
1302
   * as the BlockAckReq.
1293
   * as the BlockAckReq.
1303
   */
1294
   */
1304
  WifiPreamble preamble;
1295
  return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, m_phy->GetFrequency ());
1305
  if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK)
1306
    {
1307
      preamble = WIFI_PREAMBLE_HT_MF;
1308
    }
1309
  else if (m_stationManager->GetShortPreambleEnabled ())
1310
    {
1311
      preamble = WIFI_PREAMBLE_SHORT;
1312
    }
1313
  else
1314
    {
1315
      preamble = WIFI_PREAMBLE_LONG;
1316
    }
1317
  return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency ());
1318
}
1296
}
1319
1297
1320
Time
1298
Time
 Lines 1328-1343    Link Here 
1328
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1306
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1329
{
1307
{
1330
  NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1308
  NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1331
  WifiPreamble preamble;
1309
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ());
1332
  if (m_stationManager->GetShortPreambleEnabled ())
1333
    {
1334
      preamble = WIFI_PREAMBLE_SHORT;
1335
    }
1336
  else
1337
    {
1338
      preamble = WIFI_PREAMBLE_LONG;
1339
    }
1340
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ());
1341
}
1310
}
1342
1311
1343
uint32_t
1312
uint32_t
 Lines 1419-1464    Link Here 
1419
                                const WifiMacHeader* hdr,
1388
                                const WifiMacHeader* hdr,
1420
                                const MacLowTransmissionParameters& params) const
1389
                                const MacLowTransmissionParameters& params) const
1421
{
1390
{
1422
  WifiPreamble preamble;
1423
  Time txTime = Seconds (0);
1391
  Time txTime = Seconds (0);
1424
  if (params.MustSendRts ())
1392
  if (params.MustSendRts ())
1425
    {
1393
    {
1426
      WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr);
1394
      WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr);
1427
      if (m_stationManager->GetShortPreambleEnabled ())
1395
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ());
1428
        {
1429
          preamble = WIFI_PREAMBLE_SHORT;
1430
        }
1431
      else
1432
        {
1433
          preamble = WIFI_PREAMBLE_LONG;
1434
        }
1435
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ());
1436
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector);
1396
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector);
1437
      txTime += Time (GetSifs () * 2);
1397
      txTime += Time (GetSifs () * 2);
1438
    }
1398
    }
1439
  WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1399
  WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1440
  if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
1441
    {
1442
      preamble = WIFI_PREAMBLE_VHT;
1443
    }
1444
  else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1445
    {
1446
      preamble = WIFI_PREAMBLE_HT_GF;
1447
    }
1448
  else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1449
    {
1450
      preamble = WIFI_PREAMBLE_HT_MF;
1451
    }
1452
  else if (m_stationManager->GetShortPreambleEnabled ())
1453
    {
1454
      preamble = WIFI_PREAMBLE_SHORT;
1455
    }
1456
  else
1457
    {
1458
      preamble = WIFI_PREAMBLE_LONG;
1459
    }
1460
  uint32_t dataSize = GetSize (packet, hdr);
1400
  uint32_t dataSize = GetSize (packet, hdr);
1461
  txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency ());
1401
  txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFrequency ());
1462
  if (params.MustWaitAck ())
1402
  if (params.MustWaitAck ())
1463
    {
1403
    {
1464
      txTime += GetSifs ();
1404
      txTime += GetSifs ();
 Lines 1476-1504    Link Here 
1476
  if (params.HasNextPacket ())
1416
  if (params.HasNextPacket ())
1477
    {
1417
    {
1478
      WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1418
      WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1479
      WifiPreamble preamble;
1480
      if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1481
        {
1482
          preamble = WIFI_PREAMBLE_VHT;
1483
        }
1484
      if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1485
        {
1486
          preamble = WIFI_PREAMBLE_HT_GF;
1487
        }
1488
      else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1489
        {
1490
          preamble = WIFI_PREAMBLE_HT_MF;
1491
        }
1492
      else if (m_stationManager->GetShortPreambleEnabled ())
1493
        {
1494
          preamble = WIFI_PREAMBLE_SHORT;
1495
        }
1496
      else
1497
        {
1498
          preamble = WIFI_PREAMBLE_LONG;
1499
        }
1500
      txTime += GetSifs ();
1419
      txTime += GetSifs ();
1501
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency ());
1420
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, m_phy->GetFrequency ());
1502
    }
1421
    }
1503
  return txTime;
1422
  return txTime;
1504
}
1423
}
 Lines 1536-1542    Link Here 
1536
          cts.SetType (WIFI_MAC_CTL_CTS);
1455
          cts.SetType (WIFI_MAC_CTL_CTS);
1537
          WifiTxVector txVector = GetRtsTxVector (packet, &hdr);
1456
          WifiTxVector txVector = GetRtsTxVector (packet, &hdr);
1538
          Time navCounterResetCtsMissedDelay =
1457
          Time navCounterResetCtsMissedDelay =
1539
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency ()) +
1458
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, m_phy->GetFrequency ()) +
1540
            Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
1459
            Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
1541
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1460
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1542
                                                            &MacLow::NavCounterResetCtsMissed, this,
1461
                                                            &MacLow::NavCounterResetCtsMissed, this,
 Lines 1620-1638    Link Here 
1620
}
1539
}
1621
1540
1622
void
1541
void
1623
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
1542
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr, WifiTxVector txVector)
1624
                     WifiTxVector txVector, WifiPreamble preamble)
1625
{
1543
{
1626
  NS_LOG_FUNCTION (this << packet << hdr << txVector);
1544
  NS_LOG_FUNCTION (this << packet << hdr << txVector);
1627
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1545
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1628
                ", to=" << hdr->GetAddr1 () <<
1546
                ", to=" << hdr->GetAddr1 () <<
1629
                ", size=" << packet->GetSize () <<
1547
                ", size=" << packet->GetSize () <<
1630
                ", mode=" << txVector.GetMode  () <<
1548
                ", mode=" << txVector.GetMode  () <<
1549
                ", preamble=" << txVector.GetPreambleType () <<
1631
                ", duration=" << hdr->GetDuration () <<
1550
                ", duration=" << hdr->GetDuration () <<
1632
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1551
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1633
  if (!m_ampdu || hdr->IsRts () || hdr->IsBlockAck ())
1552
  if (!m_ampdu || hdr->IsRts () || hdr->IsBlockAck ())
1634
    {
1553
    {
1635
      m_phy->SendPacket (packet, txVector, preamble);
1554
      m_phy->SendPacket (packet, txVector);
1636
    }
1555
    }
1637
  else
1556
  else
1638
    {
1557
    {
 Lines 1644-1650    Link Here 
1644
      uint32_t queueSize = m_aggregateQueue->GetSize ();
1563
      uint32_t queueSize = m_aggregateQueue->GetSize ();
1645
      bool vhtSingleMpdu = false;
1564
      bool vhtSingleMpdu = false;
1646
      bool last = false;
1565
      bool last = false;
1647
      enum mpduType mpdutype = NORMAL_MPDU;
1566
      MpduType mpdutype = NORMAL_MPDU;
1648
      
1567
      
1649
      uint8_t tid = GetTid (packet, *hdr);
1568
      uint8_t tid = GetTid (packet, *hdr);
1650
      AcIndex ac = QosUtilsMapTidToAc (tid);
1569
      AcIndex ac = QosUtilsMapTidToAc (tid);
 Lines 1659-1665    Link Here 
1659
      AmpduTag ampdutag;
1578
      AmpduTag ampdutag;
1660
      ampdutag.SetAmpdu (true);
1579
      ampdutag.SetAmpdu (true);
1661
      Time delay = Seconds (0);
1580
      Time delay = Seconds (0);
1662
      Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, preamble, m_phy->GetFrequency ());
1581
      Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, m_phy->GetFrequency ());
1663
      if (queueSize > 1 || vhtSingleMpdu)
1582
      if (queueSize > 1 || vhtSingleMpdu)
1664
        {
1583
        {
1665
          txVector.SetAggregation (true);
1584
          txVector.SetAggregation (true);
 Lines 1692-1698    Link Here 
1692
                }
1611
                }
1693
            }
1612
            }
1694
          
1613
          
1695
          Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1614
          Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, m_phy->GetFrequency (), mpdutype, 0);
1696
          remainingAmpduDuration -= mpduDuration;
1615
          remainingAmpduDuration -= mpduDuration;
1697
1616
1698
          ampdutag.SetRemainingNbOfMpdus (queueSize - 1);
1617
          ampdutag.SetRemainingNbOfMpdus (queueSize - 1);
 Lines 1708-1718    Link Here 
1708
1627
1709
          if (delay == Seconds (0))
1628
          if (delay == Seconds (0))
1710
            {
1629
            {
1711
              m_phy->SendPacket (newPacket, txVector, preamble, mpdutype);
1630
              m_phy->SendPacket (newPacket, txVector, mpdutype);
1712
            }
1631
            }
1713
          else
1632
          else
1714
            {
1633
            {
1715
              Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, preamble, mpdutype);
1634
              Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, mpdutype);
1716
            }
1635
            }
1717
          if (queueSize > 1)
1636
          if (queueSize > 1)
1718
            {
1637
            {
 Lines 1720-1735    Link Here 
1720
              delay = delay + mpduDuration;
1639
              delay = delay + mpduDuration;
1721
            }
1640
            }
1722
1641
1723
          preamble = WIFI_PREAMBLE_NONE;
1642
          txVector.SetPreambleType (WIFI_PREAMBLE_NONE);
1724
        }
1643
        }
1725
    }
1644
    }
1726
}
1645
}
1727
1646
1728
void
1647
void
1729
MacLow::SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
1648
MacLow::SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype)
1730
{
1649
{
1731
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1650
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1732
  m_phy->SendPacket (packet, txVector, preamble, mpdutype);
1651
  m_phy->SendPacket (packet, txVector, mpdutype);
1733
}
1652
}
1734
1653
1735
void
1654
void
 Lines 1835-1850    Link Here 
1835
  WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr);
1754
  WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr);
1836
  Time duration = Seconds (0);
1755
  Time duration = Seconds (0);
1837
1756
1838
  WifiPreamble preamble;
1839
  if (m_stationManager->GetShortPreambleEnabled ())
1840
    {
1841
      preamble = WIFI_PREAMBLE_SHORT;
1842
    }
1843
  else
1844
    {
1845
      preamble = WIFI_PREAMBLE_LONG;
1846
    }
1847
1848
  if (m_txParams.HasDurationId ())
1757
  if (m_txParams.HasDurationId ())
1849
    {
1758
    {
1850
      duration += m_txParams.GetDurationId ();
1759
      duration += m_txParams.GetDurationId ();
 Lines 1855-1861    Link Here 
1855
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector);
1764
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector);
1856
      duration += GetSifs ();
1765
      duration += GetSifs ();
1857
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
1766
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
1858
                                              m_currentTxVector, preamble, m_phy->GetFrequency ());
1767
                                              m_currentTxVector, m_phy->GetFrequency ());
1859
      duration += GetSifs ();
1768
      duration += GetSifs ();
1860
      if (m_txParams.MustWaitBasicBlockAck ())
1769
      if (m_txParams.MustWaitBasicBlockAck ())
1861
        {
1770
        {
 Lines 1874-1880    Link Here 
1874
      if (m_txParams.HasNextPacket ())
1783
      if (m_txParams.HasNextPacket ())
1875
        {
1784
        {
1876
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1785
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1877
                                                  m_currentTxVector, preamble, m_phy->GetFrequency ());
1786
                                                  m_currentTxVector, m_phy->GetFrequency ());
1878
          if (m_txParams.MustWaitAck ())
1787
          if (m_txParams.MustWaitAck ())
1879
            {
1788
            {
1880
              duration += GetSifs ();
1789
              duration += GetSifs ();
 Lines 1884-1890    Link Here 
1884
    }
1793
    }
1885
  rts.SetDuration (duration);
1794
  rts.SetDuration (duration);
1886
1795
1887
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ());
1796
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ());
1888
  Time timerDelay = txDuration + GetCtsTimeout ();
1797
  Time timerDelay = txDuration + GetCtsTimeout ();
1889
1798
1890
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
1799
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
 Lines 1896-1932    Link Here 
1896
  WifiMacTrailer fcs;
1805
  WifiMacTrailer fcs;
1897
  packet->AddTrailer (fcs);
1806
  packet->AddTrailer (fcs);
1898
1807
1899
  ForwardDown (packet, &rts, rtsTxVector, preamble);
1808
  ForwardDown (packet, &rts, rtsTxVector);
1900
}
1809
}
1901
1810
1902
void
1811
void
1903
MacLow::StartDataTxTimers (WifiTxVector dataTxVector)
1812
MacLow::StartDataTxTimers (WifiTxVector dataTxVector)
1904
{
1813
{
1905
  WifiPreamble preamble;
1814
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, m_phy->GetFrequency ());
1906
1907
  if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
1908
    {
1909
      preamble = WIFI_PREAMBLE_VHT;
1910
    }
1911
  //Since it is data then it can have format = GF
1912
  else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1913
    {
1914
      preamble = WIFI_PREAMBLE_HT_GF;
1915
    }
1916
  else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1917
    {
1918
      preamble = WIFI_PREAMBLE_HT_MF;
1919
    }
1920
  else if (m_stationManager->GetShortPreambleEnabled ())
1921
    {
1922
      preamble = WIFI_PREAMBLE_SHORT;
1923
    }
1924
  else
1925
    {
1926
      preamble = WIFI_PREAMBLE_LONG;
1927
    }
1928
1929
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency ());
1930
  if (m_txParams.MustWaitNormalAck ())
1815
  if (m_txParams.MustWaitNormalAck ())
1931
    {
1816
    {
1932
      Time timerDelay = txDuration + GetAckTimeout ();
1817
      Time timerDelay = txDuration + GetAckTimeout ();
 Lines 1990-2018    Link Here 
1990
{
1875
{
1991
  NS_LOG_FUNCTION (this);
1876
  NS_LOG_FUNCTION (this);
1992
  /* send this packet directly. No RTS is needed. */
1877
  /* send this packet directly. No RTS is needed. */
1993
  WifiPreamble preamble;
1994
  if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
1995
    {
1996
      preamble = WIFI_PREAMBLE_VHT;
1997
    }
1998
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1999
    {
2000
      //In the future has to make sure that receiver has greenfield enabled
2001
      preamble = WIFI_PREAMBLE_HT_GF;
2002
    }
2003
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2004
    {
2005
      preamble = WIFI_PREAMBLE_HT_MF;
2006
    }
2007
  else if (m_stationManager->GetShortPreambleEnabled ())
2008
    {
2009
      preamble = WIFI_PREAMBLE_SHORT;
2010
    }
2011
  else
2012
    {
2013
      preamble = WIFI_PREAMBLE_LONG;
2014
    }
2015
2016
  StartDataTxTimers (m_currentTxVector);
1878
  StartDataTxTimers (m_currentTxVector);
2017
1879
2018
  Time duration = Seconds (0.0);
1880
  Time duration = Seconds (0.0);
 Lines 2043-2049    Link Here 
2043
        {
1905
        {
2044
          duration += GetSifs ();
1906
          duration += GetSifs ();
2045
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1907
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
2046
                                                  m_currentTxVector, preamble, m_phy->GetFrequency ());
1908
                                                  m_currentTxVector, m_phy->GetFrequency ());
2047
          if (m_txParams.MustWaitAck ())
1909
          if (m_txParams.MustWaitAck ())
2048
            {
1910
            {
2049
              duration += GetSifs ();
1911
              duration += GetSifs ();
 Lines 2060-2066    Link Here 
2060
      m_currentPacket->AddTrailer (fcs);
1922
      m_currentPacket->AddTrailer (fcs);
2061
    }
1923
    }
2062
1924
2063
  ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble);
1925
  ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector);
2064
  m_currentPacket = 0;
1926
  m_currentPacket = 0;
2065
}
1927
}
2066
1928
 Lines 2089-2109    Link Here 
2089
  cts.SetAddr1 (m_self);
1951
  cts.SetAddr1 (m_self);
2090
1952
2091
  WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr);
1953
  WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr);
2092
2093
  WifiPreamble preamble;
2094
  if (ctsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2095
    {
2096
      preamble = WIFI_PREAMBLE_HT_MF;
2097
    }
2098
  else if (m_stationManager->GetShortPreambleEnabled ())
2099
    {
2100
      preamble = WIFI_PREAMBLE_SHORT;
2101
    }
2102
  else
2103
    {
2104
      preamble = WIFI_PREAMBLE_LONG;
2105
    }
2106
2107
  Time duration = Seconds (0);
1954
  Time duration = Seconds (0);
2108
1955
2109
  if (m_txParams.HasDurationId ())
1956
  if (m_txParams.HasDurationId ())
 Lines 2114-2120    Link Here 
2114
    {
1961
    {
2115
      duration += GetSifs ();
1962
      duration += GetSifs ();
2116
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr),
1963
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr),
2117
                                              m_currentTxVector, preamble, m_phy->GetFrequency ());
1964
                                              m_currentTxVector, m_phy->GetFrequency ());
2118
      if (m_txParams.MustWaitBasicBlockAck ())
1965
      if (m_txParams.MustWaitBasicBlockAck ())
2119
        {
1966
        {
2120
1967
 Lines 2137-2143    Link Here 
2137
        {
1984
        {
2138
          duration += GetSifs ();
1985
          duration += GetSifs ();
2139
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1986
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
2140
                                                  m_currentTxVector, preamble, m_phy->GetFrequency ());
1987
                                                  m_currentTxVector, m_phy->GetFrequency ());
2141
          if (m_txParams.MustWaitCompressedBlockAck ())
1988
          if (m_txParams.MustWaitCompressedBlockAck ())
2142
            {
1989
            {
2143
              duration += GetSifs ();
1990
              duration += GetSifs ();
 Lines 2159-2167    Link Here 
2159
  WifiMacTrailer fcs;
2006
  WifiMacTrailer fcs;
2160
  packet->AddTrailer (fcs);
2007
  packet->AddTrailer (fcs);
2161
2008
2162
  ForwardDown (packet, &cts, ctsTxVector,preamble);
2009
  ForwardDown (packet, &cts, ctsTxVector);
2163
2010
2164
  Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ());
2011
  Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ());
2165
  txDuration += GetSifs ();
2012
  txDuration += GetSifs ();
2166
  NS_ASSERT (m_sendDataEvent.IsExpired ());
2013
  NS_ASSERT (m_sendDataEvent.IsExpired ());
2167
2014
 Lines 2200-2218    Link Here 
2200
  SnrTag tag;
2047
  SnrTag tag;
2201
  tag.Set (rtsSnr);
2048
  tag.Set (rtsSnr);
2202
  packet->AddPacketTag (tag);
2049
  packet->AddPacketTag (tag);
2203
  
2204
  WifiPreamble preamble;
2205
  if (m_stationManager->GetShortPreambleEnabled ())
2206
    {
2207
      preamble = WIFI_PREAMBLE_SHORT;
2208
    }
2209
  else
2210
    {
2211
      preamble = WIFI_PREAMBLE_LONG;
2212
    }
2213
2050
2214
  //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
2051
  //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
2215
  ForwardDown (packet, &cts, ctsTxVector, preamble);
2052
  ForwardDown (packet, &cts, ctsTxVector);
2216
}
2053
}
2217
2054
2218
void
2055
void
 Lines 2237-2265    Link Here 
2237
      m_txPackets.clear ();
2074
      m_txPackets.clear ();
2238
    }
2075
    }
2239
2076
2240
  WifiPreamble preamble;
2241
  if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
2242
    {
2243
      preamble = WIFI_PREAMBLE_VHT;
2244
    }
2245
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
2246
    {
2247
      //In the future has to make sure that receiver has greenfield enabled
2248
      preamble = WIFI_PREAMBLE_HT_GF;
2249
    }
2250
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2251
    {
2252
      preamble = WIFI_PREAMBLE_HT_MF;
2253
    }
2254
  else if (m_stationManager->GetShortPreambleEnabled ())
2255
    {
2256
      preamble = WIFI_PREAMBLE_SHORT;
2257
    }
2258
  else
2259
    {
2260
      preamble = WIFI_PREAMBLE_LONG;
2261
    }
2262
2263
  StartDataTxTimers (m_currentTxVector);
2077
  StartDataTxTimers (m_currentTxVector);
2264
  Time newDuration = Seconds (0);
2078
  Time newDuration = Seconds (0);
2265
  if (m_txParams.MustWaitBasicBlockAck ())
2079
  if (m_txParams.MustWaitBasicBlockAck ())
 Lines 2282-2288    Link Here 
2282
  if (m_txParams.HasNextPacket ())
2096
  if (m_txParams.HasNextPacket ())
2283
    {
2097
    {
2284
      newDuration += GetSifs ();
2098
      newDuration += GetSifs ();
2285
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ());
2099
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ());
2286
      if (m_txParams.MustWaitCompressedBlockAck ())
2100
      if (m_txParams.MustWaitCompressedBlockAck ())
2287
        {
2101
        {
2288
          newDuration += GetSifs ();
2102
          newDuration += GetSifs ();
 Lines 2296-2302    Link Here 
2296
        }
2110
        }
2297
    }
2111
    }
2298
2112
2299
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, preamble, m_phy->GetFrequency ());
2113
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, m_phy->GetFrequency ());
2300
  duration -= txDuration;
2114
  duration -= txDuration;
2301
  duration -= GetSifs ();
2115
  duration -= GetSifs ();
2302
2116
 Lines 2311-2317    Link Here 
2311
      m_currentPacket->AddTrailer (fcs);
2125
      m_currentPacket->AddTrailer (fcs);
2312
    }
2126
    }
2313
2127
2314
  ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble);
2128
  ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector);
2315
  m_currentPacket = 0;
2129
  m_currentPacket = 0;
2316
}
2130
}
2317
2131
 Lines 2373-2391    Link Here 
2373
  SnrTag tag;
2187
  SnrTag tag;
2374
  tag.Set (dataSnr);
2188
  tag.Set (dataSnr);
2375
  packet->AddPacketTag (tag);
2189
  packet->AddPacketTag (tag);
2376
  
2377
  WifiPreamble preamble;
2378
  if (m_stationManager->GetShortPreambleEnabled ())
2379
    {
2380
      preamble = WIFI_PREAMBLE_SHORT;
2381
    }
2382
  else
2383
    {
2384
      preamble = WIFI_PREAMBLE_LONG;
2385
    }
2386
2190
2387
  //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
2191
  //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
2388
  ForwardDown (packet, &ack, ackTxVector, preamble);
2192
  ForwardDown (packet, &ack, ackTxVector);
2389
}
2193
}
2390
2194
2391
bool
2195
bool
 Lines 2675-2697    Link Here 
2675
  packet->AddHeader (hdr);
2479
  packet->AddHeader (hdr);
2676
  WifiMacTrailer fcs;
2480
  WifiMacTrailer fcs;
2677
  packet->AddTrailer (fcs);
2481
  packet->AddTrailer (fcs);
2678
  WifiPreamble preamble;
2679
  if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2680
    {
2681
      preamble = WIFI_PREAMBLE_HT_MF;
2682
    }
2683
  else if (m_stationManager->GetShortPreambleEnabled ())
2684
    {
2685
      preamble = WIFI_PREAMBLE_SHORT;
2686
    }
2687
  else
2688
    {
2689
      preamble = WIFI_PREAMBLE_LONG;
2690
    }
2691
  SnrTag tag;
2482
  SnrTag tag;
2692
  tag.Set (rxSnr);
2483
  tag.Set (rxSnr);
2693
  packet->AddPacketTag (tag);
2484
  packet->AddPacketTag (tag);
2694
  ForwardDown (packet, &hdr, blockAckReqTxVector, preamble);
2485
  ForwardDown (packet, &hdr, blockAckReqTxVector);
2695
  m_currentPacket = 0;
2486
  m_currentPacket = 0;
2696
}
2487
}
2697
2488
 Lines 2805-2817    Link Here 
2805
}
2596
}
2806
2597
2807
void
2598
void
2808
MacLow::RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener)
2599
MacLow::RegisterBlockAckListenerForAc (AcIndex ac, MacLowAggregationCapableTransmissionListener *listener)
2809
{
2600
{
2810
  m_edcaListeners.insert (std::make_pair (ac, listener));
2601
  m_edcaListeners.insert (std::make_pair (ac, listener));
2811
}
2602
}
2812
2603
2813
void
2604
void
2814
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble)
2605
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector)
2815
{
2606
{
2816
  NS_LOG_FUNCTION (this);
2607
  NS_LOG_FUNCTION (this);
2817
  AmpduTag ampdu;
2608
  AmpduTag ampdu;
 Lines 2826-2831    Link Here 
2826
      WifiMacHeader firsthdr;
2617
      WifiMacHeader firsthdr;
2827
      (*n).first->PeekHeader (firsthdr);
2618
      (*n).first->PeekHeader (firsthdr);
2828
      NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ());
2619
      NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ());
2620
      WifiPreamble preamble = txVector.GetPreambleType ();
2829
      NotifyNav ((*n).first, firsthdr, preamble);
2621
      NotifyNav ((*n).first, firsthdr, preamble);
2830
2622
2831
      if (firsthdr.GetAddr1 () == m_self)
2623
      if (firsthdr.GetAddr1 () == m_self)
 Lines 2850-2861    Link Here 
2850
2642
2851
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2643
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2852
            {
2644
            {
2853
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
2645
              ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe);
2854
            }
2646
            }
2855
          else if (firsthdr.IsData () || firsthdr.IsQosData ())
2647
          else if (firsthdr.IsData () || firsthdr.IsQosData ())
2856
            {
2648
            {
2857
              NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ());
2649
              NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ());
2858
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
2650
              ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe);
2859
              if (firsthdr.IsQosAck ())
2651
              if (firsthdr.IsQosAck ())
2860
                {
2652
                {
2861
                  NS_LOG_DEBUG ("Normal Ack");
2653
                  NS_LOG_DEBUG ("Normal Ack");
 Lines 2895-2901    Link Here 
2895
    }
2687
    }
2896
  else
2688
  else
2897
    {
2689
    {
2898
      ReceiveOk (aggregatedPacket, rxSnr, txVector, preamble, ampduSubframe);
2690
      ReceiveOk (aggregatedPacket, rxSnr, txVector, ampduSubframe);
2899
    }
2691
    }
2900
}
2692
}
2901
2693
 Lines 2908-2944    Link Here 
2908
      return true;
2700
      return true;
2909
    }
2701
    }
2910
2702
2911
  WifiPreamble preamble;
2912
  Time aPPDUMaxTime = MilliSeconds (10);
2703
  Time aPPDUMaxTime = MilliSeconds (10);
2913
2914
  uint8_t tid = GetTid (peekedPacket, peekedHdr);
2704
  uint8_t tid = GetTid (peekedPacket, peekedHdr);
2915
  AcIndex ac = QosUtilsMapTidToAc (tid);
2705
  AcIndex ac = QosUtilsMapTidToAc (tid);
2916
  std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
2706
  std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
2917
2707
2918
  if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
2708
  if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
2919
    {
2709
    {
2920
      preamble = WIFI_PREAMBLE_VHT;
2921
      aPPDUMaxTime = MicroSeconds (5484);
2710
      aPPDUMaxTime = MicroSeconds (5484);
2922
    }
2711
    }
2923
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
2924
    {
2925
      preamble = WIFI_PREAMBLE_HT_GF;
2926
    }
2927
  else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2928
    {
2929
      preamble = WIFI_PREAMBLE_HT_MF;
2930
    }
2931
  else if (m_stationManager->GetShortPreambleEnabled ())
2932
    {
2933
      preamble = WIFI_PREAMBLE_SHORT;
2934
    }
2935
  else
2936
    {
2937
      preamble = WIFI_PREAMBLE_LONG;
2938
    }
2939
2712
2940
  //A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime
2713
  //A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime
2941
  if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, preamble, m_phy->GetFrequency ()) > aPPDUMaxTime)
2714
  if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy->GetFrequency ()) > aPPDUMaxTime)
2942
    {
2715
    {
2943
      NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime");
2716
      NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime");
2944
      return true;
2717
      return true;
(-)a/src/wifi/model/mac-low.h (-13 / +7 lines)
 Lines 30-36    Link Here 
30
#include "wifi-mac-header.h"
30
#include "wifi-mac-header.h"
31
#include "wifi-mode.h"
31
#include "wifi-mode.h"
32
#include "wifi-phy.h"
32
#include "wifi-phy.h"
33
#include "wifi-preamble.h"
34
#include "wifi-remote-station-manager.h"
33
#include "wifi-remote-station-manager.h"
35
#include "ctrl-headers.h"
34
#include "ctrl-headers.h"
36
#include "mgt-headers.h"
35
#include "mgt-headers.h"
 Lines 731-743    Link Here 
731
   * \param packet packet received
730
   * \param packet packet received
732
   * \param rxSnr snr of packet received
731
   * \param rxSnr snr of packet received
733
   * \param txVector TXVECTOR of packet received
732
   * \param txVector TXVECTOR of packet received
734
   * \param preamble type of preamble used for the packet received
735
   * \param ampduSubframe true if this MPDU is part of an A-MPDU
733
   * \param ampduSubframe true if this MPDU is part of an A-MPDU
736
   *
734
   *
737
   * This method is typically invoked by the lower PHY layer to notify
735
   * This method is typically invoked by the lower PHY layer to notify
738
   * the MAC layer that a packet was successfully received.
736
   * the MAC layer that a packet was successfully received.
739
   */
737
   */
740
  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe);
738
  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe);
741
  /**
739
  /**
742
   * \param packet packet received.
740
   * \param packet packet received.
743
   * \param rxSnr snr of packet received.
741
   * \param rxSnr snr of packet received.
 Lines 795-801    Link Here 
795
   * The lifetime of the registered listener is typically equal to the lifetime of the queue
793
   * The lifetime of the registered listener is typically equal to the lifetime of the queue
796
   * associated to this AC.
794
   * associated to this AC.
797
   */
795
   */
798
  void RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener);
796
  void RegisterBlockAckListenerForAc (AcIndex ac, MacLowAggregationCapableTransmissionListener *listener);
799
  /**
797
  /**
800
   * \param packet the packet to be aggregated. If the aggregation is succesfull, it corresponds either to the first data packet that will be aggregated or to the BAR that will be piggybacked at the end of the A-MPDU.
798
   * \param packet the packet to be aggregated. If the aggregation is succesfull, it corresponds either to the first data packet that will be aggregated or to the BAR that will be piggybacked at the end of the A-MPDU.
801
   * \param hdr the WifiMacHeader for the packet.
799
   * \param hdr the WifiMacHeader for the packet.
 Lines 809-820    Link Here 
809
   * \param aggregatedPacket which is the current A-MPDU
807
   * \param aggregatedPacket which is the current A-MPDU
810
   * \param rxSnr snr of packet received
808
   * \param rxSnr snr of packet received
811
   * \param txVector TXVECTOR of packet received
809
   * \param txVector TXVECTOR of packet received
812
   * \param preamble type of preamble used for the packet received
813
   *
810
   *
814
   * This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
811
   * This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
815
   *
812
   *
816
   */
813
   */
817
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble);
814
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector);
818
  /**
815
  /**
819
   * \param peekedPacket the packet to be aggregated
816
   * \param peekedPacket the packet to be aggregated
820
   * \param peekedHdr the WifiMacHeader for the packet.
817
   * \param peekedHdr the WifiMacHeader for the packet.
 Lines 862-868    Link Here 
862
   * \param type the Block ACK type
859
   * \param type the Block ACK type
863
   * \return the total Block ACK size
860
   * \return the total Block ACK size
864
   */
861
   */
865
  uint32_t GetBlockAckSize (enum BlockAckType type) const;
862
  uint32_t GetBlockAckSize (BlockAckType type) const;
866
  /**
863
  /**
867
   * Return the total RTS size (including FCS trailer).
864
   * Return the total RTS size (including FCS trailer).
868
   *
865
   *
 Lines 890-909    Link Here 
890
   * \param packet
887
   * \param packet
891
   * \param hdr
888
   * \param hdr
892
   * \param txVector
889
   * \param txVector
893
   * \param preamble
894
   */
890
   */
895
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
891
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr, WifiTxVector txVector);
896
                    WifiTxVector txVector, WifiPreamble preamble);
897
  /**
892
  /**
898
   * Forward the MPDU down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used.
893
   * Forward the MPDU down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used.
899
   *
894
   *
900
   * \param packet
895
   * \param packet
901
   * \param hdr
896
   * \param hdr
902
   * \param txVector
897
   * \param txVector
903
   * \param preamble
904
   * \param mpdutype
898
   * \param mpdutype
905
   */
899
   */
906
  void SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype);
900
  void SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype);
907
  /**
901
  /**
908
   * Return a TXVECTOR for the RTS frame given the destination.
902
   * Return a TXVECTOR for the RTS frame given the destination.
909
   * The function consults WifiRemoteStationManager, which controls the rate
903
   * The function consults WifiRemoteStationManager, which controls the rate
 Lines 1020-1026    Link Here 
1020
   * \param type the Block ACK type
1014
   * \param type the Block ACK type
1021
   * \return the time required to transmit the Block ACK (including preamble and FCS)
1015
   * \return the time required to transmit the Block ACK (including preamble and FCS)
1022
   */
1016
   */
1023
  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
1017
  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const;
1024
  /**
1018
  /**
1025
   * Check if the current packet should be sent with a RTS protection.
1019
   * Check if the current packet should be sent with a RTS protection.
1026
   *
1020
   *
(-)a/src/wifi/model/mgt-headers.h (-5 / +5 lines)
 Lines 614-623    Link Here 
614
   */
614
   */
615
  typedef union
615
  typedef union
616
  {
616
  {
617
    enum MeshActionValue meshAction;
617
    MeshActionValue meshAction;
618
    enum MultihopActionValue multihopAction;
618
    MultihopActionValue multihopAction;
619
    enum SelfProtectedActionValue selfProtectedAction;
619
    SelfProtectedActionValue selfProtectedAction;
620
    enum BlockAckActionValue blockAck;
620
    BlockAckActionValue blockAck;
621
  } ActionValue;
621
  } ActionValue;
622
  /**
622
  /**
623
   * Set action for this Action header.
623
   * Set action for this Action header.
 Lines 625-631    Link Here 
625
   * \param type category
625
   * \param type category
626
   * \param action action
626
   * \param action action
627
   */
627
   */
628
  void   SetAction (enum CategoryValue type,ActionValue action);
628
  void   SetAction (CategoryValue type, ActionValue action);
629
629
630
  /**
630
  /**
631
   * Return the category value.
631
   * Return the category value.
(-)a/src/wifi/model/minstrel-ht-wifi-manager.cc (-7 / +9 lines)
 Lines 85-93    Link Here 
85
      std::vector<std::vector<uint32_t> > ().swap (m_sampleTable);
85
      std::vector<std::vector<uint32_t> > ().swap (m_sampleTable);
86
      for (uint8_t j = 0; j < m_groupsTable.size (); j++)
86
      for (uint8_t j = 0; j < m_groupsTable.size (); j++)
87
        {
87
        {
88
          std::vector<struct HtRateInfo> ().swap (m_groupsTable[j].m_ratesTable);
88
          std::vector<HtRateInfo> ().swap (m_groupsTable[j].m_ratesTable);
89
        }
89
        }
90
      std::vector<struct GroupInfo> ().swap (m_groupsTable);
90
      std::vector<GroupInfo> ().swap (m_groupsTable);
91
      m_statsFile.close ();
91
      m_statsFile.close ();
92
    }
92
    }
93
}
93
}
 Lines 340-346    Link Here 
340
  txvector.SetNess (0);
340
  txvector.SetNess (0);
341
  txvector.SetStbc (phy->GetStbc ());
341
  txvector.SetStbc (phy->GetStbc ());
342
  txvector.SetMode (mode);
342
  txvector.SetMode (mode);
343
  return phy->CalculateTxDuration (m_frameLength, txvector, WIFI_PREAMBLE_HT_MF, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
343
  txvector.SetPreambleType (WIFI_PREAMBLE_HT_MF);
344
  return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
344
}
345
}
345
346
346
Time
347
Time
 Lines 355-361    Link Here 
355
  txvector.SetNess (0);
356
  txvector.SetNess (0);
356
  txvector.SetStbc (phy->GetStbc ());
357
  txvector.SetStbc (phy->GetStbc ());
357
  txvector.SetMode (mode);
358
  txvector.SetMode (mode);
358
  return phy->CalculateTxDuration (m_frameLength, txvector, WIFI_PREAMBLE_NONE, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
359
  txvector.SetPreambleType (WIFI_PREAMBLE_NONE);
360
  return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
359
}
361
}
360
362
361
Time
363
Time
 Lines 932-939    Link Here 
932
        {
934
        {
933
          m_rateChange (dataRate, station->m_state->m_address);
935
          m_rateChange (dataRate, station->m_state->m_address);
934
        }
936
        }
935
937
      WifiMode mode = GetMcsSupported (station, mcsIndex);
936
      return WifiTxVector (GetMcsSupported (station, mcsIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station),
938
      return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)),
937
                           group.sgi, group.streams, GetNess (station), group.chWidth, GetAggregation (station) && !station->m_isSampling, GetStbc (station));
939
                           group.sgi, group.streams, GetNess (station), group.chWidth, GetAggregation (station) && !station->m_isSampling, GetStbc (station));
938
    }
940
    }
939
}
941
}
 Lines 1009-1015    Link Here 
1009
1011
1010
      NS_ASSERT (rateFound);
1012
      NS_ASSERT (rateFound);
1011
1013
1012
      return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), GetShortRetryCount (station),
1014
      return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (rtsRate, GetAddress (station)),
1013
                           false, 1, 0, GetChannelWidth (station), GetAggregation (station), false);
1015
                           false, 1, 0, GetChannelWidth (station), GetAggregation (station), false);
1014
    }
1016
    }
1015
}
1017
}
(-)a/src/wifi/model/minstrel-ht-wifi-manager.h (-2 / +2 lines)
 Lines 67-73    Link Here 
67
 * Data structure for a table of group definitions.
67
 * Data structure for a table of group definitions.
68
 * A vector of McsGroups.
68
 * A vector of McsGroups.
69
 */
69
 */
70
typedef std::vector<struct McsGroup> MinstrelMcsGroups;
70
typedef std::vector<McsGroup> MinstrelMcsGroups;
71
71
72
struct MinstrelHtWifiRemoteStation;
72
struct MinstrelHtWifiRemoteStation;
73
/**
73
/**
 Lines 114-120    Link Here 
114
 * Data structure for a Minstrel Rate table.
114
 * Data structure for a Minstrel Rate table.
115
 * A vector of a struct HtRateInfo.
115
 * A vector of a struct HtRateInfo.
116
 */
116
 */
117
typedef std::vector<struct HtRateInfo> HtMinstrelRate;
117
typedef std::vector<HtRateInfo> HtMinstrelRate;
118
118
119
/**
119
/**
120
 * A struct to contain information of a group.
120
 * A struct to contain information of a group.
(-)a/src/wifi/model/minstrel-wifi-manager.cc (-4 / +8 lines)
 Lines 111-117    Link Here 
111
      WifiMode mode = phy->GetMode (i);
111
      WifiMode mode = phy->GetMode (i);
112
      WifiTxVector txVector;
112
      WifiTxVector txVector;
113
      txVector.SetMode (mode);
113
      txVector.SetMode (mode);
114
      AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()));
114
      txVector.SetPreambleType (WIFI_PREAMBLE_LONG);
115
      AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, phy->GetFrequency ()));
115
    }
116
    }
116
  WifiRemoteStationManager::SetupPhy (phy);
117
  WifiRemoteStationManager::SetupPhy (phy);
117
}
118
}
 Lines 361-367    Link Here 
361
      //start the rate at half way
362
      //start the rate at half way
362
      station->m_txrate = station->m_nModes / 2;
363
      station->m_txrate = station->m_nModes / 2;
363
    }
364
    }
364
  return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
365
  WifiMode mode = GetSupported (station, station->m_txrate);
366
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
365
}
367
}
366
368
367
WifiTxVector
369
WifiTxVector
 Lines 376-389    Link Here 
376
      channelWidth = 20;
378
      channelWidth = 20;
377
    }
379
    }
378
  WifiTxVector rtsTxVector;
380
  WifiTxVector rtsTxVector;
381
  WifiMode mode;
379
  if (GetUseNonErpProtection () == false)
382
  if (GetUseNonErpProtection () == false)
380
    {
383
    {
381
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
384
      mode = GetSupported (station, 0);
382
    }
385
    }
383
  else
386
  else
384
    {
387
    {
385
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
388
      mode = GetNonErpSupported (station, 0);
386
    }
389
    }
390
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
387
  return rtsTxVector;
391
  return rtsTxVector;
388
}
392
}
389
393
(-)a/src/wifi/model/minstrel-wifi-manager.h (-1 / +1 lines)
 Lines 66-72    Link Here 
66
 * Data structure for a Minstrel Rate table
66
 * Data structure for a Minstrel Rate table
67
 * A vector of a struct RateInfo
67
 * A vector of a struct RateInfo
68
 */
68
 */
69
typedef std::vector<struct RateInfo> MinstrelRate;
69
typedef std::vector<RateInfo> MinstrelRate;
70
/**
70
/**
71
 * Data structure for a Sample Rate table
71
 * Data structure for a Sample Rate table
72
 * A vector of a vector uint32_t
72
 * A vector of a vector uint32_t
(-)a/src/wifi/model/onoe-wifi-manager.cc (-3 / +6 lines)
 Lines 283-289    Link Here 
283
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
283
      //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac
284
      channelWidth = 20;
284
      channelWidth = 20;
285
    }
285
    }
286
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
286
  WifiMode mode = GetSupported (station, rateIndex);
287
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false);
287
}
288
}
288
289
289
WifiTxVector
290
WifiTxVector
 Lines 298-311    Link Here 
298
    }
299
    }
299
  UpdateMode (station);
300
  UpdateMode (station);
300
  WifiTxVector rtsTxVector;
301
  WifiTxVector rtsTxVector;
302
  WifiMode mode;
301
  if (GetUseNonErpProtection () == false)
303
  if (GetUseNonErpProtection () == false)
302
    {
304
    {
303
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
305
      mode = GetSupported (station, 0);
304
    }
306
    }
305
  else
307
  else
306
    {
308
    {
307
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
309
      mode = GetNonErpSupported (station, 0);
308
    }
310
    }
311
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false);
309
  return rtsTxVector;
312
  return rtsTxVector;
310
}
313
}
311
314
(-)a/src/wifi/model/originator-block-ack-agreement.cc (-1 / +1 lines)
 Lines 44-50    Link Here 
44
}
44
}
45
45
46
void
46
void
47
OriginatorBlockAckAgreement::SetState (enum State state)
47
OriginatorBlockAckAgreement::SetState (State state)
48
{
48
{
49
  m_state = state;
49
  m_state = state;
50
  if (state == INACTIVE)
50
  if (state == INACTIVE)
(-)a/src/wifi/model/originator-block-ack-agreement.h (-2 / +2 lines)
 Lines 95-101    Link Here 
95
    INACTIVE,
95
    INACTIVE,
96
    UNSUCCESSFUL
96
    UNSUCCESSFUL
97
  };
97
  };
98
  void SetState (enum State state);
98
  void SetState (State state);
99
  /**
99
  /**
100
   * Check if the current state of this agreement is PENDING.
100
   * Check if the current state of this agreement is PENDING.
101
   *
101
   *
 Lines 142-148    Link Here 
142
142
143
143
144
private:
144
private:
145
  enum State m_state;
145
  State m_state;
146
  uint16_t m_sentMpdus;
146
  uint16_t m_sentMpdus;
147
  bool m_needBlockAckReq;
147
  bool m_needBlockAckReq;
148
};
148
};
(-)a/src/wifi/model/parf-wifi-manager.cc (-3 / +6 lines)
 Lines 301-307    Link Here 
301
      channelWidth = 20;
301
      channelWidth = 20;
302
    }
302
    }
303
  CheckInit (station);
303
  CheckInit (station);
304
  return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
304
  WifiMode mode = GetSupported (station, station->m_currentRate);
305
  return WifiTxVector (mode, station->m_currentPower, GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
305
}
306
}
306
307
307
WifiTxVector
308
WifiTxVector
 Lines 318-331    Link Here 
318
      channelWidth = 20;
319
      channelWidth = 20;
319
    }
320
    }
320
  WifiTxVector rtsTxVector;
321
  WifiTxVector rtsTxVector;
322
  WifiMode mode;
321
  if (GetUseNonErpProtection () == false)
323
  if (GetUseNonErpProtection () == false)
322
    {
324
    {
323
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
325
      mode = GetSupported (station, 0);
324
    }
326
    }
325
  else
327
  else
326
    {
328
    {
327
      rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
329
      mode = GetNonErpSupported (station, 0);
328
    }
330
    }
331
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
329
  return rtsTxVector;
332
  return rtsTxVector;
330
}
333
}
331
334
(-)a/src/wifi/model/regular-wifi-mac.cc (-2 / +2 lines)
 Lines 344-350    Link Here 
344
}
344
}
345
345
346
void
346
void
347
RegularWifiMac::SetupEdcaQueue (enum AcIndex ac)
347
RegularWifiMac::SetupEdcaQueue (AcIndex ac)
348
{
348
{
349
  NS_LOG_FUNCTION (this << ac);
349
  NS_LOG_FUNCTION (this << ac);
350
350
 Lines 1099-1105    Link Here 
1099
}
1099
}
1100
1100
1101
void
1101
void
1102
RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
1102
RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard)
1103
{
1103
{
1104
  NS_LOG_FUNCTION (this << standard);
1104
  NS_LOG_FUNCTION (this << standard);
1105
  uint32_t cwmin = 0;
1105
  uint32_t cwmin = 0;
(-)a/src/wifi/model/regular-wifi-mac.h (-2 / +2 lines)
 Lines 339-345    Link Here 
339
   * deal with certain values in the WifiPhyStandard enumeration, and
339
   * deal with certain values in the WifiPhyStandard enumeration, and
340
   * chain up to this implementation to deal with the remainder.
340
   * chain up to this implementation to deal with the remainder.
341
   */
341
   */
342
  virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
342
  virtual void FinishConfigureStandard (WifiPhyStandard standard);
343
  
343
  
344
  /**
344
  /**
345
   * \param cwMin the minimum congestion window size
345
   * \param cwMin the minimum congestion window size
 Lines 539-545    Link Here 
539
   *
539
   *
540
   * \param ac the Access Category index of the queue to initialise.
540
   * \param ac the Access Category index of the queue to initialise.
541
   */
541
   */
542
  void SetupEdcaQueue (enum AcIndex ac);
542
  void SetupEdcaQueue (AcIndex ac);
543
543
544
  void SetVoMaxAmsduSize (uint32_t size);
544
  void SetVoMaxAmsduSize (uint32_t size);
545
  void SetViMaxAmsduSize (uint32_t size);
545
  void SetViMaxAmsduSize (uint32_t size);
(-)a/src/wifi/model/rraa-wifi-manager.cc (-5 / +8 lines)
 Lines 295-301    Link Here 
295
    {
295
    {
296
      ResetCountersBasic (station);
296
      ResetCountersBasic (station);
297
    }
297
    }
298
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
298
  WifiMode mode = GetSupported (station, station->m_rate);
299
  return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false);
299
}
300
}
300
301
301
WifiTxVector
302
WifiTxVector
 Lines 309-322    Link Here 
309
      channelWidth = 20;
310
      channelWidth = 20;
310
    }
311
    }
311
  WifiTxVector rtsTxVector;
312
  WifiTxVector rtsTxVector;
313
  WifiMode mode;
312
  if (GetUseNonErpProtection () == false)
314
  if (GetUseNonErpProtection () == false)
313
    {
315
    {
314
      rtsTxVector = WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false);
316
      mode = GetSupported (st, 0);
315
    }
317
    }
316
  else
318
  else
317
    {
319
    {
318
      rtsTxVector = WifiTxVector (GetNonErpSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false);
320
      mode = GetNonErpSupported (st, 0);
319
    }
321
    }
322
  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false);
320
  return rtsTxVector;
323
  return rtsTxVector;
321
}
324
}
322
325
 Lines 391-397    Link Here 
391
    }
394
    }
392
}
395
}
393
396
394
struct RraaWifiManager::ThresholdsItem
397
RraaWifiManager::ThresholdsItem
395
RraaWifiManager::GetThresholds (RraaWifiRemoteStation *station,
398
RraaWifiManager::GetThresholds (RraaWifiRemoteStation *station,
396
                                uint32_t rate) const
399
                                uint32_t rate) const
397
{
400
{
 Lines 399-405    Link Here 
399
  return GetThresholds (mode, station);
402
  return GetThresholds (mode, station);
400
}
403
}
401
404
402
struct RraaWifiManager::ThresholdsItem
405
RraaWifiManager::ThresholdsItem
403
RraaWifiManager::GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const
406
RraaWifiManager::GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const
404
{
407
{
405
  uint8_t nss = 1;  // This RAA only supports 1 spatial stream
408
  uint8_t nss = 1;  // This RAA only supports 1 spatial stream
(-)a/src/wifi/model/rraa-wifi-manager.h (-2 / +2 lines)
 Lines 131-137    Link Here 
131
   *
131
   *
132
   * \return threshold
132
   * \return threshold
133
   */
133
   */
134
  struct ThresholdsItem GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const;
134
  ThresholdsItem GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const;
135
  /**
135
  /**
136
   * Get a threshold for the given station and mode index.
136
   * Get a threshold for the given station and mode index.
137
   *
137
   *
 Lines 140-146    Link Here 
140
   *
140
   *
141
   * \return threshold
141
   * \return threshold
142
   */
142
   */
143
  struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const;
143
  ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const;
144
144
145
  bool m_basic;
145
  bool m_basic;
146
  Time m_timeout;
146
  Time m_timeout;
(-)a/src/wifi/model/spectrum-wifi-phy.cc (-47 / +23 lines)
 Lines 416-435    Link Here 
416
      return;
416
      return;
417
    }
417
    }
418
418
419
  enum WifiPreamble preamble = tag.GetWifiPreamble ();
419
  WifiPreamble preamble = txVector.GetPreambleType ();
420
  enum mpduType mpdutype = tag.GetMpduType ();
420
  MpduType mpdutype = tag.GetMpduType ();
421
421
422
  // At this point forward, processing parallels that of
422
  // At this point forward, processing parallels that of
423
  // YansWifiPhy::StartReceivePreambleAndHeader ()
423
  // YansWifiPhy::StartReceivePreambleAndHeader ()
424
424
425
  AmpduTag ampduTag;
425
  AmpduTag ampduTag;
426
  Time endRx = Simulator::Now () + rxDuration;
426
  Time endRx = Simulator::Now () + rxDuration;
427
  Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble);
427
  Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
428
428
429
  Ptr<InterferenceHelper::Event> event;
429
  Ptr<InterferenceHelper::Event> event;
430
  event = m_interference.Add (packet->GetSize (),
430
  event = m_interference.Add (packet->GetSize (),
431
                              txVector,
431
                              txVector,
432
                              preamble,
433
                              rxDuration,
432
                              rxDuration,
434
                              rxPowerW);
433
                              rxPowerW);
435
434
 Lines 533-539    Link Here 
533
            {
532
            {
534
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
533
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
535
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &SpectrumWifiPhy::StartReceivePacket, this,
534
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &SpectrumWifiPhy::StartReceivePacket, this,
536
                                                      packet, txVector, preamble, mpdutype, event);
535
                                                      packet, txVector, mpdutype, event);
537
            }
536
            }
538
537
539
          NS_ASSERT (m_endRxEvent.IsExpired ());
538
          NS_ASSERT (m_endRxEvent.IsExpired ());
 Lines 563-579    Link Here 
563
void
562
void
564
SpectrumWifiPhy::StartReceivePacket (Ptr<Packet> packet,
563
SpectrumWifiPhy::StartReceivePacket (Ptr<Packet> packet,
565
                                     WifiTxVector txVector,
564
                                     WifiTxVector txVector,
566
                                     enum WifiPreamble preamble,
565
                                     MpduType mpdutype,
567
                                     enum mpduType mpdutype,
568
                                     Ptr<InterferenceHelper::Event> event)
566
                                     Ptr<InterferenceHelper::Event> event)
569
{
567
{
570
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)mpdutype);
568
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << (uint32_t)mpdutype);
571
  NS_ASSERT (IsStateRx ());
569
  NS_ASSERT (IsStateRx ());
572
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
570
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
573
  AmpduTag ampduTag;
571
  AmpduTag ampduTag;
574
  WifiMode txMode = txVector.GetMode ();
572
  WifiMode txMode = txVector.GetMode ();
575
573
576
  struct InterferenceHelper::SnrPer snrPer;
574
  InterferenceHelper::SnrPer snrPer;
577
  snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
575
  snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
578
576
579
  NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per);
577
  NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per);
 Lines 628-639    Link Here 
628
  m_wifiSpectrumPhyInterface->SetDevice (device);
626
  m_wifiSpectrumPhyInterface->SetDevice (device);
629
}
627
}
630
628
631
void
632
SpectrumWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble)
633
{
634
  SendPacket (packet, txVector, preamble, NORMAL_MPDU);
635
}
636
637
Ptr<SpectrumValue>
629
Ptr<SpectrumValue>
638
SpectrumWifiPhy::GetTxPowerSpectralDensity (uint32_t centerFrequency, uint32_t channelWidth, double txPowerW) const
630
SpectrumWifiPhy::GetTxPowerSpectralDensity (uint32_t centerFrequency, uint32_t channelWidth, double txPowerW) const
639
{
631
{
 Lines 664-674    Link Here 
664
}
656
}
665
657
666
void
658
void
667
SpectrumWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
659
SpectrumWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype)
668
{
660
{
669
  NS_LOG_FUNCTION (this << packet << txVector.GetMode ()
661
  NS_LOG_FUNCTION (this << packet << txVector.GetMode ()
670
                        << txVector.GetMode ().GetDataRate (txVector)
662
                        << txVector.GetMode ().GetDataRate (txVector)
671
                        << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype);
663
                        << txVector.GetPreambleType ()
664
                        << (uint32_t)txVector.GetTxPowerLevel ()
665
                        << (uint32_t)mpdutype);
672
  /* Transmission can happen if:
666
  /* Transmission can happen if:
673
   *  - we are syncing on a packet. It is the responsability of the
667
   *  - we are syncing on a packet. It is the responsability of the
674
   *    MAC layer to avoid doing this but the PHY does nothing to
668
   *    MAC layer to avoid doing this but the PHY does nothing to
 Lines 684-690    Link Here 
684
      return;
678
      return;
685
    }
679
    }
686
680
687
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), mpdutype, 1);
681
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency (), mpdutype, 1);
688
  NS_ASSERT (txDuration > NanoSeconds (0));
682
  NS_ASSERT (txDuration > NanoSeconds (0));
689
683
690
  if (m_state->IsStateRx ())
684
  if (m_state->IsStateRx ())
 Lines 694-725    Link Here 
694
      m_interference.NotifyRxEnd ();
688
      m_interference.NotifyRxEnd ();
695
    }
689
    }
696
  NotifyTxBegin (packet);
690
  NotifyTxBegin (packet);
697
  uint32_t dataRate500KbpsUnits;
691
  if ((mpdutype == MPDU_IN_AGGREGATE) && (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE))
698
  if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
699
    {
700
      dataRate500KbpsUnits = 128 + txVector.GetMode ().GetMcsValue ();
701
    }
702
  else
703
    {
704
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
705
    }
706
  if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
707
    {
692
    {
708
      //send the first MPDU in an MPDU
693
      //send the first MPDU in an MPDU
709
      m_txMpduReferenceNumber++;
694
      m_txMpduReferenceNumber++;
710
    }
695
    }
711
  struct mpduInfo aMpdu;
696
  MpduInfo aMpdu;
712
  aMpdu.type = mpdutype;
697
  aMpdu.type = mpdutype;
713
  aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
698
  aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
714
  NotifyMonitorSniffTx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
699
  NotifyMonitorSniffTx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), txVector, aMpdu);
715
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
700
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector);
716
  //
701
  //
717
  // Spectrum elements added here
702
  // Spectrum elements added here
718
  //
703
  //
719
  Ptr<Packet> newPacket = packet->Copy (); // obtain non-const Packet
704
  Ptr<Packet> newPacket = packet->Copy (); // obtain non-const Packet
720
  WifiPhyTag oldtag;
705
  WifiPhyTag oldtag;
721
  newPacket->RemovePacketTag (oldtag);
706
  newPacket->RemovePacketTag (oldtag);
722
  WifiPhyTag tag (txVector, preamble, mpdutype);
707
  WifiPhyTag tag (txVector, mpdutype);
723
  newPacket->AddPacketTag (tag);
708
  newPacket->AddPacketTag (tag);
724
709
725
  NS_LOG_DEBUG ("Transmission signal power before antenna gain: " << GetPowerDbm (txVector.GetTxPowerLevel ()) << " dBm");
710
  NS_LOG_DEBUG ("Transmission signal power before antenna gain: " << GetPowerDbm (txVector.GetTxPowerLevel ()) << " dBm");
 Lines 751-763    Link Here 
751
}
736
}
752
737
753
void
738
void
754
SpectrumWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr<InterferenceHelper::Event> event)
739
SpectrumWifiPhy::EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype, Ptr<InterferenceHelper::Event> event)
755
{
740
{
756
  NS_LOG_FUNCTION (this << packet << event);
741
  NS_LOG_FUNCTION (this << packet << event);
757
  NS_ASSERT (IsStateRx ());
742
  NS_ASSERT (IsStateRx ());
758
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
743
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
759
744
760
  struct InterferenceHelper::SnrPer snrPer;
745
  InterferenceHelper::SnrPer snrPer;
761
  snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
746
  snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
762
  m_interference.NotifyRxEnd ();
747
  m_interference.NotifyRxEnd ();
763
  bool rxSucceeded;
748
  bool rxSucceeded;
 Lines 770-792    Link Here 
770
      if (m_random->GetValue () > snrPer.per)
755
      if (m_random->GetValue () > snrPer.per)
771
        {
756
        {
772
          NotifyRxEnd (packet);
757
          NotifyRxEnd (packet);
773
          uint32_t dataRate500KbpsUnits;
758
          SignalNoiseDbm signalNoise;
774
          if ((event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) || (event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT))
775
            {
776
              dataRate500KbpsUnits = 128 + event->GetPayloadMode ().GetMcsValue ();
777
            }
778
          else
779
            {
780
              dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate (event->GetTxVector ().GetChannelWidth (), event->GetTxVector ().IsShortGuardInterval (), 1) * event->GetTxVector ().GetNss () / 500000;
781
            }
782
          struct signalNoiseDbm signalNoise;
783
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
759
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
784
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
760
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
785
          struct mpduInfo aMpdu;
761
          MpduInfo aMpdu;
786
          aMpdu.type = mpdutype;
762
          aMpdu.type = mpdutype;
787
          aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
763
          aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
788
          NotifyMonitorSniffRx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
764
          NotifyMonitorSniffRx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), event->GetTxVector (), aMpdu, signalNoise);
789
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
765
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ());
790
          rxSucceeded = true;
766
          rxSucceeded = true;
791
        }
767
        }
792
      else
768
      else
(-)a/src/wifi/model/spectrum-wifi-phy.h (-8 / +5 lines)
 Lines 85-98    Link Here 
85
   *
85
   *
86
   * \param packet the arriving packet
86
   * \param packet the arriving packet
87
   * \param txVector the TXVECTOR of the arriving packet
87
   * \param txVector the TXVECTOR of the arriving packet
88
   * \param preamble the preamble of the arriving packet
88
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
89
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
90
   * \param event the corresponding event of the first time the packet arrives
89
   * \param event the corresponding event of the first time the packet arrives
91
   */
90
   */
92
  void StartReceivePacket (Ptr<Packet> packet,
91
  void StartReceivePacket (Ptr<Packet> packet,
93
                           WifiTxVector txVector,
92
                           WifiTxVector txVector,
94
                           WifiPreamble preamble,
93
                           MpduType mpdutype,
95
                           enum mpduType mpdutype,
96
                           Ptr<InterferenceHelper::Event> event);
94
                           Ptr<InterferenceHelper::Event> event);
97
95
98
  /**
96
  /**
 Lines 164-171    Link Here 
164
162
165
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
163
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
166
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
164
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
167
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble);
165
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU);
168
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype);
169
  virtual void RegisterListener (WifiPhyListener *listener);
166
  virtual void RegisterListener (WifiPhyListener *listener);
170
  virtual void UnregisterListener (WifiPhyListener *listener);
167
  virtual void UnregisterListener (WifiPhyListener *listener);
171
  virtual void SetSleepMode (void);
168
  virtual void SetSleepMode (void);
 Lines 185-194    Link Here 
185
   *
182
   *
186
   * \param packet the packet that the last bit has arrived
183
   * \param packet the packet that the last bit has arrived
187
   * \param preamble the preamble of the arriving packet
184
   * \param preamble the preamble of the arriving packet
188
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
185
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
189
   * \param event the corresponding event of the first time the packet arrives
186
   * \param event the corresponding event of the first time the packet arrives
190
   */
187
   */
191
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr<InterferenceHelper::Event> event);
188
  void EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype, Ptr<InterferenceHelper::Event> event);
192
189
193
  /**
190
  /**
194
   * \param centerFrequency center frequency (MHz)
191
   * \param centerFrequency center frequency (MHz)
(-)a/src/wifi/model/sta-wifi-mac.h (-2 / +2 lines)
 Lines 170-176    Link Here 
170
   *
170
   *
171
   * \param value the new state
171
   * \param value the new state
172
   */
172
   */
173
  void SetState (enum MacState value);
173
  void SetState (MacState value);
174
  /**
174
  /**
175
   * Set the EDCA parameters.
175
   * Set the EDCA parameters.
176
   *
176
   *
 Lines 188-194    Link Here 
188
   */
188
   */
189
  CapabilityInformation GetCapabilities (void) const;
189
  CapabilityInformation GetCapabilities (void) const;
190
190
191
  enum MacState m_state;
191
  MacState m_state;
192
  Time m_probeRequestTimeout;
192
  Time m_probeRequestTimeout;
193
  Time m_assocRequestTimeout;
193
  Time m_assocRequestTimeout;
194
  EventId m_probeRequestEvent;
194
  EventId m_probeRequestEvent;
(-)a/src/wifi/model/wifi-mac-header.cc (-6 / +6 lines)
 Lines 177-183    Link Here 
177
}
177
}
178
178
179
void
179
void
180
WifiMacHeader::SetType (enum WifiMacType type)
180
WifiMacHeader::SetType (WifiMacType type)
181
{
181
{
182
  switch (type)
182
  switch (type)
183
    {
183
    {
 Lines 396-402    Link Here 
396
  m_qosEosp = 0;
396
  m_qosEosp = 0;
397
}
397
}
398
398
399
void WifiMacHeader::SetQosAckPolicy (enum QosAckPolicy policy)
399
void WifiMacHeader::SetQosAckPolicy (QosAckPolicy policy)
400
{
400
{
401
  switch (policy)
401
  switch (policy)
402
    {
402
    {
 Lines 487-493    Link Here 
487
  return m_addr4;
487
  return m_addr4;
488
}
488
}
489
489
490
enum WifiMacType
490
WifiMacType
491
WifiMacHeader::GetType (void) const
491
WifiMacHeader::GetType (void) const
492
{
492
{
493
  switch (m_ctrlType)
493
  switch (m_ctrlType)
 Lines 609-615    Link Here 
609
    }
609
    }
610
  // NOTREACHED
610
  // NOTREACHED
611
  NS_ASSERT (false);
611
  NS_ASSERT (false);
612
  return (enum WifiMacType) -1;
612
  return (WifiMacType) - 1;
613
}
613
}
614
614
615
bool
615
bool
 Lines 856-862    Link Here 
856
  return m_qosTid;
856
  return m_qosTid;
857
}
857
}
858
858
859
enum WifiMacHeader::QosAckPolicy
859
WifiMacHeader::QosAckPolicy
860
WifiMacHeader::GetQosAckPolicy (void) const
860
WifiMacHeader::GetQosAckPolicy (void) const
861
{
861
{
862
  switch (m_qosAckPolicy)
862
  switch (m_qosAckPolicy)
 Lines 876-882    Link Here 
876
    }
876
    }
877
  // NOTREACHED
877
  // NOTREACHED
878
  NS_ASSERT (false);
878
  NS_ASSERT (false);
879
  return (enum QosAckPolicy) -1;
879
  return (QosAckPolicy) - 1;
880
}
880
}
881
881
882
uint8_t
882
uint8_t
(-)a/src/wifi/model/wifi-mac-header.h (-4 / +4 lines)
 Lines 200-206    Link Here 
200
   *
200
   *
201
   * \param type the WifiMacType for the header
201
   * \param type the WifiMacType for the header
202
   */
202
   */
203
  void SetType (enum WifiMacType type);
203
  void SetType (WifiMacType type);
204
  /**
204
  /**
205
   * Set the Duration/ID field with the given raw uint16_t value.
205
   * Set the Duration/ID field with the given raw uint16_t value.
206
   *
206
   *
 Lines 267-273    Link Here 
267
   *
267
   *
268
   * \param policy
268
   * \param policy
269
   */
269
   */
270
  void SetQosAckPolicy (enum QosAckPolicy policy);
270
  void SetQosAckPolicy (QosAckPolicy policy);
271
  /**
271
  /**
272
   * Set the QoS ACK policy in the QoS control field to normal ACK.
272
   * Set the QoS ACK policy in the QoS control field to normal ACK.
273
   */
273
   */
 Lines 340-346    Link Here 
340
   *
340
   *
341
   * \return the type (enum WifiMacType)
341
   * \return the type (enum WifiMacType)
342
   */
342
   */
343
  enum WifiMacType GetType (void) const;
343
  WifiMacType GetType (void) const;
344
  /**
344
  /**
345
   * \return true if From DS bit is set, false otherwise
345
   * \return true if From DS bit is set, false otherwise
346
   */
346
   */
 Lines 569-575    Link Here 
569
   *
569
   *
570
   * \return the QoS ACK Policy of a QoS header
570
   * \return the QoS ACK Policy of a QoS header
571
   */
571
   */
572
  enum QosAckPolicy GetQosAckPolicy (void) const;
572
  QosAckPolicy GetQosAckPolicy (void) const;
573
  /**
573
  /**
574
   * Return the TXOP limit.
574
   * Return the TXOP limit.
575
   *
575
   *
(-)a/src/wifi/model/wifi-mac-queue.cc (-1 / +1 lines)
 Lines 247-253    Link Here 
247
}
247
}
248
248
249
Mac48Address
249
Mac48Address
250
WifiMacQueue::GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it)
250
WifiMacQueue::GetAddressForPacket (WifiMacHeader::AddressType type, PacketQueueI it)
251
{
251
{
252
  if (type == WifiMacHeader::ADDR1)
252
  if (type == WifiMacHeader::ADDR1)
253
    {
253
    {
(-)a/src/wifi/model/wifi-mac-queue.h (-5 / +5 lines)
 Lines 254-268    Link Here 
254
  /**
254
  /**
255
   * typedef for packet (struct Item) queue.
255
   * typedef for packet (struct Item) queue.
256
   */
256
   */
257
  typedef std::list<struct Item> PacketQueue;
257
  typedef std::list<Item> PacketQueue;
258
  /**
258
  /**
259
   * typedef for packet (struct Item) queue reverse iterator.
259
   * typedef for packet (struct Item) queue reverse iterator.
260
   */
260
   */
261
  typedef std::list<struct Item>::reverse_iterator PacketQueueRI;
261
  typedef std::list<Item>::reverse_iterator PacketQueueRI;
262
  /**
262
  /**
263
   * typedef for packet (struct Item) queue iterator.
263
   * typedef for packet (struct Item) queue iterator.
264
   */
264
   */
265
  typedef std::list<struct Item>::iterator PacketQueueI;
265
  typedef std::list<Item>::iterator PacketQueueI;
266
  /**
266
  /**
267
   * Return the appropriate address for the given packet (given by PacketQueue iterator).
267
   * Return the appropriate address for the given packet (given by PacketQueue iterator).
268
   *
268
   *
 Lines 271-283    Link Here 
271
   *
271
   *
272
   * \return the address
272
   * \return the address
273
   */
273
   */
274
  Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it);
274
  Mac48Address GetAddressForPacket (WifiMacHeader::AddressType type, PacketQueueI it);
275
275
276
  PacketQueue m_queue; //!< Packet (struct Item) queue
276
  PacketQueue m_queue; //!< Packet (struct Item) queue
277
  uint32_t m_size;     //!< Current queue size
277
  uint32_t m_size;     //!< Current queue size
278
  uint32_t m_maxSize;  //!< Queue capacity
278
  uint32_t m_maxSize;  //!< Queue capacity
279
  Time m_maxDelay;     //!< Time to live for packets in the queue
279
  Time m_maxDelay;     //!< Time to live for packets in the queue
280
  enum DropPolicy m_dropPolicy; //!< Drop behavior of queue
280
  DropPolicy m_dropPolicy; //!< Drop behavior of queue
281
};
281
};
282
282
283
} //namespace ns3
283
} //namespace ns3
(-)a/src/wifi/model/wifi-mac.cc (-2 / +2 lines)
 Lines 287-293    Link Here 
287
}
287
}
288
288
289
void
289
void
290
WifiMac::ConfigureStandard (enum WifiPhyStandard standard)
290
WifiMac::ConfigureStandard (WifiPhyStandard standard)
291
{
291
{
292
  switch (standard)
292
  switch (standard)
293
    {
293
    {
 Lines 408-414    Link Here 
408
}
408
}
409
409
410
void
410
void
411
WifiMac::ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, enum AcIndex ac)
411
WifiMac::ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
412
{
412
{
413
  /* see IEE802.11 section 7.3.2.29 */
413
  /* see IEE802.11 section 7.3.2.29 */
414
  switch (ac)
414
  switch (ac)
(-)a/src/wifi/model/wifi-mac.h (-3 / +3 lines)
 Lines 300-306    Link Here 
300
   * \sa WifiMac::Configure80211n_5Ghz
300
   * \sa WifiMac::Configure80211n_5Ghz
301
   * \sa WifiMac::Configure80211ac
301
   * \sa WifiMac::Configure80211ac
302
   */
302
   */
303
  void ConfigureStandard (enum WifiPhyStandard standard);
303
  void ConfigureStandard (WifiPhyStandard standard);
304
304
305
305
306
protected:
306
protected:
 Lines 313-319    Link Here 
313
   *
313
   *
314
   * Configure the DCF with appropriate values depending on the given access category.
314
   * Configure the DCF with appropriate values depending on the given access category.
315
   */
315
   */
316
  void ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, enum AcIndex ac);
316
  void ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
317
317
318
318
319
private:
319
private:
 Lines 399-405    Link Here 
399
   * implement this method to configure their dcf queues according to the
399
   * implement this method to configure their dcf queues according to the
400
   * requested standard.
400
   * requested standard.
401
   */
401
   */
402
  virtual void FinishConfigureStandard (enum WifiPhyStandard standard) = 0;
402
  virtual void FinishConfigureStandard (WifiPhyStandard standard) = 0;
403
403
404
  Time m_maxPropagationDelay;
404
  Time m_maxPropagationDelay;
405
405
(-)a/src/wifi/model/wifi-mode.cc (-15 / +15 lines)
 Lines 110-116    Link Here 
110
{
110
{
111
  //TODO: nss > 4 not supported yet
111
  //TODO: nss > 4 not supported yet
112
  NS_ASSERT (nss <= 4);
112
  NS_ASSERT (nss <= 4);
113
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
113
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
114
  uint64_t dataRate = 0;
114
  uint64_t dataRate = 0;
115
  uint32_t usableSubCarriers = 0;
115
  uint32_t usableSubCarriers = 0;
116
  double symbolRate = 0;
116
  double symbolRate = 0;
 Lines 233-242    Link Here 
233
  return GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ());
233
  return GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ());
234
}
234
}
235
235
236
enum WifiCodeRate
236
WifiCodeRate
237
WifiMode::GetCodeRate (void) const
237
WifiMode::GetCodeRate (void) const
238
{
238
{
239
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
239
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
240
  if (item->modClass == WIFI_MOD_CLASS_HT)
240
  if (item->modClass == WIFI_MOD_CLASS_HT)
241
    {
241
    {
242
      switch (item->mcsValue % 8)
242
      switch (item->mcsValue % 8)
 Lines 288-294    Link Here 
288
uint16_t
288
uint16_t
289
WifiMode::GetConstellationSize (void) const
289
WifiMode::GetConstellationSize (void) const
290
{
290
{
291
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
291
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
292
  if (item->modClass == WIFI_MOD_CLASS_HT)
292
  if (item->modClass == WIFI_MOD_CLASS_HT)
293
    {
293
    {
294
      switch (item->mcsValue % 8)
294
      switch (item->mcsValue % 8)
 Lines 342-362    Link Here 
342
WifiMode::GetUniqueName (void) const
342
WifiMode::GetUniqueName (void) const
343
{
343
{
344
  //needed for ostream printing of the invalid mode
344
  //needed for ostream printing of the invalid mode
345
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
345
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
346
  return item->uniqueUid;
346
  return item->uniqueUid;
347
}
347
}
348
348
349
bool
349
bool
350
WifiMode::IsMandatory (void) const
350
WifiMode::IsMandatory (void) const
351
{
351
{
352
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
352
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
353
  return item->isMandatory;
353
  return item->isMandatory;
354
}
354
}
355
355
356
uint8_t
356
uint8_t
357
WifiMode::GetMcsValue (void) const
357
WifiMode::GetMcsValue (void) const
358
{
358
{
359
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
359
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
360
  if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
360
  if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
361
    {
361
    {
362
      return item->mcsValue;
362
      return item->mcsValue;
 Lines 375-384    Link Here 
375
  return m_uid;
375
  return m_uid;
376
}
376
}
377
377
378
enum WifiModulationClass
378
WifiModulationClass
379
WifiMode::GetModulationClass () const
379
WifiMode::GetModulationClass () const
380
{
380
{
381
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
381
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
382
  return item->modClass;
382
  return item->modClass;
383
}
383
}
384
384
 Lines 386-392    Link Here 
386
WifiMode::GetNonHtReferenceRate (void) const
386
WifiMode::GetNonHtReferenceRate (void) const
387
{
387
{
388
  uint64_t dataRate;
388
  uint64_t dataRate;
389
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
389
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
390
  if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
390
  if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
391
    {
391
    {
392
      WifiCodeRate codeRate = GetCodeRate();
392
      WifiCodeRate codeRate = GetCodeRate();
 Lines 464-470    Link Here 
464
bool
464
bool
465
WifiMode::IsHigherDataRate (WifiMode mode) const
465
WifiMode::IsHigherDataRate (WifiMode mode) const
466
{
466
{
467
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
467
  WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
468
  switch(item->modClass)
468
  switch(item->modClass)
469
    {
469
    {
470
    case WIFI_MOD_CLASS_DSSS:
470
    case WIFI_MOD_CLASS_DSSS:
 Lines 541-549    Link Here 
541
541
542
WifiMode
542
WifiMode
543
WifiModeFactory::CreateWifiMode (std::string uniqueName,
543
WifiModeFactory::CreateWifiMode (std::string uniqueName,
544
                                 enum WifiModulationClass modClass,
544
                                 WifiModulationClass modClass,
545
                                 bool isMandatory,
545
                                 bool isMandatory,
546
                                 enum WifiCodeRate codingRate,
546
                                 WifiCodeRate codingRate,
547
                                 uint16_t constellationSize)
547
                                 uint16_t constellationSize)
548
{
548
{
549
  WifiModeFactory *factory = GetFactory ();
549
  WifiModeFactory *factory = GetFactory ();
 Lines 580-586    Link Here 
580
WifiMode
580
WifiMode
581
WifiModeFactory::CreateWifiMcs (std::string uniqueName,
581
WifiModeFactory::CreateWifiMcs (std::string uniqueName,
582
                                uint8_t mcsValue,
582
                                uint8_t mcsValue,
583
                                enum WifiModulationClass modClass)
583
                                WifiModulationClass modClass)
584
{
584
{
585
  WifiModeFactory *factory = GetFactory ();
585
  WifiModeFactory *factory = GetFactory ();
586
  uint32_t uid = factory->AllocateUid (uniqueName);
586
  uint32_t uid = factory->AllocateUid (uniqueName);
 Lines 653-659    Link Here 
653
  return uid;
653
  return uid;
654
}
654
}
655
655
656
struct WifiModeFactory::WifiModeItem *
656
WifiModeFactory::WifiModeItem *
657
WifiModeFactory::Get (uint32_t uid)
657
WifiModeFactory::Get (uint32_t uid)
658
{
658
{
659
  NS_ASSERT (uid < m_itemList.size ());
659
  NS_ASSERT (uid < m_itemList.size ());
(-)a/src/wifi/model/wifi-mode.h (-8 / +8 lines)
 Lines 138-144    Link Here 
138
  /**
138
  /**
139
   * \returns the coding rate of this transmission mode
139
   * \returns the coding rate of this transmission mode
140
   */
140
   */
141
  enum WifiCodeRate GetCodeRate (void) const;
141
  WifiCodeRate GetCodeRate (void) const;
142
  /**
142
  /**
143
   * \returns the size of the modulation constellation.
143
   * \returns the size of the modulation constellation.
144
   */
144
   */
 Lines 170-176    Link Here 
170
   * \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
170
   * \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
171
   * to which this WifiMode belongs.
171
   * to which this WifiMode belongs.
172
   */
172
   */
173
  enum WifiModulationClass GetModulationClass () const;  
173
  WifiModulationClass GetModulationClass () const;
174
  /**
174
  /**
175
   * \returns the rate (in bps) of the non-HT Reference Rate
175
   * \returns the rate (in bps) of the non-HT Reference Rate
176
   * which corresponds to the HT MCS of this WifiMode.
176
   * which corresponds to the HT MCS of this WifiMode.
 Lines 263-271    Link Here 
263
   * Create a WifiMode (not used for HT or VHT).
263
   * Create a WifiMode (not used for HT or VHT).
264
   */
264
   */
265
  static WifiMode CreateWifiMode (std::string uniqueName,
265
  static WifiMode CreateWifiMode (std::string uniqueName,
266
                                  enum WifiModulationClass modClass,
266
                                  WifiModulationClass modClass,
267
                                  bool isMandatory,
267
                                  bool isMandatory,
268
                                  enum WifiCodeRate codingRate,
268
                                  WifiCodeRate codingRate,
269
                                  uint16_t constellationSize);
269
                                  uint16_t constellationSize);
270
270
271
  /**
271
  /**
 Lines 280-286    Link Here 
280
   */
280
   */
281
  static WifiMode CreateWifiMcs (std::string uniqueName,
281
  static WifiMode CreateWifiMcs (std::string uniqueName,
282
                                 uint8_t mcsValue,
282
                                 uint8_t mcsValue,
283
                                 enum WifiModulationClass modClass);
283
                                 WifiModulationClass modClass);
284
284
285
285
286
private:
286
private:
 Lines 303-311    Link Here 
303
  struct WifiModeItem
303
  struct WifiModeItem
304
  {
304
  {
305
    std::string uniqueUid;
305
    std::string uniqueUid;
306
    enum WifiModulationClass modClass;
306
    WifiModulationClass modClass;
307
    uint16_t constellationSize;
307
    uint16_t constellationSize;
308
    enum WifiCodeRate codingRate;
308
    WifiCodeRate codingRate;
309
    bool isMandatory;
309
    bool isMandatory;
310
    uint8_t mcsValue;
310
    uint8_t mcsValue;
311
  };
311
  };
 Lines 338-344    Link Here 
338
  /**
338
  /**
339
   * typedef for a vector of WifiModeItem.
339
   * typedef for a vector of WifiModeItem.
340
   */
340
   */
341
  typedef std::vector<struct WifiModeItem> WifiModeItemList;
341
  typedef std::vector<WifiModeItem> WifiModeItemList;
342
  WifiModeItemList m_itemList;
342
  WifiModeItemList m_itemList;
343
};
343
};
344
344
(-)a/src/wifi/model/wifi-net-device.cc (-1 / +1 lines)
 Lines 358-364    Link Here 
358
{
358
{
359
  NS_LOG_FUNCTION (this << packet << from << to);
359
  NS_LOG_FUNCTION (this << packet << from << to);
360
  LlcSnapHeader llc;
360
  LlcSnapHeader llc;
361
  enum NetDevice::PacketType type;
361
  NetDevice::PacketType type;
362
  if (to.IsBroadcast ())
362
  if (to.IsBroadcast ())
363
    {
363
    {
364
      type = NetDevice::PACKET_BROADCAST;
364
      type = NetDevice::PACKET_BROADCAST;
(-)a/src/wifi/model/wifi-phy-state-helper.cc (-6 / +6 lines)
 Lines 190-196    Link Here 
190
  return m_startRx;
190
  return m_startRx;
191
}
191
}
192
192
193
enum WifiPhy::State
193
WifiPhy::State
194
WifiPhyStateHelper::GetState (void)
194
WifiPhyStateHelper::GetState (void)
195
{
195
{
196
  if (m_sleeping)
196
  if (m_sleeping)
 Lines 313-321    Link Here 
313
313
314
void
314
void
315
WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, double txPowerDbm,
315
WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, double txPowerDbm,
316
                                WifiTxVector txVector, WifiPreamble preamble)
316
                                WifiTxVector txVector)
317
{
317
{
318
  m_txTrace (packet, txVector.GetMode (), preamble, txVector.GetTxPowerLevel ());
318
  m_txTrace (packet, txVector.GetMode (), txVector.GetPreambleType (), txVector.GetTxPowerLevel ());
319
  Time now = Simulator::Now ();
319
  Time now = Simulator::Now ();
320
  switch (GetState ())
320
  switch (GetState ())
321
    {
321
    {
 Lines 429-442    Link Here 
429
}
429
}
430
430
431
void
431
void
432
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
432
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector)
433
{
433
{
434
  m_rxOkTrace (packet, snr, txVector.GetMode (), preamble);
434
  m_rxOkTrace (packet, snr, txVector.GetMode (), txVector.GetPreambleType ());
435
  NotifyRxEndOk ();
435
  NotifyRxEndOk ();
436
  DoSwitchFromRx ();
436
  DoSwitchFromRx ();
437
  if (!m_rxOkCallback.IsNull ())
437
  if (!m_rxOkCallback.IsNull ())
438
    {
438
    {
439
      m_rxOkCallback (packet, snr, txVector, preamble);
439
      m_rxOkCallback (packet, snr, txVector);
440
    }
440
    }
441
441
442
}
442
}
(-)a/src/wifi/model/wifi-phy-state-helper.h (-8 / +6 lines)
 Lines 69-75    Link Here 
69
   *
69
   *
70
   * \return the current state of WifiPhy
70
   * \return the current state of WifiPhy
71
   */
71
   */
72
  enum WifiPhy::State GetState (void);
72
  WifiPhy::State GetState (void);
73
  /**
73
  /**
74
   * Check whether the current state is CCA busy.
74
   * Check whether the current state is CCA busy.
75
   *
75
   *
 Lines 138-146    Link Here 
138
   * \param packet the packet
138
   * \param packet the packet
139
   * \param txPowerDbm the nominal tx power in dBm
139
   * \param txPowerDbm the nominal tx power in dBm
140
   * \param txVector the tx vector of the packet
140
   * \param txVector the tx vector of the packet
141
   * \param preamble the preamble of the packet
142
   */
141
   */
143
  void SwitchToTx (Time txDuration, Ptr<const Packet> packet, double txPowerDbm, WifiTxVector txVector, WifiPreamble preamble);
142
  void SwitchToTx (Time txDuration, Ptr<const Packet> packet, double txPowerDbm, WifiTxVector txVector);
144
  /**
143
  /**
145
   * Switch state to RX for the given duration.
144
   * Switch state to RX for the given duration.
146
   *
145
   *
 Lines 159-167    Link Here 
159
   * \param packet the successfully received packet
158
   * \param packet the successfully received packet
160
   * \param snr the SNR of the received packet
159
   * \param snr the SNR of the received packet
161
   * \param txVector TXVECTOR of the packet
160
   * \param txVector TXVECTOR of the packet
162
   * \param preamble the preamble of the received packet
163
   */
161
   */
164
  void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
162
  void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector);
165
  /**
163
  /**
166
   * Switch from RX after the reception failed.
164
   * Switch from RX after the reception failed.
167
   *
165
   *
 Lines 187-193    Link Here 
187
  void SwitchFromSleep (Time duration);
185
  void SwitchFromSleep (Time duration);
188
186
189
  /** \todo Why is this public? */
187
  /** \todo Why is this public? */
190
  TracedCallback<Time, Time, enum WifiPhy::State> m_stateLogger;
188
  TracedCallback<Time, Time, WifiPhy::State> m_stateLogger;
191
189
192
  /**
190
  /**
193
   * TracedCallback signature for state changes.
191
   * TracedCallback signature for state changes.
 Lines 306-314    Link Here 
306
  Time m_previousStateChangeTime;
304
  Time m_previousStateChangeTime;
307
305
308
  Listeners m_listeners;
306
  Listeners m_listeners;
309
  TracedCallback<Ptr<const Packet>, double, WifiMode, enum WifiPreamble> m_rxOkTrace;
307
  TracedCallback<Ptr<const Packet>, double, WifiMode, WifiPreamble> m_rxOkTrace;
310
  TracedCallback<Ptr<const Packet>, double> m_rxErrorTrace;
308
  TracedCallback<Ptr<const Packet>, double> m_rxErrorTrace;
311
  TracedCallback<Ptr<const Packet>,WifiMode,WifiPreamble,uint8_t> m_txTrace;
309
  TracedCallback<Ptr<const Packet>, WifiMode, WifiPreamble, uint8_t> m_txTrace;
312
  WifiPhy::RxOkCallback m_rxOkCallback;
310
  WifiPhy::RxOkCallback m_rxOkCallback;
313
  WifiPhy::RxErrorCallback m_rxErrorCallback;
311
  WifiPhy::RxErrorCallback m_rxErrorCallback;
314
};
312
};
(-)a/src/wifi/model/wifi-phy-tag.cc (-28 / +7 lines)
 Lines 39-87    Link Here 
39
uint32_t
39
uint32_t
40
WifiPhyTag::GetSerializedSize (void) const
40
WifiPhyTag::GetSerializedSize (void) const
41
{
41
{
42
  return (4 + (6 * 1) + 4 + 2);
42
  return (sizeof (WifiTxVector) + 2);
43
}
43
}
44
44
45
void
45
void
46
WifiPhyTag::Serialize (TagBuffer i) const
46
WifiPhyTag::Serialize (TagBuffer i) const
47
{
47
{
48
  i.WriteU32 (m_wifiTxVector.GetMode ().GetUid ());
48
  i.Write ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
49
  i.WriteU8 (m_wifiTxVector.GetTxPowerLevel ());
50
  i.WriteU8 (m_wifiTxVector.GetRetries ());
51
  i.WriteU8 (m_wifiTxVector.IsShortGuardInterval ());
52
  i.WriteU8 (m_wifiTxVector.GetNss ());
53
  i.WriteU8 (m_wifiTxVector.GetNess ());
54
  i.WriteU8 (m_wifiTxVector.IsStbc ());
55
  i.WriteU32 (m_wifiPreamble);
56
  i.WriteU16 (m_mpduType);
49
  i.WriteU16 (m_mpduType);
57
}
50
}
58
51
59
void
52
void
60
WifiPhyTag::Deserialize (TagBuffer i)
53
WifiPhyTag::Deserialize (TagBuffer i)
61
{
54
{
62
  m_wifiTxVector.SetMode (WifiMode (i.ReadU32 ()));
55
  i.Read ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
63
  m_wifiTxVector.SetTxPowerLevel (i.ReadU8 ());
56
  m_mpduType = static_cast<MpduType> (i.ReadU16 ());
64
  m_wifiTxVector.SetRetries (i.ReadU8 ());
65
  m_wifiTxVector.SetShortGuardInterval (i.ReadU8 ());
66
  m_wifiTxVector.SetNss (i.ReadU8 ());
67
  m_wifiTxVector.SetNess (i.ReadU8 ());
68
  m_wifiTxVector.SetStbc (i.ReadU8 ());
69
  m_wifiPreamble = i.ReadU32 ();
70
  m_mpduType = static_cast<enum mpduType> (i.ReadU16 ());
71
}
57
}
72
void
58
void
73
WifiPhyTag::Print (std::ostream &os) const
59
WifiPhyTag::Print (std::ostream &os) const
74
{
60
{
75
  os << m_wifiTxVector << " " << (m_wifiPreamble ? "SP " : "LP ") << m_mpduType;
61
  os << m_wifiTxVector << " " << m_mpduType;
76
}
62
}
77
63
78
WifiPhyTag::WifiPhyTag ()
64
WifiPhyTag::WifiPhyTag ()
79
{
65
{
80
}
66
}
81
67
82
WifiPhyTag::WifiPhyTag (WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
68
WifiPhyTag::WifiPhyTag (WifiTxVector txVector, MpduType mpdutype)
83
  : m_wifiTxVector (txVector),
69
  : m_wifiTxVector (txVector),
84
    m_wifiPreamble (preamble),
85
    m_mpduType (mpdutype)
70
    m_mpduType (mpdutype)
86
{
71
{
87
}
72
}
 Lines 92-104    Link Here 
92
  return m_wifiTxVector;
77
  return m_wifiTxVector;
93
}
78
}
94
79
95
WifiPreamble
80
MpduType
96
WifiPhyTag::GetWifiPreamble (void) const
97
{
98
  return ((enum WifiPreamble) m_wifiPreamble);
99
}
100
101
enum mpduType
102
WifiPhyTag::GetMpduType (void) const
81
WifiPhyTag::GetMpduType (void) const
103
{
82
{
104
  return m_mpduType;
83
  return m_mpduType;
(-)a/src/wifi/model/wifi-phy-tag.h (-11 / +3 lines)
 Lines 22-28    Link Here 
22
22
23
#include <ns3/tag.h>
23
#include <ns3/tag.h>
24
#include <ns3/wifi-tx-vector.h>
24
#include <ns3/wifi-tx-vector.h>
25
#include <ns3/wifi-preamble.h>
26
#include <ns3/wifi-phy.h>
25
#include <ns3/wifi-phy.h>
27
26
28
namespace ns3 {
27
namespace ns3 {
 Lines 46-70    Link Here 
46
  /**
45
  /**
47
   * Constructor
46
   * Constructor
48
   * \param txVector the WifiTxVector
47
   * \param txVector the WifiTxVector
49
   * \param preamble the WifiPreamble
50
   * \param mpduType the mpduType
48
   * \param mpduType the mpduType
51
   */
49
   */
52
  WifiPhyTag (WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype);
50
  WifiPhyTag (WifiTxVector txVector, MpduType mpdutype);
53
  /**
51
  /**
54
   * Getter for WifiTxVector parameter
52
   * Getter for WifiTxVector parameter
55
   * \return the WifiTxVector
53
   * \return the WifiTxVector
56
   */
54
   */
57
  WifiTxVector GetWifiTxVector (void) const;
55
  WifiTxVector GetWifiTxVector (void) const;
58
  /**
56
  /**
59
   * Getter for WifiPreamble parameter
60
   * \return preamble the WifiPreamble
61
   */
62
  WifiPreamble GetWifiPreamble (void) const;
63
  /**
64
   * Getter for mpduType parameter
57
   * Getter for mpduType parameter
65
   * \return mpduType the mpduType
58
   * \return mpduType the mpduType
66
   */
59
   */
67
  enum mpduType GetMpduType (void) const;
60
  MpduType GetMpduType (void) const;
68
61
69
  // From class Tag
62
  // From class Tag
70
  virtual uint32_t GetSerializedSize (void) const;
63
  virtual uint32_t GetSerializedSize (void) const;
 Lines 74-81    Link Here 
74
67
75
private:
68
private:
76
  WifiTxVector m_wifiTxVector;
69
  WifiTxVector m_wifiTxVector;
77
  int32_t m_wifiPreamble;
70
  MpduType m_mpduType;
78
  enum mpduType m_mpduType;
79
};
71
};
80
72
81
} // namespace ns3
73
} // namespace ns3
(-)a/src/wifi/model/wifi-phy.cc (-31 / +35 lines)
 Lines 668-674    Link Here 
668
}
668
}
669
669
670
void
670
void
671
WifiPhy::ConfigureDefaultsForStandard (enum WifiPhyStandard standard)
671
WifiPhy::ConfigureDefaultsForStandard (WifiPhyStandard standard)
672
{
672
{
673
  NS_LOG_FUNCTION (this << standard);
673
  NS_LOG_FUNCTION (this << standard);
674
  switch (standard)
674
  switch (standard)
 Lines 927-933    Link Here 
927
}
927
}
928
928
929
bool 
929
bool 
930
WifiPhy::DefineChannelNumber (uint16_t channelNumber, enum WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth)
930
WifiPhy::DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth)
931
{
931
{
932
  NS_LOG_FUNCTION (this << channelNumber << standard << frequency << channelWidth);
932
  NS_LOG_FUNCTION (this << channelNumber << standard << frequency << channelWidth);
933
  ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
933
  ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
 Lines 972-978    Link Here 
972
}
972
}
973
973
974
void
974
void
975
WifiPhy::ConfigureChannelForStandard (enum WifiPhyStandard standard)
975
WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
976
{
976
{
977
  NS_LOG_FUNCTION (this << standard);
977
  NS_LOG_FUNCTION (this << standard);
978
  // If the user has configured both Frequency and ChannelNumber, Frequency
978
  // If the user has configured both Frequency and ChannelNumber, Frequency
 Lines 1023-1029    Link Here 
1023
}
1023
}
1024
1024
1025
void
1025
void
1026
WifiPhy::ConfigureStandard (enum WifiPhyStandard standard)
1026
WifiPhy::ConfigureStandard (WifiPhyStandard standard)
1027
{
1027
{
1028
  NS_LOG_FUNCTION (this << standard);
1028
  NS_LOG_FUNCTION (this << standard);
1029
  m_standard = standard;
1029
  m_standard = standard;
 Lines 1076-1082    Link Here 
1076
    }
1076
    }
1077
}
1077
}
1078
1078
1079
enum WifiPhyStandard
1079
WifiPhyStandard
1080
WifiPhy::GetStandard (void) const
1080
WifiPhy::GetStandard (void) const
1081
{
1081
{
1082
  return m_standard;
1082
  return m_standard;
 Lines 1264-1270    Link Here 
1264
}
1264
}
1265
1265
1266
WifiPhy::FrequencyWidthPair
1266
WifiPhy::FrequencyWidthPair
1267
WifiPhy::GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, enum WifiPhyStandard standard) const
1267
WifiPhy::GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, WifiPhyStandard standard) const
1268
{
1268
{
1269
  ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
1269
  ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
1270
  FrequencyWidthPair f = m_channelToFrequencyWidth[p];
1270
  FrequencyWidthPair f = m_channelToFrequencyWidth[p];
 Lines 1356-1362    Link Here 
1356
}
1356
}
1357
1357
1358
Time
1358
Time
1359
WifiPhy::GetPlcpHtTrainingSymbolDuration (WifiPreamble preamble, WifiTxVector txVector)
1359
WifiPhy::GetPlcpHtTrainingSymbolDuration (WifiTxVector txVector)
1360
{
1360
{
1361
  uint8_t Ndltf, Neltf;
1361
  uint8_t Ndltf, Neltf;
1362
  //We suppose here that STBC = 0.
1362
  //We suppose here that STBC = 0.
 Lines 1387-1393    Link Here 
1387
      Neltf = 4;
1387
      Neltf = 4;
1388
    }
1388
    }
1389
1389
1390
  switch (preamble)
1390
  switch (txVector.GetPreambleType ())
1391
    {
1391
    {
1392
    case WIFI_PREAMBLE_HT_MF:
1392
    case WIFI_PREAMBLE_HT_MF:
1393
      return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf));
1393
      return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf));
 Lines 1459-1467    Link Here 
1459
}
1459
}
1460
1460
1461
WifiMode
1461
WifiMode
1462
WifiPhy::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector)
1462
WifiPhy::GetPlcpHeaderMode (WifiTxVector txVector)
1463
{
1463
{
1464
  switch (payloadMode.GetModulationClass ())
1464
  switch (txVector.GetMode ().GetModulationClass ())
1465
    {
1465
    {
1466
    case WIFI_MOD_CLASS_OFDM:
1466
    case WIFI_MOD_CLASS_OFDM:
1467
    case WIFI_MOD_CLASS_HT:
1467
    case WIFI_MOD_CLASS_HT:
 Lines 1487-1493    Link Here 
1487
      return WifiPhy::GetErpOfdmRate6Mbps ();
1487
      return WifiPhy::GetErpOfdmRate6Mbps ();
1488
    case WIFI_MOD_CLASS_DSSS:
1488
    case WIFI_MOD_CLASS_DSSS:
1489
    case WIFI_MOD_CLASS_HR_DSSS:
1489
    case WIFI_MOD_CLASS_HR_DSSS:
1490
      if (preamble == WIFI_PREAMBLE_LONG || payloadMode == WifiPhy::GetDsssRate1Mbps ())
1490
      if (txVector.GetPreambleType () == WIFI_PREAMBLE_LONG || txVector.GetMode () == WifiPhy::GetDsssRate1Mbps ())
1491
        {
1491
        {
1492
          //(Section 16.2.3 "PLCP field definitions" and Section 17.2.2.2 "Long PPDU format"; IEEE Std 802.11-2012)
1492
          //(Section 16.2.3 "PLCP field definitions" and Section 17.2.2.2 "Long PPDU format"; IEEE Std 802.11-2012)
1493
          return WifiPhy::GetDsssRate1Mbps ();
1493
          return WifiPhy::GetDsssRate1Mbps ();
 Lines 1504-1511    Link Here 
1504
}
1504
}
1505
1505
1506
Time
1506
Time
1507
WifiPhy::GetPlcpHeaderDuration (WifiTxVector txVector, WifiPreamble preamble)
1507
WifiPhy::GetPlcpHeaderDuration (WifiTxVector txVector)
1508
{
1508
{
1509
  WifiPreamble preamble = txVector.GetPreambleType ();
1509
  if (preamble == WIFI_PREAMBLE_NONE)
1510
  if (preamble == WIFI_PREAMBLE_NONE)
1510
    {
1511
    {
1511
      return MicroSeconds (0);
1512
      return MicroSeconds (0);
 Lines 1568-1575    Link Here 
1568
}
1569
}
1569
1570
1570
Time
1571
Time
1571
WifiPhy::GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble)
1572
WifiPhy::GetPlcpPreambleDuration (WifiTxVector txVector)
1572
{
1573
{
1574
  WifiPreamble preamble = txVector.GetPreambleType ();
1573
  if (preamble == WIFI_PREAMBLE_NONE)
1575
  if (preamble == WIFI_PREAMBLE_NONE)
1574
    {
1576
    {
1575
      return MicroSeconds (0);
1577
      return MicroSeconds (0);
 Lines 1620-1634    Link Here 
1620
}
1622
}
1621
1623
1622
Time
1624
Time
1623
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
1625
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency)
1624
{
1626
{
1625
  return GetPayloadDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0);
1627
  return GetPayloadDuration (size, txVector, frequency, NORMAL_MPDU, 0);
1626
}
1628
}
1627
1629
1628
Time
1630
Time
1629
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
1631
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag)
1630
{
1632
{
1631
  WifiMode payloadMode = txVector.GetMode ();
1633
  WifiMode payloadMode = txVector.GetMode ();
1634
  WifiPreamble preamble = txVector.GetPreambleType ();
1632
  NS_LOG_FUNCTION (size << payloadMode);
1635
  NS_LOG_FUNCTION (size << payloadMode);
1633
1636
1634
  switch (payloadMode.GetModulationClass ())
1637
  switch (payloadMode.GetModulationClass ())
 Lines 1699-1705    Link Here 
1699
          }
1702
          }
1700
        else
1703
        else
1701
          {
1704
          {
1702
            NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
1705
            NS_FATAL_ERROR ("Wrong combination of preamble and packet type: preamble=" << preamble << ", packet type=" << mpdutype);
1703
          }
1706
          }
1704
1707
1705
        //Add signal extension for ERP PHY
1708
        //Add signal extension for ERP PHY
 Lines 1918-1947    Link Here 
1918
}
1921
}
1919
1922
1920
Time
1923
Time
1921
WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector, WifiPreamble preamble)
1924
WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector)
1922
{
1925
{
1923
  Time duration = GetPlcpPreambleDuration (txVector, preamble)
1926
  WifiPreamble preamble = txVector.GetPreambleType();
1924
    + GetPlcpHeaderDuration (txVector, preamble)
1927
  Time duration = GetPlcpPreambleDuration (txVector)
1928
    + GetPlcpHeaderDuration (txVector)
1925
    + GetPlcpHtSigHeaderDuration (preamble)
1929
    + GetPlcpHtSigHeaderDuration (preamble)
1926
    + GetPlcpVhtSigA1Duration (preamble)
1930
    + GetPlcpVhtSigA1Duration (preamble)
1927
    + GetPlcpVhtSigA2Duration (preamble)
1931
    + GetPlcpVhtSigA2Duration (preamble)
1928
    + GetPlcpHtTrainingSymbolDuration (preamble, txVector)
1932
    + GetPlcpHtTrainingSymbolDuration (txVector)
1929
    + GetPlcpVhtSigBDuration (preamble);
1933
    + GetPlcpVhtSigBDuration (preamble);
1930
  return duration;
1934
  return duration;
1931
}
1935
}
1932
1936
1933
Time
1937
Time
1934
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
1938
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag)
1935
{
1939
{
1936
  Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble)
1940
  Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector)
1937
    + GetPayloadDuration (size, txVector, preamble, frequency, mpdutype, incFlag);
1941
    + GetPayloadDuration (size, txVector, frequency, mpdutype, incFlag);
1938
  return duration;
1942
  return duration;
1939
}
1943
}
1940
1944
1941
Time
1945
Time
1942
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
1946
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency)
1943
{
1947
{
1944
  return CalculateTxDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0);
1948
  return CalculateTxDuration (size, txVector, frequency, NORMAL_MPDU, 0);
1945
}
1949
}
1946
1950
1947
void
1951
void
 Lines 1981-1995    Link Here 
1981
}
1985
}
1982
1986
1983
void
1987
void
1984
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
1988
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
1985
{
1989
{
1986
  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu, signalNoise);
1990
  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, txVector, aMpdu, signalNoise);
1987
}
1991
}
1988
1992
1989
void
1993
void
1990
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
1994
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, WifiTxVector txVector, MpduInfo aMpdu)
1991
{
1995
{
1992
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu);
1996
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, txVector, aMpdu);
1993
}
1997
}
1994
1998
1995
1999
 Lines 2981-2987    Link Here 
2981
  return 1;
2985
  return 1;
2982
}
2986
}
2983
2987
2984
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
2988
std::ostream& operator<< (std::ostream& os, WifiPhy::State state)
2985
{
2989
{
2986
  switch (state)
2990
  switch (state)
2987
    {
2991
    {
(-)a/src/wifi/model/wifi-phy.h (-74 / +51 lines)
 Lines 53-59    Link Here 
53
/**
53
/**
54
 * This enumeration defines the type of an MPDU.
54
 * This enumeration defines the type of an MPDU.
55
 */
55
 */
56
enum mpduType
56
enum MpduType
57
{
57
{
58
  /** The MPDU is not part of an A-MPDU */
58
  /** The MPDU is not part of an A-MPDU */
59
  NORMAL_MPDU = 0,
59
  NORMAL_MPDU = 0,
 Lines 63-77    Link Here 
63
  LAST_MPDU_IN_AGGREGATE
63
  LAST_MPDU_IN_AGGREGATE
64
};
64
};
65
65
66
struct signalNoiseDbm
66
struct SignalNoiseDbm
67
{
67
{
68
  double signal; //in dBm
68
  double signal; //in dBm
69
  double noise; //in dBm
69
  double noise; //in dBm
70
};
70
};
71
71
72
struct mpduInfo
72
struct MpduInfo
73
{
73
{
74
  enum mpduType type;
74
  MpduType type;
75
  uint32_t mpduRefNumber;
75
  uint32_t mpduRefNumber;
76
};
76
};
77
77
 Lines 199-205    Link Here 
199
   * arg3: TXVECTOR of packet
199
   * arg3: TXVECTOR of packet
200
   * arg4: type of preamble used for packet.
200
   * arg4: type of preamble used for packet.
201
   */
201
   */
202
  typedef Callback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> RxOkCallback;
202
  typedef Callback<void, Ptr<Packet>, double, WifiTxVector> RxOkCallback;
203
  /**
203
  /**
204
   * arg1: packet received unsuccessfully
204
   * arg1: packet received unsuccessfully
205
   * arg2: snr of packet
205
   * arg2: snr of packet
 Lines 227-244    Link Here 
227
   * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send
227
   * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send
228
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
228
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
229
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
229
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
230
   * \param preamble the type of preamble to use to send this packet.
230
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
231
   */
231
   */
232
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble) = 0;
232
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU) = 0;
233
  /**
234
   * \param packet the packet to send
235
   * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send
236
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
237
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
238
   * \param preamble the type of preamble to use to send this packet.
239
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
240
   */
241
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype) = 0;
242
233
243
  /**
234
  /**
244
   * \param listener the new listener
235
   * \param listener the new listener
 Lines 314-352    Link Here 
314
  /**
305
  /**
315
   * \param size the number of bytes in the packet to send
306
   * \param size the number of bytes in the packet to send
316
   * \param txVector the TXVECTOR used for the transmission of this packet
307
   * \param txVector the TXVECTOR used for the transmission of this packet
317
   * \param preamble the type of preamble to use for this packet.
318
   * \param frequency the channel center frequency (MHz)
308
   * \param frequency the channel center frequency (MHz)
319
   *
309
   *
320
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
310
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
321
   */
311
   */
322
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency);
312
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency);
323
  /**
313
  /**
324
   * \param size the number of bytes in the packet to send
314
   * \param size the number of bytes in the packet to send
325
   * \param txVector the TXVECTOR used for the transmission of this packet
315
   * \param txVector the TXVECTOR used for the transmission of this packet
326
   * \param preamble the type of preamble to use for this packet.
327
   * \param frequency the channel center frequency (MHz)
316
   * \param frequency the channel center frequency (MHz)
328
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
317
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
329
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
318
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
330
   *
319
   *
331
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
320
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
332
   */
321
   */
333
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
322
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag);
334
323
335
  /**
324
  /**
336
   * \param txVector the transmission parameters used for this packet
325
   * \param txVector the transmission parameters used for this packet
337
   * \param preamble the type of preamble to use for this packet.
338
   *
326
   *
339
   * \return the total amount of time this PHY will stay busy for the transmission of the PLCP preamble and PLCP header.
327
   * \return the total amount of time this PHY will stay busy for the transmission of the PLCP preamble and PLCP header.
340
   */
328
   */
341
  Time CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector, enum WifiPreamble preamble);
329
  Time CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector);
342
330
343
  /**
331
  /**
344
   * \param preamble the type of preamble
345
   * \param txVector the transmission parameters used for this packet
332
   * \param txVector the transmission parameters used for this packet
346
   *
333
   *
347
   * \return the training symbol duration
334
   * \return the training symbol duration
348
   */
335
   */
349
  static Time GetPlcpHtTrainingSymbolDuration (WifiPreamble preamble, WifiTxVector txVector);
336
  static Time GetPlcpHtTrainingSymbolDuration (WifiTxVector txVector);
350
  /**
337
  /**
351
   * \param payloadMode the WifiMode use for the transmission of the payload
338
   * \param payloadMode the WifiMode use for the transmission of the payload
352
   *
339
   *
 Lines 385-431    Link Here 
385
   */
372
   */
386
  static Time GetPlcpVhtSigBDuration (WifiPreamble preamble);
373
  static Time GetPlcpVhtSigBDuration (WifiPreamble preamble);
387
  /**
374
  /**
388
   * \param payloadMode the WifiMode use for the transmission of the payload
389
   * \param preamble the type of preamble
390
   * \param txVector the transmission parameters used for this packet
375
   * \param txVector the transmission parameters used for this packet
391
   *
376
   *
392
   * \return the WifiMode used for the transmission of the PLCP header
377
   * \return the WifiMode used for the transmission of the PLCP header
393
   */
378
   */
394
  static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector);
379
  static WifiMode GetPlcpHeaderMode (WifiTxVector txVector);
395
  /**
380
  /**
396
   * \param txVector the transmission parameters used for this packet
381
   * \param txVector the transmission parameters used for this packet
397
   * \param preamble the type of preamble
398
   *
382
   *
399
   * \return the duration of the PLCP header
383
   * \return the duration of the PLCP header
400
   */
384
   */
401
  static Time GetPlcpHeaderDuration (WifiTxVector txVector, WifiPreamble preamble);
385
  static Time GetPlcpHeaderDuration (WifiTxVector txVector);
402
  /**
386
  /**
403
   * \param txVector the transmission parameters used for this packet
387
   * \param txVector the transmission parameters used for this packet
404
   * \param preamble the type of preamble
405
   *
388
   *
406
   * \return the duration of the PLCP preamble
389
   * \return the duration of the PLCP preamble
407
   */
390
   */
408
  static Time GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble);
391
  static Time GetPlcpPreambleDuration (WifiTxVector txVector);
409
  /**
392
  /**
410
   * \param size the number of bytes in the packet to send
393
   * \param size the number of bytes in the packet to send
411
   * \param txVector the TXVECTOR used for the transmission of this packet
394
   * \param txVector the TXVECTOR used for the transmission of this packet
412
   * \param preamble the type of preamble to use for this packet
413
   * \param frequency the channel center frequency (MHz)
395
   * \param frequency the channel center frequency (MHz)
414
   *
396
   *
415
   * \return the duration of the payload
397
   * \return the duration of the payload
416
   */
398
   */
417
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency);
399
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency);
418
  /**
400
  /**
419
   * \param size the number of bytes in the packet to send
401
   * \param size the number of bytes in the packet to send
420
   * \param txVector the TXVECTOR used for the transmission of this packet
402
   * \param txVector the TXVECTOR used for the transmission of this packet
421
   * \param preamble the type of preamble to use for this packet
422
   * \param frequency the channel center frequency (MHz)
403
   * \param frequency the channel center frequency (MHz)
423
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
404
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
424
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time
405
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time
425
   *
406
   *
426
   * \return the duration of the payload
407
   * \return the duration of the payload
427
   */
408
   */
428
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
409
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag);
429
410
430
  /**
411
  /**
431
   * The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used
412
   * The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used
 Lines 581-594    Link Here 
581
   *
562
   *
582
   * \param standard the Wi-Fi standard
563
   * \param standard the Wi-Fi standard
583
   */
564
   */
584
  virtual void ConfigureStandard (enum WifiPhyStandard standard);
565
  virtual void ConfigureStandard (WifiPhyStandard standard);
585
566
586
  /**
567
  /**
587
   * Get the configured Wi-Fi standard
568
   * Get the configured Wi-Fi standard
588
   *
569
   *
589
   * \return the Wi-Fi standard that has been configured
570
   * \return the Wi-Fi standard that has been configured
590
   */
571
   */
591
  virtual enum WifiPhyStandard GetStandard (void) const;
572
  virtual WifiPhyStandard GetStandard (void) const;
592
573
593
  /**
574
  /**
594
   * Add a channel definition to the WifiPhy.  The pair (channelNumber,
575
   * Add a channel definition to the WifiPhy.  The pair (channelNumber,
 Lines 605-616    Link Here 
605
   *
586
   *
606
   * \return true if the channel definition succeeded
587
   * \return true if the channel definition succeeded
607
   */
588
   */
608
  bool DefineChannelNumber (uint16_t channelNumber, enum WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth);
589
  bool DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth);
609
590
610
  /**
591
  /**
611
   * A pair of a ChannelNumber and WifiPhyStandard
592
   * A pair of a ChannelNumber and WifiPhyStandard
612
   */
593
   */
613
  typedef std::pair<uint16_t, enum WifiPhyStandard> ChannelNumberStandardPair;
594
  typedef std::pair<uint16_t, WifiPhyStandard> ChannelNumberStandardPair;
614
  /**
595
  /**
615
   * A pair of a center Frequency and a ChannelWidth
596
   * A pair of a center Frequency and a ChannelWidth
616
   */
597
   */
 Lines 1159-1175    Link Here 
1159
   *        tuned on a given channel and still to be able to receive packets
1140
   *        tuned on a given channel and still to be able to receive packets
1160
   *        on a nearby channel.
1141
   *        on a nearby channel.
1161
   * \param channelNumber the channel on which the packet is received
1142
   * \param channelNumber the channel on which the packet is received
1162
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1163
   *        units used both for the radiotap and for the prism header)
1164
   * \param preamble the preamble of the packet
1165
   * \param txVector the TXVECTOR that holds rx parameters
1143
   * \param txVector the TXVECTOR that holds rx parameters
1166
   * \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)
1144
   * \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)
1167
   *        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)
1145
   *        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)
1168
   * \param signalNoise signal power and noise power in dBm
1146
   * \param signalNoise signal power and noise power in dBm
1169
   */
1147
   */
1170
  void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1148
  void NotifyMonitorSniffRx (Ptr<const Packet> packet,
1171
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1149
                             uint16_t channelFreqMhz,
1172
                             WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise);
1150
                             uint16_t channelNumber,
1151
                             WifiTxVector txVector,
1152
                             MpduInfo aMpdu,
1153
                             SignalNoiseDbm signalNoise);
1173
1154
1174
  /**
1155
  /**
1175
   * TracedCallback signature for monitor mode receive events.
1156
   * TracedCallback signature for monitor mode receive events.
 Lines 1184-1192    Link Here 
1184
   *        tuned on a given channel and still to be able to receive packets
1165
   *        tuned on a given channel and still to be able to receive packets
1185
   *        on a nearby channel.
1166
   *        on a nearby channel.
1186
   * \param channelNumber the channel on which the packet is received
1167
   * \param channelNumber the channel on which the packet is received
1187
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1188
   *        units used both for the radiotap and for the prism header)
1189
   * \param preamble the preamble of the packet
1190
   * \param txVector the TXVECTOR that holds rx parameters
1168
   * \param txVector the TXVECTOR that holds rx parameters
1191
   * \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)
1169
   * \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)
1192
   *        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)
1170
   *        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)
 Lines 1194-1202    Link Here 
1194
   * \todo WifiTxVector should be passed by const reference because
1172
   * \todo WifiTxVector should be passed by const reference because
1195
   * of its size.
1173
   * of its size.
1196
   */
1174
   */
1197
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
1175
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet,
1198
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1176
                                            uint16_t channelFreqMhz,
1199
                                            WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise);
1177
                                            uint16_t channelNumber,
1178
                                            WifiTxVector txVector,
1179
                                            MpduInfo aMpdu,
1180
                                            SignalNoiseDbm signalNoise);
1200
1181
1201
  /**
1182
  /**
1202
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
1183
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
 Lines 1206-1221    Link Here 
1206
   * \param channelFreqMhz the frequency in MHz at which the packet is
1187
   * \param channelFreqMhz the frequency in MHz at which the packet is
1207
   *        transmitted.
1188
   *        transmitted.
1208
   * \param channelNumber the channel on which the packet is transmitted
1189
   * \param channelNumber the channel on which the packet is transmitted
1209
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1210
   *        units used both for the radiotap and for the prism header)
1211
   * \param preamble the preamble of the packet
1212
   * \param txVector the TXVECTOR that holds tx parameters
1190
   * \param txVector the TXVECTOR that holds tx parameters
1213
   * \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)
1191
   * \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)
1214
   *        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)
1192
   *        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)
1215
   */
1193
   */
1216
  void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1194
  void NotifyMonitorSniffTx (Ptr<const Packet> packet,
1217
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1195
                             uint16_t channelFreqMhz,
1218
                             WifiTxVector txVector, struct mpduInfo aMpdu);
1196
                             uint16_t channelNumber,
1197
                             WifiTxVector txVector,
1198
                             MpduInfo aMpdu);
1219
1199
1220
  /**
1200
  /**
1221
   * TracedCallback signature for monitor mode transmit events.
1201
   * TracedCallback signature for monitor mode transmit events.
 Lines 1224-1241    Link Here 
1224
   * \param channelFreqMhz the frequency in MHz at which the packet is
1204
   * \param channelFreqMhz the frequency in MHz at which the packet is
1225
   *        transmitted.
1205
   *        transmitted.
1226
   * \param channelNumber the channel on which the packet is transmitted
1206
   * \param channelNumber the channel on which the packet is transmitted
1227
   * \param rate the PHY data rate in units of 500kbps (i.e., the same
1228
   *        units used both for the radiotap and for the prism header)
1229
   * \param preamble the preamble of the packet
1230
   * \param txVector the TXVECTOR that holds tx parameters
1207
   * \param txVector the TXVECTOR that holds tx parameters
1231
   * \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)
1208
   * \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)
1232
   *        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)
1209
   *        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)
1233
   * \todo WifiTxVector should be passed by const reference because
1210
   * \todo WifiTxVector should be passed by const reference because
1234
   * of its size.
1211
   * of its size.
1235
   */
1212
   */
1236
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
1213
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
1237
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1214
                                            uint16_t channelFreqMhz,
1238
                                            WifiTxVector txVector, struct mpduInfo aMpdu);
1215
                                            uint16_t channelNumber,
1216
                                            WifiTxVector txVector,
1217
                                            MpduInfo aMpdu);
1239
1218
1240
  /**
1219
  /**
1241
   * Assign a fixed random variable stream number to the random variables
1220
   * Assign a fixed random variable stream number to the random variables
 Lines 1660-1666    Link Here 
1660
   *
1639
   *
1661
   * \param standard the Wi-Fi standard
1640
   * \param standard the Wi-Fi standard
1662
   */
1641
   */
1663
  virtual void ConfigureDefaultsForStandard (enum WifiPhyStandard standard);
1642
  virtual void ConfigureDefaultsForStandard (WifiPhyStandard standard);
1664
  /**
1643
  /**
1665
   * Configure the PHY-level parameters for different Wi-Fi standard.
1644
   * Configure the PHY-level parameters for different Wi-Fi standard.
1666
   * This method is called when the Frequency or ChannelNumber attributes
1645
   * This method is called when the Frequency or ChannelNumber attributes
 Lines 1669-1675    Link Here 
1669
   *
1648
   *
1670
   * \param standard the Wi-Fi standard
1649
   * \param standard the Wi-Fi standard
1671
   */
1650
   */
1672
  virtual void ConfigureChannelForStandard (enum WifiPhyStandard standard);
1651
  virtual void ConfigureChannelForStandard (WifiPhyStandard standard);
1673
1652
1674
  /**
1653
  /**
1675
   * Look for channel number matching the frequency and width
1654
   * Look for channel number matching the frequency and width
 Lines 1684-1690    Link Here 
1684
   * \param standard The WifiPhyStandard to check
1663
   * \param standard The WifiPhyStandard to check
1685
   * \return the FrequencyWidthPair found
1664
   * \return the FrequencyWidthPair found
1686
   */
1665
   */
1687
  FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, enum WifiPhyStandard standard) const;
1666
  FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, WifiPhyStandard standard) const;
1688
1667
1689
  /**
1668
  /**
1690
   * The trace source fired when a packet begins the transmission process on
1669
   * The trace source fired when a packet begins the transmission process on
 Lines 1745-1752    Link Here 
1745
   * \todo WifiTxVector and signalNoiseDbm should be be passed as
1724
   * \todo WifiTxVector and signalNoiseDbm should be be passed as
1746
   * const  references because of their sizes.
1725
   * const  references because of their sizes.
1747
   */
1726
   */
1748
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1727
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, WifiTxVector, MpduInfo, SignalNoiseDbm> m_phyMonitorSniffRxTrace;
1749
                 WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
1750
1728
1751
  /**
1729
  /**
1752
   * A trace source that emulates a wifi device in monitor mode
1730
   * A trace source that emulates a wifi device in monitor mode
 Lines 1760-1767    Link Here 
1760
   * \todo WifiTxVector should be passed by const reference because
1738
   * \todo WifiTxVector should be passed by const reference because
1761
   * of its size.
1739
   * of its size.
1762
   */
1740
   */
1763
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1741
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, WifiTxVector, MpduInfo> m_phyMonitorSniffTxTrace;
1764
                 WifiPreamble, WifiTxVector, struct mpduInfo> m_phyMonitorSniffTxTrace;
1765
    
1742
    
1766
  /**
1743
  /**
1767
   * This vector holds the set of transmission modes that this
1744
   * This vector holds the set of transmission modes that this
 Lines 1804-1810    Link Here 
1804
1781
1805
  std::vector<uint32_t> m_bssMembershipSelectorSet;
1782
  std::vector<uint32_t> m_bssMembershipSelectorSet;
1806
1783
1807
  enum WifiPhyStandard m_standard;     //!< WifiPhyStandard
1784
  WifiPhyStandard m_standard;     //!< WifiPhyStandard
1808
  bool m_isConstructed;                //!< true when ready to set frequency
1785
  bool m_isConstructed;                //!< true when ready to set frequency
1809
  uint32_t m_channelCenterFrequency;   //!< Center frequency in MHz
1786
  uint32_t m_channelCenterFrequency;   //!< Center frequency in MHz
1810
  uint32_t m_initialFrequency;         //!< Store frequency until initialization
1787
  uint32_t m_initialFrequency;         //!< Store frequency until initialization
 Lines 1848-1854    Link Here 
1848
 * \param state       wifi state to stringify
1825
 * \param state       wifi state to stringify
1849
 * \return output stream
1826
 * \return output stream
1850
 */
1827
 */
1851
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state);
1828
std::ostream& operator<< (std::ostream& os, WifiPhy::State state);
1852
1829
1853
} //namespace ns3
1830
} //namespace ns3
1854
1831
(-)a/src/wifi/model/wifi-remote-station-manager.cc (-28 / +86 lines)
 Lines 719-724    Link Here 
719
    {
719
    {
720
      WifiTxVector v;
720
      WifiTxVector v;
721
      v.SetMode (GetNonUnicastMode ());
721
      v.SetMode (GetNonUnicastMode ());
722
      v.SetPreambleType (GetPreambleForTransmission (GetNonUnicastMode (), address));
722
      v.SetTxPowerLevel (m_defaultTxPowerLevel);
723
      v.SetTxPowerLevel (m_defaultTxPowerLevel);
723
      v.SetChannelWidth (m_wifiPhy->GetChannelWidth ());
724
      v.SetChannelWidth (m_wifiPhy->GetChannelWidth ());
724
      v.SetShortGuardInterval (m_wifiPhy->GetGuardInterval ());
725
      v.SetShortGuardInterval (m_wifiPhy->GetGuardInterval ());
 Lines 763-771    Link Here 
763
WifiTxVector
764
WifiTxVector
764
WifiRemoteStationManager::DoGetCtsToSelfTxVector (void)
765
WifiRemoteStationManager::DoGetCtsToSelfTxVector (void)
765
{
766
{
766
  return WifiTxVector (GetDefaultMode (),
767
  WifiMode defaultMode = GetDefaultMode ();
768
  WifiPreamble defaultPreamble;
769
  if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
770
    {
771
      defaultPreamble = WIFI_PREAMBLE_VHT;
772
    }
773
  else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
774
    {
775
      defaultPreamble = WIFI_PREAMBLE_HT_MF;
776
    }
777
  else
778
    {
779
      defaultPreamble = WIFI_PREAMBLE_LONG;
780
    }
781
782
  return WifiTxVector (defaultMode,
767
                       GetDefaultTxPowerLevel (),
783
                       GetDefaultTxPowerLevel (),
768
                       0,
784
                       0,
785
                       defaultPreamble,
769
                       m_wifiPhy->GetChannelWidth (),
786
                       m_wifiPhy->GetChannelWidth (),
770
                       m_wifiPhy->GetGuardInterval (),
787
                       m_wifiPhy->GetGuardInterval (),
771
                       GetNumberOfTransmitAntennas (),
788
                       GetNumberOfTransmitAntennas (),
 Lines 1118-1124    Link Here 
1118
}
1135
}
1119
1136
1120
bool
1137
bool
1121
WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (enum WifiModulationClass modClassReq, enum WifiModulationClass modClassAnswer) const
1138
WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (WifiModulationClass modClassReq, WifiModulationClass modClassAnswer) const
1122
{
1139
{
1123
  switch (modClassReq)
1140
  switch (modClassReq)
1124
    {
1141
    {
 Lines 1285-1298    Link Here 
1285
WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode)
1302
WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode)
1286
{
1303
{
1287
  NS_ASSERT (!address.IsGroup ());
1304
  NS_ASSERT (!address.IsGroup ());
1305
  WifiMode ctsMode = GetControlAnswerMode (address, rtsMode);
1288
  WifiTxVector v;
1306
  WifiTxVector v;
1289
  v.SetMode (GetControlAnswerMode (address, rtsMode));
1307
  v.SetMode (ctsMode);
1290
  v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, v.GetMode ()));
1308
  v.SetPreambleType (GetPreambleForTransmission (ctsMode, address));
1291
  v.SetChannelWidth (DoGetCtsTxChannelWidth (address, v.GetMode ()));
1309
  v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode));
1292
  v.SetShortGuardInterval (DoGetCtsTxGuardInterval (address, v.GetMode ()));
1310
  v.SetChannelWidth (DoGetCtsTxChannelWidth (address, ctsMode));
1293
  v.SetNss (DoGetCtsTxNss (address, v.GetMode ()));
1311
  v.SetShortGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode));
1294
  v.SetNess (DoGetCtsTxNess (address, v.GetMode ()));
1312
  v.SetNss (DoGetCtsTxNss (address, ctsMode));
1295
  v.SetStbc (DoGetCtsTxStbc (address, v.GetMode ()));
1313
  v.SetNess (DoGetCtsTxNess (address, ctsMode));
1314
  v.SetStbc (DoGetCtsTxStbc (address, ctsMode));
1296
  return v;
1315
  return v;
1297
}
1316
}
1298
1317
 Lines 1300-1313    Link Here 
1300
WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode)
1319
WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode)
1301
{
1320
{
1302
  NS_ASSERT (!address.IsGroup ());
1321
  NS_ASSERT (!address.IsGroup ());
1322
  WifiMode ackMode = GetControlAnswerMode (address, dataMode);
1303
  WifiTxVector v;
1323
  WifiTxVector v;
1304
  v.SetMode (GetControlAnswerMode (address, dataMode));
1324
  v.SetMode (ackMode);
1305
  v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, v.GetMode ()));
1325
  v.SetPreambleType (GetPreambleForTransmission (ackMode, address));
1306
  v.SetChannelWidth (DoGetAckTxChannelWidth (address, v.GetMode ()));
1326
  v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode));
1307
  v.SetShortGuardInterval (DoGetAckTxGuardInterval (address, v.GetMode ()));
1327
  v.SetChannelWidth (DoGetAckTxChannelWidth (address, ackMode));
1308
  v.SetNss (DoGetAckTxNss (address, v.GetMode ()));
1328
  v.SetShortGuardInterval (DoGetAckTxGuardInterval (address, ackMode));
1309
  v.SetNess (DoGetAckTxNess (address, v.GetMode ()));
1329
  v.SetNss (DoGetAckTxNss (address, ackMode));
1310
  v.SetStbc (DoGetAckTxStbc (address, v.GetMode ()));
1330
  v.SetNess (DoGetAckTxNess (address, ackMode));
1331
  v.SetStbc (DoGetAckTxStbc (address, ackMode));
1311
  return v;
1332
  return v;
1312
}
1333
}
1313
1334
 Lines 1315-1328    Link Here 
1315
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode)
1336
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode)
1316
{
1337
{
1317
  NS_ASSERT (!address.IsGroup ());
1338
  NS_ASSERT (!address.IsGroup ());
1339
  WifiMode blockAckMode = GetControlAnswerMode (address, blockAckReqMode);
1318
  WifiTxVector v;
1340
  WifiTxVector v;
1319
  v.SetMode (GetControlAnswerMode (address, blockAckReqMode));
1341
  v.SetMode (blockAckMode);
1320
  v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, v.GetMode ()));
1342
  v.SetPreambleType (GetPreambleForTransmission (blockAckMode, address));
1321
  v.SetChannelWidth (DoGetBlockAckTxChannelWidth (address, v.GetMode ()));
1343
  v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode));
1322
  v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval (address, v.GetMode ()));
1344
  v.SetChannelWidth (DoGetBlockAckTxChannelWidth (address, blockAckMode));
1323
  v.SetNss (DoGetBlockAckTxNss (address, v.GetMode ()));
1345
  v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode));
1324
  v.SetNess (DoGetBlockAckTxNess (address, v.GetMode ()));
1346
  v.SetNss (DoGetBlockAckTxNss (address, blockAckMode));
1325
  v.SetStbc (DoGetBlockAckTxStbc (address, v.GetMode ()));
1347
  v.SetNess (DoGetBlockAckTxNess (address, blockAckMode));
1348
  v.SetStbc (DoGetBlockAckTxStbc (address, blockAckMode));
1326
  return v;
1349
  return v;
1327
}
1350
}
1328
1351
 Lines 1782-1787    Link Here 
1782
  return station->m_state->m_operationalRateSet[index];
1805
  return station->m_state->m_operationalRateSet[index];
1783
}
1806
}
1784
1807
1808
Mac48Address
1809
WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const
1810
{
1811
  return station->m_state->m_address;
1812
}
1813
1785
uint32_t
1814
uint32_t
1786
WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
1815
WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
1787
{
1816
{
 Lines 1899-1904    Link Here 
1899
  return m_wifiPhy->GetNumberOfTransmitAntennas ();
1928
  return m_wifiPhy->GetNumberOfTransmitAntennas ();
1900
}
1929
}
1901
1930
1931
WifiPreamble
1932
WifiRemoteStationManager::GetPreambleForTransmission (WifiMode mode, Mac48Address dest)
1933
{
1934
  NS_LOG_FUNCTION (this << mode << dest);
1935
  WifiPreamble preamble;
1936
  if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
1937
    {
1938
      preamble = WIFI_PREAMBLE_VHT;
1939
    }
1940
  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT && m_wifiPhy->GetGreenfield () && GetGreenfieldSupported (dest))
1941
    {
1942
      preamble = WIFI_PREAMBLE_HT_GF;
1943
    }
1944
  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
1945
    {
1946
      preamble = WIFI_PREAMBLE_HT_MF;
1947
    }
1948
  else if (GetShortPreambleEnabled ())
1949
    {
1950
      preamble = WIFI_PREAMBLE_SHORT;
1951
    }
1952
  else
1953
    {
1954
      preamble = WIFI_PREAMBLE_LONG;
1955
    }
1956
  NS_LOG_FUNCTION ("selected preamble=" << preamble);
1957
  return preamble;
1958
}
1959
1960
WifiRemoteStation::~WifiRemoteStation ()
1961
{
1962
  NS_LOG_FUNCTION (this);
1963
}
1964
1902
WifiRemoteStationInfo::WifiRemoteStationInfo ()
1965
WifiRemoteStationInfo::WifiRemoteStationInfo ()
1903
  : m_memoryTime (Seconds (1.0)),
1966
  : m_memoryTime (Seconds (1.0)),
1904
    m_lastUpdate (Seconds (0.0)),
1967
    m_lastUpdate (Seconds (0.0)),
 Lines 1935-1943    Link Here 
1935
  return m_failAvg;
1998
  return m_failAvg;
1936
}
1999
}
1937
2000
1938
WifiRemoteStation::~WifiRemoteStation ()
1939
{
1940
  NS_LOG_FUNCTION (this);
1941
}
1942
1943
} //namespace ns3
2001
} //namespace ns3
(-)a/src/wifi/model/wifi-remote-station-manager.h (-2 / +18 lines)
 Lines 751-757    Link Here 
751
  typedef void (*RateChangeTracedCallback)(uint32_t rate, Mac48Address remoteAddress);
751
  typedef void (*RateChangeTracedCallback)(uint32_t rate, Mac48Address remoteAddress);
752
752
753
753
754
755
protected:
754
protected:
756
  virtual void DoDispose (void);
755
  virtual void DoDispose (void);
757
  /**
756
  /**
 Lines 825-830    Link Here 
825
   */
824
   */
826
  uint32_t GetNNonErpSupported (const WifiRemoteStation *station) const;
825
  uint32_t GetNNonErpSupported (const WifiRemoteStation *station) const;
827
  /**
826
  /**
827
   * Return the address of the station.
828
   *
829
   * \param station the station being queried
830
   *
831
   * \return the address of the station
832
   */
833
  Mac48Address GetAddress (const WifiRemoteStation *station) const;
834
  /**
828
   * Return the channel width supported by the station.
835
   * Return the channel width supported by the station.
829
   *
836
   *
830
   * \param station the station being queried
837
   * \param station the station being queried
 Lines 901-906    Link Here 
901
   * \return the short retry limit of the the station
908
   * \return the short retry limit of the the station
902
   */
909
   */
903
  uint32_t GetShortRetryCount (const WifiRemoteStation *station) const;
910
  uint32_t GetShortRetryCount (const WifiRemoteStation *station) const;
911
  /**
912
   * Return the preamble to be used for the transmission.
913
   *
914
   * \param mode the mode selected for the transmission
915
   * \param dest address of the recipient
916
   *
917
   * \return the preamble to be used for the transmission
918
   */
919
  WifiPreamble GetPreambleForTransmission (WifiMode mode, Mac48Address dest);
904
920
905
  /**
921
  /**
906
   * Return the WifiPhy.
922
   * Return the WifiPhy.
 Lines 1150-1156    Link Here 
1150
   * \return true if the modulation class of the selected mode for the 
1166
   * \return true if the modulation class of the selected mode for the 
1151
   * control answer frame is allowed, false otherwise
1167
   * control answer frame is allowed, false otherwise
1152
   */
1168
   */
1153
  bool IsAllowedControlAnswerModulationClass (enum WifiModulationClass modClassReq, enum WifiModulationClass modClassAnswer) const;
1169
  bool IsAllowedControlAnswerModulationClass (WifiModulationClass modClassReq, WifiModulationClass modClassAnswer) const;
1154
1170
1155
  WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
1171
  WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
1156
1172
(-)a/src/wifi/model/wifi-tx-vector.cc (-3 / +25 lines)
 Lines 26-31    Link Here 
26
26
27
WifiTxVector::WifiTxVector ()
27
WifiTxVector::WifiTxVector ()
28
  : m_retries (0),
28
  : m_retries (0),
29
    m_preamble (WIFI_PREAMBLE_NONE),
29
    m_channelWidth (20),
30
    m_channelWidth (20),
30
    m_shortGuardInterval (false),
31
    m_shortGuardInterval (false),
31
    m_nss (1),
32
    m_nss (1),
 Lines 37-48    Link Here 
37
{
38
{
38
}
39
}
39
40
40
WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries,
41
WifiTxVector::WifiTxVector (WifiMode mode,
41
                            bool shortGuardInterval, uint8_t nss, uint8_t ness,
42
                            uint8_t powerLevel,
42
                            uint32_t channelWidth, bool aggregation, bool stbc)
43
                            uint8_t retries,
44
                            WifiPreamble preamble,
45
                            bool shortGuardInterval,
46
                            uint8_t nss,
47
                            uint8_t ness,
48
                            uint32_t channelWidth,
49
                            bool aggregation,
50
                            bool stbc)
43
  : m_mode (mode),
51
  : m_mode (mode),
44
    m_txPowerLevel (powerLevel),
52
    m_txPowerLevel (powerLevel),
45
    m_retries (retries),
53
    m_retries (retries),
54
    m_preamble (preamble),
46
    m_channelWidth (channelWidth),
55
    m_channelWidth (channelWidth),
47
    m_shortGuardInterval (shortGuardInterval),
56
    m_shortGuardInterval (shortGuardInterval),
48
    m_nss (nss),
57
    m_nss (nss),
 Lines 80-85    Link Here 
80
  return m_retries;
89
  return m_retries;
81
}
90
}
82
91
92
WifiPreamble
93
WifiTxVector::GetPreambleType (void) const
94
{
95
  return m_preamble;
96
}
97
83
uint32_t
98
uint32_t
84
WifiTxVector::GetChannelWidth (void) const
99
WifiTxVector::GetChannelWidth (void) const
85
{
100
{
 Lines 137-142    Link Here 
137
}
152
}
138
153
139
void
154
void
155
WifiTxVector::SetPreambleType (WifiPreamble preamble)
156
{
157
  m_preamble = preamble;
158
}
159
160
void
140
WifiTxVector::SetChannelWidth (uint32_t channelWidth)
161
WifiTxVector::SetChannelWidth (uint32_t channelWidth)
141
{
162
{
142
  m_channelWidth = channelWidth;
163
  m_channelWidth = channelWidth;
 Lines 177-182    Link Here 
177
  os << "mode: " << v.GetMode () <<
198
  os << "mode: " << v.GetMode () <<
178
    " txpwrlvl: " << (uint32_t)v.GetTxPowerLevel () <<
199
    " txpwrlvl: " << (uint32_t)v.GetTxPowerLevel () <<
179
    " retries: " << (uint32_t)v.GetRetries () <<
200
    " retries: " << (uint32_t)v.GetRetries () <<
201
    " preamble: " << v.GetPreambleType () <<
180
    " channel width: " << v.GetChannelWidth () <<
202
    " channel width: " << v.GetChannelWidth () <<
181
    " Short GI: " << v.IsShortGuardInterval () <<
203
    " Short GI: " << v.IsShortGuardInterval () <<
182
    " Nss: " << (uint32_t)v.GetNss () <<
204
    " Nss: " << (uint32_t)v.GetNss () <<
(-)a/src/wifi/model/wifi-tx-vector.h (+14 lines)
 Lines 23-28    Link Here 
23
#define WIFI_TX_VECTOR_H
23
#define WIFI_TX_VECTOR_H
24
24
25
#include <ns3/wifi-mode.h>
25
#include <ns3/wifi-mode.h>
26
#include <ns3/wifi-preamble.h>
26
#include <ostream>
27
#include <ostream>
27
28
28
namespace ns3 {
29
namespace ns3 {
 Lines 68-73    Link Here 
68
   * \param mode WifiMode
69
   * \param mode WifiMode
69
   * \param powerLevel transmission power level
70
   * \param powerLevel transmission power level
70
   * \param retries retries
71
   * \param retries retries
72
   * \param preamble preamble type   
71
   * \param shortGuardInterval enable or disable short guard interval
73
   * \param shortGuardInterval enable or disable short guard interval
72
   * \param nss the number of spatial STBC streams (NSS)
74
   * \param nss the number of spatial STBC streams (NSS)
73
   * \param ness the number of extension spatial streams (NESS)
75
   * \param ness the number of extension spatial streams (NESS)
 Lines 78-83    Link Here 
78
  WifiTxVector (WifiMode mode,
80
  WifiTxVector (WifiMode mode,
79
                uint8_t powerLevel,
81
                uint8_t powerLevel,
80
                uint8_t retries,
82
                uint8_t retries,
83
                WifiPreamble preamble,
81
                bool shortGuardInterval,
84
                bool shortGuardInterval,
82
                uint8_t nss,
85
                uint8_t nss,
83
                uint8_t ness,
86
                uint8_t ness,
 Lines 115-120    Link Here 
115
   */
118
   */
116
  void SetRetries (uint8_t retries);
119
  void SetRetries (uint8_t retries);
117
  /**
120
  /**
121
   * \returns the preamble type
122
   */
123
  WifiPreamble GetPreambleType (void) const;
124
  /**
125
   * Sets the preamble type
126
   *
127
   * \param preamble
128
   */
129
  void SetPreambleType (WifiPreamble preamble);
130
  /**
118
   * \returns the channel width (in MHz)
131
   * \returns the channel width (in MHz)
119
   */
132
   */
120
  uint32_t GetChannelWidth (void) const;
133
  uint32_t GetChannelWidth (void) const;
 Lines 190-195    Link Here 
190
                                 to PMD_TXPWRLVL.request */
203
                                 to PMD_TXPWRLVL.request */
191
  uint8_t  m_retries;            /**< The DATA_RETRIES/RTS_RETRIES parameter
204
  uint8_t  m_retries;            /**< The DATA_RETRIES/RTS_RETRIES parameter
192
                                 for Click radiotap information */
205
                                 for Click radiotap information */
206
  WifiPreamble m_preamble;       /** preamble */
193
  uint32_t m_channelWidth;       /**< channel width in MHz */
207
  uint32_t m_channelWidth;       /**< channel width in MHz */
194
  bool     m_shortGuardInterval; /**< true if short GI is going to be used */
208
  bool     m_shortGuardInterval; /**< true if short GI is going to be used */
195
  uint8_t  m_nss;                /**< number of streams */
209
  uint8_t  m_nss;                /**< number of streams */
(-)a/src/wifi/model/yans-wifi-phy.cc (-48 / +22 lines)
 Lines 287-300    Link Here 
287
      return;
287
      return;
288
    }
288
    }
289
289
290
  enum WifiPreamble preamble = tag.GetWifiPreamble ();
290
  WifiPreamble preamble = txVector.GetPreambleType ();
291
  enum mpduType mpdutype = tag.GetMpduType ();
291
  MpduType mpdutype = tag.GetMpduType ();
292
  Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble);
292
  Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
293
293
294
  Ptr<InterferenceHelper::Event> event;
294
  Ptr<InterferenceHelper::Event> event;
295
  event = m_interference.Add (packet->GetSize (),
295
  event = m_interference.Add (packet->GetSize (),
296
                              txVector,
296
                              txVector,
297
                              preamble,
298
                              rxDuration,
297
                              rxDuration,
299
                              rxPowerW);
298
                              rxPowerW);
300
299
 Lines 394-400    Link Here 
394
            {
393
            {
395
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
394
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
396
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
395
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
397
                                                      packet, txVector, preamble, mpdutype, event);
396
                                                      packet, txVector, mpdutype, event);
398
            }
397
            }
399
398
400
          NS_ASSERT (m_endRxEvent.IsExpired ());
399
          NS_ASSERT (m_endRxEvent.IsExpired ());
 Lines 435-450    Link Here 
435
void
434
void
436
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
435
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
437
                                 WifiTxVector txVector,
436
                                 WifiTxVector txVector,
438
                                 enum WifiPreamble preamble,
437
                                 MpduType mpdutype,
439
                                 enum mpduType mpdutype,
440
                                 Ptr<InterferenceHelper::Event> event)
438
                                 Ptr<InterferenceHelper::Event> event)
441
{
439
{
442
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)mpdutype);
440
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << (uint32_t)mpdutype);
443
  NS_ASSERT (IsStateRx ());
441
  NS_ASSERT (IsStateRx ());
444
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
442
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
445
  WifiMode txMode = txVector.GetMode ();
443
  WifiMode txMode = txVector.GetMode ();
446
444
447
  struct InterferenceHelper::SnrPer snrPer;
445
  InterferenceHelper::SnrPer snrPer;
448
  snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
446
  snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
449
447
450
  NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per);
448
  NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per);
 Lines 472-488    Link Here 
472
}
470
}
473
471
474
void
472
void
475
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble)
473
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype)
476
{
477
  SendPacket (packet, txVector, preamble, NORMAL_MPDU);
478
}
479
480
void
481
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
482
{
474
{
483
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () 
475
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () 
484
    << txVector.GetMode ().GetDataRate (txVector)
476
    << txVector.GetMode ().GetDataRate (txVector) << txVector.GetPreambleType ()
485
    << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype);
477
    << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype);
486
  /* Transmission can happen if:
478
  /* Transmission can happen if:
487
   *  - we are syncing on a packet. It is the responsability of the
479
   *  - we are syncing on a packet. It is the responsability of the
488
   *    MAC layer to avoid doing this but the PHY does nothing to
480
   *    MAC layer to avoid doing this but the PHY does nothing to
 Lines 503-509    Link Here 
503
      return;
495
      return;
504
    }
496
    }
505
497
506
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), mpdutype, 1);
498
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency (), mpdutype, 1);
507
  NS_ASSERT (txDuration > NanoSeconds (0));
499
  NS_ASSERT (txDuration > NanoSeconds (0));
508
500
509
  if (m_state->IsStateRx ())
501
  if (m_state->IsStateRx ())
 Lines 513-542    Link Here 
513
      m_interference.NotifyRxEnd ();
505
      m_interference.NotifyRxEnd ();
514
    }
506
    }
515
  NotifyTxBegin (packet);
507
  NotifyTxBegin (packet);
516
  uint32_t dataRate500KbpsUnits;
508
  if ((mpdutype == MPDU_IN_AGGREGATE) && (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE))
517
  if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
518
    {
519
      dataRate500KbpsUnits = 128 + txVector.GetMode ().GetMcsValue ();
520
    }
521
  else
522
    {
523
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
524
    }
525
  if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
526
    {
509
    {
527
      //send the first MPDU in an MPDU
510
      //send the first MPDU in an MPDU
528
      m_txMpduReferenceNumber++;
511
      m_txMpduReferenceNumber++;
529
    }
512
    }
530
  struct mpduInfo aMpdu;
513
  MpduInfo aMpdu;
531
  aMpdu.type = mpdutype;
514
  aMpdu.type = mpdutype;
532
  aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
515
  aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
533
  NotifyMonitorSniffTx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
516
  NotifyMonitorSniffTx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), txVector, aMpdu);
534
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
517
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector);
535
  
518
  
536
  Ptr<Packet> newPacket = packet->Copy (); // obtain non-const Packet
519
  Ptr<Packet> newPacket = packet->Copy (); // obtain non-const Packet
537
  WifiPhyTag oldtag;
520
  WifiPhyTag oldtag;
538
  newPacket->RemovePacketTag (oldtag);
521
  newPacket->RemovePacketTag (oldtag);
539
  WifiPhyTag tag (txVector, preamble, mpdutype);
522
  WifiPhyTag tag (txVector, mpdutype);
540
  newPacket->AddPacketTag (tag);
523
  newPacket->AddPacketTag (tag);
541
  m_channel->Send (this, newPacket, GetPowerDbm (txVector.GetTxPowerLevel ()) + GetTxGain (), txDuration);
524
  m_channel->Send (this, newPacket, GetPowerDbm (txVector.GetTxPowerLevel ()) + GetTxGain (), txDuration);
542
}
525
}
 Lines 554-566    Link Here 
554
}
537
}
555
538
556
void
539
void
557
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr<InterferenceHelper::Event> event)
540
YansWifiPhy::EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype, Ptr<InterferenceHelper::Event> event)
558
{
541
{
559
  NS_LOG_FUNCTION (this << packet << event);
542
  NS_LOG_FUNCTION (this << packet << event);
560
  NS_ASSERT (IsStateRx ());
543
  NS_ASSERT (IsStateRx ());
561
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
544
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
562
545
563
  struct InterferenceHelper::SnrPer snrPer;
546
  InterferenceHelper::SnrPer snrPer;
564
  snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
547
  snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
565
  m_interference.NotifyRxEnd ();
548
  m_interference.NotifyRxEnd ();
566
549
 Lines 572-594    Link Here 
572
      if (m_random->GetValue () > snrPer.per)
555
      if (m_random->GetValue () > snrPer.per)
573
        {
556
        {
574
          NotifyRxEnd (packet);
557
          NotifyRxEnd (packet);
575
          uint32_t dataRate500KbpsUnits;
558
          SignalNoiseDbm signalNoise;
576
          if ((event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) || (event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT))
577
            {
578
              dataRate500KbpsUnits = 128 + event->GetPayloadMode ().GetMcsValue ();
579
            }
580
          else
581
            {
582
              dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate (event->GetTxVector ().GetChannelWidth (), event->GetTxVector ().IsShortGuardInterval (), 1) * event->GetTxVector ().GetNss () / 500000;
583
            }
584
          struct signalNoiseDbm signalNoise;
585
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
559
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
586
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
560
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
587
          struct mpduInfo aMpdu;
561
          MpduInfo aMpdu;
588
          aMpdu.type = mpdutype;
562
          aMpdu.type = mpdutype;
589
          aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
563
          aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
590
          NotifyMonitorSniffRx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
564
          NotifyMonitorSniffRx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), event->GetTxVector (), aMpdu, signalNoise);
591
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
565
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ());
592
        }
566
        }
593
      else
567
      else
594
        {
568
        {
(-)a/src/wifi/model/yans-wifi-phy.h (-9 / +6 lines)
 Lines 74-93    Link Here 
74
   *
74
   *
75
   * \param packet the arriving packet
75
   * \param packet the arriving packet
76
   * \param txVector the TXVECTOR of the arriving packet
76
   * \param txVector the TXVECTOR of the arriving packet
77
   * \param preamble the preamble of the arriving packet
77
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
78
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
79
   * \param event the corresponding event of the first time the packet arrives
78
   * \param event the corresponding event of the first time the packet arrives
80
   */
79
   */
81
  void StartReceivePacket (Ptr<Packet> packet,
80
  void StartReceivePacket (Ptr<Packet> packet,
82
                           WifiTxVector txVector,
81
                           WifiTxVector txVector,
83
                           WifiPreamble preamble,
82
                           MpduType mpdutype,
84
                           enum mpduType mpdutype,
85
                           Ptr<InterferenceHelper::Event> event);
83
                           Ptr<InterferenceHelper::Event> event);
86
84
87
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
85
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
88
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
86
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
89
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble);
87
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU);
90
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype);
91
  virtual void RegisterListener (WifiPhyListener *listener);
88
  virtual void RegisterListener (WifiPhyListener *listener);
92
  virtual void UnregisterListener (WifiPhyListener *listener);
89
  virtual void UnregisterListener (WifiPhyListener *listener);
93
  virtual void SetSleepMode (void);
90
  virtual void SetSleepMode (void);
 Lines 106-117    Link Here 
106
   *
103
   *
107
   * \param packet the packet that the last bit has arrived
104
   * \param packet the packet that the last bit has arrived
108
   * \param preamble the preamble of the arriving packet
105
   * \param preamble the preamble of the arriving packet
109
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
106
   * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
110
   * \param event the corresponding event of the first time the packet arrives
107
   * \param event the corresponding event of the first time the packet arrives
111
   */
108
   */
112
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr<InterferenceHelper::Event> event);
109
  void EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype, Ptr<InterferenceHelper::Event> event);
113
110
114
  Ptr<YansWifiChannel> m_channel;        //!< YansWifiChannel that this YansWifiPhy is connected to
111
  Ptr<YansWifiChannel> m_channel; //!< YansWifiChannel that this YansWifiPhy is connected to
115
};
112
};
116
113
117
} //namespace ns3
114
} //namespace ns3
(-)a/src/wifi/test/spectrum-wifi-phy-test.cc (-7 / +4 lines)
 Lines 70-80    Link Here 
70
Ptr<SpectrumSignalParameters> 
70
Ptr<SpectrumSignalParameters> 
71
SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
71
SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
72
{
72
{
73
  WifiPreamble preamble;
73
  WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, 0, WIFI_PREAMBLE_LONG, false, 1, 0, 20000000, false, false);
74
  preamble = WIFI_PREAMBLE_LONG;
74
  MpduType mpdutype = NORMAL_MPDU;
75
  WifiMode mode = WifiPhy::GetOfdmRate6Mbps ();
76
  WifiTxVector txVector = WifiTxVector (mode, 0, 0, false, 1, 0, 20000000, false, false);
77
  enum mpduType mpdutype = NORMAL_MPDU;
78
75
79
  Ptr<Packet> pkt = Create<Packet> (1000);
76
  Ptr<Packet> pkt = Create<Packet> (1000);
80
  WifiMacHeader hdr;
77
  WifiMacHeader hdr;
 Lines 83-94    Link Here 
83
  hdr.SetType (WIFI_MAC_QOSDATA);
80
  hdr.SetType (WIFI_MAC_QOSDATA);
84
  hdr.SetQosTid (0);
81
  hdr.SetQosTid (0);
85
  uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize ();
82
  uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize ();
86
  Time txDuration = m_phy->CalculateTxDuration (size, txVector, preamble, m_phy->GetFrequency(), mpdutype, 0);
83
  Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency(), mpdutype, 0);
87
  hdr.SetDuration (txDuration);
84
  hdr.SetDuration (txDuration);
88
85
89
  pkt->AddHeader (hdr);
86
  pkt->AddHeader (hdr);
90
  pkt->AddTrailer (trailer);
87
  pkt->AddTrailer (trailer);
91
  WifiPhyTag tag (txVector, preamble, mpdutype);
88
  WifiPhyTag tag (txVector, mpdutype);
92
  pkt->AddPacketTag (tag);
89
  pkt->AddPacketTag (tag);
93
  Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts);
90
  Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts);
94
  Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
91
  Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
(-)a/src/wifi/test/tx-duration-test.cc (-4 / +6 lines)
 Lines 87-92    Link Here 
87
{
87
{
88
  WifiTxVector txVector;
88
  WifiTxVector txVector;
89
  txVector.SetMode (payloadMode);
89
  txVector.SetMode (payloadMode);
90
  txVector.SetPreambleType (preamble);
90
  txVector.SetChannelWidth (channelWidth);
91
  txVector.SetChannelWidth (channelWidth);
91
  txVector.SetShortGuardInterval (isShortGuardInterval);
92
  txVector.SetShortGuardInterval (isShortGuardInterval);
92
  txVector.SetNss (1);
93
  txVector.SetNss (1);
 Lines 100-106    Link Here 
100
    {
101
    {
101
      testedFrequency = CHANNEL_36_MHZ;
102
      testedFrequency = CHANNEL_36_MHZ;
102
    }
103
    }
103
  double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds  ();
104
  double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, testedFrequency).GetMicroSeconds  ();
104
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
105
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
105
    {
106
    {
106
      std::cerr << " size=" << size
107
      std::cerr << " size=" << size
 Lines 115-121    Link Here 
115
    {
116
    {
116
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
117
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
117
      testedFrequency = CHANNEL_1_MHZ;
118
      testedFrequency = CHANNEL_1_MHZ;
118
      calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds ();
119
      calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, testedFrequency).GetMicroSeconds ();
119
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
120
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
120
        {
121
        {
121
          std::cerr << " size=" << size
122
          std::cerr << " size=" << size
 Lines 135-140    Link Here 
135
{
136
{
136
  WifiTxVector txVector;
137
  WifiTxVector txVector;
137
  txVector.SetMode (payloadMode);
138
  txVector.SetMode (payloadMode);
139
  txVector.SetPreambleType (preamble);
138
  txVector.SetChannelWidth (channelWidth);
140
  txVector.SetChannelWidth (channelWidth);
139
  txVector.SetShortGuardInterval (isShortGuardInterval);
141
  txVector.SetShortGuardInterval (isShortGuardInterval);
140
  txVector.SetNss (1);
142
  txVector.SetNss (1);
 Lines 148-154    Link Here 
148
    {
150
    {
149
      testedFrequency = CHANNEL_36_MHZ;
151
      testedFrequency = CHANNEL_36_MHZ;
150
    }
152
    }
151
  double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
153
  double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, testedFrequency).GetNanoSeconds ()) / 1000;
152
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
154
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
153
    {
155
    {
154
      std::cerr << " size=" << size
156
      std::cerr << " size=" << size
 Lines 164-170    Link Here 
164
    {
166
    {
165
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
167
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
166
      testedFrequency = CHANNEL_1_MHZ;
168
      testedFrequency = CHANNEL_1_MHZ;
167
      calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
169
      calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, testedFrequency).GetNanoSeconds ()) / 1000;
168
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
170
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
169
        {
171
        {
170
          std::cerr << " size=" << size
172
          std::cerr << " size=" << size

Return to bug 2551