--- a/src/helper/csma-helper.h Mon Mar 31 09:34:51 2008 -0700
+++ b/src/helper/csma-helper.h Mon Mar 31 09:49:22 2008 -0700
@@ -60,14 +60,81 @@
*/
void SetChannelParameter (std::string n1, Attribute v1);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nodeid the id of the node to generate pcap output for.
+ * \param deviceid the id of the device to generate pcap output for.
+ *
+ * Generate a pcap file which contains the link-level data observed
+ * by the specified deviceid within the specified nodeid. The pcap
+ * data is stored in the file prefix-nodeid-deviceid.
+ *
+ * This method should be invoked after the network topology has
+ * been fully constructed.
+ */
static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param d container of devices of type ns3::CsmaNetDevice
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::CsmaNetDevice type.
+ */
static void EnablePcap (std::string filename, NetDeviceContainer d);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param n container of nodes.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::CsmaNetDevice type and which is located in one of the
+ * input nodes.
+ */
static void EnablePcap (std::string filename, NodeContainer n);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::CsmaNetDevice type
+ */
static void EnablePcap (std::string filename);
+ /**
+ * \param os output stream
+ * \param nodeid the id of the node to generate ascii output for.
+ * \param deviceid the id of the device to generate ascii output for.
+ *
+ * Enable ascii output on the specified deviceid within the
+ * specified nodeid if it is of type ns3::CsmaNetDevice and dump
+ * that to the specified stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param os output stream
+ * \param d device container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::CsmaNetDevice type and which is located in the input
+ * device container and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+ /**
+ * \param os output stream
+ * \param n node container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::CsmaNetDevice type and which is located in one
+ * of the input node and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, NodeContainer n);
+ /**
+ * \param os output stream
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::CsmaNetDevice type and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os);
/**
--- a/src/helper/point-to-point-helper.h Mon Mar 31 09:34:51 2008 -0700
+++ b/src/helper/point-to-point-helper.h Mon Mar 31 09:49:22 2008 -0700
@@ -59,14 +59,81 @@
*/
void SetChannelParameter (std::string name, Attribute value);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nodeid the id of the node to generate pcap output for.
+ * \param deviceid the id of the device to generate pcap output for.
+ *
+ * Generate a pcap file which contains the link-level data observed
+ * by the specified deviceid within the specified nodeid. The pcap
+ * data is stored in the file prefix-nodeid-deviceid.
+ *
+ * This method should be invoked after the network topology has
+ * been fully constructed.
+ */
static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param d container of devices of type ns3::PointToPointNetDevice
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::PointToPointNetDevice type.
+ */
static void EnablePcap (std::string filename, NetDeviceContainer d);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param n container of nodes.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::PointToPointNetDevice type and which is located in one of the
+ * input nodes.
+ */
static void EnablePcap (std::string filename, NodeContainer n);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::PointToPointNetDevice type
+ */
static void EnablePcap (std::string filename);
+ /**
+ * \param os output stream
+ * \param nodeid the id of the node to generate ascii output for.
+ * \param deviceid the id of the device to generate ascii output for.
+ *
+ * Enable ascii output on the specified deviceid within the
+ * specified nodeid if it is of type ns3::PointToPointNetDevice and dump
+ * that to the specified stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param os output stream
+ * \param d device container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::PointToPointNetDevice type and which is located in the input
+ * device container and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+ /**
+ * \param os output stream
+ * \param n node container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::PointToPointNetDevice type and which is located in one
+ * of the input node and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, NodeContainer n);
+ /**
+ * \param os output stream
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::PointToPointNetDevice type and dump that to the specified
+ * stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os);
/**
--- a/src/helper/wifi-helper.cc Mon Mar 31 09:34:51 2008 -0700
+++ b/src/helper/wifi-helper.cc Mon Mar 31 09:49:22 2008 -0700
@@ -139,6 +139,35 @@
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/RxOk";
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapPhyRxEvent, pcap));
}
+void
+WifiHelper::EnablePcap (std::string filename, NetDeviceContainer d)
+{
+ for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
+ {
+ Ptr<NetDevice> dev = *i;
+ EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
+ }
+}
+void
+WifiHelper::EnablePcap (std::string filename, NodeContainer n)
+{
+ NetDeviceContainer devs;
+ for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+ {
+ Ptr<Node> node = *i;
+ for (uint32_t j = 0; j < node->GetNDevices (); ++j)
+ {
+ devs.Add (node->GetDevice (j));
+ }
+ }
+ EnablePcap (filename, devs);
+}
+
+void
+WifiHelper::EnablePcap (std::string filename)
+{
+ EnablePcap (filename, NodeContainer::GetGlobal ());
+}
void
WifiHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid)
@@ -151,6 +180,35 @@
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/Tx";
Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTxEvent, &os));
}
+void
+WifiHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
+{
+ for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
+ {
+ Ptr<NetDevice> dev = *i;
+ EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
+ }
+}
+void
+WifiHelper::EnableAscii (std::ostream &os, NodeContainer n)
+{
+ NetDeviceContainer devs;
+ for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+ {
+ Ptr<Node> node = *i;
+ for (uint32_t j = 0; j < node->GetNDevices (); ++j)
+ {
+ devs.Add (node->GetDevice (j));
+ }
+ }
+ EnableAscii (os, devs);
+}
+
+void
+WifiHelper::EnableAscii (std::ostream &os)
+{
+ EnableAscii (os, NodeContainer::GetGlobal ());
+}
NetDeviceContainer
WifiHelper::Build (NodeContainer c) const
--- a/src/helper/wifi-helper.h Mon Mar 31 09:34:51 2008 -0700
+++ b/src/helper/wifi-helper.h Mon Mar 31 09:49:22 2008 -0700
@@ -120,8 +120,83 @@
std::string n7 = "", Attribute v7 = Attribute ());
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nodeid the id of the node to generate pcap output for.
+ * \param deviceid the id of the device to generate pcap output for.
+ *
+ * Generate a pcap file which contains the link-level data observed
+ * by the specified deviceid within the specified nodeid. The pcap
+ * data is stored in the file prefix-nodeid-deviceid.
+ *
+ * This method should be invoked after the network topology has
+ * been fully constructed.
+ */
static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param d container of devices of type ns3::WifiNetDevice
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::WifiNetDevice type.
+ */
+ static void EnablePcap (std::string filename, NetDeviceContainer d);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param n container of nodes.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::WifiNetDevice type and which is located in one of the
+ * input nodes.
+ */
+ static void EnablePcap (std::string filename, NodeContainer n);
+ /**
+ * \param filename filename prefix to use for pcap files.
+ *
+ * Enable pcap output on each device which is of the
+ * ns3::WifiNetDevice type
+ */
+ static void EnablePcap (std::string filename);
+
+ /**
+ * \param os output stream
+ * \param nodeid the id of the node to generate ascii output for.
+ * \param deviceid the id of the device to generate ascii output for.
+ *
+ * Enable ascii output on the specified deviceid within the
+ * specified nodeid if it is of type ns3::WifiNetDevice and dump
+ * that to the specified stdc++ output stream.
+ */
static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
+ /**
+ * \param os output stream
+ * \param d device container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and which is located in the input
+ * device container and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+ /**
+ * \param os output stream
+ * \param n node container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and which is located in one
+ * of the input node and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAscii (std::ostream &os, NodeContainer n);
+ /**
+ * \param os output stream
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAscii (std::ostream &os);
/**
* \param c a set of nodes