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)); Simulator::Stop (Seconds (10.0));
if (tracing == true) if (tracing)
{ {
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
pointToPoint.EnablePcapAll ("third"); pointToPoint.EnablePcapAll ("third");
phy.EnablePcap ("third", apDevices.Get (0)); phy.EnablePcap ("third", apDevices.Get (0));
csma.EnablePcap ("third", csmaDevices.Get (0), true); 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)) ns.core.Simulator.Stop(ns.core.Seconds(10.0))
if tracing == "True": if tracing == "True":
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
pointToPoint.EnablePcapAll ("third") pointToPoint.EnablePcapAll ("third")
phy.EnablePcap ("third", apDevices.Get (0)) phy.EnablePcap ("third", apDevices.Get (0))
csma.EnablePcap ("third", csmaDevices.Get (0), True) csma.EnablePcap ("third", csmaDevices.Get (0), True)

View File

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

View File

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

View File

@@ -74,6 +74,7 @@ int main (int argc, char * argv[])
YansWifiChannelHelper channel = YansWifiChannelHelper::Default (); YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy; YansWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ()); phy.SetChannel (channel.Create ());
WifiHelper wifi; 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); // athstats.EnableAthstats(enableCtsRts ? "rtscts-athstats-node" : "basic-athstats-node" , nodes);
// uncomment the following to have pcap output // uncomment the following to have pcap output
// wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
// wifiPhy.EnablePcap (enableCtsRts ? "rtscts-pcap-node" : "basic-pcap-node" , nodes); // wifiPhy.EnablePcap (enableCtsRts ? "rtscts-pcap-node" : "basic-pcap-node" , nodes);

View File

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

View File

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

View File

@@ -130,9 +130,6 @@ int main (int argc, char *argv[])
wifi.SetStandard (WIFI_STANDARD_80211b); wifi.SetStandard (WIFI_STANDARD_80211b);
YansWifiPhyHelper wifiPhy; 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 ("TxPowerStart", DoubleValue (txPowerStart));
wifiPhy.Set ("TxPowerEnd", DoubleValue (txPowerEnd)); wifiPhy.Set ("TxPowerEnd", DoubleValue (txPowerEnd));
wifiPhy.Set ("TxPowerLevels", UintegerValue (nTxPowerLevels)); wifiPhy.Set ("TxPowerLevels", UintegerValue (nTxPowerLevels));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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