This documentation is not the Latest Release.
A Discrete-Event Network Simulator
API
animation-interface.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: George F. Riley<riley@ece.gatech.edu>
17  * Author: John Abraham <john.abraham@gatech.edu>
18  * Contributions: Eugene Kalishenko <ydginster@gmail.com> (Open Source and Linux Laboratory http://dev.osll.ru/)
19  */
20 
21 // Interface between ns3 and the network animator
22 
23 #ifndef ANIMATION_INTERFACE__H
24 #define ANIMATION_INTERFACE__H
25 
26 #include <string>
27 #include <cstdio>
28 #include <map>
29 
30 #include "ns3/ptr.h"
31 #include "ns3/net-device.h"
32 #include "ns3/node-container.h"
33 #include "ns3/nstime.h"
34 #include "ns3/log.h"
35 #include "ns3/node-list.h"
36 #include "ns3/random-variable-stream.h"
37 #include "ns3/simulator.h"
38 #include "ns3/config.h"
39 #include "ns3/mac48-address.h"
40 #include "ns3/lte-ue-net-device.h"
41 #include "ns3/lte-enb-net-device.h"
42 #include "ns3/uan-phy-gen.h"
43 #include "ns3/rectangle.h"
44 #include "ns3/ipv4.h"
45 #include "ns3/ipv4-l3-protocol.h"
46 
47 namespace ns3 {
48 
49 #define MAX_PKTS_PER_TRACE_FILE 100000
50 #define PURGE_INTERVAL 5
51 #define NETANIM_VERSION "netanim-3.106"
52 
53 
54 struct NodeSize;
55 
71 {
72 public:
73 
79  AnimationInterface (const std::string filename);
80 
84  typedef enum
85  {
88  } CounterType;
89 
95  typedef void (*AnimWriteCallback) (const char * str);
96 
102 
113 
123  void EnableQueueCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
124 
134  void EnableWifiMacCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
135 
145  void EnableWifiPhyCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
146 
158  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval = Seconds (5));
159 
172  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval = Seconds (5));
173 
180  static bool IsInitialized (void);
181 
189  void SetStartTime (Time t);
190 
198  void SetStopTime (Time t);
199 
209  void SetMaxPktsPerTraceFile (uint64_t maxPktsPerFile);
210 
220  void SetMobilityPollInterval (Time t);
221 
230 
236  void ResetAnimWriteCallback ();
237 
247  static void SetConstantPosition (Ptr <Node> n, double x, double y, double z=0);
248 
256  void UpdateNodeDescription (Ptr <Node> n, std::string descr);
257 
265  void UpdateNodeDescription (uint32_t nodeId, std::string descr);
266 
274  void UpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
275 
284  void UpdateNodeSize (uint32_t nodeId, double width, double height);
285 
295  void UpdateNodeColor (Ptr <Node> n, uint8_t r, uint8_t g, uint8_t b);
296 
306  void UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
307 
316  void UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter);
317 
330  void SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
331 
340  void UpdateLinkDescription (uint32_t fromNode, uint32_t toNode,
341  std::string linkDescription);
342 
351  void UpdateLinkDescription (Ptr <Node> fromNode, Ptr <Node> toNode,
352  std::string linkDescription);
353 
361  AnimationInterface & AddSourceDestination (uint32_t fromNodeId, std::string destinationIpv4Address);
362 
368  bool IsStarted (void);
369 
375  void SkipPacketTracing ();
376 
385  void EnablePacketMetadata (bool enable = true);
386 
393  uint64_t GetTracePktCount ();
394 
403  uint32_t AddNodeCounter (std::string counterName, CounterType counterType);
404 
412  uint32_t AddResource (std::string resourcePath);
413 
420  double GetNodeEnergyFraction (Ptr <const Node> node) const;
421 
422 private:
423 
425 
426  {
427  public:
428  AnimPacketInfo ();
429  AnimPacketInfo (const AnimPacketInfo & pInfo);
430  AnimPacketInfo(Ptr <const NetDevice> tx_nd, const Time fbTx, uint32_t txNodeId = 0);
432  uint32_t m_txNodeId;
433  double m_fbTx;
434  double m_lbTx;
435  double m_fbRx;
436  double m_lbRx;
438  void ProcessRxBegin (Ptr <const NetDevice> nd, const double fbRx);
439  };
440 
441  typedef struct
442  {
443  uint8_t r;
444  uint8_t g;
445  uint8_t b;
446  } Rgb;
447 
448  typedef struct
449  {
450  uint32_t fromNode;
451  uint32_t toNode;
453 
454  typedef struct
455  {
456  std::string fromNodeDescription;
457  std::string toNodeDescription;
458  std::string linkDescription;
459  } LinkProperties;
460 
462  {
464  {
465  //Check if they are the same node pairs but flipped
466  if ( ((first.fromNode == second.fromNode) && (first.toNode == second.toNode)) ||
467  ((first.fromNode == second.toNode) && (first.toNode == second.fromNode)) )
468  {
469  return false;
470  }
471  std::ostringstream oss1;
472  oss1 << first.fromNode << first.toNode;
473  std::ostringstream oss2;
474  oss2 << second.fromNode << second.toNode;
475  return oss1.str () < oss2.str ();
476  }
477 
478  };
479 
480  typedef struct
481  {
482  std::string destination;
483  uint32_t fromNodeId;
485 
486  typedef struct
487  {
488  uint32_t nodeId;
489  std::string nextHop;
491 
492  typedef enum
493  {
499  } ProtocolType;
500 
501  typedef struct
502  {
503  double width;
504  double height;
505  } NodeSize;
506  typedef std::map <P2pLinkNodeIdPair, LinkProperties, LinkPairCompare> LinkPropertiesMap;
507  typedef std::map <uint32_t, std::string> NodeDescriptionsMap;
508  typedef std::map <uint32_t, Rgb> NodeColorsMap;
509  typedef std::map<uint64_t, AnimPacketInfo> AnimUidPacketInfoMap;
510  typedef std::map <uint32_t, double> EnergyFractionMap;
511  typedef std::vector <Ipv4RoutePathElement> Ipv4RoutePathElements;
512 
513 
514  // Node Counters
515  typedef std::map <uint32_t, uint64_t> NodeCounterMap64;
516 
517 
519  {
520  public:
521  AnimXmlElement (std::string tagName, bool emptyElement=true);
522  template <typename T>
523  void AddAttribute (std::string attribute, T value, bool xmlEscape=false);
524  void Close ();
525  void CloseElement ();
526  void CloseTag ();
527  void AddLineBreak ();
528  void Add (AnimXmlElement e);
529  std::string GetElementString ();
530  private:
531  std::string m_tagName;
532  std::string m_elementString;
534 
535  };
536 
537 
538  // ##### State #####
539 
540  FILE * m_f; // File handle for output (0 if none)
541  FILE * m_routingF; // File handle for routing table output (0 if None);
543  std::string m_outputFileName;
544  uint64_t gAnimUid ; // Packet unique identifier used by AnimationInterface
546  bool m_started;
551  std::string m_originalFileName;
553  std::string m_routingFileName;
566 
567  // Counter ID
569 
573 
577 
582 
585 
586  AnimUidPacketInfoMap m_pendingWifiPackets;
587  AnimUidPacketInfoMap m_pendingWimaxPackets;
588  AnimUidPacketInfoMap m_pendingLtePackets;
589  AnimUidPacketInfoMap m_pendingCsmaPackets;
590  AnimUidPacketInfoMap m_pendingUanPackets;
591  std::map <uint32_t, Vector> m_nodeLocation;
592  std::map <std::string, uint32_t> m_macToNodeIdMap;
593  std::map <std::string, uint32_t> m_ipv4ToNodeIdMap;
594  NodeColorsMap m_nodeColors;
595  NodeDescriptionsMap m_nodeDescriptions;
596  LinkPropertiesMap m_linkProperties;
597  EnergyFractionMap m_nodeEnergyFraction;
599  std::vector <Ipv4RouteTrackElement> m_ipv4RouteTrackElements;
600  std::map <uint32_t, NodeSize> m_nodeSizes;
601  std::vector <std::string> m_resources;
602  std::vector <std::string> m_nodeCounters;
603 
604  /* Value-added custom counters */
605  NodeCounterMap64 m_nodeIpv4Drop;
606  NodeCounterMap64 m_nodeIpv4Tx;
607  NodeCounterMap64 m_nodeIpv4Rx;
608  NodeCounterMap64 m_nodeQueueEnqueue;
609  NodeCounterMap64 m_nodeQueueDequeue;
610  NodeCounterMap64 m_nodeQueueDrop;
611  NodeCounterMap64 m_nodeWifiMacTx;
612  NodeCounterMap64 m_nodeWifiMacTxDrop;
613  NodeCounterMap64 m_nodeWifiMacRx;
614  NodeCounterMap64 m_nodeWifiMacRxDrop;
615  NodeCounterMap64 m_nodeWifiPhyTxDrop;
616  NodeCounterMap64 m_nodeWifiPhyRxDrop;
617 
618  const std::vector<std::string> GetElementsFromContext (const std::string& context) const;
619  Ptr <Node> GetNodeFromContext (const std::string& context) const;
620  Ptr <NetDevice> GetNetDeviceFromContext (std::string context);
621 
622  // ##### General #####
623  void StartAnimation (bool restart = false);
624  void SetOutputFile (const std::string& fn, bool routing = false);
625  void StopAnimation (bool onlyAnimation = false);
626  std::string CounterTypeToString (CounterType counterType);
627  std::string GetPacketMetadata (Ptr<const Packet> p);
628  void AddByteTag (uint64_t animUid, Ptr<const Packet> p);
629  int WriteN (const char*, uint32_t, FILE * f);
630  int WriteN (const std::string&, FILE * f);
631  std::string GetMacAddress (Ptr <NetDevice> nd);
632  std::string GetIpv4Address (Ptr <NetDevice> nd);
633  std::string GetNetAnimVersion ();
634  void MobilityAutoCheck ();
635  bool IsPacketPending (uint64_t animUid, ProtocolType protocolType);
636  void PurgePendingPackets (ProtocolType protocolType);
637  AnimUidPacketInfoMap * ProtocolTypeToPendingPackets (ProtocolType protocolType);
638  void AddPendingPacket (ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo);
640  void AddToIpv4AddressNodeIdTable (std::string, uint32_t);
641  bool IsInTimeWindow ();
642  void CheckMaxPktsPerTraceFile ();
643 
644  void TrackWifiPhyCounters ();
645  void TrackWifiMacCounters ();
647  void TrackQueueCounters ();
648  // ##### Routing #####
649  void TrackIpv4Route ();
650  void TrackIpv4RoutePaths ();
651  std::string GetIpv4RoutingTable (Ptr <Node> n);
652  void RecursiveIpv4RoutePathSearch (std::string fromIpv4, std::string toIpv4, Ipv4RoutePathElements &);
653  void WriteRoutePath (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
654 
655 
656  // ##### Trace #####
657  void EnqueueTrace (std::string context,
659  void DequeueTrace (std::string context,
661  void QueueDropTrace (std::string context,
663  void Ipv4TxTrace (std::string context,
665  uint32_t);
666  void Ipv4RxTrace (std::string context,
668  uint32_t);
669  void Ipv4DropTrace (std::string context,
670  const Ipv4Header &,
673  uint32_t);
674 
675  void WifiMacTxTrace (std::string context,
677  void WifiMacTxDropTrace (std::string context,
679  void WifiMacRxTrace (std::string context,
681  void WifiMacRxDropTrace (std::string context,
683  void WifiPhyTxDropTrace (std::string context,
685  void WifiPhyRxDropTrace (std::string context,
687  void DevTxTrace (std::string context,
689  Ptr<NetDevice> tx,
690  Ptr<NetDevice> rx,
691  Time txTime,
692  Time rxTime);
693  void WifiPhyTxBeginTrace (std::string context,
695  void WifiPhyRxBeginTrace (std::string context,
697  void WimaxTxTrace (std::string context,
699  const Mac48Address &);
700  void WimaxRxTrace (std::string context,
702  const Mac48Address &);
703  void CsmaPhyTxBeginTrace (std::string context,
705  void CsmaPhyTxEndTrace (std::string context,
707  void CsmaPhyRxEndTrace (std::string context,
709  void CsmaMacRxTrace (std::string context,
711  void LteTxTrace (std::string context,
713  const Mac48Address &);
714  void LteRxTrace (std::string context,
716  const Mac48Address &);
717  void LteSpectrumPhyTxStart (std::string context,
719  void LteSpectrumPhyRxStart (std::string context,
721  void UanPhyGenTxTrace (std::string context,
723  void UanPhyGenRxTrace (std::string context,
725  void RemainingEnergyTrace (std::string context, double previousEnergy, double currentEnergy);
726 
727 
728  void ConnectCallbacks ();
729  void ConnectLte ();
730  void ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex);
731  void ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex);
732 
733 
734  // ##### Mobility #####
735  Vector GetPosition (Ptr <Node> n);
736  Vector UpdatePosition (Ptr <Node> n);
737  Vector UpdatePosition (Ptr <Node> n, Vector v);
738  bool NodeHasMoved (Ptr <Node> n, Vector newLocation);
739  std::vector < Ptr <Node> > GetMovedNodes ();
741 
742 
743  // ##### XML Helpers #####
744 
745  void WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
746  void WriteNodeUpdate (uint32_t nodeId);
747  void OutputWirelessPacketTxInfo (Ptr<const Packet> p, AnimPacketInfo& pktInfo, uint64_t animUid);
748  void OutputWirelessPacketRxInfo (Ptr<const Packet> p, AnimPacketInfo& pktInfo, uint64_t animUid);
750  void WriteLinkProperties ();
751  void WriteNodes ();
752  void WriteNodeColors ();
753  void WriteNodeSizes ();
754  void WriteNodeEnergies ();
755  void WriteXmlAnim (bool routing = false);
756  void WriteXmlUpdateNodePosition (uint32_t nodeId, double x, double y);
757  void WriteXmlUpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
758  void WriteXmlUpdateNodeDescription (uint32_t nodeId);
759  void WriteXmlUpdateNodeSize (uint32_t nodeId, double width, double height);
760  void WriteXmlAddResource (uint32_t resourceId, std::string resourcePath);
761  void WriteXmlAddNodeCounter (uint32_t counterId, std::string counterName, CounterType counterType);
762  void WriteXmlUpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
763  void WriteXmlUpdateNodeCounter (uint32_t counterId, uint32_t nodeId, double value);
764  void WriteXmlNode (uint32_t id, uint32_t sysId, double locX, double locY);
765  void WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId);
766  void WriteXmlUpdateLink (uint32_t fromId, uint32_t toId, std::string);
767  void WriteXmlP (std::string pktType,
768  uint32_t fId,
769  double fbTx,
770  double lbTx,
771  uint32_t tId,
772  double fbRx,
773  double lbRx,
774  std::string metaInfo = "");
775  void WriteXmlP (uint64_t animUid, std::string pktType, uint32_t fId, double fbTx, double lbTx);
776  void WriteXmlPRef (uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo = "");
777  void WriteXmlClose (std::string name, bool routing = false);
778  void WriteXmlNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
779  void WriteXmlRouting (uint32_t id, std::string routingInfo);
780  void WriteXmlRp (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
781  void WriteXmlUpdateBackground (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
782 
783 };
784 
785 
786 
787 
799 class AnimByteTag : public Tag
800 {
801 public:
802 
808  static TypeId GetTypeId (void);
809 
815  virtual TypeId GetInstanceTypeId (void) const;
816 
822  virtual uint32_t GetSerializedSize (void) const;
823 
829  virtual void Serialize (TagBuffer i) const;
830 
836  virtual void Deserialize (TagBuffer i);
837 
843  virtual void Print (std::ostream &os) const;
844 
850  void Set (uint64_t AnimUid);
851 
857  uint64_t Get (void) const;
858 
859 private:
860  uint64_t m_AnimUid;
861 };
862 
863 
864 
865 }
866 #endif
867 
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
void Set(uint64_t AnimUid)
Set global Uid in tag.
uint64_t GetTracePktCount()
Get trace file packet count (This used only for testing)
void AddToIpv4AddressNodeIdTable(std::string, uint32_t)
void UpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
Helper function to update the image of a node.
void WriteXmlRp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
void AddPendingPacket(ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo)
void WriteXmlNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
NodeCounterMap64 m_nodeQueueDequeue
std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > LinkPropertiesMap
Definition: second.py:1
void WifiMacRxTrace(std::string context, Ptr< const Packet >)
std::string GetIpv4Address(Ptr< NetDevice > nd)
std::string CounterTypeToString(CounterType counterType)
AnimationInterface(const std::string filename)
Constructor.
std::map< uint32_t, std::string > NodeDescriptionsMap
AnimationInterface & AddSourceDestination(uint32_t fromNodeId, std::string destinationIpv4Address)
Helper function to print the routing path from a source node to destination IP.
void WriteXmlUpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
static TypeId GetTypeId(void)
Get Type Id.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
AnimUidPacketInfoMap m_pendingWifiPackets
void WriteXmlUpdateNodePosition(uint32_t nodeId, double x, double y)
NodeDescriptionsMap m_nodeDescriptions
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
void PurgePendingPackets(ProtocolType protocolType)
void QueueDropTrace(std::string context, Ptr< const Packet >)
std::map< std::string, uint32_t > m_macToNodeIdMap
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
void WifiPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
void EnableWifiPhyCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Phy Counters such as TxDrop, RxDrop.
void WriteXmlAnim(bool routing=false)
NodeCounterMap64 m_nodeWifiPhyTxDrop
void LteTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
void WimaxRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
std::map< std::string, uint32_t > m_ipv4ToNodeIdMap
void RecursiveIpv4RoutePathSearch(std::string fromIpv4, std::string toIpv4, Ipv4RoutePathElements &)
void UpdateNodeSize(uint32_t nodeId, double width, double height)
Helper function to update the size of a node.
virtual void Deserialize(TagBuffer i)
Deserialize function.
void WriteXmlAddNodeCounter(uint32_t counterId, std::string counterName, CounterType counterType)
void ProcessRxBegin(Ptr< const NetDevice > nd, const double fbRx)
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
std::string GetIpv4RoutingTable(Ptr< Node > n)
void WriteXmlUpdateNodeSize(uint32_t nodeId, double width, double height)
void WriteXmlUpdateNodeColor(uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
void SetStartTime(Time t)
Specify the time at which capture should start.
void SetStopTime(Time t)
Specify the time at which capture should stop.
std::vector< Ptr< Node > > GetMovedNodes()
LinkPropertiesMap m_linkProperties
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
void Ipv4TxTrace(std::string context, Ptr< const Packet >, Ptr< Ipv4 >, uint32_t)
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
double stopTime
void WriteXmlAddResource(uint32_t resourceId, std::string resourcePath)
void ResetAnimWriteCallback()
Reset the write callback function.
NodeCounterMap64 m_nodeWifiMacTx
AnimWriteCallback m_writeCallback
void UanPhyGenTxTrace(std::string context, Ptr< const Packet >)
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
void WriteXmlUpdateLink(uint32_t fromId, uint32_t toId, std::string)
std::map< uint32_t, uint64_t > NodeCounterMap64
DropReason
Reason why a packet has been dropped.
void ConnectLteUe(Ptr< Node > n, Ptr< LteUeNetDevice > nd, uint32_t devIndex)
std::map< uint32_t, Vector > m_nodeLocation
virtual void Print(std::ostream &os) const
Print tag info.
Packet header for IPv4.
Definition: ipv4-header.h:31
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
void RemainingEnergyTrace(std::string context, double previousEnergy, double currentEnergy)
void WifiMacRxDropTrace(std::string context, Ptr< const Packet >)
void WriteXmlClose(std::string name, bool routing=false)
void OutputWirelessPacketTxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
void EnableWifiMacCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Mac Counters such as Tx, TxDrop, Rx, RxDrop.
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
~AnimationInterface()
Destructor for the animator interface.
AnimUidPacketInfoMap m_pendingWimaxPackets
EnergyFractionMap m_nodeEnergyFraction
void SkipPacketTracing()
Do not trace packets.
double startTime
double GetNodeEnergyFraction(Ptr< const Node > node) const
Get node's energy fraction (This used only for testing)
Ptr< Node > GetNodeFromContext(const std::string &context) const
void WriteNodeUpdate(uint32_t nodeId)
void DequeueTrace(std::string context, Ptr< const Packet >)
NodeCounterMap64 m_nodeIpv4Drop
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
void WriteXmlP(std::string pktType, uint32_t fId, double fbTx, double lbTx, uint32_t tId, double fbRx, double lbRx, std::string metaInfo="")
void WifiMacTxTrace(std::string context, Ptr< const Packet >)
void StartAnimation(bool restart=false)
void WriteXmlNode(uint32_t id, uint32_t sysId, double locX, double locY)
std::vector< Ipv4RoutePathElement > Ipv4RoutePathElements
AnimationInterface & EnableIpv4RouteTracking(std::string fileName, Time startTime, Time stopTime, Time pollInterval=Seconds(5))
Enable tracking of the Ipv4 routing table for all Nodes.
AnimXmlElement(std::string tagName, bool emptyElement=true)
std::map< uint32_t, NodeSize > m_nodeSizes
std::map< uint32_t, double > EnergyFractionMap
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
std::vector< std::string > m_resources
int WriteN(const char *, uint32_t, FILE *f)
void DevTxTrace(std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
tag a set of bytes in a packet
Definition: tag.h:36
void WriteXmlRouting(uint32_t id, std::string routingInfo)
void Ipv4RxTrace(std::string context, Ptr< const Packet >, Ptr< Ipv4 >, uint32_t)
void WriteXmlPRef(uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo="")
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
void(* AnimWriteCallback)(const char *str)
typedef for WriteCallBack used for listening to AnimationInterface write messages ...
uint32_t AddResource(std::string resourcePath)
Add a resource such as the path to an image file.
void SetMaxPktsPerTraceFile(uint64_t maxPktsPerFile)
Set Max packets per trace file.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
an EUI-48 address
Definition: mac48-address.h:43
NodeCounterMap64 m_nodeQueueDrop
AnimUidPacketInfoMap m_pendingLtePackets
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
std::map< uint64_t, AnimPacketInfo > AnimUidPacketInfoMap
virtual void Serialize(TagBuffer i) const
Serialize function.
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
void WriteXmlUpdateNodeDescription(uint32_t nodeId)
void EnqueueTrace(std::string context, Ptr< const Packet >)
Byte tag using by Anim to uniquely identify packets.
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
void StopAnimation(bool onlyAnimation=false)
void WriteXmlUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
Vector UpdatePosition(Ptr< Node > n)
uint64_t Get(void) const
Get Uid in tag.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
NodeCounterMap64 m_nodeWifiMacRxDrop
void WifiMacTxDropTrace(std::string context, Ptr< const Packet >)
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
read and write tag data
Definition: tag-buffer.h:51
NodeCounterMap64 m_nodeWifiPhyRxDrop
bool IsPacketPending(uint64_t animUid, ProtocolType protocolType)
std::string GetMacAddress(Ptr< NetDevice > nd)
NodeCounterMap64 m_nodeWifiMacRx
AnimUidPacketInfoMap m_pendingUanPackets
static Rectangle * userBoundary
void AddByteTag(uint64_t animUid, Ptr< const Packet > p)
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void WriteXmlUpdateBackground(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
virtual uint32_t GetSerializedSize(void) const
Get Serialized Size.
Interface to network animator.
void WriteNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
void OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
void SetAnimWriteCallback(AnimWriteCallback cb)
Set a callback function to listen to AnimationInterface write events.
void SetMobilityPollInterval(Time t)
Set mobility poll interval:WARNING: setting a low interval can cause slowness.
void Ipv4DropTrace(std::string context, const Ipv4Header &, Ptr< const Packet >, Ipv4L3Protocol::DropReason, Ptr< Ipv4 >, uint32_t)
std::map< uint32_t, Rgb > NodeColorsMap
NodeCounterMap64 m_nodeQueueEnqueue
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
Definition: first.py:1
bool IsStarted(void)
Is AnimationInterface started.
void EnableIpv4L3ProtocolCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Ipv4 L3 Protocol Counters such as Tx, Rx, Drop.
AnimUidPacketInfoMap * ProtocolTypeToPendingPackets(ProtocolType protocolType)
void EnableQueueCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Queue Counters such as Enqueue, Dequeue, Queue Drops.
void AddAttribute(std::string attribute, T value, bool xmlEscape=false)
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet >)
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
Definition: type-id.h:58
NodeCounterMap64 m_nodeWifiMacTxDrop
a 2d rectangle
Definition: rectangle.h:34
std::vector< std::string > m_nodeCounters
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet >)
void LteRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void OutputCsmaPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo)
void SetOutputFile(const std::string &fn, bool routing=false)
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
AnimUidPacketInfoMap m_pendingCsmaPackets
void WriteXmlLink(uint32_t fromId, uint32_t toLp, uint32_t toId)
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)