--- a/src/applications/onoff/onoff-application.cc Tue Dec 11 13:51:03 2007 +0100
+++ b/src/applications/onoff/onoff-application.cc Tue Dec 11 13:51:18 2007 +0100
@@ -33,6 +33,7 @@
#include "ns3/socket-factory.h"
#include "ns3/default-value.h"
#include "ns3/packet.h"
+#include "ns3/composite-trace-resolver.h"
#include "onoff-application.h"
NS_LOG_COMPONENT_DEFINE ("OnOffApplication");
@@ -241,6 +242,7 @@
NS_ASSERT (m_sendEvent.IsExpired ());
Ptr<Packet> packet = Create<Packet> (m_pktSize);
+ m_txTrace (packet);
m_socket->Send (packet);
m_totBytes += m_pktSize;
m_lastStartTime = Simulator::Now();
@@ -262,4 +264,17 @@
cout << "OnOffApplication, Connection Failed" << endl;
}
+Ptr<TraceResolver>
+OnOffApplication::GetTraceResolver (void) const
+{
+ Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
+ resolver->AddSource ("tx",
+ TraceDoc ("A new packet is created is sent",
+ "Ptr<const Packet>",
+ "The newly-created packet."),
+ m_txTrace);
+ resolver->SetParentResolver (Application::GetTraceResolver ());
+ return resolver;
+}
+
} // Namespace ns3
--- a/src/applications/onoff/onoff-application.h Tue Dec 11 13:51:03 2007 +0100
+++ b/src/applications/onoff/onoff-application.h Tue Dec 11 13:51:18 2007 +0100
@@ -29,6 +29,7 @@
#include "ns3/event-id.h"
#include "ns3/ptr.h"
#include "ns3/data-rate.h"
+#include "ns3/callback-trace-source.h"
namespace ns3 {
@@ -135,8 +136,10 @@
EventId m_sendEvent; // Eventid of pending "send packet" event
bool m_sending; // True if currently in sending state
std::string m_iid;
+ CallbackTraceSource<Ptr<const Packet> > m_txTrace;
private:
+ virtual Ptr<TraceResolver> GetTraceResolver (void) const;
void ScheduleNextTx();
void ScheduleStartEvent();
void ScheduleStopEvent();