diff --git a/src/helper/csma-helper.cc b/src/helper/csma-helper.cc index 78a1645fc..3b3164658 100644 --- a/src/helper/csma-helper.cc +++ b/src/helper/csma-helper.cc @@ -78,6 +78,13 @@ void CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid) { std::ostringstream oss; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/"; + Config::MatchContainer matches = Config::LookupMatches (oss.str ()); + if (matches.GetN () == 0) + { + return; + } + oss.str (""); oss << filename << "-" << nodeid << "-" << deviceid << ".pcap"; Ptr pcap = Create (); pcap->Open (oss.str ()); diff --git a/src/helper/point-to-point-helper.cc b/src/helper/point-to-point-helper.cc index ff99b6499..52a539ee0 100644 --- a/src/helper/point-to-point-helper.cc +++ b/src/helper/point-to-point-helper.cc @@ -78,6 +78,13 @@ void PointToPointHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid) { std::ostringstream oss; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/"; + Config::MatchContainer matches = Config::LookupMatches (oss.str ()); + if (matches.GetN () == 0) + { + return; + } + oss.str (""); oss << filename << "-" << nodeid << "-" << deviceid << ".pcap"; Ptr pcap = Create (); pcap->Open (oss.str ()); diff --git a/src/helper/wifi-helper.cc b/src/helper/wifi-helper.cc index 8e8e958ef..ce5f07701 100644 --- a/src/helper/wifi-helper.cc +++ b/src/helper/wifi-helper.cc @@ -149,6 +149,13 @@ void WifiHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid) { std::ostringstream oss; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/"; + Config::MatchContainer matches = Config::LookupMatches (oss.str ()); + if (matches.GetN () == 0) + { + return; + } + oss.str (""); oss << filename << "-" << nodeid << "-" << deviceid << ".pcap"; Ptr pcap = Create (); pcap->Open (oss.str ());