View | Details | Raw Unified | Return to bug 683
Collapse All | Expand All

(-)a/src/helper/csma-helper.cc (-4 / +16 lines)
 Lines 66-72    Link Here 
66
}
66
}
67
67
68
void 
68
void 
69
CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
69
CsmaHelper::EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
70
{
70
{
71
  std::ostringstream oss;
71
  std::ostringstream oss;
72
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/";
72
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/";
 Lines 75-84    Link Here 
75
    {
75
    {
76
      return;
76
      return;
77
    }
77
    }
78
  oss.str ("");
79
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
80
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
78
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
81
  pcap->Open (oss.str ());
79
  pcap->Open (filename);
82
  pcap->WriteEthernetHeader ();
80
  pcap->WriteEthernetHeader ();
83
  oss.str ("");
81
  oss.str ("");
84
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
82
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
 Lines 94-99    Link Here 
94
}
92
}
95
93
96
void 
94
void 
95
CsmaHelper::EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
96
{
97
  EnablePcapExplicit (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
98
}
99
100
void
101
CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
102
{
103
  std::ostringstream oss;
104
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
105
  EnablePcapExplicit(oss.str (), nodeid, deviceid, promiscuous);
106
}
107
108
void 
97
CsmaHelper::EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous)
109
CsmaHelper::EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous)
98
{
110
{
99
  for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
111
  for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
(-)a/src/helper/csma-helper.h (+23 lines)
 Lines 81-86    Link Here 
81
  void SetChannelAttribute (std::string n1, const AttributeValue &v1);
81
  void SetChannelAttribute (std::string n1, const AttributeValue &v1);
82
82
83
  /**
83
  /**
84
   * \param filename filename to use for the pcap file (explicit).
85
   * \param nodeid the id of the node to generate pcap output for.
86
   * \param deviceid the id of the device to generate pcap output for.
87
   * \param promiscuous If true capture all possible packets available at the device.
88
   *
89
   * Generate a pcap file which contains the link-level data observed
90
   * by the specified deviceid within the specified nodeid.
91
   *
92
   * This method should be invoked after the network topology has 
93
   * been fully constructed.
94
   */
95
  static void EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous);
96
97
  /**
98
   * \param filename filename to use for the pcap file (explicit).
99
   * \param nd Net device in which you want to enable tracing.
100
   * \param promiscuous If true capture all possible packets available at the device.
101
   *
102
   * Enable pcap output the indicated net device.
103
   */
104
  static void EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd, bool promiscuous);
105
106
  /**
84
   * \param filename filename prefix to use for pcap files.
107
   * \param filename filename prefix to use for pcap files.
85
   * \param nodeid the id of the node to generate pcap output for.
108
   * \param nodeid the id of the node to generate pcap output for.
86
   * \param deviceid the id of the device to generate pcap output for.
109
   * \param deviceid the id of the device to generate pcap output for.
(-)a/src/helper/emu-helper.cc (-4 / +19 lines)
 Lines 66-81    Link Here 
66
}
66
}
67
67
68
void 
68
void 
69
EmuHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
69
EmuHelper::EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
70
{
70
{
71
  NS_LOG_FUNCTION (filename << nodeid << deviceid << promiscuous);
71
  NS_LOG_FUNCTION (filename << nodeid << deviceid << promiscuous);
72
  std::ostringstream oss;
72
  std::ostringstream oss;
73
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
74
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
73
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
75
  pcap->Open (oss.str ());
74
  pcap->Open (filename);
76
  pcap->WriteEthernetHeader ();
75
  pcap->WriteEthernetHeader ();
77
76
78
  oss.str ("");
79
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
77
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
80
  if (promiscuous)
78
  if (promiscuous)
81
    {
79
    {
 Lines 89-94    Link Here 
89
}
87
}
90
88
91
void 
89
void 
90
EmuHelper::EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
91
{
92
  NS_LOG_FUNCTION (filename << &nd << promiscuous);
93
  EnablePcapExplicit (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
94
}
95
96
void 
97
EmuHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
98
{
99
  NS_LOG_FUNCTION (filename << nodeid << deviceid << promiscuous);
100
  std::ostringstream oss;
101
  oss.str ("");
102
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
103
  EnablePcapExplicit(oss.str (), nodeid, deviceid, promiscuous);
104
}
105
106
void 
92
EmuHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
107
EmuHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
93
{
108
{
94
  NS_LOG_FUNCTION (filename << &nd << promiscuous);
109
  NS_LOG_FUNCTION (filename << &nd << promiscuous);
(-)a/src/helper/emu-helper.h (+23 lines)
 Lines 71-76    Link Here 
71
  void SetAttribute (std::string n1, const AttributeValue &v1);
71
  void SetAttribute (std::string n1, const AttributeValue &v1);
72
72
73
  /**
73
  /**
74
   * \param filename filename to use for the pcap file (explicit).
75
   * \param nodeid the id of the node to generate pcap output for.
76
   * \param deviceid the id of the device to generate pcap output for.
77
   * \param promiscuous If true capture all possible packets available at the device.
78
   *
79
   * Generate a pcap file which contains the link-level data observed
80
   * by the specified deviceid within the specified nodeid.
81
   *
82
   * This method should be invoked after the network topology has 
83
   * been fully constructed.
84
   */
