helper+utils: Small extension of global routing helper and restoring several IP-based metric collectors, including Ipv4RateL3Tracer
diff --git a/utils/tracers/ipv4-app-tracer.cc b/utils/tracers/ipv4-app-tracer.cc
new file mode 100644
index 0000000..57fb612
--- /dev/null
+++ b/utils/tracers/ipv4-app-tracer.cc
@@ -0,0 +1,70 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ipv4-app-tracer.h"
+#include "ns3/node.h"
+#include "ns3/packet.h"
+#include "ns3/config.h"
+#include "ns3/callback.h"
+#include "ns3/names.h"
+
+#include <boost/lexical_cast.hpp>
+
+using namespace std;
+using namespace boost;
+
+namespace ns3 {
+
+Ipv4AppTracer::Ipv4AppTracer (Ptr<Node> node, const std::string &appId)
+ : m_appId (appId)
+ , m_nodePtr (node)
+{
+ m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+
+ Connect ();
+
+ string name = Names::FindName (node);
+ if (!name.empty ())
+ {
+ m_node = name;
+ }
+}
+
+void
+Ipv4AppTracer::Connect ()
+{
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/SendOutgoing",
+ MakeCallback (&Ipv4AppTracer::Tx, this));
+
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/LocalDeliver",
+ MakeCallback (&Ipv4AppTracer::Rx, this));
+
+ // Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/Tx",
+ // MakeCallback (&Ipv4AppTracer::Rx, this));
+
+ // Config::Connect ("/NodeList/"+m_node+"/ApplicationList/"+m_appId+"/$ns3::PacketSink/Rx",
+ // MakeCallback (&Ipv4AppTracer::InData, this));
+
+ // Config::Connect ("/NodeList/"+m_node+"/ApplicationList/"+m_appId+"/$ns3::BulkSendApplication/Tx",
+ // MakeCallback (&Ipv4AppTracer::OutData, this));
+}
+
+
+} // namespace ns3
diff --git a/utils/tracers/ipv4-app-tracer.h b/utils/tracers/ipv4-app-tracer.h
new file mode 100644
index 0000000..f24c6c3
--- /dev/null
+++ b/utils/tracers/ipv4-app-tracer.h
@@ -0,0 +1,74 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef IPV4_APP_TRACER_H
+#define IPV4_APP_TRACER_H
+
+#include "ns3/ptr.h"
+#include "ns3/simple-ref-count.h"
+#include "ns3/ipv4.h"
+
+namespace ns3 {
+
+class Ipv4Header;
+
+class Ipv4AppTracer : public SimpleRefCount<Ipv4AppTracer>
+{
+public:
+ Ipv4AppTracer (Ptr<Node> node, const std::string &appId = "*");
+ virtual ~Ipv4AppTracer () { };
+
+ void
+ Connect ();
+
+ virtual void
+ PrintHeader (std::ostream &os) const = 0;
+
+ virtual void
+ Print (std::ostream &os) const = 0;
+
+ virtual void
+ Rx (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, uint32_t) = 0;
+
+ virtual void
+ Tx (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, uint32_t) = 0;
+
+protected:
+ std::string m_app;
+ std::string m_appId;
+ std::string m_node;
+ Ptr<Node> m_nodePtr;
+};
+
+inline std::ostream&
+operator << (std::ostream &os, const Ipv4AppTracer &tracer)
+{
+ os << "# ";
+ tracer.PrintHeader (os);
+ os << "\n";
+ tracer.Print (os);
+ return os;
+}
+
+} // namespace ns3
+
+#endif // IPV4_APP_TRACER_H
diff --git a/utils/tracers/ipv4-l3-tracer.cc b/utils/tracers/ipv4-l3-tracer.cc
new file mode 100644
index 0000000..8e36d26
--- /dev/null
+++ b/utils/tracers/ipv4-l3-tracer.cc
@@ -0,0 +1,58 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ipv4-l3-tracer.h"
+#include "ns3/node.h"
+#include "ns3/config.h"
+#include "ns3/names.h"
+#include "ns3/callback.h"
+
+#include <boost/lexical_cast.hpp>
+
+using namespace std;
+
+namespace ns3 {
+
+Ipv4L3Tracer::Ipv4L3Tracer (Ptr<Node> node)
+: m_nodePtr (node)
+{
+ m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+
+ Connect ();
+
+ string name = Names::FindName (node);
+ if (!name.empty ())
+ {
+ m_node = name;
+ }
+}
+
+void
+Ipv4L3Tracer::Connect ()
+{
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/Tx",
+ MakeCallback (&Ipv4L3Tracer::Tx, this));
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/Rx",
+ MakeCallback (&Ipv4L3Tracer::Rx, this));
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::Ipv4L3Protocol/Drop",
+ MakeCallback (&Ipv4L3Tracer::Drop, this));
+}
+
+} // namespace ns3
diff --git a/utils/tracers/ipv4-l3-tracer.h b/utils/tracers/ipv4-l3-tracer.h
new file mode 100644
index 0000000..e5f3c74
--- /dev/null
+++ b/utils/tracers/ipv4-l3-tracer.h
@@ -0,0 +1,90 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef IPV4_L3_TRACER_H
+#define IPV4_L3_TRACER_H
+
+#include "ns3/ptr.h"
+#include "ns3/simple-ref-count.h"
+#include "ns3/ipv4-l3-protocol.h"
+
+namespace ns3 {
+
+class Node;
+
+class Ipv4L3Tracer : public SimpleRefCount<Ipv4L3Tracer>
+{
+public:
+ Ipv4L3Tracer (Ptr<Node> node);
+ virtual ~Ipv4L3Tracer () { };
+
+ void
+ Connect ();
+
+ virtual void
+ PrintHeader (std::ostream &os) const = 0;
+
+ virtual void
+ Print (std::ostream &os) const = 0;
+
+ virtual void
+ Rx (std::string context,
+ Ptr<const Packet>, Ptr<Ipv4>, uint32_t) = 0;
+
+ virtual void
+ Tx (std::string context,
+ Ptr<const Packet>, Ptr<Ipv4>, uint32_t) = 0;
+
+ virtual void
+ Drop (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, Ipv4L3Protocol::DropReason, Ptr<Ipv4>, uint32_t) = 0;
+
+protected:
+ std::string m_node;
+ Ptr<Node> m_nodePtr;
+
+ struct Stats
+ {
+ void Reset ()
+ {
+ m_in = 0;
+ m_out = 0;
+ m_drop = 0;
+ }
+
+ uint64_t m_in;
+ uint64_t m_out;
+ uint64_t m_drop;
+ };
+};
+
+inline std::ostream&
+operator << (std::ostream &os, const Ipv4L3Tracer &tracer)
+{
+ os << "# ";
+ tracer.PrintHeader (os);
+ os << "\n";
+ tracer.Print (os);
+ return os;
+}
+
+} // namespace ns3
+
+#endif // IPV4_L3_TRACER_H
diff --git a/utils/tracers/ipv4-rate-l3-tracer.cc b/utils/tracers/ipv4-rate-l3-tracer.cc
new file mode 100644
index 0000000..280301d
--- /dev/null
+++ b/utils/tracers/ipv4-rate-l3-tracer.cc
@@ -0,0 +1,184 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ipv4-rate-l3-tracer.h"
+#include "ns3/node.h"
+#include "ns3/packet.h"
+#include "ns3/config.h"
+#include "ns3/callback.h"
+#include "ns3/simulator.h"
+#include "ns3/node-list.h"
+#include "ns3/node.h"
+#include "ns3/log.h"
+
+#include "ns3/ipv4-header.h"
+
+#include <boost/lexical_cast.hpp>
+
+using namespace boost;
+using namespace std;
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4RateL3Tracer");
+
+namespace ns3 {
+
+boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<Ipv4RateL3Tracer> > >
+Ipv4RateL3Tracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+{
+ std::list<Ptr<Ipv4RateL3Tracer> > tracers;
+ boost::shared_ptr<std::ofstream> outputStream (new std::ofstream ());
+ outputStream->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+
+ if (!outputStream->is_open ())
+ return boost::make_tuple (outputStream, tracers);
+
+ for (NodeList::Iterator node = NodeList::Begin ();
+ node != NodeList::End ();
+ node++)
+ {
+ NS_LOG_DEBUG ("Node: " << lexical_cast<string> ((*node)->GetId ()));
+
+ Ptr<Ipv4RateL3Tracer> trace = Create<Ipv4RateL3Tracer> (outputStream, *node);
+ trace->SetAveragingPeriod (averagingPeriod);
+ tracers.push_back (trace);
+ }
+
+ if (tracers.size () > 0)
+ {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front ()->PrintHeader (*outputStream);
+ *outputStream << "\n";
+ }
+
+ return boost::make_tuple (outputStream, tracers);
+}
+
+
+Ipv4RateL3Tracer::Ipv4RateL3Tracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : Ipv4L3Tracer (node)
+ , m_os (os)
+{
+ SetAveragingPeriod (Seconds (1.0));
+}
+
+Ipv4RateL3Tracer::~Ipv4RateL3Tracer ()
+{
+ m_printEvent.Cancel ();
+}
+
+void
+Ipv4RateL3Tracer::SetAveragingPeriod (const Time &period)
+{
+ m_period = period;
+ m_printEvent.Cancel ();
+ m_printEvent = Simulator::Schedule (m_period, &Ipv4RateL3Tracer::PeriodicPrinter, this);
+}
+
+void
+Ipv4RateL3Tracer::PeriodicPrinter ()
+{
+ Print (*m_os);
+ Reset ();
+
+ m_printEvent = Simulator::Schedule (m_period, &Ipv4RateL3Tracer::PeriodicPrinter, this);
+}
+
+void
+Ipv4RateL3Tracer::PrintHeader (std::ostream &os) const
+{
+ os << "Time" << "\t"
+
+ << "Node" << "\t"
+ << "Interface" << "\t"
+
+ << "Type" << "\t"
+ << "Packets" << "\t"
+ << "Kilobytes";
+}
+
+void
+Ipv4RateL3Tracer::Reset ()
+{
+ for (std::map<uint32_t, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin ();
+ stats != m_stats.end ();
+ stats++)
+ {
+ stats->second.get<0> ().Reset ();
+ stats->second.get<1> ().Reset ();
+ }
+}
+
+const double alpha = 0.8;
+
+#define STATS(INDEX) stats->second.get<INDEX> ()
+#define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble (Time::S)
+
+#define PRINTER(printName, fieldName) \
+STATS(2).fieldName = /*new value*/alpha * RATE(0, fieldName) + /*old value*/(1-alpha) * STATS(2).fieldName; \
+STATS(3).fieldName = /*new value*/alpha * RATE(1, fieldName) / 1024.0 + /*old value*/(1-alpha) * STATS(3).fieldName; \
+ \
+os << time.ToDouble (Time::S) << "\t" \
+ << m_node << "\t" \
+ << stats->first << "\t" \
+ << printName << "\t" \
+ << STATS(2).fieldName << "\t" \
+ << STATS(3).fieldName << "\n";
+
+void
+Ipv4RateL3Tracer::Print (std::ostream &os) const
+{
+ for (std::map<uint32_t, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin ();
+ stats != m_stats.end ();
+ stats++)
+ {
+ Time time = Simulator::Now ();
+
+ PRINTER ("In", m_in);
+ PRINTER ("Out", m_out);
+ PRINTER ("Drop", m_drop);
+ }
+}
+
+void
+Ipv4RateL3Tracer::Rx (std::string context,
+ Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t iface)
+{
+ m_stats[iface].get<0> ().m_in ++;
+ m_stats[iface].get<1> ().m_in += packet->GetSize ();
+}
+
+void
+Ipv4RateL3Tracer::Tx (std::string context,
+ Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t iface)
+{
+ m_stats[iface].get<0> ().m_out ++;
+ m_stats[iface].get<1> ().m_out += packet->GetSize ();
+}
+
+void
+Ipv4RateL3Tracer::Drop (std::string context,
+ const Ipv4Header &header, Ptr<const Packet> packet, Ipv4L3Protocol::DropReason, Ptr<Ipv4> ipv4, uint32_t iface)
+{
+ m_stats[iface].get<0> ().m_drop ++;
+ m_stats[iface].get<1> ().m_drop += packet->GetSize ();
+}
+
+
+} // namespace ns3
diff --git a/utils/tracers/ipv4-rate-l3-tracer.h b/utils/tracers/ipv4-rate-l3-tracer.h
new file mode 100644
index 0000000..e624c3d
--- /dev/null
+++ b/utils/tracers/ipv4-rate-l3-tracer.h
@@ -0,0 +1,100 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef IPV4_RATE_L3_TRACER_H
+#define IPV4_RATE_L3_TRACER_H
+
+#include "ipv4-l3-tracer.h"
+
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/shared_ptr.hpp>
+#include <map>
+
+namespace ns3 {
+
+/**
+ * @ingroup ccnx
+ * @brief CCNx network-layer rate tracer
+ */
+class Ipv4RateL3Tracer : public Ipv4L3Tracer
+{
+public:
+ /**
+ * @brief Network layer tracer constructor
+ */
+ Ipv4RateL3Tracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ virtual ~Ipv4RateL3Tracer ();
+
+ /**
+ * @brief Helper method to install tracers on all simulation nodes
+ *
+ * @param file File to which traces will be written
+ * @param averagingPeriod Defines averaging period for the rate calculation,
+ * as well as how often data will be written into the trace file (default, every half second)
+ *
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * for the lifetime of simulation, otherwise SEGFAULTs are inevitable
+ *
+ */
+ static boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<Ipv4RateL3Tracer> > >
+ InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+
+ void
+ SetAveragingPeriod (const Time &period);
+
+ virtual void
+ PrintHeader (std::ostream &os) const;
+
+ virtual void
+ Print (std::ostream &os) const;
+
+ virtual void
+ Rx (std::string context,
+ Ptr<const Packet>, Ptr<Ipv4>, uint32_t);
+
+ virtual void
+ Tx (std::string context,
+ Ptr<const Packet>, Ptr<Ipv4>, uint32_t);
+
+ virtual void
+ Drop (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, Ipv4L3Protocol::DropReason, Ptr<Ipv4>, uint32_t);
+
+private:
+ void
+ PeriodicPrinter ();
+
+ void
+ Reset ();
+
+private:
+ boost::shared_ptr<std::ostream> m_os;
+ Time m_period;
+ EventId m_printEvent;
+
+ mutable std::map<uint32_t, boost::tuple<Stats, Stats, Stats, Stats> > m_stats;
+};
+
+} // namespace ns3
+
+#endif // IPV4_RATE_L3_TRACER_H
diff --git a/utils/tracers/ipv4-seqs-app-tracer.cc b/utils/tracers/ipv4-seqs-app-tracer.cc
new file mode 100644
index 0000000..3147ed0
--- /dev/null
+++ b/utils/tracers/ipv4-seqs-app-tracer.cc
@@ -0,0 +1,110 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ipv4-seqs-app-tracer.h"
+#include "ns3/node.h"
+#include "ns3/packet.h"
+#include "ns3/config.h"
+#include "ns3/callback.h"
+#include "ns3/simulator.h"
+
+#include "ns3/tcp-l4-protocol.h"
+#include "ns3/tcp-header.h"
+#include "ns3/ipv4-header.h"
+
+namespace ns3 {
+
+Ipv4SeqsAppTracer::Ipv4SeqsAppTracer (std::ostream &os, Ptr<Node> node, const std::string &appId)
+ : Ipv4AppTracer (node, appId)
+ , m_os (os)
+{
+}
+
+void
+Ipv4SeqsAppTracer::Reset ()
+{
+}
+
+void
+Ipv4SeqsAppTracer::PrintHeader (std::ostream &os) const
+{
+ os << "Time\t"
+ << "Node\t"
+ << "AppName\t"
+ << "AppId\t"
+ << "Type\t"
+ << "SeqNo";
+}
+
+void
+Ipv4SeqsAppTracer::Print (std::ostream &os) const
+{
+}
+
+#define PRINTER(type,size) \
+ m_os \
+ << Simulator::Now ().ToDouble (Time::S) << "\t" \
+ << m_node << "\t" \
+ << m_app << "\t" \
+ << m_appId << "\t" \
+ << type << "\t" \
+ << size / 1040.0 << std::endl;
+
+void
+Ipv4SeqsAppTracer::Tx (std::string context,
+ const Ipv4Header &ip, Ptr<const Packet>, uint32_t)
+{
+ if (ip.GetProtocol () != TcpL4Protocol::PROT_NUMBER) return;
+}
+
+void
+Ipv4SeqsAppTracer::Rx (std::string context,
+ const Ipv4Header &ip, Ptr<const Packet> pktOrig, uint32_t)
+{
+ if (ip.GetProtocol () != TcpL4Protocol::PROT_NUMBER) return;
+
+ TcpHeader tcp;
+ Ptr<Packet> packet = pktOrig->Copy ();
+ packet->RemoveHeader (tcp);
+
+ if (tcp.GetFlags () | TcpHeader::ACK)
+ {
+ PRINTER("InAck", tcp.GetAckNumber ().GetValue ());
+ }
+}
+
+
+// void
+// Ipv4SeqsAppTracer::InData (std::string context,
+// Ptr<const Packet> packet, const Address &address)
+// {
+// PRINTER ("InData", m_inSeq);
+// m_inSeq += packet->GetSize ();
+// }
+
+// void
+// Ipv4SeqsAppTracer::OutData (std::string context,
+// Ptr<const Packet> packet)
+// {
+// PRINTER ("OutData", m_outSeq);
+// m_outSeq += packet->GetSize ();
+// }
+
+} // namespace ns3
diff --git a/utils/tracers/ipv4-seqs-app-tracer.h b/utils/tracers/ipv4-seqs-app-tracer.h
new file mode 100644
index 0000000..9ae24ac
--- /dev/null
+++ b/utils/tracers/ipv4-seqs-app-tracer.h
@@ -0,0 +1,58 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef IPV4_SEQS_APP_TRACER_H
+#define IPV4_SEQS_APP_TRACER_H
+
+#include "ipv4-app-tracer.h"
+
+namespace ns3 {
+
+class Ipv4SeqsAppTracer : public Ipv4AppTracer
+{
+public:
+ Ipv4SeqsAppTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*");
+ virtual ~Ipv4SeqsAppTracer () { };
+
+ virtual void
+ PrintHeader (std::ostream &os) const;
+
+ virtual void
+ Print (std::ostream &os) const;
+
+ virtual void
+ Rx (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, uint32_t);
+
+ virtual void
+ Tx (std::string context,
+ const Ipv4Header &, Ptr<const Packet>, uint32_t);
+
+protected:
+ void
+ Reset ();
+
+protected:
+ std::ostream& m_os;
+};
+
+} // namespace ns3
+
+#endif // IPV4_AGGREGATE_APP_TRACER_H