From 5b02c55613c2d0198620172a742945815e754fe7 Mon Sep 17 00:00:00 2001 From: Josh Pelkey Date: Tue, 29 Sep 2009 09:58:00 -0400 Subject: [PATCH] Bug 680, moving trace source over to channel --- src/contrib/net-anim/animation-interface.cc | 2 +- .../point-to-point/point-to-point-channel.cc | 6 +++++- .../point-to-point/point-to-point-channel.h | 17 +++++++++++++++++ .../point-to-point-net-device.cc | 3 --- .../point-to-point/point-to-point-net-device.h | 18 ------------------ 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/contrib/net-anim/animation-interface.cc b/src/contrib/net-anim/animation-interface.cc index 3b80ce8e5..047083689 100644 --- a/src/contrib/net-anim/animation-interface.cc +++ b/src/contrib/net-anim/animation-interface.cc @@ -141,7 +141,7 @@ void AnimationInterface::StartAnimation () } // Connect the callback for packet tx events - Config::Connect ("/NodeList/*/DeviceList/*/TxRxPointToPoint", + Config::Connect ("/ChannelList/*/TxRxPointToPoint", MakeCallback (&AnimationInterface::DevTxTrace, this)); } diff --git a/src/devices/point-to-point/point-to-point-channel.cc b/src/devices/point-to-point/point-to-point-channel.cc index d95114428..eb6865e14 100644 --- a/src/devices/point-to-point/point-to-point-channel.cc +++ b/src/devices/point-to-point/point-to-point-channel.cc @@ -18,6 +18,7 @@ #include "point-to-point-channel.h" #include "point-to-point-net-device.h" +#include "ns3/trace-source-accessor.h" #include "ns3/packet.h" #include "ns3/simulator.h" #include "ns3/log.h" @@ -38,6 +39,9 @@ PointToPointChannel::GetTypeId (void) TimeValue (Seconds (0)), MakeTimeAccessor (&PointToPointChannel::m_delay), MakeTimeChecker ()) + .AddTraceSource ("TxRxPointToPoint", + "Trace source indicating transmission of packet from the PointToPointChannel, used by the Animation interface.", + MakeTraceSourceAccessor (&PointToPointChannel::m_txrxPointToPoint)) ; return tid; } @@ -93,7 +97,7 @@ PointToPointChannel::TransmitStart( m_link[wire].m_dst, p); // Call the tx anim callback on the net device - src->m_txrxPointToPoint (p, src, m_link[wire].m_dst, txTime, txTime + m_delay); + m_txrxPointToPoint (p, src, m_link[wire].m_dst, txTime, txTime + m_delay); return true; } diff --git a/src/devices/point-to-point/point-to-point-channel.h b/src/devices/point-to-point/point-to-point-channel.h index 9830e048f..23d2cfa48 100644 --- a/src/devices/point-to-point/point-to-point-channel.h +++ b/src/devices/point-to-point/point-to-point-channel.h @@ -24,6 +24,7 @@ #include "ns3/ptr.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" +#include "ns3/traced-callback.h" namespace ns3 { @@ -97,6 +98,22 @@ private: Time m_delay; int32_t m_nDevices; + /** + * The trace source for the packet transmission animation events that the + * device can fire. + * Arguments to the callback are the packet, transmitting + * net device, receiving net device, transmittion time and + * packet receipt time. + * + * @see class CallBackTraceSource + */ + TracedCallback, // Packet being transmitted + Ptr, // Transmitting NetDevice + Ptr, // Receiving NetDevice + Time, // Amount of time to transmit the pkt + Time // Last bit receive time (relative to now) + > m_txrxPointToPoint; + enum WireState { INITIALIZING, diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index ca02c7344..ff6ec3693 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -82,9 +82,6 @@ PointToPointNetDevice::GetTypeId (void) // Trace sources at the "top" of the net device, where packets transition // to/from higher layers. // - .AddTraceSource ("TxRxPointToPoint", - "Trace source indicating transmission of packet from the PointToPointChannel, used by the Animation interface.", - MakeTraceSourceAccessor (&PointToPointNetDevice::m_txrxPointToPoint)) .AddTraceSource ("MacTx", "Trace source indicating a packet has arrived for transmission by this device", MakeTraceSourceAccessor (&PointToPointNetDevice::m_macTxTrace)) diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 1dbfd25cb..cb2784085 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -386,24 +386,6 @@ private: */ Ptr m_receiveErrorModel; - /** - * The trace source for the packet transmission animation events that the - * device can fire. - * Arguments to the callback are the packet, transmitting - * net device, receiving net device, transmittion time and - * packet receipt time. - * - * @see class CallBackTraceSource - */ - friend class PointToPointChannel; // Allow the channel to call the callback - TracedCallback, // Packet being transmitted - Ptr, // Transmitting NetDevice - Ptr, // Receiving NetDevice - Time, // Amount of time to transmit the pkt - Time // Last bit receive time (relative to now) - > m_txrxPointToPoint; - - /** * The trace source fired when packets come into the "top" of the device * at the L3/L2 transition, before being queued for transmission.