85
  static void EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous);
86
87
  /**
88
   * \param filename filename to use for the pcap file (explicit).
89
   * \param nd Net device in which you want to enable tracing.
90
   * \param promiscuous If true capture all possible packets available at the device.
91
   *
92
   * Enable pcap output the indicated net device.
93
   */
94
  static void EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd, bool promiscuous);
95
96
  /**
74
   * \param filename filename prefix to use for pcap files.
97
   * \param filename filename prefix to use for pcap files.
75
   * \param nodeid the id of the node to generate pcap output for.
98
   * \param nodeid the id of the node to generate pcap output for.
76
   * \param deviceid the id of the device to generate pcap output for.
99
   * \param deviceid the id of the device to generate pcap output for.
(-)a/src/helper/point-to-point-helper.cc (-4 / +16 lines)
 Lines 65-71    Link Here 
65
}
65
}
66
66
67
void 
67
void 
68
PointToPointHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
68
PointToPointHelper::EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid)
69
{
69
{
70
  std::ostringstream oss;
70
  std::ostringstream oss;
71
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/";
71
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/";
 Lines 74-83    Link Here 
74
    {
74
    {
75
      return;
75
      return;
76
    }
76
    }
77
  oss.str ("");
78
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
79
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
77
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
80
  pcap->Open (oss.str ());
78
  pcap->Open (filename);
81
  pcap->WritePppHeader ();
79
  pcap->WritePppHeader ();
82
  oss.str ("");
80
  oss.str ("");
83
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
81
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
 Lines 86-91    Link Here 
86
}
84
}
87
85
88
void 
86
void 
87
PointToPointHelper::EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd)
88
{
89
  EnablePcapExplicit (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
90
}
91
92
void 
93
PointToPointHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
94
{
95
  std::ostringstream oss;
96
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
97
  EnablePcapExplicit (oss.str (), nodeid, deviceid);
98
}
99
100
void 
89
PointToPointHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
101
PointToPointHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
90
{
102
{
91
  EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
103
  EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
(-)a/src/helper/point-to-point-helper.h (+22 lines)
 Lines 81-86    Link Here 
81
  void SetChannelAttribute (std::string name, const AttributeValue &value);
81
  void SetChannelAttribute (std::string name, const AttributeValue &value);
82
82
83
  /**
83
  /**
84
   * \param filename filename to use for the pcap file (explicit).
85
   * \param nodeid the id of the node to generate pcap output for.
86
   * \param deviceid the id of the device to generate pcap output for.
87
   *
88
   * Generate a pcap file which contains the link-level data observed
89
   * by the specified deviceid within the specified nodeid.
90
   *
91
   * This method should be invoked after the network topology has 
92
   * been fully constructed.
93
   */
