32 #include "ns3/animation-interface.h"
33 #include "ns3/channel.h"
34 #include "ns3/config.h"
36 #include "ns3/mobility-model.h"
37 #include "ns3/packet.h"
38 #include "ns3/simulator.h"
39 #include "ns3/wifi-mac-header.h"
40 #include "ns3/wimax-mac-header.h"
41 #include "ns3/wifi-net-device.h"
42 #include "ns3/wifi-mac.h"
43 #include "ns3/constant-position-mobility-model.h"
44 #include "ns3/lte-ue-phy.h"
45 #include "ns3/lte-enb-phy.h"
46 #include "ns3/uan-net-device.h"
47 #include "ns3/uan-mac.h"
49 #include "ns3/ipv4-routing-protocol.h"
50 #include "ns3/energy-source-container.h"
66 m_mobilityPollInterval (
Seconds (0.25)),
67 m_outputFileName (fn),
71 m_enablePacketMetadata (false),
73 m_stopTime (
Seconds (3600 * 1000)),
75 m_originalFileName (fn),
76 m_routingStopTime (
Seconds (0)),
77 m_routingFileName (
""),
78 m_routingPollInterval (
Seconds (5)),
291 loc = CreateObject<ConstantPositionMobilityModel> ();
294 Vector hubVec (x, y, z);
295 loc->SetPosition (hubVec);
296 NS_LOG_INFO (
"Node:" << n->
GetId () <<
" Position set to:(" << x <<
"," << y <<
"," << z <<
")");
303 NS_LOG_INFO (
"Setting node image for Node Id:" << nodeId);
306 NS_FATAL_ERROR (
"Resource Id:" << resourceId <<
" not found. Did you use AddResource?");
316 NS_FATAL_ERROR (
"NodeCounter Id:" << nodeCounterId <<
" not found. Did you use AddNodeCounter?");
324 if ((opacity < 0) || (opacity > 1))
349 NS_LOG_INFO (
"Setting node color for Node Id:" << nodeId);
357 std::string linkDescription)
364 std::string linkDescription)
391 const EnergyFractionMap::const_iterator fractionIter =
m_nodeEnergyFraction.find (node->GetId ());
393 return fractionIter->second;
410 v = mobility->GetPosition ();
420 if ((ceil (oldLocation.x) == ceil (newLocation.x)) &&
421 (ceil (oldLocation.y) == ceil (newLocation.y)))
437 for (uint32_t i = 0; i < MovedNodes.size (); i++)
454 std::vector <Ptr <Node> >
457 std::vector < Ptr <Node> > movedNodes;
479 movedNodes.push_back (n);
494 return WriteN (st.c_str (), st.length (), f);
503 uint32_t nLeft = count;
504 const char* p =
data;
505 uint32_t written = 0;
508 int n = std::fwrite (p, 1, nLeft, f);
523 NS_LOG_INFO (
"Writing Route Path From :" << nodeId <<
" To: " << destination.c_str ());
543 const std::vector<std::string>
546 std::vector <std::string> elements;
548 while (pos1 != context.npos)
550 pos1 = context.find (
"/",pos1);
551 pos2 = context.find (
"/",pos1+1);
552 elements.push_back (context.substr (pos1+1,pos2-(pos1+1)));
582 return n->
GetDevice (atoi (elements.at (3).c_str ()));
626 const uint32_t nodeId = node->GetId ();
628 NS_LOG_INFO (
"Remaining energy on one of sources on node " << nodeId <<
": " << currentEnergy);
634 const double energyFraction = currentEnergy / energySource->GetInitialEnergy ();
636 NS_LOG_INFO (
"Total energy fraction on node " << nodeId <<
": " << energyFraction);
748 double lbTx = (now + txTime).GetSeconds ();
749 double fbRx = (now + rxTime - txTime).GetSeconds ();
750 double lbRx = (now + rxTime).GetSeconds ();
753 tx->GetNode ()->GetId (),
756 rx->GetNode ()->GetId (),
790 NS_LOG_INFO (
"UanPhyGenRxTrace for packet:" << animUid);
793 NS_LOG_WARN (
"UanPhyGenRxBeginTrace: unknown Uid");
819 Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress ();
820 std::ostringstream oss;
839 NS_LOG_INFO (
"Wifi RxBeginTrace for packet:" << animUid);
844 std::ostringstream oss;
854 NS_LOG_WARN (
"Transmitter Mac address " << oss.str () <<
" never seen before. Skipping");
861 NS_LOG_WARN (
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
898 NS_LOG_INFO (
"WimaxRxTrace for packet:" << animUid);
957 context =
"/" + context;
963 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
989 context =
"/" + context;
995 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1005 NS_LOG_WARN (
"LteSpectrumPhyRxTrace: unknown Uid");
1043 NS_LOG_INFO (
"CsmaPhyTxEndTrace for packet:" << animUid);
1051 NS_LOG_WARN (
"Unknown Uid, but adding Csma Packet anyway");
1077 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid);
1078 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid <<
" complete");
1101 NS_LOG_INFO (
"MacRxTrace for packet:" << animUid <<
" complete");
1109 uint32_t nodeId = 0;
1111 nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1122 uint32_t rxId = pktInfo.
m_rxnd->GetNode ()->GetId ();
1131 uint32_t nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1132 uint32_t rxId = pktInfo.
m_rxnd->GetNode ()->GetId ();
1149 pendingPackets->insert (AnimUidPacketInfoMap::value_type (animUid, pktInfo));
1157 return (pendingPackets->find (animUid) != pendingPackets->end ());
1165 if (pendingPackets->empty ())
1167 std::vector <uint64_t> purgeList;
1168 for (AnimUidPacketInfoMap::iterator i = pendingPackets->begin ();
1169 i != pendingPackets->end ();
1177 purgeList.push_back (i->first);
1180 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
1181 i != purgeList.end ();
1184 pendingPackets->erase (*i);
1192 switch (protocolType)
1220 return pendingPackets;
1229 std::string typeString =
"unknown";
1230 switch (counterType)
1234 typeString =
"UINT32";
1239 typeString =
"DOUBLE";
1251 std::ostringstream oss;
1321 std::ostringstream oss;
1323 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
1345 std::ostringstream oss;
1347 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
1369 for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
1381 if (lteEnbNetDevice)
1394 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
1396 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin",
1408 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin",
1410 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd",
1412 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd",
1414 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
1416 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
1418 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
1420 Config::Connect (
"/NodeList/*/$ns3::BasicEnergySource/RemainingEnergy",
1434 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Enqueue",
1436 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Enqueue",
1438 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Enqueue",
1443 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Dequeue",
1445 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Dequeue",
1447 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Dequeue",
1452 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Drop",
1454 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Drop",
1456 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Drop",
1461 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
1463 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTxDrop",
1465 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
1467 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRxDrop",
1471 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop",
1473 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1487 NS_LOG_UNCOND (
"AnimationInterface WARNING:Node:" << n->
GetId () <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
1514 Address nodeAddr = nd->GetAddress ();
1515 std::ostringstream oss;
1517 return oss.str ().substr (6);
1526 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
1529 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
1532 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
1536 std::ostringstream oss;
1548 uint32_t n1Id = n->
GetId ();
1550 for (uint32_t i = 0; i < nDev; ++i)
1559 if ((dev->GetInstanceTypeId ().GetName () ==
"ns3::LteUeNetDevice") ||
1560 (dev->GetInstanceTypeId ().GetName () ==
"ns3::LteEnbNetDevice")||
1561 (dev->GetInstanceTypeId ().GetName () ==
"ns3::VirtualNetDevice"))
1568 std::string channelType = ch->GetInstanceTypeId ().GetName ();
1570 if (channelType == std::string (
"ns3::PointToPointChannel"))
1573 uint32_t nChDev = ch->GetNDevices ();
1574 for (uint32_t j = 0; j < nChDev; ++j)
1577 uint32_t n2Id = chDev->GetNode ()->GetId ();
1671 if (!routing &&
m_f)
1681 NS_LOG_INFO (
"Creating new trace file:" << fn.c_str ());
1683 f = std::fopen (fn.c_str (),
"w");
1751 NS_LOG_WARN (
"Routing protocol object not found");
1765 rpElements.push_back (elem);
1769 std::ostringstream oss;
1775 rpElements.push_back (elem);
1779 rpElements.push_back (elem2);
1785 rpElements.push_back (elem);
1790 rpElements.push_back (elem);
1857 NS_LOG_INFO (
"TrackIpv4L3ProtocolCounters Completed");
1909 std::stringstream stream;
1912 return stream.str ();
1919 NS_LOG_INFO (
"RecursiveIpv4RoutePathSearch from:" << from.c_str () <<
" to:" << to.c_str ());
1920 if ((from ==
"0.0.0.0") || (from ==
"127.0.0.1"))
1922 NS_LOG_INFO (
"Got " << from.c_str () <<
" End recursion");
1930 rpElements.push_back (elem);
1952 NS_LOG_WARN (
"Routing protocol object not found");
1965 std::ostringstream oss;
1971 rpElements.push_back (elem);
1975 rpElements.push_back (elem2);
1981 rpElements.push_back (elem);
1995 template <
typename T>
1999 std::ostringstream oss;
2000 oss << std::setprecision (10);
2002 m_elementString += attribute.c_str ();
2003 m_elementString +=
"=\"" + oss.str () +
"\" ";
2009 m_elementString +=
">\n";
2015 m_elementString +=
">";
2021 m_elementString +=
"\n";
2033 return m_elementString;
2059 std::string closeString =
"</" + name +
">\n";
2145 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin ();
2146 i != rpElements.end ();
2153 rpeElement.
Close ();
2154 element.
Add (rpeElement);
2167 if (!metaInfo.empty ())
2189 uint32_t tId,
double fbRx,
double lbRx, std::string metaInfo)
2195 if (!metaInfo.empty ())
2337 .SetGroupName (
"NetAnim")
2346 return GetTypeId ();
2352 return sizeof (uint64_t);
2370 os <<
"AnimUid=" << m_AnimUid;
2376 m_AnimUid = AnimUid;
2408 m_fbTx (fbTx.GetSeconds ()),
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 CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
void WriteXmlNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
Simulation virtual time values and global simulation resolution.
CounterType
Counter Types.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
SocketErrno
Enumeration of the possible errors returned by a socket.
NodeCounterMap64 m_nodeQueueDequeue
void WifiMacRxTrace(std::string context, Ptr< const Packet >)
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Ipv4Address GetLocal(void) const
Get the local address.
std::string GetIpv4Address(Ptr< NetDevice > nd)
std::string CounterTypeToString(CounterType counterType)
void WriteU64(uint64_t v)
AnimationInterface(const std::string filename)
Constructor.
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 WriteXmlUpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
static TypeId GetTypeId(void)
Get Type Id.
void TrackIpv4L3ProtocolCounters()
Introspection did not find any typical Config paths.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
Ptr< LteEnbPhy > GetPhy(void) const
Mobility model for which the current position does not change once it has been set and until it is se...
AnimUidPacketInfoMap m_pendingWifiPackets
void WriteXmlUpdateNodePosition(uint32_t nodeId, double x, double y)
NodeDescriptionsMap m_nodeDescriptions
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
uint32_t m_ipv4L3ProtocolTxCounterId
void PurgePendingPackets(ProtocolType protocolType)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
uint32_t m_queueEnqueueCounterId
uint64_t m_maxPktsPerFile
void QueueDropTrace(std::string context, Ptr< const Packet >)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::map< std::string, uint32_t > m_macToNodeIdMap
Time m_ipv4L3ProtocolCountersPollInterval
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
void TrackQueueCounters()
void TrackWifiPhyCounters()
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Vector GetPosition(void) const
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 TrackIpv4RoutePaths()
NodeContainer m_routingNc
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Time m_ipv4L3ProtocolCountersStopTime
void WriteXmlAnim(bool routing=false)
uint64_t m_currentPktCount
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Fatal error handling.
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 &)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
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 Print(std::ostream &os) const
Print the packet contents.
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.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const =0
Get the routing protocol to be used by this Ipv4 stack.
std::vector< Ptr< Node > > GetMovedNodes()
LinkPropertiesMap m_linkProperties
uint32_t GetSystemId(void) const
Time m_queueCountersPollInterval
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.
void WriteXmlAddResource(uint32_t resourceId, std::string resourcePath)
void ResetAnimWriteCallback()
Reset the write callback function.
NodeCounterMap64 m_nodeWifiMacTx
AnimWriteCallback m_writeCallback
a polymophic address class
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)
void CheckMaxPktsPerTraceFile()
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
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.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
uint32_t m_ipv4L3ProtocolRxCounterId
void Add(AnimXmlElement e)
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
void RemainingEnergyTrace(std::string context, double previousEnergy, double currentEnergy)
uint32_t m_wifiPhyTxDropCounterId
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.
static void EnablePrinting(void)
Enable printing packets metadata.
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
uint32_t m_queueDropCounterId
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
std::string GetElementString()
~AnimationInterface()
Destructor for the animator interface.
AnimUidPacketInfoMap m_pendingWimaxPackets
EnergyFractionMap m_nodeEnergyFraction
void SkipPacketTracing()
Do not trace packets.
static Iterator End(void)
std::string GetNetAnimVersion()
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
std::string m_outputFileName
void DequeueTrace(std::string context, Ptr< const Packet >)
NodeCounterMap64 m_nodeIpv4Drop
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
ByteTagIterator GetByteTagIterator(void) const
Retiurns an iterator over the set of byte tags included in this packet.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
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
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void Connect(std::string path, const CallbackBase &cb)
Ipv4Address GetGateway(void) const
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
Time m_wifiMacCountersPollInterval
std::vector< std::string > m_resources
int WriteN(const char *, uint32_t, FILE *f)
AnimXmlElement(std::string tagName)
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
Time m_wifiPhyCountersPollInterval
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
tag a set of bytes in a packet
NodeColorsMap m_nodeColors
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.
uint32_t m_wifiMacRxDropCounterId
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.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
std::string fromNodeDescription
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void SetMaxPktsPerTraceFile(uint64_t maxPktsPerFile)
Set Max packets per trace file.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Iterator over the set of byte tags in a packet.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionaly.
Time m_routingPollInterval
NodeCounterMap64 m_nodeQueueDrop
uint32_t m_wifiMacRxCounterId
AnimUidPacketInfoMap m_pendingLtePackets
void TrackWifiMacCounters()
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
std::map< uint64_t, AnimPacketInfo > AnimUidPacketInfoMap
TypeId GetTypeId(void) const
virtual void Serialize(TagBuffer i) const
Serialize function.
static Time Now(void)
Return the current simulation virtual time.
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.
uint32_t m_wifiMacTxCounterId
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
void StopAnimation(bool onlyAnimation=false)
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
void WriteXmlUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
Vector UpdatePosition(Ptr< Node > n)
Ptr< const NetDevice > m_rxnd
std::string m_elementString
uint64_t Get(void) const
Get Uid in tag.
std::string toNodeDescription
NodeCounterMap64 m_nodeIpv4Rx
Ipv4 addresses are stored in host order in this class.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
NodeCounterMap64 m_nodeWifiMacRxDrop
void WifiMacTxDropTrace(std::string context, Ptr< const Packet >)
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
NodeCounterMap64 m_nodeWifiPhyRxDrop
std::string m_routingFileName
bool IsPacketPending(uint64_t animUid, ProtocolType protocolType)
uint32_t GetId(void) const
a class to store IPv4 address information on an interface
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint32_t m_queueDequeueCounterId
std::string GetMacAddress(Ptr< NetDevice > nd)
static Iterator Begin(void)
NodeCounterMap64 m_nodeIpv4Tx
NodeCounterMap64 m_nodeWifiMacRx
AnimUidPacketInfoMap m_pendingUanPackets
#define MAX_PKTS_PER_TRACE_FILE
void AddByteTag(uint64_t animUid, Ptr< const Packet > p)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
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)
bool m_enablePacketMetadata
Ptr< const NetDevice > m_txnd
uint32_t m_wifiMacTxDropCounterId
Time m_wifiPhyCountersStopTime
void OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
static bool IsFinished(void)
Check if the simulation should finish.
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)
NodeCounterMap64 m_nodeQueueEnqueue
uint32_t m_wifiPhyRxDropCounterId
Time m_wifiMacCountersStopTime
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
void WriteLinkProperties()
Time m_mobilityPollInterval
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.
uint32_t m_remainingEnergyCounterId
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet >)
std::string linkDescription
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
NodeCounterMap64 m_nodeWifiMacTxDrop
TypeId SetParent(TypeId tid)
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)
uint32_t m_ipv4L3ProtocolDropCounterId
Time m_queueCountersStopTime
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 &)
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.