A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
animation-interface.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Author: George F. Riley<riley@ece.gatech.edu>
16  * Author: John Abraham <john.abraham@gatech.edu>
17  * Contributions: Eugene Kalishenko <ydginster@gmail.com> (Open Source and Linux Laboratory http://dev.osll.ru/)
18  */
19 
20 // Interface between ns3 and the network animator
21 
22 #ifndef ANIMATION_INTERFACE__H
23 #define ANIMATION_INTERFACE__H
24 
25 #include <string>
26 #include <cstdio>
27 #include <map>
28 
29 #include "ns3/ptr.h"
30 #include "ns3/net-device.h"
31 #include "ns3/node-container.h"
32 #include "ns3/nstime.h"
33 #include "ns3/log.h"
34 #include "ns3/node-list.h"
35 #include "ns3/random-variable-stream.h"
36 #include "ns3/simulator.h"
37 #include "ns3/config.h"
38 #include "ns3/mac48-address.h"
39 #include "ns3/lte-ue-net-device.h"
40 #include "ns3/lte-enb-net-device.h"
41 #include "ns3/uan-phy-gen.h"
42 #include "ns3/rectangle.h"
43 #include "ns3/ipv4.h"
44 #include "ns3/ipv4-l3-protocol.h"
45 
46 namespace ns3 {
47 
48 #define MAX_PKTS_PER_TRACE_FILE 100000
49 #define PURGE_INTERVAL 5
50 #define NETANIM_VERSION "netanim-3.105"
51 
52 
53 struct NodeSize;
54 
70 {
71 public:
72 
78  AnimationInterface (const std::string filename);
79 
83  typedef enum
84  {
87  } CounterType;
88 
94  typedef void (*AnimWriteCallback) (const char * str);
95 
101 
112 
122  void EnableQueueCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
123 
133  void EnableWifiMacCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
134 
144  void EnableWifiPhyCounters (Time startTime, Time stopTime, Time pollInterval = Seconds (1));
145 
157  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval = Seconds (5));
158 
171  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval = Seconds (5));
172 
179  static bool IsInitialized (void);
180 
188  void SetStartTime (Time t);
189 
197  void SetStopTime (Time t);
198 
208  void SetMaxPktsPerTraceFile (uint64_t maxPktsPerFile);
209 
219  void SetMobilityPollInterval (Time t);
220 
229 
235  void ResetAnimWriteCallback ();
236 
246  static void SetConstantPosition (Ptr <Node> n, double x, double y, double z=0);
247 
255  void UpdateNodeDescription (Ptr <Node> n, std::string descr);
256 
264  void UpdateNodeDescription (uint32_t nodeId, std::string descr);
265 
273  void UpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
274 
283  void UpdateNodeSize (uint32_t nodeId, double width, double height);
284 
294  void UpdateNodeColor (Ptr <Node> n, uint8_t r, uint8_t g, uint8_t b);
295 
305  void UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
306 
315  void UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter);
316 
329  void SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
330 
339  void UpdateLinkDescription (uint32_t fromNode, uint32_t toNode,
340  std::string linkDescription);
341 
350  void UpdateLinkDescription (Ptr <Node> fromNode, Ptr <Node> toNode,
351  std::string linkDescription);
352 
360  AnimationInterface & AddSourceDestination (uint32_t fromNodeId, std::string destinationIpv4Address);
361 
367  bool IsStarted (void);
368 
374  void SkipPacketTracing ();
375 
384  void EnablePacketMetadata (bool enable = true);
385 
392  uint64_t GetTracePktCount ();
393 
402  uint32_t AddNodeCounter (std::string counterName, CounterType counterType);
403 
411  uint32_t AddResource (std::string resourcePath);
412 
419  double GetNodeEnergyFraction (Ptr <const Node> node) const;
420 
421 private:
422 
423 
424  // ##### typedef #####
426  {
427  public:
429  AnimRxInfo (const Time& fbRx, Ptr <const NetDevice> nd ,double rxRange)
430  : m_fbRx (fbRx.GetSeconds ()), m_lbRx (0), m_rxnd (nd), rxRange (rxRange), m_PhyRxComplete (false) {}
431  double m_fbRx;
432  double m_lbRx;
434  double rxRange;
435  bool IsPhyRxComplete ();
436  void SetPhyRxComplete ();
437  private:
439  };
440 
442 
443  {
444  public:
445  AnimPacketInfo ();
446  AnimPacketInfo (const AnimPacketInfo & pInfo);
447  AnimPacketInfo(Ptr <const NetDevice> tx_nd, const Time fbTx, const Time lbTx, Vector txLoc, uint32_t txNodeId = 0);
449  uint32_t m_txNodeId;
450  double m_fbTx;
451  double m_lbTx;
454  std::map<uint32_t,AnimRxInfo> m_rx;
455  void ProcessRxBegin (Ptr <const NetDevice> nd, const Time fbRx);
456  bool ProcessRxEnd (Ptr <const NetDevice> nd, const Time fbRx, Vector rxLoc);
460 
461  };
462 
463  typedef struct
464  {
465  uint8_t r;
466  uint8_t g;
467  uint8_t b;
468  } Rgb;
469 
470  typedef struct
471  {
472  uint32_t fromNode;
473  uint32_t toNode;
475 
476  typedef struct
477  {
478  std::string fromNodeDescription;
479  std::string toNodeDescription;
480  std::string linkDescription;
481  } LinkProperties;
482 
484  {
486  {
487  //Check if they are the same node pairs but flipped
488  if ( ((first.fromNode == second.fromNode) && (first.toNode == second.toNode)) ||
489  ((first.fromNode == second.toNode) && (first.toNode == second.fromNode)) )
490  {
491  return false;
492  }
493  std::ostringstream oss1;
494  oss1 << first.fromNode << first.toNode;
495  std::ostringstream oss2;
496  oss2 << second.fromNode << second.toNode;
497  return oss1.str () < oss2.str ();
498  }
499 
500  };
501 
502  typedef struct
503  {
504  std::string destination;
505  uint32_t fromNodeId;
507 
508  typedef struct
509  {
510  uint32_t nodeId;
511  std::string nextHop;
513 
514  typedef enum
515  {
521  } ProtocolType;
522 
523  typedef struct
524  {
525  double width;
526  double height;
527  } NodeSize;
528  typedef std::map <P2pLinkNodeIdPair, LinkProperties, LinkPairCompare> LinkPropertiesMap;
529  typedef std::map <uint32_t, std::string> NodeDescriptionsMap;
530  typedef std::map <uint32_t, Rgb> NodeColorsMap;
531  typedef std::map<uint64_t, AnimPacketInfo> AnimUidPacketInfoMap;
532  typedef std::map <uint32_t, double> EnergyFractionMap;
533  typedef std::vector <Ipv4RoutePathElement> Ipv4RoutePathElements;
534 
535 
536  // Node Counters
537  typedef std::map <uint32_t, uint64_t> NodeCounterMap64;
538 
539 
541  {
542  public:
543  AnimXmlElement (std::string tagName);
544  template <typename T>
545  void AddAttribute (std::string attribute, T value);
546  void Close ();
547  void CloseTag ();
548  void AddLineBreak ();
549  void Add (AnimXmlElement e);
550  std::string GetElementString ();
551  private:
552  std::string m_tagName;
553  std::string m_elementString;
554 
555  };
556 
557 
558  // ##### State #####
559 
560  FILE * m_f; // File handle for output (0 if none)
561  FILE * m_routingF; // File handle for routing table output (0 if None);
563  std::string m_outputFileName;
564  uint64_t gAnimUid ; // Packet unique identifier used by AnimationInterface
566  bool m_started;
571  std::string m_originalFileName;
573  std::string m_routingFileName;
586 
587  // Counter ID
589 
593 
597 
602 
605 
611  std::map<uint32_t, Vector> m_nodeLocation;
612  std::map <std::string, uint32_t> m_macToNodeIdMap;
613  std::map <std::string, uint32_t> m_ipv4ToNodeIdMap;
619  std::vector <Ipv4RouteTrackElement> m_ipv4RouteTrackElements;
620  std::map <uint32_t, NodeSize> m_nodeSizes;
621  std::vector <std::string> m_resources;
622  std::vector <std::string> m_nodeCounters;
623 
636 
637  const std::vector<std::string> GetElementsFromContext (const std::string& context) const;
638  Ptr <Node> GetNodeFromContext (const std::string& context) const;
639  Ptr <NetDevice> GetNetDeviceFromContext (std::string context);
640 
641  // ##### General #####
642  void StartAnimation (bool restart = false);
643  void SetOutputFile (const std::string& fn, bool routing = false);
644  void StopAnimation (bool onlyAnimation = false);
645  std::string CounterTypeToString (CounterType counterType);
646  std::string GetPacketMetadata (Ptr<const Packet> p);
647  void AddByteTag (uint64_t animUid, Ptr<const Packet> p);
648  int WriteN (const char*, uint32_t, FILE * f);
649  int WriteN (const std::string&, FILE * f);
650  std::string GetMacAddress (Ptr <NetDevice> nd);
651  std::string GetIpv4Address (Ptr <NetDevice> nd);
652  std::string GetNetAnimVersion ();
653  void MobilityAutoCheck ();
654  bool IsPacketPending (uint64_t animUid, ProtocolType protocolType);
655  void PurgePendingPackets (ProtocolType protocolType);
657  void AddPendingPacket (ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo);
659  void AddToIpv4AddressNodeIdTable (std::string, uint32_t);
660  bool IsInTimeWindow ();
661  void CheckMaxPktsPerTraceFile ();
662 
663  void TrackWifiPhyCounters ();
664  void TrackWifiMacCounters ();
666  void TrackQueueCounters ();
667  // ##### Routing #####
668  void TrackIpv4Route ();
669  void TrackIpv4RoutePaths ();
670  std::string GetIpv4RoutingTable (Ptr <Node> n);
671  void RecursiveIpv4RoutePathSearch (std::string fromIpv4, std::string toIpv4, Ipv4RoutePathElements &);
672  void WriteRoutePath (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
673 
674 
675  // ##### Trace #####
676  void EnqueueTrace (std::string context,
678  void DequeueTrace (std::string context,
680  void QueueDropTrace (std::string context,
682  void Ipv4TxTrace (std::string context,
684  uint32_t);
685  void Ipv4RxTrace (std::string context,
687  uint32_t);
688  void Ipv4DropTrace (std::string context,
689  const Ipv4Header &,
692  uint32_t);
693 
694  void WifiMacTxTrace (std::string context,
696  void WifiMacTxDropTrace (std::string context,
698  void WifiMacRxTrace (std::string context,
700  void WifiMacRxDropTrace (std::string context,
702  void WifiPhyTxDropTrace (std::string context,
704  void WifiPhyRxDropTrace (std::string context,
706  void DevTxTrace (std::string context,
708  Ptr<NetDevice> tx,
709  Ptr<NetDevice> rx,
710  Time txTime,
711  Time rxTime);
712  void WifiPhyTxBeginTrace (std::string context,
714  void WifiPhyRxBeginTrace (std::string context,
716  void WimaxTxTrace (std::string context,
718  const Mac48Address &);
719  void WimaxRxTrace (std::string context,
721  const Mac48Address &);
722  void CsmaPhyTxBeginTrace (std::string context,
724  void CsmaPhyTxEndTrace (std::string context,
726  void CsmaPhyRxEndTrace (std::string context,
728  void CsmaMacRxTrace (std::string context,
730  void LteTxTrace (std::string context,
732  const Mac48Address &);
733  void LteRxTrace (std::string context,
735  const Mac48Address &);
736  void LteSpectrumPhyTxStart (std::string context,
738  void LteSpectrumPhyRxStart (std::string context,
740  void UanPhyGenTxTrace (std::string context,
742  void UanPhyGenRxTrace (std::string context,
744  void RemainingEnergyTrace (std::string context, double previousEnergy, double currentEnergy);
745 
746 
747  void ConnectCallbacks ();
748  void ConnectLte ();
749  void ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex);
750  void ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex);
751 
752 
753  // ##### Mobility #####
757  bool NodeHasMoved (Ptr <Node> n, Vector newLocation);
758  std::vector < Ptr <Node> > GetMovedNodes ();
760 
761 
762  // ##### XML Helpers #####
763 
764  void WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
765  void WriteNodeUpdate (uint32_t nodeId);
766  void OutputWirelessPacketTxInfo (Ptr<const Packet> p, AnimPacketInfo& pktInfo, uint64_t animUid);
767  void OutputWirelessPacketRxInfo (Ptr<const Packet> p, AnimRxInfo pktrxInfo, uint64_t animUid);
768  void OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
769  void WriteLinkProperties ();
770  void WriteNodes ();
771  void WriteNodeColors ();
772  void WriteNodeSizes ();
773  void WriteNodeEnergies ();
774  void WriteXmlAnim (bool routing = false);
775  void WriteXmlUpdateNodePosition (uint32_t nodeId, double x, double y);
776  void WriteXmlUpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
777  void WriteXmlUpdateNodeDescription (uint32_t nodeId);
778  void WriteXmlUpdateNodeSize (uint32_t nodeId, double width, double height);
779  void WriteXmlAddResource (uint32_t resourceId, std::string resourcePath);
780  void WriteXmlAddNodeCounter (uint32_t counterId, std::string counterName, CounterType counterType);
781  void WriteXmlUpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
782  void WriteXmlUpdateNodeCounter (uint32_t counterId, uint32_t nodeId, double value);
783  void WriteXmlNode (uint32_t id, uint32_t sysId, double locX, double locY);
784  void WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId);
785  void WriteXmlUpdateLink (uint32_t fromId, uint32_t toId, std::string);
786  void WriteXmlP (std::string pktType,
787  uint32_t fId,
788  double fbTx,
789  double lbTx,
790  uint32_t tId,
791  double fbRx,
792  double lbRx,
793  std::string metaInfo = "");
794  void WriteXmlP (uint64_t animUid, std::string pktType, uint32_t fId, double fbTx, double lbTx);
795  void WriteXmlPRef (uint64_t animUid, uint32_t fId, double fbTx, double lbTx, std::string metaInfo = "");
796  void WriteXmlClose (std::string name, bool routing = false);
797  void WriteXmlNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
798  void WriteXmlRouting (uint32_t id, std::string routingInfo);
799  void WriteXmlRp (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
800  void WriteXmlUpdateBackground (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
801 
802 };
803 
804 
805 
806 
818 class AnimByteTag : public Tag
819 {
820 public:
821 
827  static TypeId GetTypeId (void);
828 
834  virtual TypeId GetInstanceTypeId (void) const;
835 
841  virtual uint32_t GetSerializedSize (void) const;
842 
848  virtual void Serialize (TagBuffer i) const;
849 
855  virtual void Deserialize (TagBuffer i);
856 
862  virtual void Print (std::ostream &os) const;
863 
869  void Set (uint64_t AnimUid);
870 
876  uint64_t Get (void) const;
877 
878 private:
879  uint64_t m_AnimUid;
880 };
881 
882 
883 
884 }
885 #endif
886 
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:95
NodeCounterMap64 m_nodeQueueDequeue
std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > LinkPropertiesMap
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)
AnimRxInfo(const Time &fbRx, Ptr< const NetDevice > nd, double rxRange)
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 RemoveRxInfo(Ptr< const NetDevice > nd)
void QueueDropTrace(std::string context, Ptr< const Packet >)
void WriteXmlPRef(uint64_t animUid, uint32_t fId, double fbTx, double lbTx, std::string metaInfo="")
void OutputCsmaPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
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 ProcessRxBegin(Ptr< const NetDevice > nd, const Time fbRx)
void WriteXmlAddNodeCounter(uint32_t counterId, std::string counterName, CounterType counterType)
AnimRxInfo GetRxInfo(Ptr< const NetDevice > nd)
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)
bool ProcessRxEnd(Ptr< const NetDevice > nd, const Time fbRx, Vector rxLoc)
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
a 3d vector
Definition: vector.h:31
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 AddAttribute(std::string attribute, T value)
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.
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)
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.
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:41
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:845
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 ProcessRxDrop(Ptr< const NetDevice > nd)
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)
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 OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimRxInfo pktrxInfo, uint64_t animUid)
void EnableQueueCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Queue Counters such as Enqueue, Dequeue, Queue Drops.
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet >)
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
Definition: type-id.h:49
NodeCounterMap64 m_nodeWifiMacTxDrop
a 2d rectangle
Definition: rectangle.h:33
std::vector< std::string > m_nodeCounters
void(* AnimWriteCallback)(const char *str)
typedef for WriteCallBack used for listening to AnimationInterface write messages ...
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.
std::map< uint32_t, AnimRxInfo > m_rx
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 &)