94
  static void EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid);
95
96
  /**
97
   * \param filename filename to use for the pcap file (explicit).
98
   * \param nd Net device on which you want to enable tracing.
99
   *
100
   * Enable pcap output on each input device which is of the
101
   * ns3::PointToPointNetDevice type.
102
   */
103
  static void EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd);
104
105
  /**
84
   * \param filename filename prefix to use for pcap files.
106
   * \param filename filename prefix to use for pcap files.
85
   * \param nodeid the id of the node to generate pcap output for.
107
   * \param nodeid the id of the node to generate pcap output for.
86
   * \param deviceid the id of the device to generate pcap output for.
108
   * \param deviceid the id of the device to generate pcap output for.
(-)a/src/helper/yans-wifi-helper.cc (-4 / +16 lines)
 Lines 224-230    Link Here 
224
224
225
225
226
void 
226
void 
227
YansWifiPhyHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
227
YansWifiPhyHelper::EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid)
228
{
228
{
229
  std::ostringstream oss;
229
  std::ostringstream oss;
230
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/";
230
  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/";
 Lines 233-242    Link Here 
233
    {
233
    {
234
      return;
234
      return;
235
    }
235
    }
236
  oss.str ("");
237
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
238
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
236
  Ptr<PcapWriter> pcap = CreateObject<PcapWriter> ();
239
  pcap->Open (oss.str ());
237
  pcap->Open (filename);
240
238
241
  switch (m_pcapFormat) {
239
  switch (m_pcapFormat) {
242
  case PCAP_FORMAT_80211:
240
  case PCAP_FORMAT_80211:
 Lines 262-267    Link Here 
262
}
260
}
263
261
264
void 
262
void 
263
YansWifiPhyHelper::EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd)
264
{
265
  EnablePcapExplicit (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
266
}
267
268
void 
269
YansWifiPhyHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
270
{
271
  std::ostringstream oss;
272
  oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
273
  EnablePcapExplicit (oss.str (), nodeid, deviceid);
274
}
275
276
void 
265
YansWifiPhyHelper::EnablePcap (std::string filename, NetDeviceContainer d)
277
YansWifiPhyHelper::EnablePcap (std::string filename, NetDeviceContainer d)
266
{
278
{
267
  for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
279
  for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
(-)a/src/helper/yans-wifi-helper.h (+25 lines)
 Lines 222-227    Link Here 
222
  void SetPcapFormat (enum PcapFormat format);
222
  void SetPcapFormat (enum PcapFormat format);
223
223
224
  /**
224
  /**
225
   * \param filename filename to use for the pcap file (explicit).
226
   * \param nodeid the id of the node to generate pcap output for.
227
   * \param deviceid the id of the device to generate pcap output for.
228
   *
229
   * Generate a pcap file which contains the link-level data observed
230
   * by the specified deviceid within the specified nodeid. By
231
   * default, no PHY layer information is provided. An optional header
232
   * with PHY layer information, such as the radiotap or the prism
233
   * header, can be used by invoking SetPcapFormat().
234
   *
235
   * This method should be invoked after the network topology has 
236
   * been fully constructed.
237
   */
238
  void EnablePcapExplicit (std::string filename, uint32_t nodeid, uint32_t deviceid);
239
240
  /**
241
   * \param filename filename to use for the pcap file (explicit).
242
   * \param nd Net device on which you want to enable tracing.
243
   *
244
   * Enable pcap output on each input device which is of the
245
   * ns3::WifiNetDevice type.
246
   */
247
   void EnablePcapExplicit (std::string filename, Ptr<NetDevice> nd);
248
249
  /**
225
   * \param filename filename prefix to use for pcap files.
250
   * \param filename filename prefix to use for pcap files.
226
   * \param nodeid the id of the node to generate pcap output for.
251
   * \param nodeid the id of the node to generate pcap output for.
227
   * \param deviceid the id of the device to generate pcap output for.
252
   * \param deviceid the id of the device to generate pcap output for.

Return to bug 683