Bug 2184 [wifi] - integer overflow in MacLow; remove dependcy between tx and rx reference number field in MPDU status
This commit is contained in:
@@ -28,6 +28,7 @@ Bugs fixed
|
||||
- Bug 1132 - useless for loops in block-ack-test-suite.cc
|
||||
- Bug 2183 - LiIonEnergySourceHelper is not in the energy wscript
|
||||
- Bug 2003 - Missing DSSS short PLCP preamble
|
||||
- Bug 2184 - integer overflow in MacLow
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
@@ -209,7 +209,6 @@ PcapSniffTxEvent (
|
||||
if (txVector.IsAggregation ())
|
||||
{
|
||||
uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
|
||||
/* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
|
||||
AmpduSubframeHeader hdr;
|
||||
@@ -221,7 +220,7 @@ PcapSniffTxEvent (
|
||||
{
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
|
||||
}
|
||||
header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
}
|
||||
|
||||
if (preamble == WIFI_PREAMBLE_VHT)
|
||||
@@ -405,7 +404,7 @@ PcapSniffRxEvent (
|
||||
|
||||
if (txVector.IsAggregation ())
|
||||
{
|
||||
uint16_t ampduStatusFlags = 0;
|
||||
uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
|
||||
/* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
|
||||
@@ -418,7 +417,7 @@ PcapSniffRxEvent (
|
||||
{
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
|
||||
}
|
||||
header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
}
|
||||
|
||||
if (preamble == WIFI_PREAMBLE_VHT)
|
||||
|
||||
@@ -106,7 +106,7 @@ InterferenceExperiment::SendA (void) const
|
||||
WifiTxVector txVector;
|
||||
txVector.SetTxPowerLevel (m_input.txPowerLevelA);
|
||||
txVector.SetMode (WifiMode (m_input.txModeA));
|
||||
m_txA->SendPacket (p, txVector, m_input.preamble, 0, 0);
|
||||
m_txA->SendPacket (p, txVector, m_input.preamble, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -116,7 +116,7 @@ InterferenceExperiment::SendB (void) const
|
||||
WifiTxVector txVector;
|
||||
txVector.SetTxPowerLevel (m_input.txPowerLevelB);
|
||||
txVector.SetMode (WifiMode (m_input.txModeB));
|
||||
m_txB->SendPacket (p, txVector, m_input.preamble, 0, 0);
|
||||
m_txB->SendPacket (p, txVector, m_input.preamble, 0);
|
||||
}
|
||||
|
||||
InterferenceExperiment::InterferenceExperiment ()
|
||||
|
||||
@@ -74,7 +74,7 @@ PsrExperiment::Send (void)
|
||||
WifiTxVector txVector;
|
||||
txVector.SetTxPowerLevel (m_input.txPowerLevel);
|
||||
txVector.SetMode (mode);
|
||||
m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
|
||||
m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -182,7 +182,7 @@ CollisionExperiment::SendA (void) const
|
||||
WifiTxVector txVector;
|
||||
txVector.SetTxPowerLevel (m_input.txPowerLevelA);
|
||||
txVector.SetMode (WifiMode (m_input.txModeA));
|
||||
m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
|
||||
m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -193,7 +193,7 @@ CollisionExperiment::SendB (void) const
|
||||
WifiTxVector txVector;
|
||||
txVector.SetTxPowerLevel (m_input.txPowerLevelB);
|
||||
txVector.SetMode (WifiMode (m_input.txModeB));
|
||||
m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
|
||||
m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -371,7 +371,6 @@ PcapSniffTxEvent (
|
||||
if (txVector.IsAggregation ())
|
||||
{
|
||||
uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
|
||||
/* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
|
||||
AmpduSubframeHeader hdr;
|
||||
@@ -383,7 +382,7 @@ PcapSniffTxEvent (
|
||||
{
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
|
||||
}
|
||||
header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
}
|
||||
|
||||
if (preamble == WIFI_PREAMBLE_VHT)
|
||||
@@ -567,7 +566,7 @@ PcapSniffRxEvent (
|
||||
|
||||
if (txVector.IsAggregation ())
|
||||
{
|
||||
uint16_t ampduStatusFlags = 0;
|
||||
uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
|
||||
/* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
|
||||
@@ -580,7 +579,7 @@ PcapSniffRxEvent (
|
||||
{
|
||||
ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
|
||||
}
|
||||
header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
|
||||
}
|
||||
|
||||
if (preamble == WIFI_PREAMBLE_VHT)
|
||||
|
||||
@@ -365,8 +365,7 @@ MacLow::MacLow ()
|
||||
m_listener (0),
|
||||
m_phyMacLowListener (0),
|
||||
m_ctsToSelfSupported (false),
|
||||
m_receivedAtLeastOneMpdu (false),
|
||||
m_mpduReferenceNumber (0)
|
||||
m_receivedAtLeastOneMpdu (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_lastNavDuration = Seconds (0);
|
||||
@@ -1605,7 +1604,7 @@ MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
|
||||
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
|
||||
if (!m_ampdu || hdr->IsRts ())
|
||||
{
|
||||
m_phy->SendPacket (packet, txVector, preamble, 0, 0);
|
||||
m_phy->SendPacket (packet, txVector, preamble, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1658,11 +1657,11 @@ MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
|
||||
{
|
||||
packetType = 0;
|
||||
}
|
||||
m_phy->SendPacket (newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
|
||||
m_phy->SendPacket (newPacket, txVector, preamble, packetType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
|
||||
Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType);
|
||||
}
|
||||
if (queueSize > 1)
|
||||
{
|
||||
@@ -1670,15 +1669,14 @@ MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
|
||||
}
|
||||
preamble = WIFI_PREAMBLE_NONE;
|
||||
}
|
||||
m_mpduReferenceNumber = ((m_mpduReferenceNumber + 1) % 4294967296);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
|
||||
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
|
||||
{
|
||||
NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
|
||||
m_phy->SendPacket (packet, txVector, preamble, packetType, mpduReferenceNumber);
|
||||
m_phy->SendPacket (packet, txVector, preamble, packetType);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -892,9 +892,8 @@ private:
|
||||
* \param txVector
|
||||
* \param preamble
|
||||
* \param packetType
|
||||
* \param mpduReferenceNumber
|
||||
*/
|
||||
void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
|
||||
void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType);
|
||||
/**
|
||||
* Return a TXVECTOR for the RTS frame given the destination.
|
||||
* The function consults WifiRemoteStationManager, which controls the rate
|
||||
@@ -1373,7 +1372,6 @@ private:
|
||||
WifiTxVector m_currentTxVector; //!< TXVECTOR used for the current packet transmission
|
||||
bool m_receivedAtLeastOneMpdu; //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
|
||||
std::vector<Item> m_txPackets; //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
|
||||
uint32_t m_mpduReferenceNumber; //!< A-MPDU reference number to identify all subframes belonging to the same A-MPDU
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -48,7 +48,7 @@ struct signalNoiseDbm
|
||||
struct mpduInfo
|
||||
{
|
||||
uint8_t packetType;
|
||||
uint32_t referenceNumber;
|
||||
uint32_t mpduRefNumber;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -222,9 +222,8 @@ public:
|
||||
* power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
|
||||
* \param preamble the type of preamble to use to send this packet.
|
||||
* \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
|
||||
* \param mpduReferenceNumber the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
|
||||
*/
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber) = 0;
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType) = 0;
|
||||
|
||||
/**
|
||||
* \param listener the new listener
|
||||
@@ -1111,8 +1110,7 @@ public:
|
||||
*/
|
||||
typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
|
||||
uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
|
||||
WifiTxVector txVector, struct mpduInfo aMpdu,
|
||||
struct signalNoiseDbm signalNoise);
|
||||
WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise);
|
||||
|
||||
/**
|
||||
* Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
|
||||
@@ -1298,8 +1296,7 @@ private:
|
||||
* const references because of their sizes.
|
||||
*/
|
||||
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
|
||||
WifiPreamble, WifiTxVector,
|
||||
struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
|
||||
WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
|
||||
|
||||
/**
|
||||
* A trace source that emulates a wifi device in monitor mode
|
||||
@@ -1314,8 +1311,7 @@ private:
|
||||
* of its size.
|
||||
*/
|
||||
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
|
||||
WifiPreamble, WifiTxVector,
|
||||
struct mpduInfo> m_phyMonitorSniffTxTrace;
|
||||
WifiPreamble, WifiTxVector, struct mpduInfo> m_phyMonitorSniffTxTrace;
|
||||
|
||||
uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
|
||||
uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
|
||||
|
||||
@@ -79,7 +79,7 @@ YansWifiChannel::SetPropagationDelayModel (Ptr<PropagationDelayModel> delay)
|
||||
|
||||
void
|
||||
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
|
||||
WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const
|
||||
WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const
|
||||
{
|
||||
Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
|
||||
NS_ASSERT (senderMobility != 0);
|
||||
@@ -113,7 +113,7 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
|
||||
|
||||
struct Parameters parameters;
|
||||
parameters.rxPowerDbm = rxPowerDbm;
|
||||
parameters.aMpdu = aMpdu;
|
||||
parameters.packetType = packetType;
|
||||
parameters.duration = duration;
|
||||
parameters.txVector = txVector;
|
||||
parameters.preamble = preamble;
|
||||
@@ -128,7 +128,7 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
|
||||
void
|
||||
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, struct Parameters parameters) const
|
||||
{
|
||||
m_phyList[i]->StartReceivePreambleAndHeader (packet, parameters.rxPowerDbm, parameters.txVector, parameters.preamble, parameters.aMpdu, parameters.duration);
|
||||
m_phyList[i]->StartReceivePreambleAndHeader (packet, parameters.rxPowerDbm, parameters.txVector, parameters.preamble, parameters.packetType, parameters.duration);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
||||
@@ -40,7 +40,7 @@ class PropagationDelayModel;
|
||||
struct Parameters
|
||||
{
|
||||
double rxPowerDbm;
|
||||
struct mpduInfo aMpdu;
|
||||
uint8_t packetType;
|
||||
Time duration;
|
||||
WifiTxVector txVector;
|
||||
WifiPreamble preamble;
|
||||
@@ -92,8 +92,7 @@ public:
|
||||
* \param txPowerDbm the tx power associated to the packet
|
||||
* \param txVector the TXVECTOR associated to the packet
|
||||
* \param preamble the preamble associated to the packet
|
||||
* \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)
|
||||
* 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)
|
||||
* \param packetType The type of the packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
|
||||
* \param duration the transmission duration associated to the packet
|
||||
*
|
||||
* This method should not be invoked by normal users. It is
|
||||
@@ -102,7 +101,7 @@ public:
|
||||
* e.g. PHYs that are operating on the same channel.
|
||||
*/
|
||||
void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
|
||||
WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const;
|
||||
WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const;
|
||||
|
||||
/**
|
||||
* Assign a fixed random variable stream number to the random variables
|
||||
|
||||
@@ -190,7 +190,9 @@ YansWifiPhy::YansWifiPhy ()
|
||||
m_endPlcpRxEvent (),
|
||||
m_channelStartingFrequency (0),
|
||||
m_mpdusNum (0),
|
||||
m_plcpSuccess (false)
|
||||
m_plcpSuccess (false),
|
||||
m_txMpduReferenceNumber (0xffffffff),
|
||||
m_rxMpduReferenceNumber (0xffffffff)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_random = CreateObject<UniformRandomVariable> ();
|
||||
@@ -572,11 +574,12 @@ YansWifiPhy::StartReceivePreambleAndHeader (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
WifiTxVector txVector,
|
||||
enum WifiPreamble preamble,
|
||||
struct mpduInfo aMpdu, Time rxDuration)
|
||||
uint8_t packetType,
|
||||
Time rxDuration)
|
||||
{
|
||||
//This function should be later split to check separately whether plcp preamble and plcp header can be successfully received.
|
||||
//Note: plcp preamble reception is not yet modeled.
|
||||
NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
|
||||
NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)packetType);
|
||||
AmpduTag ampduTag;
|
||||
rxPowerDbm += m_rxGainDb;
|
||||
double rxPowerW = DbmToW (rxPowerDbm);
|
||||
@@ -653,6 +656,7 @@ YansWifiPhy::StartReceivePreambleAndHeader (Ptr<Packet> packet,
|
||||
{
|
||||
//received the first MPDU in an MPDU
|
||||
m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
|
||||
m_rxMpduReferenceNumber++;
|
||||
}
|
||||
else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
|
||||
{
|
||||
@@ -684,12 +688,12 @@ YansWifiPhy::StartReceivePreambleAndHeader (Ptr<Packet> packet,
|
||||
{
|
||||
NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
|
||||
m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
|
||||
packet, txVector, preamble, aMpdu, event);
|
||||
packet, txVector, preamble, packetType, event);
|
||||
}
|
||||
|
||||
NS_ASSERT (m_endRxEvent.IsExpired ());
|
||||
m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
|
||||
packet, preamble, aMpdu, event);
|
||||
packet, preamble, packetType, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -726,10 +730,10 @@ void
|
||||
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
|
||||
WifiTxVector txVector,
|
||||
enum WifiPreamble preamble,
|
||||
struct mpduInfo aMpdu,
|
||||
uint8_t packetType,
|
||||
Ptr<InterferenceHelper::Event> event)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
|
||||
NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)packetType);
|
||||
NS_ASSERT (IsStateRx ());
|
||||
NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
|
||||
AmpduTag ampduTag;
|
||||
@@ -763,7 +767,7 @@ YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
|
||||
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
|
||||
/* Transmission can happen if:
|
||||
@@ -800,12 +804,17 @@ YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPr
|
||||
{
|
||||
dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
|
||||
}
|
||||
if (packetType == 1 && preamble != WIFI_PREAMBLE_NONE)
|
||||
{
|
||||
//send the first MPDU in an MPDU
|
||||
m_txMpduReferenceNumber++;
|
||||
}
|
||||
struct mpduInfo aMpdu;
|
||||
aMpdu.packetType = packetType;
|
||||
aMpdu.referenceNumber = mpduReferenceNumber;
|
||||
aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
|
||||
NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
|
||||
m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
|
||||
m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, aMpdu, txDuration);
|
||||
m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, packetType, txDuration);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -1141,7 +1150,7 @@ YansWifiPhy::GetPowerDbm (uint8_t power) const
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event)
|
||||
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << event);
|
||||
NS_ASSERT (IsStateRx ());
|
||||
@@ -1171,6 +1180,9 @@ YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct
|
||||
struct signalNoiseDbm signalNoise;
|
||||
signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
|
||||
signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
|
||||
struct mpduInfo aMpdu;
|
||||
aMpdu.packetType = packetType;
|
||||
aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
|
||||
NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
|
||||
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
|
||||
}
|
||||
@@ -1186,7 +1198,7 @@ YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct
|
||||
m_state->SwitchFromRxEndError (packet, snrPer.snr);
|
||||
}
|
||||
|
||||
if (preamble == WIFI_PREAMBLE_NONE && aMpdu.packetType == 2)
|
||||
if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
|
||||
{
|
||||
m_plcpSuccess = false;
|
||||
}
|
||||
|
||||
@@ -107,15 +107,14 @@ public:
|
||||
* \param rxPowerDbm the receive power in dBm
|
||||
* \param txVector the TXVECTOR of the arriving packet
|
||||
* \param preamble the preamble of the arriving packet
|
||||
* \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)
|
||||
* 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)
|
||||
* \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
|
||||
* \param rxDuration the duration needed for the reception of the packet
|
||||
*/
|
||||
void StartReceivePreambleAndHeader (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
WifiTxVector txVector,
|
||||
WifiPreamble preamble,
|
||||
struct mpduInfo aMpdu,
|
||||
uint8_t packetType,
|
||||
Time rxDuration);
|
||||
/**
|
||||
* Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
|
||||
@@ -123,14 +122,13 @@ public:
|
||||
* \param packet the arriving packet
|
||||
* \param txVector the TXVECTOR of the arriving packet
|
||||
* \param preamble the preamble of the arriving packet
|
||||
* \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)
|
||||
* 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)
|
||||
* \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
|
||||
* \param event the corresponding event of the first time the packet arrives
|
||||
*/
|
||||
void StartReceivePacket (Ptr<Packet> packet,
|
||||
WifiTxVector txVector,
|
||||
WifiPreamble preamble,
|
||||
struct mpduInfo aMpdu,
|
||||
uint8_t packetType,
|
||||
Ptr<InterferenceHelper::Event> event);
|
||||
|
||||
/**
|
||||
@@ -281,7 +279,7 @@ public:
|
||||
|
||||
virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
|
||||
virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType);
|
||||
virtual void RegisterListener (WifiPhyListener *listener);
|
||||
virtual void UnregisterListener (WifiPhyListener *listener);
|
||||
virtual void SetSleepMode (void);
|
||||
@@ -513,11 +511,10 @@ private:
|
||||
*
|
||||
* \param packet the packet that the last bit has arrived
|
||||
* \param preamble the preamble of the arriving packet
|
||||
* \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)
|
||||
* 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)
|
||||
* \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
|
||||
* \param event the corresponding event of the first time the packet arrives
|
||||
*/
|
||||
void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event);
|
||||
void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
|
||||
|
||||
bool m_initialized; //!< Flag for runtime initialization
|
||||
double m_edThresholdW; //!< Energy detection threshold in watts
|
||||
@@ -592,6 +589,8 @@ private:
|
||||
Time m_channelSwitchDelay; //!< Time required to switch between channel
|
||||
uint16_t m_mpdusNum; //!< carries the number of expected mpdus that are part of an A-MPDU
|
||||
bool m_plcpSuccess; //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
|
||||
uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU
|
||||
uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user