From 806f5e902608364c6f8bce03009cdbeabd613a4f Mon Sep 17 00:00:00 2001 From: John Abraham Date: Thu, 11 Oct 2012 12:21:17 -0700 Subject: [PATCH] NetAnim: Add support for ipv4 address printing for non-p2p --- src/netanim/examples/uan-animation.cc | 2 +- src/netanim/model/animation-interface.cc | 30 ++++++++++++++++++++---- src/netanim/model/animation-interface.h | 4 ++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/netanim/examples/uan-animation.cc b/src/netanim/examples/uan-animation.cc index 455cb03f2..7ed4570f6 100644 --- a/src/netanim/examples/uan-animation.cc +++ b/src/netanim/examples/uan-animation.cc @@ -255,7 +255,7 @@ main (int argc, char **argv) { LogComponentEnable ("UanCwExample", LOG_LEVEL_ALL); - LogComponentEnable ("AnimationInterface", LOG_LEVEL_ALL); + //LogComponentEnable ("AnimationInterface", LOG_LEVEL_ALL); NetAnimExperiment exp; diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 17260769b..748cd5f5a 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -473,7 +473,8 @@ void AnimationInterface::StartAnimation (bool restart) } else { - //NS_FATAL_ERROR ("Net animation currently only supports point-to-point links."); + NS_LOG_INFO ("Link:" << GetIpv4Address (dev) << " Channel Type:" << channelType); + WriteNonP2pLinkProperties (n->GetId (), GetIpv4Address (dev), channelType); } } } @@ -688,14 +689,20 @@ void AnimationInterface::WriteDummyPacket () double lbTx = now.GetSeconds (); double fbRx = now.GetSeconds (); double lbRx = now.GetSeconds (); - if (m_xml) - { - oss << GetXMLOpenClose_p ("p", 0, fbTx, lbTx, 0, fbRx, lbRx, "", "DummyPktIgnoreThis"); - } + oss << GetXMLOpenClose_p ("p", 0, fbTx, lbTx, 0, fbRx, lbRx, "", "DummyPktIgnoreThis"); WriteN (oss.str ()); } + + +void AnimationInterface::WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType) +{ + std::ostringstream oss; + oss << GetXMLOpenClose_NonP2pLinkProperties (id, ipv4Address, channelType); + WriteN (oss.str ()); +} + void AnimationInterface::DevTxTrace (std::string context, Ptr p, Ptr tx, Ptr rx, Time txTime, Time rxTime) @@ -1739,6 +1746,19 @@ std::string AnimationInterface::GetXMLOpenClose_meta (std::string metaInfo) return oss.str (); } + +std::string AnimationInterface::GetXMLOpenClose_NonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType) +{ + std::ostringstream oss; + oss << "" << std::endl; + return oss.str (); +} + + std::vector AnimationInterface::GetElementsFromContext (std::string context) { std::vector elements; diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h index 0b0b8dcea..eb20e5766 100644 --- a/src/netanim/model/animation-interface.h +++ b/src/netanim/model/animation-interface.h @@ -552,6 +552,8 @@ private: void StartNewTraceFile(); std::string GetIpv4Address (Ptr nd); + void WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType); + std::string GetNetAnimVersion (); // XML helpers @@ -578,6 +580,8 @@ private: std::string GetXMLOpen_wpacket (uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range); std::string GetXMLClose (std::string name) {return "\n"; } std::string GetXMLOpenClose_meta (std::string metaInfo); + std::string GetXMLOpenClose_NonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType); + /// Provides uniform random variables. Ptr m_uniformRandomVariable;