From 885c5168bbebc0f6fcd38e9e419ad177d77c324f Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 13 Mar 2020 14:38:09 -0700 Subject: [PATCH] netanim: Remove tabs and other whitespace issues --- src/netanim/model/animation-interface.cc | 1024 +++++++++++----------- src/netanim/model/animation-interface.h | 223 +++-- 2 files changed, 628 insertions(+), 619 deletions(-) diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 811c329f1..fd36818ad 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -75,19 +75,19 @@ static bool initialized = false; //!< Initialization flag AnimationInterface::AnimationInterface (const std::string fn) : m_f (0), m_routingF (0), - m_mobilityPollInterval (Seconds (0.25)), + m_mobilityPollInterval (Seconds (0.25)), m_outputFileName (fn), - gAnimUid (0), - m_writeCallback (0), - m_started (false), - m_enablePacketMetadata (false), - m_startTime (Seconds (0)), + gAnimUid (0), + m_writeCallback (0), + m_started (false), + m_enablePacketMetadata (false), + m_startTime (Seconds (0)), m_stopTime (Seconds (3600 * 1000)), - m_maxPktsPerFile (MAX_PKTS_PER_TRACE_FILE), + m_maxPktsPerFile (MAX_PKTS_PER_TRACE_FILE), m_originalFileName (fn), - m_routingStopTime (Seconds (0)), + m_routingStopTime (Seconds (0)), m_routingFileName (""), - m_routingPollInterval (Seconds (5)), + m_routingPollInterval (Seconds (5)), m_trackPackets (true) { initialized = true; @@ -99,7 +99,7 @@ AnimationInterface::~AnimationInterface () StopAnimation (); } -void +void AnimationInterface::SkipPacketTracing () { m_trackPackets = false; @@ -121,7 +121,7 @@ AnimationInterface::EnableWifiPhyCounters (Time startTime, Time stopTime, Time p UpdateNodeCounter (m_wifiPhyRxDropCounterId, n->GetId (), 0); } Simulator::Schedule (startTime, &AnimationInterface::TrackWifiPhyCounters, this); - + } void @@ -190,7 +190,7 @@ AnimationInterface::EnableIpv4L3ProtocolCounters (Time startTime, Time stopTime, Simulator::Schedule (startTime, &AnimationInterface::TrackIpv4L3ProtocolCounters, this); } -AnimationInterface & +AnimationInterface & AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval) { SetOutputFile (fileName, true); @@ -201,14 +201,14 @@ AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTim return *this; } -AnimationInterface & +AnimationInterface & AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval) { m_routingNc = nc; return EnableIpv4RouteTracking (fileName, startTime, stopTime, pollInterval); } -AnimationInterface & +AnimationInterface & AnimationInterface::AddSourceDestination (uint32_t fromNodeId, std::string ipv4Address) { Ipv4RouteTrackElement element = { ipv4Address, fromNodeId }; @@ -216,84 +216,84 @@ AnimationInterface::AddSourceDestination (uint32_t fromNodeId, std::string ipv4A return *this; } -void +void AnimationInterface::SetStartTime (Time t) { m_startTime = t; } -void +void AnimationInterface::SetStopTime (Time t) { m_stopTime = t; } -void +void AnimationInterface::SetMaxPktsPerTraceFile (uint64_t maxPacketsPerFile) { m_maxPktsPerFile = maxPacketsPerFile; } -uint32_t +uint32_t AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType) { m_nodeCounters.push_back (counterName); uint32_t counterId = m_nodeCounters.size () - 1; // counter ID is zero-indexed WriteXmlAddNodeCounter (counterId, counterName, counterType); - return counterId; + return counterId; } -uint32_t +uint32_t AnimationInterface::AddResource (std::string resourcePath) { m_resources.push_back (resourcePath); uint32_t resourceId = m_resources.size () - 1; // resource ID is zero-indexed WriteXmlAddResource (resourceId, resourcePath); - return resourceId; + return resourceId; } -void +void AnimationInterface::EnablePacketMetadata (bool enable) { - m_enablePacketMetadata = enable; - if (enable) - { - Packet::EnablePrinting (); - } + m_enablePacketMetadata = enable; + if (enable) + { + Packet::EnablePrinting (); + } } -bool +bool AnimationInterface::IsInitialized () { return initialized; } -bool +bool AnimationInterface::IsStarted () { return m_started; } -void +void AnimationInterface::SetAnimWriteCallback (AnimWriteCallback cb) { m_writeCallback = cb; } -void +void AnimationInterface::ResetAnimWriteCallback () { m_writeCallback = 0; } -void +void AnimationInterface::SetMobilityPollInterval (Time t) { m_mobilityPollInterval = t; } -void +void AnimationInterface::SetConstantPosition (Ptr n, double x, double y, double z) { NS_ASSERT (n); @@ -309,18 +309,18 @@ AnimationInterface::SetConstantPosition (Ptr n, double x, double y, doubl } -void +void AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId) { NS_LOG_INFO ("Setting node image for Node Id:" << nodeId); - if (resourceId > (m_resources.size ()-1)) + if (resourceId > (m_resources.size () - 1)) { NS_FATAL_ERROR ("Resource Id:" << resourceId << " not found. Did you use AddResource?"); } WriteXmlUpdateNodeImage (nodeId, resourceId); } -void +void AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter) { if (nodeCounterId > (m_nodeCounters.size () - 1)) @@ -330,7 +330,7 @@ AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, WriteXmlUpdateNodeCounter (nodeCounterId, nodeId, counter); } -void +void AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity) { if ((opacity < 0) || (opacity > 1)) @@ -340,7 +340,7 @@ AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y WriteXmlUpdateBackground (fileName, x, y, scaleX, scaleY, opacity); } -void +void AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height) { AnimationInterface::NodeSize s = { width, height }; @@ -348,45 +348,45 @@ AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height WriteXmlUpdateNodeSize (nodeId, s.width, s.height); } -void +void AnimationInterface::UpdateNodeColor (Ptr n, uint8_t r, uint8_t g, uint8_t b) { UpdateNodeColor (n->GetId (), r, g, b); } -void +void AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b) { NS_ASSERT (NodeList::GetNode (nodeId)); - NS_LOG_INFO ("Setting node color for Node Id:" << nodeId); + NS_LOG_INFO ("Setting node color for Node Id:" << nodeId); Rgb rgb = {r, g, b}; m_nodeColors[nodeId] = rgb; WriteXmlUpdateNodeColor (nodeId, r, g, b); } -void +void AnimationInterface::UpdateLinkDescription (uint32_t fromNode, uint32_t toNode, - std::string linkDescription) + std::string linkDescription) { WriteXmlUpdateLink (fromNode, toNode, linkDescription); } -void +void AnimationInterface::UpdateLinkDescription (Ptr fromNode, Ptr toNode, - std::string linkDescription) + std::string linkDescription) { NS_ASSERT (fromNode); NS_ASSERT (toNode); WriteXmlUpdateLink (fromNode->GetId (), toNode->GetId (), linkDescription); } -void +void AnimationInterface::UpdateNodeDescription (Ptr n, std::string descr) { UpdateNodeDescription (n->GetId (), descr); } -void +void AnimationInterface::UpdateNodeDescription (uint32_t nodeId, std::string descr) { NS_ASSERT (NodeList::GetNode (nodeId)); @@ -397,7 +397,7 @@ AnimationInterface::UpdateNodeDescription (uint32_t nodeId, std::string descr) // Private methods -double +double AnimationInterface::GetNodeEnergyFraction (Ptr node) const { const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find (node->GetId ()); @@ -405,17 +405,17 @@ AnimationInterface::GetNodeEnergyFraction (Ptr node) const return fractionIter->second; } -void +void AnimationInterface::MobilityCourseChangeTrace (Ptr mobility) { CHECK_STARTED_INTIMEWINDOW; Ptr n = mobility->GetObject (); NS_ASSERT (n); - Vector v ; + Vector v; if (!mobility) { v = GetPosition (n); - } + } else { v = mobility->GetPosition (); @@ -424,13 +424,13 @@ AnimationInterface::MobilityCourseChangeTrace (Ptr mobilit WriteXmlUpdateNodePosition (n->GetId (), v.x, v.y); } -bool +bool AnimationInterface::NodeHasMoved (Ptr n, Vector newLocation) { Vector oldLocation = GetPosition (n); bool moved = true; - if ((ceil (oldLocation.x) == ceil (newLocation.x)) && - (ceil (oldLocation.y) == ceil (newLocation.y))) + if ((ceil (oldLocation.x) == ceil (newLocation.x)) + && (ceil (oldLocation.y) == ceil (newLocation.y))) { moved = false; } @@ -441,7 +441,7 @@ AnimationInterface::NodeHasMoved (Ptr n, Vector newLocation) return moved; } -void +void AnimationInterface::MobilityAutoCheck () { CHECK_STARTED_INTIMEWINDOW; @@ -451,7 +451,7 @@ AnimationInterface::MobilityAutoCheck () Ptr n = MovedNodes [i]; NS_ASSERT (n); Vector v = GetPosition (n); - WriteXmlUpdateNodePosition (n->GetId () , v.x, v.y); + WriteXmlUpdateNodePosition (n->GetId (), v.x, v.y); } if (!Simulator::IsFinished ()) { @@ -465,7 +465,7 @@ AnimationInterface::MobilityAutoCheck () } } -std::vector > +std::vector > AnimationInterface::GetMovedNodes () { std::vector < Ptr > movedNodes; @@ -496,7 +496,7 @@ AnimationInterface::GetMovedNodes () return movedNodes; } -int +int AnimationInterface::WriteN (const std::string& st, FILE * f) { if (!f) @@ -510,9 +510,9 @@ AnimationInterface::WriteN (const std::string& st, FILE * f) return WriteN (st.c_str (), st.length (), f); } -int +int AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) -{ +{ if (!f) { return 0; @@ -524,7 +524,7 @@ AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) while (nLeft) { int n = std::fwrite (p, 1, nLeft, f); - if (n <= 0) + if (n <= 0) { return written; } @@ -535,7 +535,7 @@ AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) return written; } -void +void AnimationInterface::WriteRoutePath (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements) { NS_LOG_INFO ("Writing Route Path From :" << nodeId << " To: " << destination.c_str ()); @@ -552,25 +552,25 @@ AnimationInterface::WriteRoutePath (uint32_t nodeId, std::string destination, Ip */ } -void +void AnimationInterface::WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType) { WriteXmlNonP2pLinkProperties (id, ipv4Address, channelType); } -const std::vector +const std::vector AnimationInterface::GetElementsFromContext (const std::string& context) const { std::vector elements; - std::size_t pos1=0, pos2; + std::size_t pos1 = 0, pos2; while (pos1 != context.npos) - { - pos1 = context.find ("/",pos1); - pos2 = context.find ("/",pos1+1); - elements.push_back (context.substr (pos1+1,pos2-(pos1+1))); - pos1 = pos2; - pos2 = context.npos; - } + { + pos1 = context.find ("/",pos1); + pos2 = context.find ("/",pos1 + 1); + elements.push_back (context.substr (pos1 + 1,pos2 - (pos1 + 1))); + pos1 = pos2; + pos2 = context.npos; + } return elements; } @@ -600,7 +600,7 @@ AnimationInterface::GetNetDeviceFromContext (std::string context) return n->GetDevice (atoi (elements.at (3).c_str ())); } -uint64_t +uint64_t AnimationInterface::GetAnimUidFromPacket (Ptr p) { AnimByteTag tag; @@ -626,7 +626,7 @@ AnimationInterface::GetAnimUidFromPacket (Ptr p) } } -void +void AnimationInterface::AddByteTag (uint64_t animUid, Ptr p) { AnimByteTag tag; @@ -634,7 +634,7 @@ AnimationInterface::AddByteTag (uint64_t animUid, Ptr p) p->AddByteTag (tag); } -void +void AnimationInterface::RemainingEnergyTrace (std::string context, double previousEnergy, double currentEnergy) { CHECK_STARTED_INTIMEWINDOW; @@ -731,7 +731,7 @@ AnimationInterface::Ipv4TxTrace (std::string context, Ptr p, Ptr node = GetNodeFromContext (context); ++m_nodeIpv4Tx[node->GetId ()]; } - + void AnimationInterface::Ipv4RxTrace (std::string context, Ptr p, Ptr ipv4, uint32_t interfaceIndex) { @@ -740,11 +740,11 @@ AnimationInterface::Ipv4RxTrace (std::string context, Ptr p, Ptr p, - Ipv4L3Protocol::DropReason dropReason, - Ptr ipv4, +AnimationInterface::Ipv4DropTrace (std::string context, + const Ipv4Header & ipv4Header, + Ptr p, + Ipv4L3Protocol::DropReason dropReason, + Ptr ipv4, uint32_t) { const Ptr node = GetNodeFromContext (context); @@ -769,19 +769,19 @@ AnimationInterface::DequeueTrace (std::string context, void AnimationInterface::QueueDropTrace (std::string context, - Ptr p) + Ptr p) { const Ptr node = GetNodeFromContext (context); ++m_nodeQueueDrop[node->GetId ()]; } -void -AnimationInterface::DevTxTrace (std::string context, - Ptr p, - Ptr tx, - Ptr rx, - Time txTime, - Time rxTime) +void +AnimationInterface::DevTxTrace (std::string context, + Ptr p, + Ptr tx, + Ptr rx, + Time txTime, + Time rxTime) { NS_LOG_FUNCTION (this); CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; @@ -793,14 +793,14 @@ AnimationInterface::DevTxTrace (std::string context, double fbRx = (now + rxTime - txTime).GetSeconds (); double lbRx = (now + rxTime).GetSeconds (); CheckMaxPktsPerTraceFile (); - WriteXmlP ("p", - tx->GetNode ()->GetId (), - fbTx, - lbTx, - rx->GetNode ()->GetId (), - fbRx, - lbRx, - m_enablePacketMetadata? GetPacketMetadata (p):""); + WriteXmlP ("p", + tx->GetNode ()->GetId (), + fbTx, + lbTx, + rx->GetNode ()->GetId (), + fbRx, + lbRx, + m_enablePacketMetadata ? GetPacketMetadata (p) : ""); } void @@ -820,16 +820,16 @@ AnimationInterface::GenericWirelessTxTrace (std::string context, Ptr netDevice = DynamicCast (ndev); if (netDevice) - { + { Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress (); - std::ostringstream oss; + std::ostringstream oss; oss << nodeAddr; Ptr n = netDevice->GetNode (); NS_ASSERT (n); m_macToNodeIdMap[oss.str ()] = n->GetId (); - NS_LOG_INFO ("Added Mac" << oss.str () << " node:" <at (gAnimUid), gAnimUid); } @@ -848,26 +848,26 @@ AnimationInterface::GenericWirelessRxTrace (std::string context, Ptrat (animUid).ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); OutputWirelessPacketRxInfo (p, pendingPackets->at (animUid), animUid); } -void +void AnimationInterface::UanPhyGenTxTrace (std::string context, Ptr p) { NS_LOG_FUNCTION (this); return GenericWirelessTxTrace (context, p, AnimationInterface::UAN); } -void +void AnimationInterface::UanPhyGenRxTrace (std::string context, Ptr p) { NS_LOG_FUNCTION (this); return GenericWirelessRxTrace (context, p, AnimationInterface::UAN); } -void +void AnimationInterface::WifiPhyTxBeginTrace (std::string context, Ptr psdu, WifiTxVector txVector, double txPowerW) { NS_LOG_FUNCTION (this); @@ -897,7 +897,7 @@ AnimationInterface::WifiPhyTxBeginTrace (std::string context, Ptr n = netDevice->GetNode (); NS_ASSERT (n); m_macToNodeIdMap[oss.str ()] = n->GetId (); - NS_LOG_INFO ("Added Mac" << oss.str () << " node:" < p) { NS_LOG_FUNCTION (this); @@ -921,16 +921,16 @@ AnimationInterface::WifiPhyRxBeginTrace (std::string context, Ptr std::ostringstream oss; WifiMacHeader hdr; if (!p->PeekHeader (hdr)) - { - NS_LOG_WARN ("WifiMacHeader not present"); - return; - } + { + NS_LOG_WARN ("WifiMacHeader not present"); + return; + } oss << hdr.GetAddr2 (); - if (m_macToNodeIdMap.find (oss.str ()) == m_macToNodeIdMap.end ()) - { - NS_LOG_WARN ("Transmitter Mac address " << oss.str () << " never seen before. Skipping"); - return; - } + if (m_macToNodeIdMap.find (oss.str ()) == m_macToNodeIdMap.end ()) + { + NS_LOG_WARN ("Transmitter Mac address " << oss.str () << " never seen before. Skipping"); + return; + } Ptr txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]); UpdatePosition (txNode); AnimPacketInfo pktInfo (0, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); @@ -942,7 +942,7 @@ AnimationInterface::WifiPhyRxBeginTrace (std::string context, Ptr OutputWirelessPacketRxInfo (p, m_pendingWifiPackets[animUid], animUid); } -void +void AnimationInterface::LrWpanPhyTxBeginTrace (std::string context, Ptr p) { @@ -960,10 +960,10 @@ AnimationInterface::LrWpanPhyTxBeginTrace (std::string context, LrWpanMacHeader hdr; if (!p->PeekHeader (hdr)) - { - NS_LOG_WARN ("LrWpanMacHeader not present"); - return; - } + { + NS_LOG_WARN ("LrWpanMacHeader not present"); + return; + } std::ostringstream oss; if (hdr.GetSrcAddrMode () == 2) @@ -982,7 +982,7 @@ AnimationInterface::LrWpanPhyTxBeginTrace (std::string context, return; } m_macToNodeIdMap[oss.str ()] = n->GetId (); - NS_LOG_INFO ("Added Mac" << oss.str () << " node:" < std::ostringstream oss; WifiMacHeader hdr; if (!p->PeekHeader (hdr)) - { - NS_LOG_WARN ("WaveMacHeader not present"); - return; - } + { + NS_LOG_WARN ("WaveMacHeader not present"); + return; + } oss << hdr.GetAddr2 (); if (m_macToNodeIdMap.find (oss.str ()) == m_macToNodeIdMap.end ()) - { - NS_LOG_WARN ("Transmitter Mac address " << oss.str () << " never seen before. Skipping"); - return; - } + { + NS_LOG_WARN ("Transmitter Mac address " << oss.str () << " never seen before. Skipping"); + return; + } Ptr txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]); UpdatePosition (txNode); AnimPacketInfo pktInfo (0, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); @@ -1076,33 +1076,33 @@ AnimationInterface::WimaxTxTrace (std::string context, Ptr p, cons } -void +void AnimationInterface::WimaxRxTrace (std::string context, Ptr p, const Mac48Address & m) { NS_LOG_FUNCTION (this); return GenericWirelessRxTrace (context, p, AnimationInterface::WIMAX); } -void +void AnimationInterface::LteTxTrace (std::string context, Ptr p, const Mac48Address & m) { NS_LOG_FUNCTION (this); return GenericWirelessTxTrace (context, p, AnimationInterface::LTE); } -void +void AnimationInterface::LteRxTrace (std::string context, Ptr p, const Mac48Address & m) { NS_LOG_FUNCTION (this); return GenericWirelessRxTrace (context, p, AnimationInterface::LTE); } -void +void AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr pb) { NS_LOG_FUNCTION (this); CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; - if (!pb) + if (!pb) { NS_LOG_WARN ("pb == 0. Not yet supported"); return; @@ -1127,12 +1127,12 @@ AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr pb) { NS_LOG_FUNCTION (this); CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; - if (!pb) + if (!pb) { NS_LOG_WARN ("pb == 0. Not yet supported"); return; @@ -1161,7 +1161,7 @@ AnimationInterface::LteSpectrumPhyRxStart (std::string context, Ptr p) { NS_LOG_FUNCTION (this); @@ -1179,7 +1179,7 @@ AnimationInterface::CsmaPhyTxBeginTrace (std::string context, Ptr } -void +void AnimationInterface::CsmaPhyTxEndTrace (std::string context, Ptr p) { NS_LOG_FUNCTION (this); @@ -1191,8 +1191,8 @@ AnimationInterface::CsmaPhyTxEndTrace (std::string context, Ptr p) NS_LOG_INFO ("CsmaPhyTxEndTrace for packet:" << animUid); if (!IsPacketPending (animUid, AnimationInterface::CSMA)) { - NS_LOG_WARN ("CsmaPhyTxEndTrace: unknown Uid"); - NS_FATAL_ERROR ("CsmaPhyTxEndTrace: unknown Uid"); + NS_LOG_WARN ("CsmaPhyTxEndTrace: unknown Uid"); + NS_FATAL_ERROR ("CsmaPhyTxEndTrace: unknown Uid"); AnimPacketInfo pktInfo (ndev, Simulator::Now ()); AddPendingPacket (AnimationInterface::CSMA, animUid, pktInfo); NS_LOG_WARN ("Unknown Uid, but adding Csma Packet anyway"); @@ -1202,7 +1202,7 @@ AnimationInterface::CsmaPhyTxEndTrace (std::string context, Ptr p) pktInfo.m_lbTx = Simulator::Now ().GetSeconds (); } -void +void AnimationInterface::CsmaPhyRxEndTrace (std::string context, Ptr p) { NS_LOG_FUNCTION (this); @@ -1213,7 +1213,7 @@ AnimationInterface::CsmaPhyRxEndTrace (std::string context, Ptr p) uint64_t animUid = GetAnimUidFromPacket (p); if (!IsPacketPending (animUid, AnimationInterface::CSMA)) { - NS_LOG_WARN ("CsmaPhyRxEndTrace: unknown Uid"); + NS_LOG_WARN ("CsmaPhyRxEndTrace: unknown Uid"); return; } /// \todo NS_ASSERT (CsmaPacketIsPending (AnimUid) == true); @@ -1224,9 +1224,9 @@ AnimationInterface::CsmaPhyRxEndTrace (std::string context, Ptr p) OutputCsmaPacket (p, pktInfo); } -void +void AnimationInterface::CsmaMacRxTrace (std::string context, - Ptr p) + Ptr p) { NS_LOG_FUNCTION (this); CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; @@ -1235,7 +1235,7 @@ AnimationInterface::CsmaMacRxTrace (std::string context, uint64_t animUid = GetAnimUidFromPacket (p); if (!IsPacketPending (animUid, AnimationInterface::CSMA)) { - NS_LOG_WARN ("CsmaMacRxTrace: unknown Uid"); + NS_LOG_WARN ("CsmaMacRxTrace: unknown Uid"); return; } /// \todo NS_ASSERT (CsmaPacketIsPending (AnimUid) == true); @@ -1257,10 +1257,10 @@ AnimationInterface::OutputWirelessPacketTxInfo (Ptr p, AnimPacketI { nodeId = pktInfo.m_txNodeId; } - WriteXmlPRef (animUid, nodeId, pktInfo.m_fbTx, m_enablePacketMetadata? GetPacketMetadata (p):""); + WriteXmlPRef (animUid, nodeId, pktInfo.m_fbTx, m_enablePacketMetadata ? GetPacketMetadata (p) : ""); } -void +void AnimationInterface::OutputWirelessPacketRxInfo (Ptr p, AnimPacketInfo & pktInfo, uint64_t animUid) { CheckMaxPktsPerTraceFile (); @@ -1268,7 +1268,7 @@ AnimationInterface::OutputWirelessPacketRxInfo (Ptr p, AnimPacketI WriteXmlP (animUid, "wpr", rxId, pktInfo.m_fbRx, pktInfo.m_lbRx); } -void +void AnimationInterface::OutputCsmaPacket (Ptr p, AnimPacketInfo &pktInfo) { CheckMaxPktsPerTraceFile (); @@ -1276,17 +1276,17 @@ AnimationInterface::OutputCsmaPacket (Ptr p, AnimPacketInfo &pktIn uint32_t nodeId = pktInfo.m_txnd->GetNode ()->GetId (); uint32_t rxId = pktInfo.m_rxnd->GetNode ()->GetId (); - WriteXmlP ("p", - nodeId, - pktInfo.m_fbTx, - pktInfo.m_lbTx, + WriteXmlP ("p", + nodeId, + pktInfo.m_fbTx, + pktInfo.m_lbTx, rxId, - pktInfo.m_fbRx, - pktInfo.m_lbRx, - m_enablePacketMetadata? GetPacketMetadata (p):""); + pktInfo.m_fbRx, + pktInfo.m_lbRx, + m_enablePacketMetadata ? GetPacketMetadata (p) : ""); } -void +void AnimationInterface::AddPendingPacket (ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo) { AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); @@ -1294,7 +1294,7 @@ AnimationInterface::AddPendingPacket (ProtocolType protocolType, uint64_t animUi pendingPackets->insert (AnimUidPacketInfoMap::value_type (animUid, pktInfo)); } -bool +bool AnimationInterface::IsPacketPending (uint64_t animUid, AnimationInterface::ProtocolType protocolType) { AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); @@ -1302,7 +1302,7 @@ AnimationInterface::IsPacketPending (uint64_t animUid, AnimationInterface::Proto return (pendingPackets->find (animUid) != pendingPackets->end ()); } -void +void AnimationInterface::PurgePendingPackets (AnimationInterface::ProtocolType protocolType) { AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); @@ -1316,8 +1316,8 @@ AnimationInterface::PurgePendingPackets (AnimationInterface::ProtocolType protoc i != pendingPackets->end (); ++i) { - - AnimPacketInfo pktInfo = i->second; + + AnimPacketInfo pktInfo = i->second; double delta = (Simulator::Now ().GetSeconds () - pktInfo.m_fbTx); if (delta > PURGE_INTERVAL) { @@ -1332,47 +1332,47 @@ AnimationInterface::PurgePendingPackets (AnimationInterface::ProtocolType protoc } } -AnimationInterface::AnimUidPacketInfoMap * +AnimationInterface::AnimUidPacketInfoMap * AnimationInterface::ProtocolTypeToPendingPackets (AnimationInterface::ProtocolType protocolType) { AnimUidPacketInfoMap * pendingPackets = 0; switch (protocolType) { - case AnimationInterface::WIFI: - { - pendingPackets = &m_pendingWifiPackets; - break; - } - case AnimationInterface::UAN: - { - pendingPackets = &m_pendingUanPackets; - break; - } - case AnimationInterface::CSMA: - { - pendingPackets = &m_pendingCsmaPackets; - break; - } - case AnimationInterface::WIMAX: - { - pendingPackets = &m_pendingWimaxPackets; - break; - } - case AnimationInterface::LTE: - { - pendingPackets = &m_pendingLtePackets; - break; - } - case AnimationInterface::LRWPAN: - { - pendingPackets = &m_pendingLrWpanPackets; - break; - } - case AnimationInterface::WAVE: - { - pendingPackets = &m_pendingWavePackets; - break; - } + case AnimationInterface::WIFI: + { + pendingPackets = &m_pendingWifiPackets; + break; + } + case AnimationInterface::UAN: + { + pendingPackets = &m_pendingUanPackets; + break; + } + case AnimationInterface::CSMA: + { + pendingPackets = &m_pendingCsmaPackets; + break; + } + case AnimationInterface::WIMAX: + { + pendingPackets = &m_pendingWimaxPackets; + break; + } + case AnimationInterface::LTE: + { + pendingPackets = &m_pendingLtePackets; + break; + } + case AnimationInterface::LRWPAN: + { + pendingPackets = &m_pendingLrWpanPackets; + break; + } + case AnimationInterface::WAVE: + { + pendingPackets = &m_pendingWavePackets; + break; + } } return pendingPackets; @@ -1384,70 +1384,70 @@ AnimationInterface::ProtocolTypeToString (AnimationInterface::ProtocolType proto std::string result = "Unknown"; switch (protocolType) { - case AnimationInterface::WIFI: - { - result = "WIFI"; - break; - } - case AnimationInterface::UAN: - { - result = "UAN"; - break; - } - case AnimationInterface::CSMA: - { - result = "CSMA"; - break; - } - case AnimationInterface::WIMAX: - { - result = "WIMAX"; - break; - } - case AnimationInterface::LTE: - { - result = "LTE"; - break; - } - case AnimationInterface::LRWPAN: - { - result = "LRWPAN"; - break; - } - case AnimationInterface::WAVE: - { - result = "WAVE"; - break; - } + case AnimationInterface::WIFI: + { + result = "WIFI"; + break; + } + case AnimationInterface::UAN: + { + result = "UAN"; + break; + } + case AnimationInterface::CSMA: + { + result = "CSMA"; + break; + } + case AnimationInterface::WIMAX: + { + result = "WIMAX"; + break; + } + case AnimationInterface::LTE: + { + result = "LTE"; + break; + } + case AnimationInterface::LRWPAN: + { + result = "LRWPAN"; + break; + } + case AnimationInterface::WAVE: + { + result = "WAVE"; + break; + } } return result; } // Counters -std::string +std::string AnimationInterface::CounterTypeToString (CounterType counterType) { std::string typeString = "unknown"; switch (counterType) { - case UINT32_COUNTER: - { - typeString = "UINT32"; - break; - } - case DOUBLE_COUNTER: - { - typeString = "DOUBLE"; - break; - } + case UINT32_COUNTER: + { + typeString = "UINT32"; + break; + } + case DOUBLE_COUNTER: + { + typeString = "DOUBLE"; + break; + } } return typeString; } // General -std::string +std::string AnimationInterface::GetPacketMetadata (Ptr p) { std::ostringstream oss; @@ -1455,19 +1455,19 @@ AnimationInterface::GetPacketMetadata (Ptr p) return oss.str (); } -uint64_t +uint64_t AnimationInterface::GetTracePktCount () { return m_currentPktCount; } -void +void AnimationInterface::StopAnimation (bool onlyAnimation) { m_started = false; NS_LOG_INFO ("Stopping Animation"); ResetAnimWriteCallback (); - if (m_f) + if (m_f) { // Terminate the anim element WriteXmlClose ("anim"); @@ -1486,7 +1486,7 @@ AnimationInterface::StopAnimation (bool onlyAnimation) } } -void +void AnimationInterface::StartAnimation (bool restart) { m_currentPktCount = 0; @@ -1507,44 +1507,44 @@ AnimationInterface::StartAnimation (bool restart) } } -void +void AnimationInterface::AddToIpv4AddressNodeIdTable (std::string ipv4Address, uint32_t nodeId) { m_ipv4ToNodeIdMap[ipv4Address] = nodeId; - m_nodeIdIpv4Map.insert(NodeIdIpv4Pair(nodeId, ipv4Address)); + m_nodeIdIpv4Map.insert (NodeIdIpv4Pair (nodeId, ipv4Address)); } -void +void AnimationInterface::AddToIpv4AddressNodeIdTable (std::vector ipv4Addresses, uint32_t nodeId) { for (std::vector::const_iterator i = ipv4Addresses.begin (); - i != ipv4Addresses.end (); - ++i) + i != ipv4Addresses.end (); + ++i) { - AddToIpv4AddressNodeIdTable (*i, nodeId); + AddToIpv4AddressNodeIdTable (*i, nodeId); } } void -AnimationInterface::AddToIpv6AddressNodeIdTable(std::string ipv6Address, uint32_t nodeId) +AnimationInterface::AddToIpv6AddressNodeIdTable (std::string ipv6Address, uint32_t nodeId) { - m_ipv6ToNodeIdMap[ipv6Address] = nodeId; - m_nodeIdIpv6Map.insert(NodeIdIpv6Pair(nodeId, ipv6Address)); + m_ipv6ToNodeIdMap[ipv6Address] = nodeId; + m_nodeIdIpv6Map.insert (NodeIdIpv6Pair (nodeId, ipv6Address)); } void -AnimationInterface::AddToIpv6AddressNodeIdTable(std::vector ipv6Addresses, uint32_t nodeId) +AnimationInterface::AddToIpv6AddressNodeIdTable (std::vector ipv6Addresses, uint32_t nodeId) { - for (std::vector::const_iterator i = ipv6Addresses.begin(); - i != ipv6Addresses.end(); - ++i) - { - AddToIpv6AddressNodeIdTable(*i, nodeId); - } + for (std::vector::const_iterator i = ipv6Addresses.begin (); + i != ipv6Addresses.end (); + ++i) + { + AddToIpv6AddressNodeIdTable (*i, nodeId); + } } // Callbacks -void +void AnimationInterface::ConnectLteEnb (Ptr n, Ptr nd, uint32_t devIndex) { @@ -1568,7 +1568,7 @@ AnimationInterface::ConnectLteEnb (Ptr n, Ptr nd, uint3 -void +void AnimationInterface::ConnectLteUe (Ptr n, Ptr nd, uint32_t devIndex) { @@ -1585,12 +1585,12 @@ AnimationInterface::ConnectLteUe (Ptr n, Ptr nd, uint32_ } if (ulPhy) { - ulPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); - ulPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); + ulPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); + ulPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); } } -void +void AnimationInterface::ConnectLte () { @@ -1603,7 +1603,9 @@ AnimationInterface::ConnectLte () { Ptr nd = n->GetDevice (devIndex); if (!nd) - continue; + { + continue; + } Ptr lteUeNetDevice = DynamicCast (nd); if (lteUeNetDevice) { @@ -1612,13 +1614,15 @@ AnimationInterface::ConnectLte () } Ptr lteEnbNetDevice = DynamicCast (nd); if (lteEnbNetDevice) - ConnectLteEnb (n, lteEnbNetDevice, devIndex); + { + ConnectLteEnb (n, lteEnbNetDevice, devIndex); + } } } } -void +void AnimationInterface::ConnectCallbacks () { // Connect the callbacks @@ -1629,7 +1633,7 @@ AnimationInterface::ConnectCallbacks () Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin", MakeCallback (&AnimationInterface::WifiPhyRxBeginTrace, this)); Config::ConnectWithoutContext ("/NodeList/*/$ns3::MobilityModel/CourseChange", - MakeCallback (&AnimationInterface::MobilityCourseChangeTrace, this)); + MakeCallback (&AnimationInterface::MobilityCourseChangeTrace, this)); Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Tx", MakeCallback (&AnimationInterface::WimaxTxTrace, this)); Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Rx", @@ -1680,7 +1684,7 @@ AnimationInterface::ConnectCallbacks () Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Dequeue", MakeCallback (&AnimationInterface::DequeueTrace, this)); - // Queue Drops + // Queue Drops Config::Connect ("/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Drop", MakeCallback (&AnimationInterface::QueueDropTrace, this)); @@ -1727,7 +1731,7 @@ AnimationInterface::ConnectCallbacks () MakeCallback (&AnimationInterface::WavePhyRxBeginTrace, this)); } -Vector +Vector AnimationInterface::UpdatePosition (Ptr n) { Ptr loc = n->GetObject (); @@ -1736,20 +1740,20 @@ AnimationInterface::UpdatePosition (Ptr n) m_nodeLocation[n->GetId ()] = loc->GetPosition (); } else - { - NS_LOG_UNCOND ( "AnimationInterface WARNING:Node:" << n->GetId () << " Does not have a mobility model. Use SetConstantPosition if it is stationary"); - Ptr x = CreateObject (); - x->SetAttribute ("Min", DoubleValue (0)); - x->SetAttribute ("Max", DoubleValue (100)); - Ptr y = CreateObject (); - y->SetAttribute ("Min", DoubleValue (0)); - y->SetAttribute ("Max", DoubleValue (100)); - m_nodeLocation[n->GetId ()] = Vector (int (x->GetValue ()), int (y->GetValue ()), 0); - } + { + NS_LOG_UNCOND ( "AnimationInterface WARNING:Node:" << n->GetId () << " Does not have a mobility model. Use SetConstantPosition if it is stationary"); + Ptr x = CreateObject (); + x->SetAttribute ("Min", DoubleValue (0)); + x->SetAttribute ("Max", DoubleValue (100)); + Ptr y = CreateObject (); + y->SetAttribute ("Min", DoubleValue (0)); + y->SetAttribute ("Max", DoubleValue (100)); + m_nodeLocation[n->GetId ()] = Vector (int (x->GetValue ()), int (y->GetValue ()), 0); + } return m_nodeLocation[n->GetId ()]; } -Vector +Vector AnimationInterface::UpdatePosition (Ptr n, Vector v) { m_nodeLocation[n->GetId ()] = v; @@ -1764,18 +1768,18 @@ AnimationInterface::UpdatePosition (Ptr ndev) return UpdatePosition (n); } -Vector +Vector AnimationInterface::GetPosition (Ptr n) { if (m_nodeLocation.find (n->GetId ()) == m_nodeLocation.end ()) { - NS_FATAL_ERROR ("Node:" <GetId () << " not found in Location table"); - } + NS_FATAL_ERROR ("Node:" << n->GetId () << " not found in Location table"); + } return m_nodeLocation[n->GetId ()]; } -std::string +std::string AnimationInterface::GetMacAddress (Ptr nd) { Address nodeAddr = nd->GetAddress (); @@ -1784,7 +1788,7 @@ AnimationInterface::GetMacAddress (Ptr nd) return oss.str ().substr (6); // Skip the first 6 chars to get the Mac } -std::string +std::string AnimationInterface::GetIpv4Address (Ptr nd) { Ptr ipv4 = NodeList::GetNode (nd->GetNode ()->GetId ())->GetObject (); @@ -1806,37 +1810,39 @@ AnimationInterface::GetIpv4Address (Ptr nd) } std::string -AnimationInterface::GetIpv6Address(Ptr nd) +AnimationInterface::GetIpv6Address (Ptr nd) { - Ptr ipv6 = NodeList::GetNode(nd->GetNode()->GetId())->GetObject (); + Ptr ipv6 = NodeList::GetNode (nd->GetNode ()->GetId ())->GetObject (); if (!ipv6) { - NS_LOG_WARN("Node: " << nd->GetNode()->GetId() << " No ipv4 object found"); + NS_LOG_WARN ("Node: " << nd->GetNode ()->GetId () << " No ipv4 object found"); return "::"; } - int32_t ifIndex = ipv6->GetInterfaceForDevice(nd); + int32_t ifIndex = ipv6->GetInterfaceForDevice (nd); if (ifIndex == -1) { - NS_LOG_WARN("Node :" << nd->GetNode()->GetId() << " Could not find index of NetDevice"); + NS_LOG_WARN ("Node :" << nd->GetNode ()->GetId () << " Could not find index of NetDevice"); return "::"; } bool nonLinkLocalFound = false; - uint32_t nAddresses = ipv6->GetNAddresses(ifIndex); + uint32_t nAddresses = ipv6->GetNAddresses (ifIndex); Ipv6InterfaceAddress addr; for (uint32_t addressIndex = 0; addressIndex < nAddresses; ++addressIndex) { - addr = ipv6->GetAddress(ifIndex, addressIndex); - if (!addr.GetAddress().IsLinkLocal()) + addr = ipv6->GetAddress (ifIndex, addressIndex); + if (!addr.GetAddress ().IsLinkLocal ()) { nonLinkLocalFound = true; - break; + break; } } if (!nonLinkLocalFound) - addr = ipv6->GetAddress(ifIndex, 0); + { + addr = ipv6->GetAddress (ifIndex, 0); + } std::ostringstream oss; - oss << addr.GetAddress(); - return oss.str(); + oss << addr.GetAddress (); + return oss.str (); } @@ -1862,25 +1868,25 @@ AnimationInterface::GetIpv4Addresses (Ptr nd) Ipv4InterfaceAddress addr = ipv4->GetAddress (ifIndex, index); std::ostringstream oss; oss << addr.GetLocal (); - ipv4Addresses.push_back(oss.str ()); + ipv4Addresses.push_back (oss.str ()); } return ipv4Addresses; } std::vector -AnimationInterface::GetIpv6Addresses(Ptr nd) +AnimationInterface::GetIpv6Addresses (Ptr nd) { std::vector ipv6Addresses; Ptr ipv6 = NodeList::GetNode (nd->GetNode ()->GetId ())->GetObject (); if (!ipv6) { - NS_LOG_WARN("Node: " << nd->GetNode ()->GetId () << " No ipv6 object found"); + NS_LOG_WARN ("Node: " << nd->GetNode ()->GetId () << " No ipv6 object found"); return ipv6Addresses; } int32_t ifIndex = ipv6->GetInterfaceForDevice (nd); if (ifIndex == -1) { - NS_LOG_WARN("Node :" << nd->GetNode ()->GetId () << " Could not find index of NetDevice"); + NS_LOG_WARN ("Node :" << nd->GetNode ()->GetId () << " Could not find index of NetDevice"); return ipv6Addresses; } for (uint32_t index = 0; index < ipv6->GetNAddresses (ifIndex); ++index) @@ -1898,23 +1904,23 @@ void AnimationInterface::WriteIpv4Addresses () { for (NodeIdIpv4Map::const_iterator i = m_nodeIdIpv4Map.begin (); - i != m_nodeIdIpv4Map.end(); + i != m_nodeIdIpv4Map.end (); ++i) { std::vector ipv4Addresses; std::pair iterPair = m_nodeIdIpv4Map.equal_range (i->first); for (NodeIdIpv4Map::const_iterator it = iterPair.first; - it != iterPair.second; - ++it) + it != iterPair.second; + ++it) { ipv4Addresses.push_back (it->second); - } + } WriteXmlIpv4Addresses (i->first, ipv4Addresses); } } void -AnimationInterface::WriteIpv6Addresses() +AnimationInterface::WriteIpv6Addresses () { for (NodeIdIpv6Map::const_iterator i = m_nodeIdIpv6Map.begin (); i != m_nodeIdIpv6Map.end (); @@ -1923,16 +1929,16 @@ AnimationInterface::WriteIpv6Addresses() std::vector ipv6Addresses; std::pair iterPair = m_nodeIdIpv6Map.equal_range (i->first); for (NodeIdIpv6Map::const_iterator it = iterPair.first; - it != iterPair.second; + it != iterPair.second; ++it) { ipv6Addresses.push_back (it->second); - } - WriteXmlIpv6Addresses (i->first, ipv6Addresses); + } + WriteXmlIpv6Addresses (i->first, ipv6Addresses); } } -void +void AnimationInterface::WriteLinkProperties () { for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) @@ -1944,46 +1950,46 @@ AnimationInterface::WriteLinkProperties () for (uint32_t i = 0; i < nDev; ++i) { Ptr dev = n->GetDevice (i); - NS_ASSERT (dev); - Ptr ch = dev->GetChannel (); + NS_ASSERT (dev); + Ptr ch = dev->GetChannel (); std::string channelType = "Unknown channel"; - if (ch) + if (ch) { - channelType = ch->GetInstanceTypeId ().GetName (); - } - NS_LOG_DEBUG("Got ChannelType" << channelType); + channelType = ch->GetInstanceTypeId ().GetName (); + } + NS_LOG_DEBUG ("Got ChannelType" << channelType); - if (!ch || (channelType != std::string("ns3::PointToPointChannel"))) + if (!ch || (channelType != std::string ("ns3::PointToPointChannel"))) { - NS_LOG_DEBUG ("No channel can't be a p2p device"); - /* + NS_LOG_DEBUG ("No channel can't be a p2p device"); + /* // Try to see if it is an LTE NetDevice, which does not return a channel - if ((dev->GetInstanceTypeId ().GetName () == "ns3::LteUeNetDevice") || + if ((dev->GetInstanceTypeId ().GetName () == "ns3::LteUeNetDevice") || (dev->GetInstanceTypeId ().GetName () == "ns3::LteEnbNetDevice")|| (dev->GetInstanceTypeId ().GetName () == "ns3::VirtualNetDevice")) { WriteNonP2pLinkProperties (n->GetId (), GetIpv4Address (dev) + "~" + GetMacAddress (dev), channelType); AddToIpv4AddressNodeIdTable (GetIpv4Address (dev), n->GetId ()); } - */ + */ std::vector ipv4Addresses = GetIpv4Addresses (dev); - AddToIpv4AddressNodeIdTable(ipv4Addresses, n->GetId ()); - std::vector ipv6Addresses = GetIpv6Addresses (dev); - AddToIpv6AddressNodeIdTable(ipv6Addresses, n->GetId ()); - if (!ipv4Addresses.empty ()) + AddToIpv4AddressNodeIdTable (ipv4Addresses, n->GetId ()); + std::vector ipv6Addresses = GetIpv6Addresses (dev); + AddToIpv6AddressNodeIdTable (ipv6Addresses, n->GetId ()); + if (!ipv4Addresses.empty ()) + { + NS_LOG_INFO ("Writing Ipv4 link"); + WriteNonP2pLinkProperties (n->GetId (), GetIpv4Address (dev) + "~" + GetMacAddress (dev), channelType); + } + else if (!ipv6Addresses.empty ()) { - NS_LOG_INFO ("Writing Ipv4 link"); - WriteNonP2pLinkProperties(n->GetId (), GetIpv4Address (dev) + "~" + GetMacAddress (dev), channelType); - } - else if (!ipv6Addresses.empty ()) - { NS_LOG_INFO ("Writing Ipv6 link"); - WriteNonP2pLinkProperties(n->GetId (), GetIpv6Address (dev) + "~" + GetMacAddress (dev), channelType); - } + WriteNonP2pLinkProperties (n->GetId (), GetIpv6Address (dev) + "~" + GetMacAddress (dev), channelType); + } continue; } - else if (channelType == std::string ("ns3::PointToPointChannel")) + else if (channelType == std::string ("ns3::PointToPointChannel")) { // Since these are duplex links, we only need to dump // if srcid < dstid std::size_t nChDev = ch->GetNDevices (); @@ -1992,30 +1998,30 @@ AnimationInterface::WriteLinkProperties () Ptr chDev = ch->GetDevice (j); uint32_t n2Id = chDev->GetNode ()->GetId (); if (n1Id < n2Id) - { + { std::vector ipv4Addresses = GetIpv4Addresses (dev); AddToIpv4AddressNodeIdTable (ipv4Addresses, n1Id); ipv4Addresses = GetIpv4Addresses (chDev); - AddToIpv4AddressNodeIdTable (ipv4Addresses, n2Id); - std::vector ipv6Addresses = GetIpv6Addresses (dev); - AddToIpv6AddressNodeIdTable(ipv6Addresses, n1Id); - ipv6Addresses = GetIpv6Addresses (chDev); - AddToIpv6AddressNodeIdTable(ipv6Addresses, n2Id); + AddToIpv4AddressNodeIdTable (ipv4Addresses, n2Id); + std::vector ipv6Addresses = GetIpv6Addresses (dev); + AddToIpv6AddressNodeIdTable (ipv6Addresses, n1Id); + ipv6Addresses = GetIpv6Addresses (chDev); + AddToIpv6AddressNodeIdTable (ipv6Addresses, n2Id); P2pLinkNodeIdPair p2pPair; p2pPair.fromNode = n1Id; p2pPair.toNode = n2Id; - if (!ipv4Addresses.empty ()) - { + if (!ipv4Addresses.empty ()) + { LinkProperties lp = { GetIpv4Address (dev) + "~" + GetMacAddress (dev), GetIpv4Address (chDev) + "~" + GetMacAddress (chDev), "" }; - m_linkProperties[p2pPair] = lp; - } - else if (!ipv6Addresses.empty ()) - { - LinkProperties lp = { GetIpv6Address (dev) + "~" + GetMacAddress (dev), GetIpv6Address (chDev) + "~" + GetMacAddress (chDev), "" }; - m_linkProperties[p2pPair] = lp; - } + m_linkProperties[p2pPair] = lp; + } + else if (!ipv6Addresses.empty ()) + { + LinkProperties lp = { GetIpv6Address (dev) + "~" + GetMacAddress (dev), GetIpv6Address (chDev) + "~" + GetMacAddress (chDev), "" }; + m_linkProperties[p2pPair] = lp; + } WriteXmlLink (n1Id, 0, n2Id); } } @@ -2037,7 +2043,7 @@ AnimationInterface::WriteNodes () } } -void +void AnimationInterface::WriteNodeColors () { for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) @@ -2045,14 +2051,14 @@ AnimationInterface::WriteNodeColors () Ptr n = *i; Rgb rgb = {255, 0, 0}; if (m_nodeColors.find (n->GetId ()) == m_nodeColors.end ()) - { - m_nodeColors[n->GetId ()] = rgb; - } + { + m_nodeColors[n->GetId ()] = rgb; + } UpdateNodeColor (n, rgb.r, rgb.g, rgb.b); } } -void +void AnimationInterface::WriteNodeSizes () { for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) @@ -2065,7 +2071,7 @@ AnimationInterface::WriteNodeSizes () } } -void +void AnimationInterface::WriteNodeEnergies () { m_remainingEnergyCounterId = AddNodeCounter ("RemainingEnergy", AnimationInterface::DOUBLE_COUNTER); @@ -2079,17 +2085,21 @@ AnimationInterface::WriteNodeEnergies () } } -bool +bool AnimationInterface::IsInTimeWindow () { - if ((Simulator::Now () >= m_startTime) && - (Simulator::Now () <= m_stopTime)) - return true; + if ((Simulator::Now () >= m_startTime) + && (Simulator::Now () <= m_stopTime)) + { + return true; + } else - return false; + { + return false; + } } -void +void AnimationInterface::SetOutputFile (const std::string& fn, bool routing) { if (!routing && m_f) @@ -2123,7 +2133,7 @@ AnimationInterface::SetOutputFile (const std::string& fn, bool routing) return; } -void +void AnimationInterface::CheckMaxPktsPerTraceFile () { // Start a new trace file if the current packet count exceeded nax packets per file @@ -2136,10 +2146,10 @@ AnimationInterface::CheckMaxPktsPerTraceFile () StopAnimation (true); } -std::string +std::string AnimationInterface::GetNetAnimVersion () { - return NETANIM_VERSION; + return NETANIM_VERSION; } @@ -2221,7 +2231,7 @@ AnimationInterface::TrackIpv4L3ProtocolCounters () /***** Routing-related *****/ -void +void AnimationInterface::TrackIpv4RoutePaths () { if (m_ipv4RouteTrackElements.empty ()) @@ -2268,7 +2278,7 @@ AnimationInterface::TrackIpv4RoutePaths () } std::ostringstream oss; oss << rt->GetGateway (); - NS_LOG_INFO ("Node:" << trackElement.fromNodeId << "-->" << rt->GetGateway ()); + NS_LOG_INFO ("Node:" << trackElement.fromNodeId << "-->" << rt->GetGateway ()); if (rt->GetGateway () == "0.0.0.0") { Ipv4RoutePathElement elem = { trackElement.fromNodeId, "C" }; @@ -2295,7 +2305,7 @@ AnimationInterface::TrackIpv4RoutePaths () } -void +void AnimationInterface::TrackIpv4Route () { if (Simulator::Now () > m_routingStopTime) @@ -2323,7 +2333,7 @@ AnimationInterface::TrackIpv4Route () Simulator::Schedule (m_routingPollInterval, &AnimationInterface::TrackIpv4Route, this); } -std::string +std::string AnimationInterface::GetIpv4RoutingTable (Ptr n) { @@ -2341,7 +2351,7 @@ AnimationInterface::GetIpv4RoutingTable (Ptr n) } -void +void AnimationInterface::RecursiveIpv4RoutePathSearch (std::string from, std::string to, Ipv4RoutePathElements & rpElements) { NS_LOG_INFO ("RecursiveIpv4RoutePathSearch from:" << from.c_str () << " to:" << to.c_str ()); @@ -2404,7 +2414,7 @@ AnimationInterface::RecursiveIpv4RoutePathSearch (std::string from, std::string } return; } - NS_LOG_INFO ("Node:" << fromNode->GetId () << "-->" << rt->GetGateway ()); + NS_LOG_INFO ("Node:" << fromNode->GetId () << "-->" << rt->GetGateway ()); Ipv4RoutePathElement elem = { fromNode->GetId (), oss.str () }; rpElements.push_back (elem); RecursiveIpv4RoutePathSearch (oss.str (), to, rpElements); @@ -2415,7 +2425,7 @@ AnimationInterface::RecursiveIpv4RoutePathSearch (std::string from, std::string /***** WriteXml *****/ -void +void AnimationInterface::WriteXmlAnim (bool routing) { AnimXmlElement element ("anim"); @@ -2433,10 +2443,10 @@ AnimationInterface::WriteXmlAnim (bool routing) WriteN (element.ToString (false) + ">\n", f); } -void -AnimationInterface::WriteXmlClose (std::string name, bool routing) +void +AnimationInterface::WriteXmlClose (std::string name, bool routing) { - std::string closeString = "\n"; + std::string closeString = "\n"; if (!routing) { WriteN (closeString, m_f); @@ -2447,7 +2457,7 @@ AnimationInterface::WriteXmlClose (std::string name, bool routing) } } -void +void AnimationInterface::WriteXmlNode (uint32_t id, uint32_t sysId, double locX, double locY) { AnimXmlElement element ("node"); @@ -2458,7 +2468,7 @@ AnimationInterface::WriteXmlNode (uint32_t id, uint32_t sysId, double locX, doub WriteN (element.ToString (), m_f); } -void +void AnimationInterface::WriteXmlUpdateLink (uint32_t fromId, uint32_t toId, std::string linkDescription) { AnimXmlElement element ("linkupdate"); @@ -2469,14 +2479,14 @@ AnimationInterface::WriteXmlUpdateLink (uint32_t fromId, uint32_t toId, std::str WriteN (element.ToString (), m_f); } -void +void AnimationInterface::WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId) { AnimXmlElement element ("link"); element.AddAttribute ("fromId", fromId); element.AddAttribute ("toId", toId); - LinkProperties lprop ; + LinkProperties lprop; lprop.fromNodeDescription = ""; lprop.toNodeDescription = ""; lprop.linkDescription = ""; @@ -2491,10 +2501,10 @@ AnimationInterface::WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId) { lprop = m_linkProperties[p2]; } - - element.AddAttribute ("fd", lprop.fromNodeDescription, true); - element.AddAttribute ("td", lprop.toNodeDescription, true); - element.AddAttribute ("ld", lprop.linkDescription, true); + + element.AddAttribute ("fd", lprop.fromNodeDescription, true); + element.AddAttribute ("td", lprop.toNodeDescription, true); + element.AddAttribute ("ld", lprop.linkDescription, true); WriteN (element.ToString (), m_f); } @@ -2509,7 +2519,7 @@ AnimationInterface::WriteXmlIpv4Addresses (uint32_t nodeId, std::vector ipv6Addresses) { AnimXmlElement element ("ipv6"); - element.AddAttribute("n", nodeId); + element.AddAttribute ("n", nodeId); for (std::vector::const_iterator i = ipv6Addresses.begin (); i != ipv6Addresses.end (); ++i) @@ -2527,10 +2537,10 @@ AnimationInterface::WriteXmlIpv6Addresses (uint32_t nodeId, std::vector void -AnimationInterface::AnimXmlElement::AddAttribute(std::string attribute, T value, bool xmlEscape) +AnimationInterface::AnimXmlElement::AddAttribute (std::string attribute, T value, bool xmlEscape) { - std::ostringstream oss; - oss << std::setprecision(10); - oss << value; - std::string attributeString = attribute.c_str(); - if (xmlEscape) - { - attributeString += "=\""; - std::string valueStr = oss.str(); - for (std::string::iterator it = valueStr.begin(); it != valueStr.end(); ++it) - { - switch (*it) - { - case '&': - attributeString += "&"; - break; - case '\"': - attributeString += """; - break; - case '\'': - attributeString += "'"; - break; - case '<': - attributeString += "<"; - break; - case '>': - attributeString += ">"; - break; - default: - attributeString += *it; - break; - } - } - attributeString += "\" "; - } - else - { - attributeString += "=\"" + oss.str() + "\" "; - } - m_attributes.push_back(attributeString); + std::ostringstream oss; + oss << std::setprecision (10); + oss << value; + std::string attributeString = attribute.c_str (); + if (xmlEscape) + { + attributeString += "=\""; + std::string valueStr = oss.str (); + for (std::string::iterator it = valueStr.begin (); it != valueStr.end (); ++it) + { + switch (*it) + { + case '&': + attributeString += "&"; + break; + case '\"': + attributeString += """; + break; + case '\'': + attributeString += "'"; + break; + case '<': + attributeString += "<"; + break; + case '>': + attributeString += ">"; + break; + default: + attributeString += *it; + break; + } + } + attributeString += "\" "; + } + else + { + attributeString += "=\"" + oss.str () + "\" "; + } + m_attributes.push_back (attributeString); } void -AnimationInterface::AnimXmlElement::AppendChild(AnimXmlElement e) +AnimationInterface::AnimXmlElement::AppendChild (AnimXmlElement e) { - m_children.push_back(e.ToString()); + m_children.push_back (e.ToString ()); } void -AnimationInterface::AnimXmlElement::SetText(std::string text) +AnimationInterface::AnimXmlElement::SetText (std::string text) { - m_text = text; + m_text = text; } std::string -AnimationInterface::AnimXmlElement::ToString(bool autoClose) +AnimationInterface::AnimXmlElement::ToString (bool autoClose) { - std::string elementString = "<" + m_tagName + " "; + std::string elementString = "<" + m_tagName + " "; - - for (std::vector::const_iterator i = m_attributes.begin(); - i != m_attributes.end(); - ++i) - { - elementString += *i; - } - if (m_children.empty() && m_text.empty()) - { - if (autoClose) - { - elementString += "/>"; - } - } - else - { - elementString += ">"; - if (!m_text.empty()) - { - elementString += m_text; - } - if (!m_children.empty()) - { - elementString += "\n"; - for (std::vector::const_iterator i = m_children.begin(); - i != m_children.end(); - ++i) - { - elementString += *i + "\n"; - } - } - if (autoClose) - { - elementString += ""; - } - } + for (std::vector::const_iterator i = m_attributes.begin (); + i != m_attributes.end (); + ++i) + { + elementString += *i; + } + if (m_children.empty () && m_text.empty ()) + { + if (autoClose) + { + elementString += "/>"; + } + } + else + { + elementString += ">"; + if (!m_text.empty ()) + { + elementString += m_text; + } + if (!m_children.empty ()) + { + elementString += "\n"; + for (std::vector::const_iterator i = m_children.begin (); + i != m_children.end (); + ++i) + { + elementString += *i + "\n"; + } - - return elementString + ((autoClose) ?"\n": ""); + } + if (autoClose) + { + elementString += ""; + } + } + + + return elementString + ((autoClose) ? "\n" : ""); } @@ -2896,10 +2906,10 @@ AnimByteTag::Get (void) const } AnimationInterface::AnimPacketInfo::AnimPacketInfo () - : m_txnd (0), + : m_txnd (0), m_txNodeId (0), - m_fbTx (0), - m_lbTx (0), + m_fbTx (0), + m_lbTx (0), m_lbRx (0) { } @@ -2913,20 +2923,22 @@ AnimationInterface::AnimPacketInfo::AnimPacketInfo (const AnimPacketInfo & pInfo m_lbRx = pInfo.m_lbRx; } -AnimationInterface::AnimPacketInfo::AnimPacketInfo (Ptr txnd, - const Time fbTx, - uint32_t txNodeId) - : m_txnd (txnd), +AnimationInterface::AnimPacketInfo::AnimPacketInfo (Ptr txnd, + const Time fbTx, + uint32_t txNodeId) + : m_txnd (txnd), m_txNodeId (0), - m_fbTx (fbTx.GetSeconds ()), - m_lbTx (0), + m_fbTx (fbTx.GetSeconds ()), + m_lbTx (0), m_lbRx (0) { if (!m_txnd) - m_txNodeId = txNodeId; + { + m_txNodeId = txNodeId; + } } -void +void AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr nd, const double fbRx) { Ptr n = nd->GetNode (); diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h index 89fd8a884..b9c6f9c5d 100644 --- a/src/netanim/model/animation-interface.h +++ b/src/netanim/model/animation-interface.h @@ -50,8 +50,8 @@ namespace ns3 { #define MAX_PKTS_PER_TRACE_FILE 100000 #define PURGE_INTERVAL 5 #define NETANIM_VERSION "netanim-3.108" -#define CHECK_STARTED_INTIMEWINDOW {if (!m_started || !IsInTimeWindow ()) return;} -#define CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS {if (!m_started || !IsInTimeWindow () || !m_trackPackets) return;} +#define CHECK_STARTED_INTIMEWINDOW {if (!m_started || !IsInTimeWindow ()) {return; }} +#define CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS {if (!m_started || !IsInTimeWindow () || !m_trackPackets) {return; }} struct NodeSize; @@ -74,7 +74,6 @@ class WifiPsdu; class AnimationInterface { public: - /** * \brief Constructor * \param filename The Filename for the trace file used by the Animator @@ -83,20 +82,20 @@ public: AnimationInterface (const std::string filename); /** - * Counter Types + * Counter Types */ typedef enum - { - UINT32_COUNTER, - DOUBLE_COUNTER - } CounterType; + { + UINT32_COUNTER, + DOUBLE_COUNTER + } CounterType; /** * \brief typedef for WriteCallBack used for listening to AnimationInterface * write messages - * + * */ - typedef void (*AnimWriteCallback) (const char * str); + typedef void (*AnimWriteCallback)(const char * str); /** * \brief Destructor for the animator interface. @@ -151,7 +150,7 @@ public: /** * \brief Enable tracking of the Ipv4 routing table for all Nodes * - * \param fileName Trace file for storing routing table information + * \param fileName Trace file for storing routing table information * \param startTime Start time for capture * \param stopTime End time for capture * \param pollInterval The periodic interval at which routing table information is polled @@ -185,7 +184,7 @@ public: /** * \brief Specify the time at which capture should start - * + * * \param t The time at which AnimationInterface should begin capture of traffic info * * \returns none @@ -194,7 +193,7 @@ public: /** * \brief Specify the time at which capture should stop - * + * * \param t The time at which AnimationInterface should stop capture of traffic info * * \returns none @@ -204,16 +203,16 @@ public: /** * \brief Set Max packets per trace file * \param maxPktsPerFile The maximum number of packets per trace file. - AnimationInterface will create trace files with the following + AnimationInterface will create trace files with the following filenames : filename, filename-1, filename-2..., filename-N - where each file contains packet info for 'maxPktsPerFile' number of packets + where each file contains packet info for 'maxPktsPerFile' number of packets * * \returns none */ void SetMaxPktsPerTraceFile (uint64_t maxPktsPerFile); /** - * \brief Set mobility poll interval:WARNING: setting a low interval can + * \brief Set mobility poll interval:WARNING: setting a low interval can * cause slowness * * \param t Time interval between fetching mobility/position information @@ -248,7 +247,7 @@ public: * * \returns none */ - static void SetConstantPosition (Ptr n, double x, double y, double z=0); + static void SetConstantPosition (Ptr n, double x, double y, double z = 0); /** * \brief Helper function to update the description for a given node @@ -285,7 +284,7 @@ public: * * \returns none */ - void UpdateNodeSize (uint32_t nodeId, double width, double height); + void UpdateNodeSize (uint32_t nodeId, double width, double height); /** * \brief Helper function to update the node color @@ -331,7 +330,7 @@ public: * * \returns none */ - void SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity); + void SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity); /** * \brief Helper function to update the description for a link @@ -358,7 +357,7 @@ public: /** * \brief Helper function to print the routing path from a source node to destination IP * \param fromNodeId The source node - * \param destinationIpv4Address The destination Ipv4 Address + * \param destinationIpv4Address The destination Ipv4 Address * * \returns reference to this AnimationInterface object */ @@ -401,16 +400,16 @@ public: * \brief Setup a node counter * \param counterName A string to identify the counter * \param counterType The type of the counter, such as uint32, double etc - * + * * \returns The id of the counter to be used as a reference for future */ - uint32_t AddNodeCounter (std::string counterName, CounterType counterType); + uint32_t AddNodeCounter (std::string counterName, CounterType counterType); /** * * \brief Add a resource such as the path to an image file * \param resourcePath Absolute Path to an image/resource - * + * * \returns a number identifying the resource */ uint32_t AddResource (std::string resourcePath); @@ -425,14 +424,13 @@ public: double GetNodeEnergyFraction (Ptr node) const; private: - /** * AnimPacketInfo class */ class AnimPacketInfo - + { - public: +public: AnimPacketInfo (); /** * Constructor @@ -447,11 +445,11 @@ private: * \param fbTx fb transmit * \param txNodeId transmit node ID */ - AnimPacketInfo(Ptr tx_nd, const Time fbTx, uint32_t txNodeId = 0); + AnimPacketInfo (Ptr tx_nd, const Time fbTx, uint32_t txNodeId = 0); Ptr m_txnd; ///< transmit device uint32_t m_txNodeId; ///< node ID double m_fbTx; ///< fb transmit - double m_lbTx; ///< lb transmit + double m_lbTx; ///< lb transmit double m_fbRx; ///< fb receive double m_lbRx; ///< lb receive Ptr m_rxnd; ///< receive device @@ -465,11 +463,11 @@ private: /// RGB structure typedef struct - { - uint8_t r; ///< r - uint8_t g; ///< g - uint8_t b; ///< b - } Rgb; ///< RGB structure + { + uint8_t r; ///< r + uint8_t g; ///< g + uint8_t b; ///< b + } Rgb; ///< RGB structure /// P2pLinkNodeIdPair structure typedef struct @@ -497,54 +495,54 @@ private: * \return true if equal */ bool operator () (P2pLinkNodeIdPair first, P2pLinkNodeIdPair second) const - { - //Check if they are the same node pairs but flipped - if ( ((first.fromNode == second.fromNode) && (first.toNode == second.toNode)) || - ((first.fromNode == second.toNode) && (first.toNode == second.fromNode)) ) - { - return false; - } - std::ostringstream oss1; - oss1 << first.fromNode << first.toNode; - std::ostringstream oss2; - oss2 << second.fromNode << second.toNode; - return oss1.str () < oss2.str (); - } + { + //Check if they are the same node pairs but flipped + if ( ((first.fromNode == second.fromNode) && (first.toNode == second.toNode)) + || ((first.fromNode == second.toNode) && (first.toNode == second.fromNode)) ) + { + return false; + } + std::ostringstream oss1; + oss1 << first.fromNode << first.toNode; + std::ostringstream oss2; + oss2 << second.fromNode << second.toNode; + return oss1.str () < oss2.str (); + } }; /// Ipv4RouteTrackElement structure - typedef struct - { - std::string destination; ///< destination - uint32_t fromNodeId; ///< from node ID - } Ipv4RouteTrackElement; ///< IPv4 route track element + typedef struct + { + std::string destination; ///< destination + uint32_t fromNodeId; ///< from node ID + } Ipv4RouteTrackElement; ///< IPv4 route track element /// Ipv4RoutePathElement structure - typedef struct - { - uint32_t nodeId; ///< node ID - std::string nextHop; ///< next hop - } Ipv4RoutePathElement; ///< IPv4 route path element + typedef struct + { + uint32_t nodeId; ///< node ID + std::string nextHop; ///< next hop + } Ipv4RoutePathElement; ///< IPv4 route path element /// ProtocolType enumeration typedef enum - { - UAN, - LTE, - WIFI, - WIMAX, - CSMA, - LRWPAN, - WAVE - } ProtocolType; + { + UAN, + LTE, + WIFI, + WIMAX, + CSMA, + LRWPAN, + WAVE + } ProtocolType; /// NodeSize structure typedef struct - { - double width; ///< width - double height; ///< height - } NodeSize; ///< node size + { + double width; ///< width + double height; ///< height + } NodeSize; ///< node size typedef std::map LinkPropertiesMap; ///< LinkPropertiesMap typedef typedef std::map NodeDescriptionsMap; ///< NodeDescriptionsMap typedef typedef std::map NodeColorsMap; ///< NodeColorsMap typedef @@ -564,14 +562,14 @@ private: /// AnimXmlElement class class AnimXmlElement { - public: +public: /** * Constructor * * \param tagName tag name * \param emptyElement empty element? */ - AnimXmlElement (std::string tagName, bool emptyElement=true); + AnimXmlElement (std::string tagName, bool emptyElement = true); template /** * Add attribute function @@ -579,25 +577,25 @@ private: * \param value the attribute value * \param xmlEscape true to escape */ - void AddAttribute (std::string attribute, T value, bool xmlEscape=false); + void AddAttribute (std::string attribute, T value, bool xmlEscape = false); /** * Set text function * \param text the text for the element */ - void SetText(std::string text); + void SetText (std::string text); /** * Append child function * \param e the element to add as a child */ - void AppendChild(AnimXmlElement e); + void AppendChild (AnimXmlElement e); /** * Get text for the element function * \param autoClose auto close the element * \returns the text */ - std::string ToString(bool autoClose = true); + std::string ToString (bool autoClose = true); - private: +private: std::string m_tagName; ///< tag name std::string m_text; ///< element string std::vector m_attributes; ///< list of attributes @@ -613,10 +611,10 @@ private: FILE * m_routingF; ///< File handle for routing table output (0 if None); Time m_mobilityPollInterval; ///< mobility poll interval std::string m_outputFileName; ///< output file name - uint64_t gAnimUid ; ///< Packet unique identifier used by AnimationInterface + uint64_t gAnimUid; ///< Packet unique identifier used by AnimationInterface AnimWriteCallback m_writeCallback; ///< write callback bool m_started; ///< started - bool m_enablePacketMetadata; ///< enable packet metadata + bool m_enablePacketMetadata; ///< enable packet metadata Time m_startTime; ///< start time Time m_stopTime; ///< stop time uint64_t m_maxPktsPerFile; ///< maximum pakets per file @@ -638,7 +636,7 @@ private: // Counter ID uint32_t m_remainingEnergyCounterId; ///< remaining energy counter ID - + uint32_t m_ipv4L3ProtocolTxCounterId; ///< IPv4 L3 protocol transmit counter ID uint32_t m_ipv4L3ProtocolRxCounterId; ///< IPv4 L3 protocol receive counter ID uint32_t m_ipv4L3ProtocolDropCounterId; ///< IPv4 protocol drop counter ID @@ -648,13 +646,13 @@ private: uint32_t m_queueDropCounterId; ///< queue drop counter ID uint32_t m_wifiMacTxCounterId; ///< wifi MAC transmit counter ID - uint32_t m_wifiMacTxDropCounterId; ///< wifi MAC transmit drop counter ID + uint32_t m_wifiMacTxDropCounterId; ///< wifi MAC transmit drop counter ID uint32_t m_wifiMacRxCounterId; ///< wifi MAC receive counter ID uint32_t m_wifiMacRxDropCounterId; ///< wifi MAC receive drop counter ID - + uint32_t m_wifiPhyTxDropCounterId; ///< wifi Phy transmit drop counter ID uint32_t m_wifiPhyRxDropCounterId; ///< wifi Phy receive drop counter ID - + AnimUidPacketInfoMap m_pendingWifiPackets; ///< pending wifi packets AnimUidPacketInfoMap m_pendingWimaxPackets; ///< pending wimax packets AnimUidPacketInfoMap m_pendingLrWpanPackets; ///< pending LR-WPAN packets @@ -695,8 +693,8 @@ private: NodeCounterMap64 m_nodeWifiPhyRxDrop; ///< node wifi Phy receive drop NodeCounterMap64 m_nodeLrWpanMacTx; ///< node LR-WPAN MAC transmit NodeCounterMap64 m_nodeLrWpanMacTxDrop; ///< node LR-WPAN MAC transmit drop - NodeCounterMap64 m_nodeLrWpanMacRx;///< node LR-WPAN MAC receive - NodeCounterMap64 m_nodeLrWpanMacRxDrop;///< node LR-WPAN MAC receive drop + NodeCounterMap64 m_nodeLrWpanMacRx; ///< node LR-WPAN MAC receive + NodeCounterMap64 m_nodeLrWpanMacRxDrop; ///< node LR-WPAN MAC receive drop /** * Get elements from context @@ -716,7 +714,7 @@ private: * \returns the device */ Ptr GetNetDeviceFromContext (std::string context); - + // ##### General ##### /** * Start animation function @@ -787,7 +785,7 @@ private: * \param nd the device * \returns the IPv6 address */ - std::string GetIpv6Address(Ptr nd); + std::string GetIpv6Address (Ptr nd); /** * Get IPv4 addresses * \param nd the device @@ -824,7 +822,7 @@ private: * Protocol type to pending packets function * \param protocolType the protocol type * \returns AnimUidPacketInfoMap * - */ + */ AnimUidPacketInfoMap * ProtocolTypeToPendingPackets (ProtocolType protocolType); /** * Protocol type to string function @@ -939,7 +937,7 @@ private: * \param interfaceIndex the interface index */ void Ipv4TxTrace (std::string context, - Ptr p, Ptr ipv4, + Ptr p, Ptr ipv4, uint32_t interfaceIndex); /** * IPv4 receive trace function @@ -961,9 +959,9 @@ private: * \param interfaceIndex the interface index */ void Ipv4DropTrace (std::string context, - const Ipv4Header & ipv4Header, - Ptr p, - Ipv4L3Protocol::DropReason dropReason, Ptr ipv4, + const Ipv4Header & ipv4Header, + Ptr p, + Ipv4L3Protocol::DropReason dropReason, Ptr ipv4, uint32_t interfaceIndex); /** @@ -1066,7 +1064,7 @@ private: * \param context the context * \param p the packet */ - void WavePhyTxBeginTrace (std::string context, + void WavePhyTxBeginTrace (std::string context, Ptr p); /** * WAVE Phy receive begin trace function @@ -1074,7 +1072,7 @@ private: * \param context the context * \param p the packet */ - void WavePhyRxBeginTrace (std::string context, + void WavePhyRxBeginTrace (std::string context, Ptr p); /** * LR-WPAN Phy receive begin trace function @@ -1100,7 +1098,7 @@ private: */ void WimaxTxTrace (std::string context, Ptr p, - const Mac48Address & m); + const Mac48Address & m); /** * WIMax receive trace function * \param context the context @@ -1144,8 +1142,8 @@ private: * \param m the MAC address */ void LteTxTrace (std::string context, - Ptr p, - const Mac48Address & m); + Ptr p, + const Mac48Address & m); /** * LTE receive trace function * \param context the context @@ -1153,8 +1151,8 @@ private: * \param m the MAC address */ void LteRxTrace (std::string context, - Ptr p, - const Mac48Address & m); + Ptr p, + const Mac48Address & m); /** * LTE Spectrum Phy transmit start function * \param context the context @@ -1201,7 +1199,7 @@ private: */ void GenericWirelessRxTrace (std::string context, Ptr p, ProtocolType protocolType); - + /// Connect callbacks function void ConnectCallbacks (); /// Connect LTE function @@ -1267,7 +1265,7 @@ private: void MobilityCourseChangeTrace (Ptr mob); - // ##### XML Helpers ##### + // ##### XML Helpers ##### /** * Write non P2P link properties function @@ -1401,19 +1399,19 @@ private: * \param fId the FID * \param fbTx the FB transmit * \param lbTx the LB transmit - * \param tId the TID + * \param tId the TID * \param fbRx the FB receive * \param lbRx the LB receive * \param metaInfo the meta info */ - void WriteXmlP (std::string pktType, - uint32_t fId, - double fbTx, - double lbTx, - uint32_t tId, - double fbRx, - double lbRx, - std::string metaInfo = ""); + void WriteXmlP (std::string pktType, + uint32_t fId, + double fbTx, + double lbTx, + uint32_t tId, + double fbRx, + double lbRx, + std::string metaInfo = ""); /** * Write XMLP function * \param animUid the UID @@ -1492,21 +1490,20 @@ private: * * When Anim receives a Tx Notification we tag the packet with a unique global uint64_t identifier * before recording Tx information - * When Anim receives Rx notifications the tag is used to retrieve Tx information recorded earlier - * + * When Anim receives Rx notifications the tag is used to retrieve Tx information recorded earlier + * */ class AnimByteTag : public Tag { public: - /** * \brief Get Type Id * \returns Type Id * */ static TypeId GetTypeId (void); - + /** * \brief Get Instance Type Id * \returns Type Id