24 #include "ns3/animation-interface.h"
25 #include "ns3/channel.h"
26 #include "ns3/config.h"
28 #include "ns3/mobility-model.h"
29 #include "ns3/packet.h"
30 #include "ns3/simulator.h"
31 #include "ns3/animation-interface-helper.h"
32 #include "ns3/wifi-mac-header.h"
33 #include "ns3/wimax-mac-header.h"
34 #include "ns3/wifi-net-device.h"
35 #include "ns3/wifi-mac.h"
36 #include "ns3/constant-position-mobility-model.h"
37 #include "ns3/lte-ue-phy.h"
38 #include "ns3/lte-enb-phy.h"
39 #include "ns3/uan-net-device.h"
40 #include "ns3/uan-mac.h"
42 #include "ns3/ipv4-routing-protocol.h"
56 #define PURGE_INTERVAL 5
66 : m_routingF (0), m_xml (usingXML), m_mobilityPollInterval (Seconds(0.25)),
67 m_outputFileName (fn),
68 m_outputFileSet (false), gAnimUid (0), m_randomPosition (true),
69 m_writeCallback (0), m_started (false),
70 m_enablePacketMetadata (false), m_startTime (Seconds(0)), m_stopTime (Seconds(3600 * 1000)),
71 m_maxPktsPerFile (maxPktsPerFile), m_originalFileName (fn),
72 m_routingStopTime (Seconds (0)), m_routingFileName (
""),
73 m_routingPollInterval (Seconds (5))
116 std::stringstream stream;
125 NS_LOG_INFO (
"RecursiveIpv4RoutePathSearch from:" << from.c_str () <<
" to:" << to.c_str ());
126 if ((from ==
"0.0.0.0") || (from ==
"127.0.0.1"))
128 NS_LOG_INFO (
"Got " << from.c_str () <<
" End recursion");
136 rpElements.push_back (elem);
171 std::ostringstream oss;
177 rpElements.push_back (elem);
181 rpElements.push_back (elem2);
187 rpElements.push_back (elem);
232 rpElements.push_back (elem);
236 std::ostringstream oss;
242 rpElements.push_back (elem);
246 rpElements.push_back (elem2);
252 rpElements.push_back (elem);
257 rpElements.push_back (elem);
302 std::ostringstream oss;
318 return "netanim-3.103";
337 NS_LOG_INFO (
"Creating new trace file:" << fn.c_str ());
338 m_f = std::fopen (fn.c_str (),
"w");
447 NS_LOG_UNCOND (
"AnimationInterface WARNING:Node:" << n->
GetId () <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
448 Vector deterministicVector (100,100,0);
483 std::vector <uint64_t> purgeList;
493 purgeList.push_back (i->first);
497 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
498 i != purgeList.end ();
510 std::vector <uint64_t> purgeList;
520 purgeList.push_back (i->first);
524 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
525 i != purgeList.end ();
538 std::vector <uint64_t> purgeList;
548 purgeList.push_back (i->first);
552 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
553 i != purgeList.end ();
564 std::vector <uint64_t> purgeList;
574 purgeList.push_back (i->first);
578 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
579 i != purgeList.end ();
589 Address nodeAddr = nd->GetAddress();
590 std::ostringstream oss;
592 return oss.str ().substr (6);
600 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
603 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
606 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
610 std::ostringstream oss;
635 struct Rgb rgb = {255, 0, 0};
643 std::ostringstream oss;
653 std::ostringstream oss;
664 uint32_t n1Id = n->
GetId ();
666 for (uint32_t i = 0; i < nDev; ++i)
675 if ((dev->GetInstanceTypeId ().GetName () ==
"ns3::LteUeNetDevice") ||
676 (dev->GetInstanceTypeId ().GetName () ==
"ns3::LteEnbNetDevice")||
677 (dev->GetInstanceTypeId ().GetName () ==
"ns3::VirtualNetDevice"))
684 std::string channelType = ch->GetInstanceTypeId ().GetName ();
686 if (channelType == std::string (
"ns3::PointToPointChannel"))
689 uint32_t nChDev = ch->GetNDevices ();
690 for (uint32_t j = 0; j < nChDev; ++j)
693 uint32_t n2Id = chDev->GetNode ()->GetId ();
701 std::ostringstream oss;
708 oss <<
"0.0 L " << n1Id <<
" " << n2Id << std::endl;
723 if (
m_xml && !restart)
751 std::ostringstream oss;
753 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
774 std::ostringstream oss;
776 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
797 for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
821 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
823 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin",
835 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin",
837 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd",
839 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd",
843 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
845 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
884 return WriteN (st.c_str (), st.length (), f);
889 std::vector < Ptr <Node> > MovedNodes;
912 MovedNodes.push_back (n);
930 uint32_t nLeft = count;
931 const char* p =
data;
932 uint32_t written = 0;
935 int n = std::fwrite (p, 1, nLeft, f);
950 std::ostringstream oss;
955 oss <<
GetXMLOpenClose_p (
"p", 0, fbTx, lbTx, 0, fbRx, lbRx,
"",
"DummyPktIgnoreThis");
963 NS_LOG_INFO (
"Writing Route Path From :" << nodeId <<
" To: " << destination.c_str ());
979 std::ostringstream oss;
993 std::ostringstream oss;
995 double lbTx = (now + txTime).GetSeconds ();
996 double fbRx = (now + rxTime - txTime).GetSeconds ();
997 double lbRx = (now + rxTime).GetSeconds ();
1000 oss <<
GetXMLOpenClose_p (
"p", tx->GetNode ()->GetId (), fbTx, lbTx, rx->GetNode ()->GetId (),
1007 oss << std::setprecision (10);
1009 << tx->GetNode ()->GetId () <<
" "
1010 << rx->GetNode ()->GetId () <<
" "
1011 << (now + txTime).GetSeconds () <<
" "
1012 << (now + rxTime - txTime).GetSeconds () <<
" "
1013 << (now + rxTime).GetSeconds () << std::endl;
1029 return n->
GetDevice (atoi (elements[3].c_str ()));
1114 NS_LOG_INFO (
"UanPhyGenRxTrace for packet:" << AnimUid);
1117 NS_LOG_WARN (
"UanPhyGenRxBeginTrace: unknown Uid");
1145 Mac48Address nodeAddr = netDevice->GetMac()->GetAddress();
1146 std::ostringstream oss;
1166 NS_LOG_INFO (
"TxDropTrace for packet:" << AnimUid);
1182 NS_LOG_INFO (
"Wifi RxBeginTrace for packet:" << AnimUid);
1186 std::ostringstream oss;
1202 NS_LOG_WARN (
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
1233 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1258 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1296 NS_LOG_INFO (
"WimaxRxTrace for packet:" << AnimUid);
1357 context =
"/" + context;
1363 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1389 context =
"/" + context;
1395 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1405 NS_LOG_WARN (
"LteSpectrumPhyRxTrace: unknown Uid");
1444 NS_LOG_INFO (
"CsmaPhyTxEndTrace for packet:" << AnimUid);
1450 NS_LOG_WARN (
"Unknown Uid, but adding Csma Packet anyway");
1475 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << AnimUid);
1479 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << AnimUid <<
" complete");
1506 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1526 v = mobility->GetPosition ();
1530 std::ostringstream oss;
1541 if ((ceil (oldLocation.
x) == ceil (newLocation.
x)) &&
1542 (ceil (oldLocation.
y) == ceil (newLocation.
y)))
1558 std::ostringstream oss;
1560 for (uint32_t i = 0; i < MovedNodes.size (); i++)
1582 std::ostringstream oss;
1607 "<information><!-- \n\
1608 Description of attributes:\n\
1609 =========================\n\
1611 * ver = Current version\n\
1613 * minX = minimum X coordinate of the canvas\n\
1614 * minY = minimum Y coordinate of the canvas\n\
1615 * maxX = maximum X coordinate of the canvas\n\
1616 * maxY = maximum Y coordinate of the canvas\n\
1619 * locX = X coordinate\n\
1620 * locY = Y coordinate\n\
1621 * r = Red component\n\
1622 * g = Green component\n\
1623 * b = Blue component\n\
1625 * fromId = From Node Id\n\
1626 * toId = To Node Id\n\
1627 * fd = From Node description (for IP Address)\n\
1628 * td = To Node description (for IP Address)\n\
1629 * ld = Link description (for Bandwidth, delay etc)\n\
1631 * t = Simulation time\n\
1632 * ld = Link description (for Bandwidth, delay etc)\n\
1634 * t = Simulation time\n\
1635 * descr = Node description\n\
1636 * r = Red component\n\
1637 * g = Green component\n\
1638 * b = Blue component\n\
1639 * visible = Node visibility\n\
1641 * fId = From Node Id\n\
1642 * fbTx = First bit transmit time\n\
1643 * lbTx = Last bit transmit time\n\
1644 * tId = To Node Id\n\
1645 * fbRx = First bit Rx Time\n\
1646 * lbRx = Last bit Rx\n\
1647 * meta-info = Packet meta data\n\
1649 * fId = From Node Id\n\
1650 * fbTx = First bit transmit time\n\
1651 * lbTx = Last bit transmit time\n\
1652 * range = Reception range\n\
1653 * tId = To Node Id\n\
1654 * fbRx = First bit Rx time\n\
1655 * meta-info = Packet meta data\n\
1656 * lbRx = Last bit Rx time-->\n\
1665 std::ostringstream oss;
1666 uint32_t nodeId = 0;
1668 nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1673 uint32_t rxId = pktrxInfo.
m_rxnd->GetNode ()->GetId ();
1684 std::ostringstream oss;
1686 uint32_t nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1687 uint32_t rxId = pktrxInfo.
m_rxnd->GetNode ()->GetId ();
1700 hubLoc = CreateObject<ConstantPositionMobilityModel> ();
1704 hubLoc->SetPosition (hubVec);
1705 NS_LOG_INFO (
"Node:" << n->
GetId () <<
" Position set to:(" << x <<
"," << y <<
"," << z <<
")");
1712 NS_FATAL_ERROR (
"SetBoundary must be used prior to creating the AnimationInterface object");
1728 NS_FATAL_ERROR (
"SetNodeColor must be used prior to creating the AnimationInterface object");
1731 struct Rgb rgb = {r, g, b};
1738 NS_LOG_INFO (
"Setting node visibility for Node Id:" << nodeId);
1739 std::ostringstream oss;
1758 NS_LOG_INFO (
"Setting node color for Node Id:" << nodeId);
1759 struct Rgb rgb = {r, g, b};
1761 std::ostringstream oss;
1770 for (uint32_t i = 0; i < nc.
GetN (); ++i)
1780 std::string linkDescription)
1782 std::ostringstream oss;
1788 std::string linkDescription)
1792 std::ostringstream oss;
1798 std::string linkDescription,
1799 std::string fromNodeDescription,
1800 std::string toNodeDescription)
1806 LinkProperties lp = { fromNodeDescription, toNodeDescription, linkDescription };
1822 std::string linkDescription,
1823 std::string fromNodeDescription,
1824 std::string toNodeDescription)
1835 NS_FATAL_ERROR (
"SetNodeDescription must be used prior to creating the AnimationInterface object");
1849 std::ostringstream oss;
1859 NS_FATAL_ERROR (
"SetNodeDescription must be used prior to creating the AnimationInterface object");
1860 for (uint32_t i = 0; i < nc.
GetN (); ++i)
1873 std::ostringstream oss;
1886 std::ostringstream oss;
1887 oss <<
"<topology minX = \"" << minX <<
"\" minY = \"" << minY
1888 <<
"\" maxX = \"" << maxX <<
"\" maxY = \"" << maxY
1889 <<
"\">" << std::endl;
1900 std::ostringstream oss;
1901 oss <<
"<nodeupdate id=\"" <<
id <<
"\"";
1904 oss <<
" visible=\"" << 1 <<
"\"";
1906 oss <<
" visible=\"" << 0 <<
"\"";
1913 oss <<
" descr=\"\"";
1915 oss <<
" r=\"" << (uint32_t)r <<
"\" "
1916 <<
" g=\"" << (uint32_t)g <<
"\" b=\"" << (uint32_t)b <<
"\"/>\n";
1923 std::ostringstream oss;
1924 oss <<
"<node id=\"" <<
id <<
"\"";
1931 oss <<
" descr=\"\"";
1933 oss <<
" locX = \"" << locX <<
"\" " <<
"locY = \"" << locY <<
"\" />\n";
1942 std::ostringstream oss;
1943 oss <<
"<node id = \"" <<
id <<
"\"";
1950 oss <<
" descr=\"\"";
1952 oss <<
" locX=\"" << locX <<
"\" " <<
"locY=\"" << locY <<
"\"" <<
" r=\"" << (uint32_t)r <<
"\" "
1953 <<
" g=\"" << (uint32_t)g <<
"\" b=\"" << (uint32_t)b <<
"\"/>\n";
1959 std::ostringstream oss;
1961 <<
" fromId=\"" << fromId
1962 <<
"\" toId=\"" << toId
1965 oss <<
" ld=\"" << linkDescription <<
"\""
1973 std::ostringstream oss;
1974 oss <<
"<link fromId=\"" << fromId
1975 <<
"\" toId=\"" << toId
2004 std::ostringstream oss;
2005 oss << std::setprecision (10);
2006 oss <<
"<p fId=\"" << fromId
2007 <<
"\" fbTx=\"" << fbTx
2008 <<
"\" lbTx=\"" << lbTx
2009 << (auxInfo.empty()?
"":
"\" aux=\"") << auxInfo.c_str () <<
"\">";
2015 std::ostringstream oss;
2017 <<
" id=\"" << nodeId <<
"\""
2018 <<
" info=\"" << routingInfo.c_str () <<
"\""
2019 <<
"/>" << std::endl;
2025 std::ostringstream oss;
2027 <<
" id=\"" << nodeId <<
"\"" <<
" d=\"" << destination.c_str () <<
"\""
2028 <<
" c=\"" << rpElements.size () <<
"\"" <<
">" << std::endl;
2029 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin ();
2030 i != rpElements.end ();
2034 oss <<
"<rpe" <<
" n=\"" << rpElement.
nodeId <<
"\"" <<
" nH=\"" << rpElement.
nextHop.c_str () <<
"\"" <<
"/>" << std::endl;
2036 oss <<
"</rp>" << std::endl;
2042 uint32_t tId,
double fbRx,
double lbRx, std::string metaInfo,
2043 std::string auxInfo)
2045 std::ostringstream oss;
2046 oss << std::setprecision (10);
2047 oss <<
"<" << pktType <<
" fId=\"" << fId
2048 <<
"\" fbTx=\"" << fbTx
2049 <<
"\" lbTx=\"" << lbTx <<
"\"";
2050 if (!auxInfo.empty ())
2052 oss <<
" aux=\"" << auxInfo.c_str () <<
"\"";
2054 if (!metaInfo.empty ())
2056 oss <<
" meta-info=\"" << metaInfo.c_str () <<
"\"";
2058 oss <<
" tId=\"" << tId <<
"\" fbRx=\"" << fbRx <<
"\" lbRx=\"" << lbRx <<
"\">" << std::endl;
2066 std::ostringstream oss;
2067 oss << std::setprecision (10);
2068 oss <<
"<wpacket fromId=\"" << fromId
2069 <<
"\" fbTx=\"" << fbTx
2070 <<
"\" lbTx=\"" << lbTx
2071 <<
"\" range=\"" << range <<
"\">" << std::endl;
2078 std::ostringstream oss;
2079 oss << std::setprecision (10);
2080 oss <<
"<rx toId=\"" << toId
2081 <<
"\" fbRx=\"" << fbRx
2082 <<
"\" lbRx=\"" << lbRx
2083 <<
"\"/>" << std::endl;
2089 std::ostringstream oss;
2090 oss <<
"<meta info=\""
2091 << metaInfo <<
"\" />" << std::endl;
2098 std::ostringstream oss;
2099 oss <<
"<nonp2plinkproperties id=\""
2101 <<
" ipv4Address=\"" << ipv4Address <<
"\""
2102 <<
" channelType=\"" << channelType <<
"\""
2103 <<
"/>" << std::endl;
2110 std::vector <std::string> elements;
2111 size_t pos1=0, pos2;
2112 while (pos1 != context.npos)
2114 pos1 = context.find (
"/",pos1);
2115 pos2 = context.find (
"/",pos1+1);
2116 elements.push_back (context.substr (pos1+1,pos2-(pos1+1)));
2118 pos2 = context.npos;
2128 .AddConstructor<AnimByteTag> ()
2141 return sizeof (uint64_t);
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)
bool WifiPacketIsPending(uint64_t AnimUid)
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
keep track of time values and allow control of global simulation resolution
std::vector< std::string > GetElementsFromContext(std::string context)
std::string GetXMLOpen_anim(uint32_t lp)
bool CsmaPacketIsPending(uint64_t AnimUid)
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
AnimRxInfo GetRxInfo(Ptr< const NetDevice > nd)
GetRxInfo.
static uint32_t GetNNodes(void)
std::vector< Ptr< Node > > RecalcTopoBounds()
void AddPendingWifiPacket(uint64_t AnimUid, AnimPacketInfo &)
std::vector< Ptr< Node > >::const_iterator Iterator
std::string GetPreamble(void)
bool LtePacketIsPending(uint64_t AnimUid)
Ipv4Address GetLocal(void) const
std::string GetIpv4Address(Ptr< NetDevice > nd)
void WriteU64(uint64_t v)
static Ptr< Node > GetNode(uint32_t n)
AnimationInterface & AddSourceDestination(uint32_t fromNodeId, std::string destinationIpv4Address)
Helper function to print the routing path from a source node to destination IP.
void EnablePacketMetadata(bool enable)
Enable Packet metadata.
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.
Mobility model for which the current position does not change once it has been set and until it is se...
bool ProcessRxEnd(Ptr< const NetDevice > nd, const Time &fbRx, Vector rxLoc)
Process RxEnd notifications.
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
#define NS_ASSERT(condition)
std::string GetXMLClose(std::string name)
uint64_t m_maxPktsPerFile
void WifiMacRxTrace(std::string context, Ptr< const Packet > p)
#define NS_LOG_COMPONENT_DEFINE(name)
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)
Vector GetPosition(void) const
void WifiPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
std::map< uint64_t, AnimPacketInfo > m_pendingWimaxPackets
void TrackIpv4RoutePaths()
NodeContainer m_routingNc
bool SetRoutingOutputFile(const std::string &fn)
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
uint64_t m_currentPktCount
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 &)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
virtual void Deserialize(TagBuffer i)
Deserialize function.
void Connect(std::string path, const CallbackBase &cb)
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
std::string GetIpv4RoutingTable(Ptr< Node > n)
void Print(std::ostream &os) const
void SetStartTime(Time t)
Specify the time at which capture should start.
void SetStopTime(Time t)
Specify the time at which capture should stop.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const =0
Get the routing protocol to be used by this Ipv4 stack.
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.
void ProcessRxBegin(Ptr< const NetDevice > nd, const Time &fbRx)
Process RxBegin notifications.
void ResetAnimWriteCallback()
Reset the write callback function.
#define NS_FATAL_ERROR(msg)
fatal error handling
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)
a polymophic address class
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.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
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.
Keep track of the current position and velocity of an object.
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.
static void SetBoundary(double minX, double minY, double maxX, double maxY)
Helper function to set the topology boundary rectangle.
void SetXMLOutput()
Specify that animation commands are to be written in XML format.
double GetSeconds(void) const
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)
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="")
static void EnablePrinting(void)
void SetRandomPosition(bool setRandPos)
Set random position if a Mobility Model does not exists for the node.
~AnimationInterface()
Destructor for the animator interface.
static Iterator End(void)
std::string GetNetAnimVersion()
Ptr< const NetDevice > m_rxnd
Ptr to receiving NetDevice.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
double m_fbRx
First bit receive time.
std::string m_outputFileName
double firstlastbitDelta
Time delta between First bit Rx and Last bit Rx.
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 >)
Ptr< NetDevice > GetDevice(uint32_t index) const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
ByteTagIterator GetByteTagIterator(void) const
std::map< uint64_t, AnimPacketInfo > m_pendingLtePackets
void StartAnimation(bool restart=false)
Writes the topology information and sets up the appropriate animation packet tx callback.
int64_t AssignStreams(int64_t stream)
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)
static std::map< uint32_t, Rgb > nodeColors
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet > p)
void AggregateObject(Ptr< Object > other)
Ipv4Address GetGateway(void) const
std::map< uint64_t, AnimPacketInfo > m_pendingCsmaPackets
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
std::string GetXMLOpen_wpacket(uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range)
int WriteN(const char *, uint32_t, FILE *f)
double m_lbTx
Last bit transmission time.
Access to the Ipv4 forwarding table, interfaces, and configuration.
void DevTxTrace(std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
uint32_t GetNDevices(void) const
uint32_t PeekHeader(Header &header) const
uint32_t m_txNodeId
Tx Node Id if NetDevice is unknown.
tag a set of bytes in a packet
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.
std::vector< Ptr< Node > >::const_iterator Iterator
void AddPendingWimaxPacket(uint64_t AnimUid, AnimPacketInfo &)
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Iterator over the set of byte tags in a packet.
static Rectangle * userBoundary
std::string linkDescription
#define NS_LOG_UNCOND(msg)
Time m_routingPollInterval
TypeId GetTypeId(void) const
virtual void Serialize(TagBuffer i) const
Serialize function.
bool UanPacketIsPending(uint64_t AnimUid)
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.
double m_lbRx
Last bit receive time.
void GetTag(Tag &tag) const
Vector UpdatePosition(Ptr< Node > n)
bool IsPhyRxComplete()
Check if Wifi Phy Rx is Complete.
uint64_t Get(void) const
Get Uid in tag.
Ipv4 addresses are stored in host order in this class.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
std::string m_routingFileName
std::map< uint64_t, AnimPacketInfo > m_pendingWifiPackets
uint32_t GetId(void) const
a class to store IPv4 address information on an interface
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)
Ptr< const NetDevice > m_txnd
Ptr to NetDevice that is transmitting.
std::string GetMacAddress(Ptr< NetDevice > nd)
static Iterator Begin(void)
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
#define NS_LOG_DEBUG(msg)
AnimationInterface(const std::string filename, uint64_t maxPktsPerFile=MAX_PKTS_PER_TRACE_FILE, bool usingXML=true)
Constructor.
std::string GetXMLOpenClose_rp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
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)
bool m_enablePacketMetadata
void WifiPhyRxEndTrace(std::string context, Ptr< const Packet > p)
std::string fromNodeDescription
static std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > linkProperties
double m_fbTx
First bit transmission time.
static bool IsFinished(void)
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 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 toNodeDescription
Time m_mobilityPollInterval
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.
Ptr< T > GetObject(void) const
bool WimaxPacketIsPending(uint64_t AnimUid)
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
static std::map< uint32_t, std::string > nodeDescriptions
TypeId SetParent(TypeId tid)
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)
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 ConnectWithoutContext(std::string path, const CallbackBase &cb)
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
std::string m_originalFileName
void AddByteTag(const Tag &tag) const
AnimPacketInfo helper class.