38 #include "ns3/animation-interface.h" 39 #include "ns3/channel.h" 40 #include "ns3/config.h" 42 #include "ns3/mobility-model.h" 43 #include "ns3/packet.h" 44 #include "ns3/simulator.h" 45 #include "ns3/wifi-mac-header.h" 46 #include "ns3/wimax-mac-header.h" 47 #include "ns3/wifi-net-device.h" 48 #include "ns3/wifi-mac.h" 49 #include "ns3/lr-wpan-mac-header.h" 50 #include "ns3/lr-wpan-net-device.h" 51 #include "ns3/constant-position-mobility-model.h" 52 #include "ns3/lte-ue-phy.h" 53 #include "ns3/lte-enb-phy.h" 54 #include "ns3/uan-net-device.h" 55 #include "ns3/uan-mac.h" 56 #include "ns3/double.h" 59 #include "ns3/ipv4-routing-protocol.h" 60 #include "ns3/energy-source-container.h" 77 m_mobilityPollInterval (
Seconds (0.25)),
78 m_outputFileName (fn),
82 m_enablePacketMetadata (false),
84 m_stopTime (
Seconds (3600 * 1000)),
86 m_originalFileName (fn),
87 m_routingStopTime (
Seconds (0)),
88 m_routingFileName (
""),
89 m_routingPollInterval (
Seconds (5)),
302 loc = CreateObject<ConstantPositionMobilityModel> ();
303 n->AggregateObject (loc);
305 Vector hubVec (
x, y, z);
306 loc->SetPosition (hubVec);
307 NS_LOG_INFO (
"Node:" <<
n->GetId () <<
" Position set to:(" <<
x <<
"," << y <<
"," << z <<
")");
314 NS_LOG_INFO (
"Setting node image for Node Id:" << nodeId);
317 NS_FATAL_ERROR (
"Resource Id:" << resourceId <<
" not found. Did you use AddResource?");
327 NS_FATAL_ERROR (
"NodeCounter Id:" << nodeCounterId <<
" not found. Did you use AddNodeCounter?");
335 if ((opacity < 0) || (opacity > 1))
360 NS_LOG_INFO (
"Setting node color for Node Id:" << nodeId);
368 std::string linkDescription)
375 std::string linkDescription)
402 const EnergyFractionMap::const_iterator fractionIter =
m_nodeEnergyFraction.find (node->GetId ());
404 return fractionIter->second;
431 if ((ceil (oldLocation.x) == ceil (newLocation.x)) &&
432 (ceil (oldLocation.y) == ceil (newLocation.y)))
448 for (uint32_t i = 0; i < MovedNodes.size (); i++)
467 std::vector <Ptr <Node> >
470 std::vector < Ptr <Node> > movedNodes;
483 newLocation =
mobility->GetPosition ();
492 movedNodes.push_back (
n);
509 return WriteN (st.c_str (), st.length (),
f);
520 uint32_t nLeft = count;
521 const char* p =
data;
522 uint32_t written = 0;
525 int n = std::fwrite (p, 1, nLeft,
f);
540 NS_LOG_INFO (
"Writing Route Path From :" << nodeId <<
" To: " << destination.c_str ());
560 const std::vector<std::string>
563 std::vector <std::string> elements;
564 std::size_t pos1=0, pos2;
565 while (pos1 != context.npos)
567 pos1 = context.find (
"/",pos1);
568 pos2 = context.find (
"/",pos1+1);
569 elements.push_back (context.substr (pos1+1,pos2-(pos1+1)));
599 return n->GetDevice (atoi (elements.at (3).c_str ()));
641 const uint32_t nodeId = node->GetId ();
643 NS_LOG_INFO (
"Remaining energy on one of sources on node " << nodeId <<
": " << currentEnergy);
649 const double energyFraction = currentEnergy / energySource->GetInitialEnergy ();
651 NS_LOG_INFO (
"Total energy fraction on node " << nodeId <<
": " << energyFraction);
791 double lbTx = (now + txTime).GetSeconds ();
792 double fbRx = (now + rxTime - txTime).GetSeconds ();
793 double lbRx = (now + rxTime).GetSeconds ();
796 tx->GetNode ()->GetId (),
799 rx->GetNode ()->GetId (),
823 Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress ();
824 std::ostringstream oss;
851 pendingPackets->at (animUid).ProcessRxBegin (ndev,
Simulator::Now ().GetSeconds ());
885 NS_LOG_INFO (
"Wifi RxBeginTrace for packet:" << animUid);
890 std::ostringstream oss;
900 NS_LOG_WARN (
"Transmitter Mac address " << oss.str () <<
" never seen before. Skipping");
907 NS_LOG_WARN (
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
937 std::ostringstream oss;
940 Mac16Address nodeAddr = netDevice->GetMac ()->GetShortAddress ();
945 Mac64Address nodeAddr = netDevice->GetMac ()->GetExtendedAddress ();
950 NS_LOG_WARN (
"LrWpanMacHeader without source address");
984 NS_LOG_INFO (
"LrWpan RxBeginTrace for packet:" << animUid);
987 NS_LOG_WARN (
"LrWpanPhyRxBeginTrace: unknown Uid - most probably it's an ACK.");
1011 NS_LOG_INFO (
"Wave RxBeginTrace for packet:" << animUid);
1016 std::ostringstream oss;
1026 NS_LOG_WARN (
"Transmitter Mac address " << oss.str () <<
" never seen before. Skipping");
1033 NS_LOG_WARN (
"WavePhyRxBegin: unknown Uid, but we are adding a wave packet");
1080 context =
"/" + context;
1085 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1110 context =
"/" + context;
1115 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1125 NS_LOG_WARN (
"LteSpectrumPhyRxTrace: unknown Uid");
1161 NS_LOG_INFO (
"CsmaPhyTxEndTrace for packet:" << animUid);
1168 NS_LOG_WARN (
"Unknown Uid, but adding Csma Packet anyway");
1192 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid);
1193 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid <<
" complete");
1213 NS_LOG_INFO (
"MacRxTrace for packet:" << animUid <<
" complete");
1221 uint32_t nodeId = 0;
1264 pendingPackets->insert (AnimUidPacketInfoMap::value_type (animUid, pktInfo));
1272 return (pendingPackets->find (animUid) != pendingPackets->end ());
1280 if (pendingPackets->empty ())
1284 std::vector <uint64_t> purgeList;
1285 for (AnimUidPacketInfoMap::iterator i = pendingPackets->begin ();
1286 i != pendingPackets->end ();
1294 purgeList.push_back (i->first);
1297 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
1298 i != purgeList.end ();
1301 pendingPackets->erase (*i);
1309 switch (protocolType)
1347 return pendingPackets;
1354 std::string result =
"Unknown";
1355 switch (protocolType)
1401 std::string typeString =
"unknown";
1402 switch (counterType)
1406 typeString =
"UINT32";
1411 typeString =
"DOUBLE";
1423 std::ostringstream oss;
1490 for (std::vector<std::string>::const_iterator i = ipv4Addresses.begin ();
1491 i != ipv4Addresses.end ();
1508 for (std::vector<std::string>::const_iterator i = ipv6Addresses.begin();
1509 i != ipv6Addresses.end();
1524 std::ostringstream oss;
1526 oss <<
"NodeList/" <<
n->GetId () <<
"/DeviceList/" << devIndex <<
"/";
1548 std::ostringstream oss;
1550 oss <<
"NodeList/" <<
n->GetId () <<
"/DeviceList/" << devIndex <<
"/";
1571 uint32_t nDevices =
n->GetNDevices ();
1572 for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
1584 if (lteEnbNetDevice)
1597 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
1599 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin",
1611 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin",
1613 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd",
1615 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd",
1617 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
1619 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
1621 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
1623 Config::Connect (
"/NodeList/*/$ns3::BasicEnergySource/RemainingEnergy",
1637 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Enqueue",
1639 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Enqueue",
1641 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Enqueue",
1646 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Dequeue",
1648 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Dequeue",
1650 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Dequeue",
1655 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Drop",
1657 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Drop",
1659 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Drop",
1664 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
1666 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTxDrop",
1668 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
1670 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRxDrop",
1674 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop",
1676 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1680 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Phy/PhyTxBegin",
1682 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Phy/PhyRxBegin",
1684 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacTx",
1686 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacTxDrop",
1688 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacRx",
1690 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacRxDrop",
1694 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/PhyTxBegin",
1696 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/PhyRxBegin",
1710 NS_LOG_UNCOND (
"AnimationInterface WARNING:Node:" <<
n->GetId () <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
1742 NS_FATAL_ERROR (
"Node:" <<
n->GetId () <<
" not found in Location table");
1751 Address nodeAddr = nd->GetAddress ();
1752 std::ostringstream oss;
1754 return oss.str ().substr (6);
1763 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
1766 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
1769 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
1773 std::ostringstream oss;
1784 NS_LOG_WARN(
"Node: " << nd->GetNode()->GetId() <<
" No ipv4 object found");
1787 int32_t ifIndex = ipv6->GetInterfaceForDevice(nd);
1790 NS_LOG_WARN(
"Node :" << nd->GetNode()->GetId() <<
" Could not find index of NetDevice");
1793 bool nonLinkLocalFound =
false;
1794 uint32_t nAddresses = ipv6->GetNAddresses(ifIndex);
1796 for (uint32_t addressIndex = 0; addressIndex < nAddresses; ++addressIndex)
1798 addr = ipv6->GetAddress(ifIndex, addressIndex);
1801 nonLinkLocalFound =
true;
1805 if (!nonLinkLocalFound)
1806 addr = ipv6->GetAddress(ifIndex, 0);
1807 std::ostringstream oss;
1814 std::vector<std::string>
1817 std::vector<std::string> ipv4Addresses;
1821 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
1822 return ipv4Addresses;
1824 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
1827 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
1828 return ipv4Addresses;
1830 for (uint32_t index = 0; index < ipv4->GetNAddresses (ifIndex); ++index)
1833 std::ostringstream oss;
1835 ipv4Addresses.push_back(oss.str ());
1837 return ipv4Addresses;
1840 std::vector<std::string>
1843 std::vector<std::string> ipv6Addresses;
1847 NS_LOG_WARN(
"Node: " << nd->GetNode ()->GetId () <<
" No ipv6 object found");
1848 return ipv6Addresses;
1850 int32_t ifIndex = ipv6->GetInterfaceForDevice (nd);
1853 NS_LOG_WARN(
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
1854 return ipv6Addresses;
1856 for (uint32_t index = 0; index < ipv6->GetNAddresses (ifIndex); ++index)
1859 std::ostringstream oss;
1861 ipv6Addresses.push_back (oss.str ());
1863 return ipv6Addresses;
1874 std::vector <std::string> ipv4Addresses;
1875 std::pair<NodeIdIpv4Map::const_iterator, NodeIdIpv4Map::const_iterator> iterPair =
m_nodeIdIpv4Map.equal_range (i->first);
1876 for (NodeIdIpv4Map::const_iterator it = iterPair.first;
1877 it != iterPair.second;
1880 ipv4Addresses.push_back (it->second);
1893 std::vector <std::string> ipv6Addresses;
1894 std::pair<NodeIdIpv6Map::const_iterator, NodeIdIpv6Map::const_iterator> iterPair =
m_nodeIdIpv6Map.equal_range (i->first);
1895 for (NodeIdIpv6Map::const_iterator it = iterPair.first;
1896 it != iterPair.second;
1899 ipv6Addresses.push_back (it->second);
1912 uint32_t n1Id =
n->GetId ();
1913 uint32_t nDev =
n->GetNDevices ();
1914 for (uint32_t i = 0; i < nDev; ++i)
1919 std::string channelType =
"Unknown channel";
1922 channelType = ch->GetInstanceTypeId ().GetName ();
1926 if (!ch || (channelType != std::string(
"ns3::PointToPointChannel")))
1943 if (!ipv4Addresses.empty ())
1948 else if (!ipv6Addresses.empty ())
1956 else if (channelType == std::string (
"ns3::PointToPointChannel"))
1959 std::size_t nChDev = ch->GetNDevices ();
1960 for (std::size_t j = 0; j < nChDev; ++j)
1963 uint32_t n2Id = chDev->GetNode ()->GetId ();
1979 if (!ipv4Addresses.empty ())
1984 else if (!ipv6Addresses.empty ())
2004 NS_LOG_INFO (
"Update Position for Node: " <<
n->GetId ());
2065 if (!routing &&
m_f)
2075 NS_LOG_INFO (
"Creating new trace file:" << fn.c_str ());
2077 f = std::fopen (fn.c_str (),
"w");
2175 NS_LOG_INFO (
"TrackIpv4L3ProtocolCounters Completed");
2221 NS_LOG_WARN (
"Routing protocol object not found");
2235 rpElements.push_back (elem);
2239 std::ostringstream oss;
2245 rpElements.push_back (elem);
2249 rpElements.push_back (elem2);
2255 rpElements.push_back (elem);
2260 rpElements.push_back (elem);
2304 NS_LOG_WARN (
"Node " <<
n->GetId () <<
" Does not have an Ipv4 object");
2307 std::stringstream stream;
2310 return stream.str ();
2317 NS_LOG_INFO (
"RecursiveIpv4RoutePathSearch from:" << from.c_str () <<
" to:" << to.c_str ());
2318 if ((from ==
"0.0.0.0") || (from ==
"127.0.0.1"))
2320 NS_LOG_INFO (
"Got " << from.c_str () <<
" End recursion");
2328 rpElements.push_back (elem);
2350 NS_LOG_WARN (
"Routing protocol object not found");
2363 std::ostringstream oss;
2369 rpElements.push_back (elem);
2373 rpElements.push_back (elem2);
2379 rpElements.push_back (elem);
2409 std::string closeString =
"</" + name +
">\n";
2476 for (std::vector<std::string>::const_iterator i = ipv4Addresses.begin ();
2477 i != ipv4Addresses.end ();
2492 for (std::vector<std::string>::const_iterator i = ipv6Addresses.begin ();
2493 i != ipv6Addresses.end ();
2509 element.
AddAttribute (
"info", routingInfo.c_str (),
true);
2516 std::string tagName =
"rp";
2522 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin ();
2523 i != rpElements.end ();
2543 if (!metaInfo.empty ())
2545 element.
AddAttribute (
"meta-info", metaInfo.c_str (),
true);
2563 uint32_t tId,
double fbRx,
double lbRx, std::string metaInfo)
2569 if (!metaInfo.empty ())
2571 element.
AddAttribute (
"meta-info", metaInfo.c_str (),
true);
2705 template <
typename T>
2709 std::ostringstream oss;
2710 oss << std::setprecision(10);
2712 std::string attributeString = attribute.c_str();
2715 attributeString +=
"=\"";
2716 std::string valueStr = oss.str();
2717 for (std::string::iterator it = valueStr.begin(); it != valueStr.end(); ++it)
2722 attributeString +=
"&";
2725 attributeString +=
""";
2728 attributeString +=
"'";
2731 attributeString +=
"<";
2734 attributeString +=
">";
2737 attributeString += *it;
2741 attributeString +=
"\" ";
2745 attributeString +=
"=\"" + oss.str() +
"\" ";
2747 m_attributes.push_back(attributeString);
2753 m_children.push_back(e.
ToString());
2765 std::string elementString =
"<" + m_tagName +
" ";
2768 for (std::vector<std::string>::const_iterator i = m_attributes.begin();
2769 i != m_attributes.end();
2772 elementString += *i;
2774 if (m_children.empty() && m_text.empty())
2778 elementString +=
"/>";
2783 elementString +=
">";
2784 if (!m_text.empty())
2786 elementString += m_text;
2788 if (!m_children.empty())
2790 elementString +=
"\n";
2791 for (std::vector<std::string>::const_iterator i = m_children.begin();
2792 i != m_children.end();
2795 elementString += *i +
"\n";
2801 elementString +=
"</" + m_tagName +
">";
2806 return elementString + ((autoClose) ?
"\n":
"");
2820 .SetGroupName (
"NetAnim")
2829 return GetTypeId ();
2835 return sizeof (uint64_t);
2853 os <<
"AnimUid=" << m_AnimUid;
2859 m_AnimUid = AnimUid;
2891 m_fbTx (fbTx.GetSeconds ()),
void GenericWirelessTxTrace(std::string context, Ptr< const Packet > p, ProtocolType protocolType)
Generic wireless transmit trace function.
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
Get anim UID from packet function.
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
void Set(uint64_t AnimUid)
Set global Uid in tag.
uint64_t GetTracePktCount()
Get trace file packet count (This used only for testing)
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)
Write XMLRP function.
TypeId GetTypeId(void) const
void AddPendingPacket(ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo)
Add pending packet function.
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
CSMA MAC receive trace function.
Ipv6Address GetAddress() const
Get the IPv6 address.
Simulation virtual time values and global simulation resolution.
void MobilityAutoCheck()
Mobility auto check function.
void Print(std::ostream &os) const
Print the packet contents.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void WriteXmlUpdateLink(uint32_t fromId, uint32_t toId, std::string linkDescription)
Write XML update link counter function.
NodeCounterMap64 m_nodeQueueDequeue
node queue dequeue
uint64_t Get(void) const
Get Uid in tag.
void LteTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
LTE transmit trace function.
void LrWpanMacTxDropTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC transmit drop trace function.
LinkProperties structure.
uint32_t GetId(void) const
FILE * m_routingF
File handle for routing table output (0 if None);.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
std::string GetIpv4Address(Ptr< NetDevice > nd)
Get IPv4 address.
std::string CounterTypeToString(CounterType counterType)
Counter type to string function.
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)
Write XML update node image function.
std::string GetIpv6Address(Ptr< NetDevice > nd)
Get IPv6 address.
virtual void Serialize(TagBuffer i) const
Serialize function.
NodeCounterMap64 m_nodeLrWpanMacRxDrop
node LR-WPAN MAC receive drop
std::map< std::string, uint32_t > m_ipv6ToNodeIdMap
IPv6 to node ID map.
static TypeId GetTypeId(void)
Get Type Id.
void WriteXmlIpv6Addresses(uint32_t nodeId, std::vector< std::string > ipv6Addresses)
Write XML Ipv6 addresses function.
void WriteNodes()
Write nodes function.
void TrackIpv4L3ProtocolCounters()
Track IPv4 L3 protocol counters function.
Introspection did not find any typical Config paths.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
CSMA Phy transmit begin trace function.
P2pLinkNodeIdPair structure.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Mobility model for which the current position does not change once it has been set and until it is se...
AnimUidPacketInfoMap m_pendingWifiPackets
pending wifi packets
void WriteXmlUpdateNodePosition(uint32_t nodeId, double x, double y)
Write XML update node position function.
NodeDescriptionsMap m_nodeDescriptions
node description
std::string ToString(bool autoClose=true)
Get text for the element function.
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
uint32_t m_ipv4L3ProtocolTxCounterId
IPv4 L3 protocol transmit counter ID.
void WifiMacTxDropTrace(std::string context, Ptr< const Packet > p)
wifi MAC transmit drop trace function
void PurgePendingPackets(ProtocolType protocolType)
Purge pending packets function.
#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
queue enqueue counter ID
uint64_t m_maxPktsPerFile
maximum pakets per file
virtual Ptr< Node > GetNode(void) const =0
void QueueDropTrace(std::string context, Ptr< const Packet >)
Queue trace function.
void WifiMacRxTrace(std::string context, Ptr< const Packet > p)
wifi MAC receive trace function
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
IPv6 address associated with an interface.
std::map< std::string, uint32_t > m_macToNodeIdMap
MAC to node ID map.
Time m_ipv4L3ProtocolCountersPollInterval
IPv4 L3 protocol counters poll interval.
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
LTE Spectrum Phy receive start function.
void TrackQueueCounters()
Track queue counters function.
void TrackWifiPhyCounters()
Track wifi phy counters function.
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get net device from context.
void WifiPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
wifi Phy transmit begin trace function
void EnableWifiPhyCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Phy Counters such as TxDrop, RxDrop.
void TrackIpv4RoutePaths()
Track IPv4 route paths function.
NodeContainer m_routingNc
routing node container
Time m_ipv4L3ProtocolCountersStopTime
IPv4 L3 protocol counters stop time.
void WriteXmlAnim(bool routing=false)
Write XML anim function.
uint64_t m_currentPktCount
current packet count
std::pair< uint32_t, std::string > NodeIdIpv6Pair
NodeIdIpv6Pair typedef.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
void WimaxRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
WIMax receive trace function.
NodeCounterMap64 m_nodeWifiPhyTxDrop
node wifi Phy transmit drop
void LrWpanMacRxDropTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC receive drop trace function.
#define CHECK_STARTED_INTIMEWINDOW
void Ipv4RxTrace(std::string context, Ptr< const Packet > p, Ptr< Ipv4 > ipv4, uint32_t interfaceIndex)
IPv4 receive trace function.
std::map< std::string, uint32_t > m_ipv4ToNodeIdMap
IPv4 to node ID map.
void WavePhyTxBeginTrace(std::string context, Ptr< const Packet > p)
WAVE Phy transmit begin trace function.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
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)
Write XML add node counter function.
void ProcessRxBegin(Ptr< const NetDevice > nd, const double fbRx)
Process receive begin.
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
Connect LTE ENB function.
std::string GetIpv4RoutingTable(Ptr< Node > n)
Get IPv4 routing table function.
void WriteXmlUpdateNodeSize(uint32_t nodeId, double width, double height)
Write XML update node size function.
void WriteXmlUpdateNodeColor(uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
Write XML update node color function.
void WriteIpv6Addresses()
Write IPv6 Addresses function.
SocketErrno
Enumeration of the possible errors returned by a socket.
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()
Get moved nodes function.
LinkPropertiesMap m_linkProperties
link properties
Time m_queueCountersPollInterval
queue counters poll interval
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
wifi Phy receive begin trace function
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
#define CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS
void WriteXmlAddResource(uint32_t resourceId, std::string resourcePath)
Write XML add resource function.
void ResetAnimWriteCallback()
Reset the write callback function.
NodeCounterMap64 m_nodeWifiMacTx
node wifi MAC transmit
AnimWriteCallback m_writeCallback
write callback
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet > p)
wifi Phy receive drop trace function
a polymophic address class
void UanPhyGenTxTrace(std::string context, Ptr< const Packet >)
UAN Phy gen transmit trace function.
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
void CheckMaxPktsPerTraceFile()
Check maximum packets per trace file function.
void AddToIpv6AddressNodeIdTable(std::string ipv6Address, uint32_t nodeId)
Add to IPv6 address node ID table function.
DropReason
Reason why a packet has been dropped.
void ConnectLteUe(Ptr< Node > n, Ptr< LteUeNetDevice > nd, uint32_t devIndex)
Connect LTE ue function.
void WriteNodeColors()
Write node colors function.
std::map< uint32_t, Vector > m_nodeLocation
node location
Ipv4RoutePathElement structure.
Keep track of the current position and velocity of an object.
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
void LteRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
LTE receive trace function.
uint32_t m_ipv4L3ProtocolRxCounterId
IPv4 L3 protocol receive counter ID.
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
CSMA Phy receive end trace function.
NodeIdIpv6Map m_nodeIdIpv6Map
node ID to IPv6 map
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)
Remaining energy trace function.
uint32_t m_wifiPhyTxDropCounterId
wifi Phy transmit drop counter ID
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
void WriteXmlClose(std::string name, bool routing=false)
Write XML close function.
void OutputWirelessPacketTxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
Output wireless packet transmit info.
int WriteN(const char *data, uint32_t count, FILE *f)
WriteN function.
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.
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
uint32_t m_queueDropCounterId
queue drop counter ID
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
~AnimationInterface()
Destructor for the animator interface.
AnimUidPacketInfoMap m_pendingWimaxPackets
pending wimax packets
std::vector< std::string > GetIpv4Addresses(Ptr< NetDevice > nd)
Get IPv4 addresses.
EnergyFractionMap m_nodeEnergyFraction
node energy fraction
bool m_trackPackets
track packets
void SkipPacketTracing()
Do not trace packets.
static Iterator End(void)
std::string GetNetAnimVersion()
Get netanim version function.
void RecursiveIpv4RoutePathSearch(std::string from, std::string to, Ipv4RoutePathElements &rpElements)
Recursive IPv4 route path search function.
void WriteXmlNonP2pLinkProperties(uint32_t id, std::string ipAddress, std::string channelType)
Write XML non P2P link properties function.
std::string m_outputFileName
output file name
FILE * m_f
File handle for output (0 if none)
void DequeueTrace(std::string context, Ptr< const Packet >)
Dequeue trace function.
NodeCounterMap64 m_nodeIpv4Drop
node IPv4 drop
uint32_t fromNode
from node
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
UAN Phy gen receive trace function.
std::pair< uint32_t, std::string > NodeIdIpv4Pair
NodeIdIpv4Pair typedef.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
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="")
Write XMLP function.
void StartAnimation(bool restart=false)
Start animation function.
void WriteXmlNode(uint32_t id, uint32_t sysId, double locX, double locY)
Write XML node function.
std::vector< Ipv4RoutePathElement > Ipv4RoutePathElements
Ipv4RoutePathElements typedef.
void Ipv4TxTrace(std::string context, Ptr< const Packet > p, Ptr< Ipv4 > ipv4, uint32_t interfaceIndex)
IPv4 transmit trace function.
AnimationInterface & EnableIpv4RouteTracking(std::string fileName, Time startTime, Time stopTime, Time pollInterval=Seconds(5))
Enable tracking of the Ipv4 routing table for all Nodes.
AnimXmlElement(std::string tagName, bool emptyElement=true)
Constructor.
AnimUidPacketInfoMap m_pendingLrWpanPackets
pending LR-WPAN packets
std::map< uint32_t, NodeSize > m_nodeSizes
node sizes
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet > p)
wifi Phy transmit drop trace function
Ptr< LteEnbPhy > GetPhy(void) const
void Connect(std::string path, const CallbackBase &cb)
void WavePhyRxBeginTrace(std::string context, Ptr< const Packet > p)
WAVE Phy receive begin trace function.
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
CSMA Phy transmit end trace function.
CounterType
Counter Types.
std::string GetPacketMetadata(Ptr< const Packet > p)
Get packet metadata function.
Time m_wifiMacCountersPollInterval
wifi MAC counters poll interval
std::vector< std::string > m_resources
resources
void WriteXmlIpv4Addresses(uint32_t nodeId, std::vector< std::string > ipv4Addresses)
Write XML Ipv4 addresses function.
NodeIdIpv4Map m_nodeIdIpv4Map
node ID to IPv4 map
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
Access to the IPv4 forwarding table, interfaces, and configuration.
uint32_t m_txNodeId
node ID
void DevTxTrace(std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
Device transmit trace function.
Time m_wifiPhyCountersPollInterval
wifi Phy counters poll interval
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
double f(double x, void *params)
tag a set of bytes in a packet
NodeColorsMap m_nodeColors
node colors
void WriteXmlRouting(uint32_t id, std::string routingInfo)
Write XML routing function.
NodeCounterMap64 m_nodeLrWpanMacTxDrop
node LR-WPAN MAC transmit drop
void WriteXmlPRef(uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo="")
Write XMLP Ref function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_wifiMacRxDropCounterId
wifi MAC receive drop counter ID
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.
ProtocolType
ProtocolType enumeration.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
std::string fromNodeDescription
from node description
NodeCounterMap64 m_nodeLrWpanMacTx
node LR-WPAN MAC transmit
void ConnectCallbacks()
Connect callbacks function.
void SetMaxPktsPerTraceFile(uint64_t maxPktsPerFile)
Set Max packets per trace file.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Node has moved function.
void WriteNodeEnergies()
Write node energies function.
uint64_t gAnimUid
Packet unique identifier used by AnimationInterface.
std::vector< std::string > GetIpv6Addresses(Ptr< NetDevice > nd)
Get IPv6 addresses.
Iterator over the set of byte tags in a packet.
void AddToIpv4AddressNodeIdTable(std::string ipv4Address, uint32_t nodeId)
Add to IPv4 address node ID table function.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
Time m_routingPollInterval
routing poll interval
NodeCounterMap64 m_nodeQueueDrop
node queue drop
uint32_t m_wifiMacRxCounterId
wifi MAC receive counter ID
std::string nextHop
next hop
void LrWpanPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
LR-WPAN Phy receive begin trace function.
AnimUidPacketInfoMap m_pendingLtePackets
pending LTE packets
void TrackWifiMacCounters()
Track wifi MAC counters function.
This class can contain 16 bit addresses.
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
std::map< uint64_t, AnimPacketInfo > AnimUidPacketInfoMap
AnimUidPacketInfoMap typedef.
static Time Now(void)
Return the current simulation virtual time.
void WriteXmlUpdateNodeDescription(uint32_t nodeId)
Write XML update node description function.
void AppendChild(AnimXmlElement e)
Append child function.
void EnqueueTrace(std::string context, Ptr< const Packet >)
Enqueue trace function.
Byte tag using by Anim to uniquely identify packets.
Ipv4Address GetGateway(void) const
uint32_t m_wifiMacTxCounterId
wifi MAC transmit counter ID
void StopAnimation(bool onlyAnimation=false)
Stop animation function.
std::string destination
destination
uint32_t fromNodeId
from node ID
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
Get elements from context.
void WriteXmlUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
Write XML update node counter function.
AnimUidPacketInfoMap m_pendingWavePackets
pending WAVE packets
Vector UpdatePosition(Ptr< Node > n)
Update position function.
void LrWpanMacRxTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC receive trace function.
Ptr< const NetDevice > m_rxnd
receive device
Vector GetPosition(void) const
virtual uint32_t GetSerializedSize(void) const
Get Serialized Size.
void WriteNodeSizes()
Write node sizes function.
double GetNodeEnergyFraction(Ptr< const Node > node) const
Get node's energy fraction (This used only for testing)
void GenericWirelessRxTrace(std::string context, Ptr< const Packet > p, ProtocolType protocolType)
Generic wireless receive trace function.
std::string toNodeDescription
to node description
NodeCounterMap64 m_nodeIpv4Rx
node IPv4 receive
Ipv4 addresses are stored in host order in this class.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
IPv route track elements.
NodeCounterMap64 m_nodeWifiMacRxDrop
node wifi MAC receive drop
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
Mobility course change trace function.
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
WIMax transmit trace function.
NodeCounterMap64 m_nodeWifiPhyRxDrop
node wifi Phy receive drop
std::string m_routingFileName
routing file name
bool IsPacketPending(uint64_t animUid, ProtocolType protocolType)
Is packet pending function.
void SetText(std::string text)
Set text function.
a class to store IPv4 address information on an interface
static bool initialized
Initialization flag.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint32_t m_queueDequeueCounterId
queue dequeue counter ID
std::string GetMacAddress(Ptr< NetDevice > nd)
Get MAC address function.
static Iterator Begin(void)
NodeCounterMap64 m_nodeIpv4Tx
node IPv4 transmit
NodeCounterMap64 m_nodeWifiMacRx
node wifi MAC receive
AnimUidPacketInfoMap m_pendingUanPackets
pending UAN packets
#define MAX_PKTS_PER_TRACE_FILE
std::string ProtocolTypeToString(ProtocolType protocolType)
Protocol type to string function.
void AddByteTag(uint64_t animUid, Ptr< const Packet > p)
Add byte tag function.
void ConnectLte()
Connect LTE function.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void WifiMacTxTrace(std::string context, Ptr< const Packet > p)
wifi MAC transmit trace function
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)
Write XML update background function.
Interface to network animator.
void WriteNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
Write non P2P link properties function.
bool m_enablePacketMetadata
enable packet metadata
Ptr< const NetDevice > m_txnd
transmit device
uint32_t m_wifiMacTxDropCounterId
wifi MAC transmit drop counter ID
NodeCounterMap64 m_nodeLrWpanMacRx
node LR-WPAN MAC receive
Time m_wifiPhyCountersStopTime
wifi Phy counters stop time
void OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
Output wireless packet receive info.
void LrWpanMacTxTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC transmit trace function.
Time m_startTime
start time
void Ipv4DropTrace(std::string context, const Ipv4Header &ipv4Header, Ptr< const Packet > p, Ipv4L3Protocol::DropReason dropReason, Ptr< Ipv4 > ipv4, uint32_t interfaceIndex)
IPv4 drop trace function.
Ipv4Address GetLocal(void) const
Get the local address.
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.
NodeCounterMap64 m_nodeQueueEnqueue
node queue enqueue
uint32_t m_wifiPhyRxDropCounterId
wifi Phy receive drop counter ID
Time m_wifiMacCountersStopTime
wifi MAC counters stop time
void LrWpanPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
LR-WPAN Phy receive begin trace function.
virtual void Print(std::ostream &os) const
Print tag info.
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
Write route path function.
void WriteLinkProperties()
Write link properties function.
Time m_mobilityPollInterval
mobility poll interval
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Ipv4RouteTrackElement structure.
bool IsStarted(void)
Is AnimationInterface started.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
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)
Protocol type to pending packets function.
void EnableQueueCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Queue Counters such as Enqueue, Dequeue, Queue Drops.
void AddAttribute(std::string attribute, T value, bool xmlEscape=false)
Add attribute function.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint32_t m_remainingEnergyCounterId
remaining energy counter ID
void WriteIpv4Addresses()
Write IPv4 Addresses function.
std::string linkDescription
link description
Vector GetPosition(Ptr< Node > n)
Get position function.
bool IsInTimeWindow()
Is in time window function.
a unique identifier for an interface.
NodeCounterMap64 m_nodeWifiMacTxDrop
node wifi MAC transmit drop
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
std::vector< std::string > m_nodeCounters
node counters
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)
Output CSMA packet function.
Time m_routingStopTime
routing stop time
uint32_t m_ipv4L3ProtocolDropCounterId
IPv4 protocol drop counter ID.
Ptr< Node > GetNodeFromContext(const std::string &context) const
Get node from context.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Time m_queueCountersStopTime
queue counters stop time
void SetOutputFile(const std::string &fn, bool routing=false)
Set output file function.
ByteTagIterator GetByteTagIterator(void) const
Returns an iterator over the set of byte tags included in this packet.
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
LTE Spectrum Phy transmit start function.
AnimUidPacketInfoMap m_pendingCsmaPackets
pending CSMA packets
void WifiMacRxDropTrace(std::string context, Ptr< const Packet > p)
wifi MAC receive drop trace function
void WriteXmlLink(uint32_t fromId, uint32_t toLp, uint32_t toId)
Write XML link counter function.
void TrackIpv4Route()
Track IPv4 router function.