802.11n short guard interval indication in radiotap header

This commit is contained in:
Sébastien Deronne
2015-06-06 18:02:37 +02:00
parent af65a032f1
commit ef49c036ec
5 changed files with 69 additions and 47 deletions

View File

@@ -88,12 +88,12 @@ AsciiPhyReceiveSinkWithoutContext (
static void
PcapSniffTxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
uint8_t txPower)
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
WifiTxVector txvector)
{
uint32_t dlt = file->GetDataLinkType ();
@@ -121,7 +121,12 @@ PcapSniffTxEvent (
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
}
header.SetFrameFlags (frameFlags);
header.SetRate (rate);
@@ -164,13 +169,14 @@ PcapSniffTxEvent (
static void
PcapSniffRxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
double signalDbm,
double noiseDbm)
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
WifiTxVector txvector,
double signalDbm,
double noiseDbm)
{
uint32_t dlt = file->GetDataLinkType ();
@@ -199,6 +205,11 @@ PcapSniffRxEvent (
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
}
header.SetFrameFlags (frameFlags);
header.SetRate (rate);

View File

@@ -248,12 +248,12 @@ YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<NetDevice> device) const
static void
PcapSniffTxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
uint8_t txPower)
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
WifiTxVector txvector)
{
uint32_t dlt = file->GetDataLinkType ();
@@ -281,6 +281,11 @@ PcapSniffTxEvent (
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
}
header.SetFrameFlags (frameFlags);
header.SetRate (rate);
@@ -310,7 +315,6 @@ PcapSniffTxEvent (
}
header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
p->AddHeader (header);
file->Write (Simulator::Now (), p);
@@ -324,13 +328,14 @@ PcapSniffTxEvent (
static void
PcapSniffRxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
double signalDbm,
double noiseDbm)
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
uint32_t rate,
bool isShortPreamble,
WifiTxVector txvector,
double signalDbm,
double noiseDbm)
{
uint32_t dlt = file->GetDataLinkType ();
@@ -358,6 +363,11 @@ PcapSniffRxEvent (
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
}
header.SetFrameFlags (frameFlags);
header.SetRate (rate);

View File

@@ -382,10 +382,9 @@ WifiPhy::GetPlcpPreambleDuration (WifiMode payloadMode, WifiPreamble preamble)
Time
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag)
{
WifiMode payloadMode=txvector.GetMode();
WifiMode payloadMode = txvector.GetMode();
NS_LOG_FUNCTION (size << payloadMode);
switch (payloadMode.GetModulationClass ())
{
case WIFI_MOD_CLASS_OFDM:
@@ -632,15 +631,15 @@ WifiPhy::NotifyRxDrop (Ptr<const Packet> packet)
}
void
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, double signalDbm, double noiseDbm)
{
m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, signalDbm, noiseDbm);
}
void
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector)
{
m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txPower);
m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector);
}

View File

@@ -1011,13 +1011,14 @@ public:
* \param rate the PHY data rate in units of 500kbps (i.e., the same
* units used both for the radiotap and for the prism header)
* \param isShortPreamble true if short preamble is used, false otherwise
* \param txVector the txvector that holds rx parameters
* \param signalDbm signal power in dBm
* \param noiseDbm noise power in dBm
*/
void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
uint16_t channelNumber, uint32_t rate,
bool isShortPreamble, double signalDbm,
double noiseDbm);
bool isShortPreamble, WifiTxVector txvector,
double signalDbm, double noiseDbm);
/**
* TracedCallback signature for monitor mode receive events.
@@ -1035,14 +1036,15 @@ public:
* \param rate the PHY data rate in units of 500kbps (i.e., the same
* units used both for the radiotap and for the prism header)
* \param isShortPreamble true if short preamble is used, false otherwise
* \param txVector the txvector that holds rx parameters
* \param signalDbm signal power in dBm
* \param noiseDbm noise power in dBm
*/
typedef void (* MonitorSnifferRxCallback)
(Ptr<const Packet> packet, uint16_t channelFreqMhz,
uint16_t channelNumber, uint32_t rate,
bool isShortPreamble, double signalDbm,
double noiseDbm);
bool isShortPreamble, WifiTxVector txvector,
double signalDbm, double noiseDbm);
/**
* Public method used to fire a MonitorSniffer trace for a wifi packet
@@ -1055,11 +1057,11 @@ public:
* \param rate the PHY data rate in units of 500kbps (i.e., the same
* units used both for the radiotap and for the prism header)
* \param isShortPreamble true if short preamble is used, false otherwise
* \param txPower the transmission power in dBm
* \param txVector the txvector that holds tx parameters
*/
void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
uint16_t channelNumber, uint32_t rate,
bool isShortPreamble, uint8_t txPower);
bool isShortPreamble, WifiTxVector txvector);
/**
* TracedCallback signature for monitor mode transmit events.
@@ -1071,12 +1073,12 @@ public:
* \param rate the PHY data rate in units of 500kbps (i.e., the same
* units used both for the radiotap and for the prism header)
* \param isShortPreamble true if short preamble is used, false otherwise
* \param txPower the transmission power in dBm
* \param txVector the txvector that holds tx parameters
*/
typedef void (* MonitorSnifferTxCallback)
(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
uint16_t channelNumber, uint32_t rate,
bool isShortPreamble, uint8_t txPower);
bool isShortPreamble, WifiTxVector txvector);
/**
@@ -1214,7 +1216,7 @@ private:
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, double, double> m_phyMonitorSniffRxTrace;
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, double, double> m_phyMonitorSniffRxTrace;
/**
* A trace source that emulates a wifi device in monitor mode
@@ -1226,7 +1228,7 @@ private:
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool,uint8_t> m_phyMonitorSniffTxTrace;
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, WifiTxVector> 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

View File

@@ -748,7 +748,7 @@ YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPr
dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000;
}
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector.GetTxPowerLevel());
NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector);
m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel()), txVector, preamble);
m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble, packetType, txDuration);
}
@@ -1033,7 +1033,7 @@ YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, event->GetTxVector (), signalDbm, noiseDbm);
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
}
else