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 #include "ns3/ptr.h"
29 #include "ns3/net-device.h"
30 #include "ns3/node-container.h"
31 #include "ns3/nstime.h"
32 #include "ns3/log.h"
33 #include "ns3/node-list.h"
34 #include "ns3/random-variable-stream.h"
35 #include "ns3/simulator.h"
36 #include "ns3/config.h"
37 #include "ns3/animation-interface-helper.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 
44 namespace ns3 {
45 
46 #define MAX_PKTS_PER_TRACE_FILE 100000
47 struct Rgb;
48 struct NodeSize;
49 typedef struct
50 {
51  uint32_t fromNode;
52  uint32_t toNode;
54 
55 typedef struct
56 {
57  std::string fromNodeDescription;
58  std::string toNodeDescription;
59  std::string linkDescription;
61 
62 
64 {
66  {
67  //Check if they are the same node pairs but flipped
68  if ( ((first.fromNode == second.fromNode) && (first.toNode == second.toNode)) ||
69  ((first.fromNode == second.toNode) && (first.toNode == second.fromNode)) )
70  {
71  return false;
72  }
73  std::ostringstream oss1;
74  oss1 << first.fromNode << first.toNode;
75  std::ostringstream oss2;
76  oss2 << second.fromNode << second.toNode;
77  return oss1.str () < oss2.str ();
78  }
79 
80 };
81 
83  std::string destination;
84  uint32_t fromNodeId;
85 };
86 
87 
88 typedef struct {
89  uint32_t nodeId;
90  std::string nextHop;
91 
93 
109 {
110 public:
111 
123  AnimationInterface (const std::string filename, bool enable3105 = true,
124  uint64_t maxPktsPerFile = MAX_PKTS_PER_TRACE_FILE);
125 
129  typedef enum
130  {
133  } CounterType;
134 
140 
152  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval = Seconds (5));
153 
166  AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval = Seconds (5));
167 
173  static bool IsInitialized (void);
174 
182  void SetStartTime (Time t);
183 
191  void SetStopTime (Time t);
192 
201  void SetMobilityPollInterval (Time t);
202 
210  void SetRandomPosition (bool setRandPos);
211 
217  typedef void (*AnimWriteCallback) (const char * str);
218 
226 
231  void ResetAnimWriteCallback ();
232 
241  static void SetConstantPosition (Ptr <Node> n, double x, double y, double z=0);
242 
249  static void SetNodeDescription (Ptr <Node> n, std::string descr);
250 
257  void UpdateNodeDescription (Ptr <Node> n, std::string descr);
258 
265  void UpdateNodeDescription (uint32_t nodeId, std::string descr);
266 
273  void ShowNode (uint32_t nodeId, bool show = true);
274 
281  void ShowNode (Ptr <Node> n, bool show = true);
282 
289  static void SetNodeDescription (NodeContainer nc, std::string descr);
290 
299  static void SetNodeColor (Ptr <Node> n, uint8_t r, uint8_t g, uint8_t b);
300 
307  void UpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
315  void UpdateNodeSize (uint32_t nodeId, double width, double height);
316 
325  void UpdateNodeColor (Ptr <Node> n, uint8_t r, uint8_t g, uint8_t b);
326 
335  void UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
336 
337 
346  static void SetNodeColor (NodeContainer nc, uint8_t r, uint8_t g, uint8_t b);
347 
348 
356  void UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter);
357 
368  void SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
369 
379  static void SetLinkDescription (uint32_t fromNode, uint32_t toNode,
380  std::string linkDescription,
381  std::string fromNodeDescription = "",
382  std::string toNodeDescription = "");
383 
393  static void SetLinkDescription (Ptr <Node> fromNode, Ptr <Node> toNode,
394  std::string linkDescription,
395  std::string fromNodeDescription = "",
396  std::string toNodeDescription = "");
397 
398 
406  void UpdateLinkDescription (uint32_t fromNode, uint32_t toNode,
407  std::string linkDescription);
408 
416  void UpdateLinkDescription (Ptr <Node> fromNode, Ptr <Node> toNode,
417  std::string linkDescription);
418 
426  AnimationInterface & AddSourceDestination (uint32_t fromNodeId, std::string destinationIpv4Address);
427 
433  bool IsStarted (void);
434 
439  void SkipPacketTracing ();
440 
447  void EnablePacketMetadata (bool enable = true);
448 
456  uint64_t GetTracePktCount ();
457 
466  uint32_t AddNodeCounter (std::string counterName, CounterType counterType);
467 
476  uint32_t AddResource (std::string resourcePath);
477 
485  double GetNodeEnergyFraction (Ptr <const Node> node) const;
486 
495  int64_t AssignStreams (int64_t stream);
496 
497 private:
498  FILE * m_f; // File handle for output (0 if none)
499  FILE * m_routingF; // File handle for routing table output (0 if None);
500  // Write specified amount of data to the specified handle
501  int WriteN (const char*, uint32_t, FILE * f);
503  std::string m_outputFileName;
505  uint64_t gAnimUid ; // Packet unique identifier used by Animtion
508  bool m_started;
513  std::string m_originalFileName;
515  std::string m_routingFileName;
518 
519  void TrackIpv4Route ();
520  void TrackIpv4RoutePaths ();
521  std::string GetIpv4RoutingTable (Ptr <Node> n);
522 
534  bool SetOutputFile (const std::string& fn);
535  bool SetRoutingOutputFile (const std::string& fn);
536 
544  void SetXMLOutput ();
545 
557  void StartAnimation (bool restart = false);
558 
563  void StopAnimation (bool onlyAnimation = false);
564 
565  void DevTxTrace (std::string context,
567  Ptr<NetDevice> tx,
568  Ptr<NetDevice> rx,
569  Time txTime,
570  Time rxTime);
571  void WifiPhyTxBeginTrace (std::string context,
573  void WifiPhyTxEndTrace (std::string context,
575  void WifiPhyTxDropTrace (std::string context,
577  void WifiPhyRxBeginTrace (std::string context,
579  void WifiPhyRxEndTrace (std::string context,
581  void WifiMacRxTrace (std::string context,
583  void WifiPhyRxDropTrace (std::string context,
585  void WimaxTxTrace (std::string context,
587  const Mac48Address &);
588  void WimaxRxTrace (std::string context,
590  const Mac48Address &);
591  void CsmaPhyTxBeginTrace (std::string context,
593  void CsmaPhyTxEndTrace (std::string context,
595  void CsmaPhyRxEndTrace (std::string context,
597  void CsmaMacRxTrace (std::string context,
599 
600  void LteTxTrace (std::string context,
602  const Mac48Address &);
603 
604  void LteRxTrace (std::string context,
606  const Mac48Address &);
607 
608  void LteSpectrumPhyTxStart (std::string context,
610  void LteSpectrumPhyRxStart (std::string context,
612 
613  void UanPhyGenTxTrace (std::string context,
615  void UanPhyGenRxTrace (std::string context,
617 
618  void RemainingEnergyTrace (std::string context, double previousEnergy, double currentEnergy);
619 
621 
622  // Write a string to the specified handle;
623  int WriteN (const std::string&, FILE * f);
624 
625  void OutputWirelessPacket (Ptr<const Packet> p, AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
626  void OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
627  void MobilityAutoCheck ();
628 
629 
630  std::map<uint64_t, AnimPacketInfo> m_pendingWifiPackets;
631  void AddPendingWifiPacket (uint64_t AnimUid, AnimPacketInfo&);
632  bool WifiPacketIsPending (uint64_t AnimUid);
633 
634  std::map<uint64_t, AnimPacketInfo> m_pendingWimaxPackets;
635  void AddPendingWimaxPacket (uint64_t AnimUid, AnimPacketInfo&);
636  bool WimaxPacketIsPending (uint64_t AnimUid);
637 
638  std::map<uint64_t, AnimPacketInfo> m_pendingLtePackets;
639  void AddPendingLtePacket (uint64_t AnimUid, AnimPacketInfo&);
640  bool LtePacketIsPending (uint64_t AnimUid);
641 
642  std::map<uint64_t, AnimPacketInfo> m_pendingCsmaPackets;
643  void AddPendingCsmaPacket (uint64_t AnimUid, AnimPacketInfo&);
644  bool CsmaPacketIsPending (uint64_t AnimUid);
645 
646  std::map<uint64_t, AnimPacketInfo> m_pendingUanPackets;
647  void AddPendingUanPacket (uint64_t AnimUid, AnimPacketInfo&);
648  bool UanPacketIsPending (uint64_t AnimUid);
649 
651 
652  std::map<uint32_t, Vector> m_nodeLocation;
656  void WriteDummyPacket ();
657  bool NodeHasMoved (Ptr <Node> n, Vector newLocation);
658 
659  void PurgePendingWifi ();
660  void PurgePendingWimax ();
661  void PurgePendingLte ();
662  void PurgePendingCsma ();
663 
664  // Recalculate topology bounds
665  void RecalcTopoBounds (Vector v);
666  std::vector < Ptr <Node> > RecalcTopoBounds ();
667 
668  void ConnectCallbacks ();
669  void ConnectLte ();
670  void ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex);
671  void ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex);
672 
673 
674  std::map <std::string, uint32_t> m_macToNodeIdMap;
675  std::map <std::string, uint32_t> m_ipv4ToNodeIdMap;
676  void AddToIpv4AddressNodeIdTable (std::string, uint32_t);
677  std::vector <Ipv4RouteTrackElement> m_ipv4RouteTrackElements;
678  typedef std::vector <Ipv4RoutePathElement> Ipv4RoutePathElements;
679  void RecursiveIpv4RoutePathSearch (std::string fromIpv4, std::string toIpv4, Ipv4RoutePathElements &);
680  void WriteRoutePath (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
681  bool IsInTimeWindow ();
682 
683  // Path helper
684  const std::vector<std::string> GetElementsFromContext (const std::string& context) const;
685  Ptr <Node> GetNodeFromContext (const std::string& context) const;
686  Ptr <NetDevice> GetNetDeviceFromContext (std::string context);
687 
688  typedef std::map <uint32_t, double> EnergyFractionMap;
689 
690  static std::map <uint32_t, Rgb> nodeColors;
691  static std::map <uint32_t, std::string> nodeDescriptions;
692  static std::map <P2pLinkNodeIdPair, LinkProperties, LinkPairCompare> linkProperties;
695 
696  std::map <uint32_t, NodeSize> m_nodeSizes;
697  std::vector <std::string> m_resources;
698  std::vector <std::string> m_nodeCounters;
699  void StartNewTraceFile ();
700 
701  std::string GetMacAddress (Ptr <NetDevice> nd);
702  std::string GetIpv4Address (Ptr <NetDevice> nd);
703  void WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
704 
705  void WriteNodeUpdate (uint32_t nodeId);
706 
707  std::string GetNetAnimVersion ();
708 
709  // XML helpers
710  std::string GetPreamble (void);
711  std::string CounterTypeToString (CounterType counterType);
712  // Topology element dimensions
713  double m_topoMinX;
714  double m_topoMinY;
715  double m_topoMaxX;
716  double m_topoMaxY;
717 
721  std::string GetPacketMetadata (Ptr<const Packet> p);
722 
723  std::string GetXMLOpen_anim (uint32_t lp);
724  std::string GetXMLOpenCloseUpdateNodePosition (uint32_t nodeId, double x, double y);
725  std::string GetXMLOpenCloseUpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b);
726  std::string GetXMLOpenCloseUpdateNodeDescription (uint32_t nodeId);
727  std::string GetXMLOpenCloseUpdateNodeSize (uint32_t nodeId, double width, double height);
728  std::string GetXMLOpenCloseAddResource (uint32_t resourceId, std::string resourcePath);
729  std::string GetXMLOpenCloseAddNodeCounter (uint32_t counterId, std::string counterName, CounterType counterType);
730  std::string GetXMLOpenCloseUpdateNodeImage (uint32_t nodeId, uint32_t resourceId);
731  std::string GetXMLOpenCloseUpdateNodeCounter (uint32_t counterId, uint32_t nodeId, double value);
732  std::string GetXMLOpen_topology (double minX, double minY, double maxX, double maxY);
733  std::string GetXMLOpenClose_node (uint32_t lp, uint32_t id, double locX, double locY);
734  std::string GetXMLOpenClose_node (uint32_t lp, uint32_t id, double locX, double locY, struct Rgb rgb);
735  std::string GetXMLOpenClose_nodeupdate (uint32_t id, bool visible = true);
736  std::string GetXMLOpenClose_link (uint32_t fromLp, uint32_t fromId, uint32_t toLp, uint32_t toId);
737  std::string GetXMLOpenClose_linkupdate (uint32_t fromId, uint32_t toId, std::string);
738  std::string GetXMLOpen_packet (uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, std::string auxInfo = "");
739  std::string GetXMLOpenClose_p (std::string pktType, uint32_t fId, double fbTx, double lbTx, uint32_t tId, double fbRx, double lbRx,
740  std::string metaInfo = "", std::string auxInfo = "");
741  std::string GetXMLOpenClose_rx (uint32_t toLp, uint32_t toId, double fbRx, double lbRx);
742  std::string GetXMLOpen_wpacket (uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range);
743  std::string GetXMLClose (std::string name) {return "</" + name + ">\n"; }
744  std::string GetXMLOpenClose_meta (std::string metaInfo);
745  std::string GetXMLOpenClose_NonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType);
746  std::string GetXMLOpenClose_routing (uint32_t id, std::string routingInfo);
747  std::string GetXMLOpenClose_rp (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
748  std::string GetXMLOpenCloseUpdateBackground (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity);
749 
750  void AppendXMLNodeDescription (std::ostream& ostream, uint32_t id) const;
751  void AppendXMLNodeColor (std::ostream& ostream, const Rgb& color) const;
752  void AppendXMLRemainingEnergy (std::ostream& ostream, uint32_t id) const;
753 
756 };
757 
763 struct Rgb
764 {
765  uint8_t r;
766  uint8_t g;
767  uint8_t b;
768 };
769 
775 struct NodeSize
776 {
777  double width;
778  double height;
779 };
780 
781 
793 class AnimByteTag : public Tag
794 {
795 public:
796 
802  static TypeId GetTypeId (void);
803 
809  virtual TypeId GetInstanceTypeId (void) const;
810 
816  virtual uint32_t GetSerializedSize (void) const;
817 
823  virtual void Serialize (TagBuffer i) const;
824 
830  virtual void Deserialize (TagBuffer i);
831 
837  virtual void Print (std::ostream &os) const;
838 
844  void Set (uint64_t AnimUid);
845 
851  uint64_t Get (void) const;
852 
853 private:
854  uint64_t m_AnimUid;
855 };
856 
857 }
858 #endif
859 
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
void Set(uint64_t AnimUid)
Set global Uid in tag.
std::string GetXMLOpenClose_nodeupdate(uint32_t id, bool visible=true)
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.
bool WifiPacketIsPending(uint64_t AnimUid)
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
std::string GetXMLOpen_anim(uint32_t lp)
bool CsmaPacketIsPending(uint64_t AnimUid)
std::vector< Ptr< Node > > RecalcTopoBounds()
void AddPendingWifiPacket(uint64_t AnimUid, AnimPacketInfo &)
bool LtePacketIsPending(uint64_t AnimUid)
std::string GetIpv4Address(Ptr< NetDevice > nd)
std::string CounterTypeToString(CounterType counterType)
AnimationInterface & AddSourceDestination(uint32_t fromNodeId, std::string destinationIpv4Address)
Helper function to print the routing path from a source node to destination IP.
AnimRxInfo helper class.
static TypeId GetTypeId(void)
Get Type Id.
std::string GetXMLOpenClose_NonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
static void SetNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to set the node color.
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
std::string GetXMLClose(std::string name)
void WifiMacRxTrace(std::string context, Ptr< const Packet > p)
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)
std::map< uint64_t, AnimPacketInfo > m_pendingWimaxPackets
bool SetRoutingOutputFile(const std::string &fn)
A structure to store the width and height of a node`.
std::string GetXMLOpenClose_rx(uint32_t toLp, uint32_t toId, double fbRx, double lbRx)
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 ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
std::string GetIpv4RoutingTable(Ptr< Node > n)
void SetStartTime(Time t)
Specify the time at which capture should start.
void SetStopTime(Time t)
Specify the time at which capture should stop.
a 3d vector
Definition: vector.h:31
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
double stopTime
void ResetAnimWriteCallback()
Reset the write callback function.
std::string GetXMLOpenClose_node(uint32_t lp, uint32_t id, double locX, double locY)
AnimWriteCallback m_writeCallback
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet > p)
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 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.
static void SetLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription, std::string fromNodeDescription="", std::string toNodeDescription="")
Helper function to set the description for a link.
void SetXMLOutput()
Specify that animation commands are to be written in XML format.
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
std::string GetXMLOpen_packet(uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, std::string auxInfo="")
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
void RemainingEnergyTrace(std::string context, double previousEnergy, double currentEnergy)
std::string GetXMLOpenClose_p(std::string pktType, uint32_t fId, double fbTx, double lbTx, uint32_t tId, double fbRx, double lbRx, std::string metaInfo="", std::string auxInfo="")
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
void SetRandomPosition(bool setRandPos)
Set random position if a Mobility Model does not exists for the node.
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
~AnimationInterface()
Destructor for the animator interface.
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)
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
static void SetNodeDescription(Ptr< Node > n, std::string descr)
Helper function to set a brief description for a given node.
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
std::map< uint64_t, AnimPacketInfo > m_pendingLtePackets
std::string GetXMLOpenCloseUpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
void StartAnimation(bool restart=false)
Writes the topology information and sets up the appropriate animation packet tx callback.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
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.
void OutputWirelessPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
std::string GetXMLOpenCloseUpdateNodePosition(uint32_t nodeId, double x, double y)
static std::map< uint32_t, Rgb > nodeColors
std::map< uint32_t, NodeSize > m_nodeSizes
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet > p)
std::map< uint32_t, double > EnergyFractionMap
std::string GetXMLOpenCloseUpdateNodeColor(uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
std::map< uint64_t, AnimPacketInfo > m_pendingCsmaPackets
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
std::vector< std::string > m_resources
std::string GetXMLOpen_wpacket(uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range)
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 AddPendingUanPacket(uint64_t AnimUid, AnimPacketInfo &)
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 AppendXMLRemainingEnergy(std::ostream &ostream, uint32_t id) const
void AddPendingWimaxPacket(uint64_t AnimUid, AnimPacketInfo &)
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
an EUI-48 address
Definition: mac48-address.h:41
std::string GetXMLOpenCloseUpdateNodeDescription(uint32_t nodeId)
AnimationInterface(const std::string filename, bool enable3105=true, uint64_t maxPktsPerFile=MAX_PKTS_PER_TRACE_FILE)
Constructor.
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
virtual void Serialize(TagBuffer i) const
Serialize function.
bool UanPacketIsPending(uint64_t AnimUid)
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
bool SetOutputFile(const std::string &fn)
Specify that animation commands are to be written to the specified output file.
Byte tag using by Anim to uniquely identify packets.
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
void StopAnimation(bool onlyAnimation=false)
Closes the interface to the animator.
Vector UpdatePosition(Ptr< Node > n)
std::string GetXMLOpenCloseUpdateNodeSize(uint32_t nodeId, double width, double height)
std::string GetXMLOpenCloseAddResource(uint32_t resourceId, std::string resourcePath)
uint64_t Get(void) const
Get Uid in tag.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
read and write tag data
Definition: tag-buffer.h:51
std::map< uint64_t, AnimPacketInfo > m_pendingWifiPackets
std::map< uint64_t, AnimPacketInfo > m_pendingUanPackets
std::string GetXMLOpenClose_linkupdate(uint32_t fromId, uint32_t toId, std::string)
std::string GetXMLOpenClose_routing(uint32_t id, std::string routingInfo)
std::string GetMacAddress(Ptr< NetDevice > nd)
#define MAX_PKTS_PER_TRACE_FILE
std::string GetXMLOpenCloseAddNodeCounter(uint32_t counterId, std::string counterName, CounterType counterType)
std::string GetXMLOpenClose_rp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
std::string GetXMLOpenCloseUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
void WifiPhyTxEndTrace(std::string context, Ptr< const Packet > p)
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 WifiPhyRxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetXMLOpenCloseUpdateBackground(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
static std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > linkProperties
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 AddPendingLtePacket(uint64_t AnimUid, AnimPacketInfo &)
void AddPendingCsmaPacket(uint64_t AnimUid, AnimPacketInfo &)
void AppendXMLNodeDescription(std::ostream &ostream, uint32_t id) const
void AppendXMLNodeColor(std::ostream &ostream, const Rgb &color) const
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
A structure to store red, blue and green components for entities such as nodes.
std::string GetXMLOpenClose_meta(std::string metaInfo)
void ShowNode(uint32_t nodeId, bool show=true)
Helper function to show/hide a node.
bool IsStarted(void)
Is AnimationInterface started.
bool WimaxPacketIsPending(uint64_t AnimUid)
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
Definition: type-id.h:49
static std::map< uint32_t, std::string > nodeDescriptions
std::string GetXMLOpenClose_link(uint32_t fromLp, uint32_t fromId, uint32_t toLp, uint32_t toId)
std::string GetXMLOpen_topology(double minX, double minY, double maxX, double maxY)
std::vector< std::string > m_nodeCounters
void(* AnimWriteCallback)(const char *str)
typedef for WriteCallBack used for listening to AnimationInterface write messages ...
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 LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
AnimPacketInfo helper class.