examples: Set wifi data link type when PCAP file is generated

This commit is contained in:
Sébastien Deronne
2021-04-17 12:16:02 +02:00
parent db97b88195
commit e353bafa48
16 changed files with 12 additions and 8 deletions

View File

@@ -173,8 +173,9 @@ main (int argc, char *argv[])
Simulator::Stop (Seconds (10.0));
if (tracing == true)
if (tracing)
{
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
pointToPoint.EnablePcapAll ("third");
phy.EnablePcap ("third", apDevices.Get (0));
csma.EnablePcap ("third", csmaDevices.Get (0), true);

View File

@@ -152,6 +152,7 @@ ns.internet.Ipv4GlobalRoutingHelper.PopulateRoutingTables()
ns.core.Simulator.Stop(ns.core.Seconds(10.0))
if tracing == "True":
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
pointToPoint.EnablePcapAll ("third")
phy.EnablePcap ("third", apDevices.Get (0))
csma.EnablePcap ("third", csmaDevices.Get (0), True)

View File

@@ -156,6 +156,7 @@ main (int argc, char *argv[])
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("OfdmRate54Mbps"));
YansWifiPhyHelper wifiPhy;
wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone);

View File

@@ -136,6 +136,7 @@ def main(argv):
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
"DataMode", ns.core.StringValue("OfdmRate54Mbps"))
wifiPhy = ns.wifi.YansWifiPhyHelper()
wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
wifiChannel = ns.wifi.YansWifiChannelHelper.Default()
wifiPhy.SetChannel(wifiChannel.Create())
backboneDevices = wifi.Install(wifiPhy, mac, backbone)

View File

@@ -74,6 +74,7 @@ int main (int argc, char * argv[])
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ());
WifiHelper wifi;

View File

@@ -90,6 +90,7 @@ void experiment (bool enableCtsRts, std::string wifiManager)
// athstats.EnableAthstats(enableCtsRts ? "rtscts-athstats-node" : "basic-athstats-node" , nodes);
// uncomment the following to have pcap output
// wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
// wifiPhy.EnablePcap (enableCtsRts ? "rtscts-pcap-node" : "basic-pcap-node" , nodes);

View File

@@ -140,7 +140,6 @@ Experiment::Run (Parameters params)
channel.AddPropagationLoss ("ns3::RangePropagationLossModel");
YansWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ());
WifiHelper wifi;

View File

@@ -521,6 +521,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
if (enablePcap)
{
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.EnablePcapAll (GetOutputFileName ());
}

View File

@@ -130,9 +130,6 @@ int main (int argc, char *argv[])
wifi.SetStandard (WIFI_STANDARD_80211b);
YansWifiPhyHelper wifiPhy;
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
wifiPhy.Set ("TxPowerStart", DoubleValue (txPowerStart));
wifiPhy.Set ("TxPowerEnd", DoubleValue (txPowerEnd));
wifiPhy.Set ("TxPowerLevels", UintegerValue (nTxPowerLevels));

View File

@@ -492,6 +492,7 @@ int main (int argc, char *argv[])
if (enablePcap)
{
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
std::stringstream ss;
ss << "wifi-spectrum-per-example-" << i;
phy.EnablePcap (ss.str (), apDevice);

View File

@@ -557,6 +557,7 @@ int main (int argc, char *argv[])
if (enablePcap)
{
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
std::stringstream ss;
ss << "wifi-spectrum-per-example-" << i;
phy.EnablePcap (ss.str (), apDevice);

View File

@@ -648,6 +648,7 @@ int main (int argc, char *argv[])
if (enablePcap)
{
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
std::stringstream ss;
ss << "wifi-spectrum-saturation-example-" << i;
phy.EnablePcap (ss.str (), apDevice);

View File

@@ -125,7 +125,6 @@ Issue211Test::DoRun (void)
spectrumChannel->SetPropagationDelayModel (delayModel);
SpectrumWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (spectrumChannel);
WifiHelper wifi;

View File

@@ -150,6 +150,7 @@ WifiMsduAggregatorThroughputTest::DoRun (void)
// Enable tracing at the AP
if (m_writeResults)
{
wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
wifiPhy.EnablePcap ("wifi-amsdu-throughput", sta.Get (0)->GetId (), 0);
}

View File

@@ -353,7 +353,6 @@ WifiPrimaryChannelsTest::DoSetup (void)
spectrumChannel->SetPropagationDelayModel (delayModel);
SpectrumWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (spectrumChannel);
phy.Set ("Frequency", UintegerValue (frequency)); // same frequency for all BSSes

View File

@@ -164,7 +164,6 @@ WifiTxopTest::DoRun (void)
spectrumChannel->SetPropagationDelayModel (delayModel);
SpectrumWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (spectrumChannel);
Config::SetDefault ("ns3::QosFrameExchangeManager::PifsRecovery", BooleanValue (m_pifsRecovery));