36#include "ns3/bs-net-device.h"
37#include "ns3/csma-net-device.h"
38#include "ns3/wave-net-device.h"
42#include "ns3/animation-interface.h"
43#include "ns3/channel.h"
44#include "ns3/config.h"
45#include "ns3/constant-position-mobility-model.h"
46#include "ns3/double.h"
47#include "ns3/energy-source-container.h"
48#include "ns3/ipv4-routing-protocol.h"
51#include "ns3/lr-wpan-mac-header.h"
52#include "ns3/lr-wpan-net-device.h"
53#include "ns3/lte-enb-phy.h"
54#include "ns3/lte-ue-phy.h"
55#include "ns3/mobility-model.h"
57#include "ns3/packet.h"
58#include "ns3/simulator.h"
59#include "ns3/uan-mac.h"
60#include "ns3/uan-net-device.h"
61#include "ns3/wifi-mac-header.h"
62#include "ns3/wifi-mac.h"
63#include "ns3/wifi-net-device.h"
64#include "ns3/wifi-psdu.h"
65#include "ns3/wimax-mac-header.h"
81 m_mobilityPollInterval(
Seconds(0.25)),
84 m_writeCallback(nullptr),
86 m_enablePacketMetadata(false),
88 m_stopTime(
Seconds(3600 * 1000)),
90 m_originalFileName(fn),
92 m_routingFileName(
""),
93 m_routingPollInterval(
Seconds(5)),
334 loc = CreateObject<ConstantPositionMobilityModel>();
337 Vector hubVec(x, y, z);
338 loc->SetPosition(hubVec);
339 NS_LOG_INFO(
"Node:" << n->
GetId() <<
" Position set to:(" << x <<
"," << y <<
"," << z <<
")");
345 NS_LOG_INFO(
"Setting node image for Node Id:" << nodeId);
348 NS_FATAL_ERROR(
"Resource Id:" << resourceId <<
" not found. Did you use AddResource?");
359 <<
" not found. Did you use AddNodeCounter?");
372 if ((opacity < 0) || (opacity > 1))
397 NS_LOG_INFO(
"Setting node color for Node Id:" << nodeId);
406 std::string linkDescription)
414 std::string linkDescription)
440 const EnergyFractionMap::const_iterator fractionIter =
m_nodeEnergyFraction.find(node->GetId());
442 return fractionIter->second;
469 if ((ceil(oldLocation.x) == ceil(newLocation.x)) &&
470 (ceil(oldLocation.y) == ceil(newLocation.y)))
486 for (
uint32_t i = 0; i < MovedNodes.size(); i++)
505std::vector<Ptr<Node>>
508 std::vector<Ptr<Node>> movedNodes;
521 newLocation =
mobility->GetPosition();
530 movedNodes.push_back(n);
547 return WriteN(st.c_str(), st.length(),
f);
559 const char* p =
data;
563 int n = std::fwrite(p, 1, nLeft,
f);
577 std::string destination,
580 NS_LOG_INFO(
"Writing Route Path From :" << nodeId <<
" To: " << destination);
596 std::string ipv4Address,
597 std::string channelType)
602const std::vector<std::string>
605 std::vector<std::string> elements;
606 std::size_t pos1 = 0;
608 while (pos1 != context.npos)
610 pos1 = context.find(
'/', pos1);
611 pos2 = context.find(
'/', pos1 + 1);
612 elements.push_back(context.substr(pos1 + 1, pos2 - (pos1 + 1)));
642 return n->
GetDevice(std::stoi(elements.at(3)));
681 double previousEnergy,
682 double currentEnergy)
686 const uint32_t nodeId = node->GetId();
688 NS_LOG_INFO(
"Remaining energy on one of sources on node " << nodeId <<
": " << currentEnergy);
694 const double energyFraction = currentEnergy / energySource->GetInitialEnergy();
696 NS_LOG_INFO(
"Total energy fraction on node " << nodeId <<
": " << energyFraction);
841 double lbTx = (now + txTime).GetSeconds();
842 double fbRx = (now + rxTime - txTime).GetSeconds();
843 double lbRx = (now + rxTime).GetSeconds();
846 tx->GetNode()->GetId(),
849 rx->GetNode()->GetId(),
868 <<
" GenericWirelessTxTrace for packet:" <<
gAnimUid);
877 std::ostringstream oss;
906 pendingPackets->at(animUid).ProcessRxBegin(ndev,
Simulator::Now().GetSeconds());
938 for (
auto& psdu : psduMap)
948 mpdu->GetProtocolDataUnit(),
958 std::ostringstream oss;
967 NS_ABORT_MSG(
"This NetDevice should be a Wi-Fi network device");
982 NS_LOG_INFO(
"Wifi RxBeginTrace for packet: " << animUid);
986 std::ostringstream oss;
996 NS_LOG_WARN(
"Transmitter Mac address " << oss.str() <<
" never seen before. Skipping");
1003 NS_LOG_WARN(
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
1032 std::ostringstream oss;
1045 NS_LOG_WARN(
"LrWpanMacHeader without source address");
1078 NS_LOG_INFO(
"LrWpan RxBeginTrace for packet:" << animUid);
1081 NS_LOG_WARN(
"LrWpanPhyRxBeginTrace: unknown Uid - most probably it's an ACK.");
1105 NS_LOG_INFO(
"Wave RxBeginTrace for packet:" << animUid);
1109 std::ostringstream oss;
1119 NS_LOG_WARN(
"Transmitter Mac address " << oss.str() <<
" never seen before. Skipping");
1126 NS_LOG_WARN(
"WavePhyRxBegin: unknown Uid, but we are adding a wave packet");
1171 context =
"/" + context;
1176 std::list<Ptr<Packet>> pbList = pb->GetPackets();
1199 context =
"/" + context;
1204 std::list<Ptr<Packet>> pbList = pb->GetPackets();
1212 NS_LOG_WARN(
"LteSpectrumPhyRxTrace: unknown Uid");
1246 NS_LOG_INFO(
"CsmaPhyTxEndTrace for packet:" << animUid);
1253 NS_LOG_WARN(
"Unknown Uid, but adding Csma Packet anyway");
1277 NS_LOG_INFO(
"CsmaPhyRxEndTrace for packet:" << animUid);
1278 NS_LOG_INFO(
"CsmaPhyRxEndTrace for packet:" << animUid <<
" complete");
1297 NS_LOG_INFO(
"MacRxTrace for packet:" << animUid <<
" complete");
1357 pendingPackets->insert(AnimUidPacketInfoMap::value_type(animUid, pktInfo));
1365 return (pendingPackets->find(animUid) != pendingPackets->end());
1373 if (pendingPackets->empty())
1377 std::vector<uint64_t> purgeList;
1378 for (AnimUidPacketInfoMap::iterator i = pendingPackets->begin(); i != pendingPackets->end();
1385 purgeList.push_back(i->first);
1388 for (std::vector<uint64_t>::iterator i = purgeList.begin(); i != purgeList.end(); ++i)
1390 pendingPackets->erase(*i);
1398 switch (protocolType)
1429 return pendingPackets;
1435 std::string result =
"Unknown";
1436 switch (protocolType)
1475 std::string typeString =
"unknown";
1476 switch (counterType)
1479 typeString =
"UINT32";
1483 typeString =
"DOUBLE";
1495 std::ostringstream oss;
1563 for (std::vector<std::string>::const_iterator i = ipv4Addresses.begin();
1564 i != ipv4Addresses.end();
1582 for (std::vector<std::string>::const_iterator i = ipv6Addresses.begin();
1583 i != ipv6Addresses.end();
1597 std::ostringstream oss;
1599 oss <<
"NodeList/" << n->
GetId() <<
"/DeviceList/" << devIndex <<
"/";
1602 dlPhy->TraceConnect(
"TxStart",
1605 dlPhy->TraceConnect(
"RxStart",
1611 ulPhy->TraceConnect(
"TxStart",
1614 ulPhy->TraceConnect(
"RxStart",
1626 std::ostringstream oss;
1628 oss <<
"NodeList/" << n->
GetId() <<
"/DeviceList/" << devIndex <<
"/";
1631 dlPhy->TraceConnect(
"TxStart",
1634 dlPhy->TraceConnect(
"RxStart",
1640 ulPhy->TraceConnect(
"TxStart",
1643 ulPhy->TraceConnect(
"RxStart",
1657 for (
uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
1671 if (lteEnbNetDevice)
1690 "/NodeList/*/$ns3::MobilityModel/CourseChange",
1783 "/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/PhyTxBegin",
1786 "/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/PhyRxBegin",
1801 "AnimationInterface WARNING:Node:"
1803 <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
1843 Address nodeAddr = nd->GetAddress();
1844 std::ostringstream oss;
1846 return oss.str().substr(6);
1855 NS_LOG_WARN(
"Node: " << nd->GetNode()->GetId() <<
" No ipv4 object found");
1858 int32_t ifIndex = ipv4->GetInterfaceForDevice(nd);
1861 NS_LOG_WARN(
"Node :" << nd->GetNode()->GetId() <<
" Could not find index of NetDevice");
1865 std::ostringstream oss;
1876 NS_LOG_WARN(
"Node: " << nd->GetNode()->GetId() <<
" No ipv4 object found");
1879 int32_t ifIndex = ipv6->GetInterfaceForDevice(nd);
1882 NS_LOG_WARN(
"Node :" << nd->GetNode()->GetId() <<
" Could not find index of NetDevice");
1885 bool nonLinkLocalFound =
false;
1886 uint32_t nAddresses = ipv6->GetNAddresses(ifIndex);
1888 for (
uint32_t addressIndex = 0; addressIndex < nAddresses; ++addressIndex)
1890 addr = ipv6->GetAddress(ifIndex, addressIndex);
1893 nonLinkLocalFound =
true;
1897 if (!nonLinkLocalFound)
1899 addr = ipv6->GetAddress(ifIndex, 0);
1901 std::ostringstream oss;
1906std::vector<std::string>
1909 std::vector<std::string> ipv4Addresses;
1913 NS_LOG_WARN(
"Node: " << nd->GetNode()->GetId() <<
" No ipv4 object found");
1914 return ipv4Addresses;
1916 int32_t ifIndex = ipv4->GetInterfaceForDevice(nd);
1919 NS_LOG_WARN(
"Node :" << nd->GetNode()->GetId() <<
" Could not find index of NetDevice");
1920 return ipv4Addresses;
1922 for (
uint32_t index = 0; index < ipv4->GetNAddresses(ifIndex); ++index)
1925 std::ostringstream oss;
1927 ipv4Addresses.push_back(oss.str());
1929 return ipv4Addresses;
1932std::vector<std::string>
1935 std::vector<std::string> ipv6Addresses;
1939 NS_LOG_WARN(
"Node: " << nd->GetNode()->GetId() <<
" No ipv6 object found");
1940 return ipv6Addresses;
1942 int32_t ifIndex = ipv6->GetInterfaceForDevice(nd);
1945 NS_LOG_WARN(
"Node :" << nd->GetNode()->GetId() <<
" Could not find index of NetDevice");
1946 return ipv6Addresses;
1948 for (
uint32_t index = 0; index < ipv6->GetNAddresses(ifIndex); ++index)
1951 std::ostringstream oss;
1953 ipv6Addresses.push_back(oss.str());
1955 return ipv6Addresses;
1963 std::vector<std::string> ipv4Addresses;
1964 std::pair<NodeIdIpv4Map::const_iterator, NodeIdIpv4Map::const_iterator> iterPair =
1966 for (NodeIdIpv4Map::const_iterator it = iterPair.first; it != iterPair.second; ++it)
1968 ipv4Addresses.push_back(it->second);
1980 std::vector<std::string> ipv6Addresses;
1981 std::pair<NodeIdIpv6Map::const_iterator, NodeIdIpv6Map::const_iterator> iterPair =
1983 for (NodeIdIpv6Map::const_iterator it = iterPair.first; it != iterPair.second; ++it)
1985 ipv6Addresses.push_back(it->second);
2000 for (
uint32_t i = 0; i < nDev; ++i)
2005 std::string channelType =
"Unknown channel";
2012 if (!ch || (channelType != std::string(
"ns3::PointToPointChannel")))
2030 if (!ipv4Addresses.empty())
2037 else if (!ipv6Addresses.empty())
2047 else if (channelType == std::string(
"ns3::PointToPointChannel"))
2051 for (std::size_t j = 0; j < nChDev; ++j)
2054 uint32_t n2Id = chDev->GetNode()->GetId();
2069 if (!ipv4Addresses.empty())
2076 else if (!ipv6Addresses.empty())
2163 if (!routing &&
m_f)
2175 f = std::fopen(fn.c_str(),
"w");
2275 NS_LOG_INFO(
"TrackIpv4L3ProtocolCounters Completed");
2328 Ptr<Ipv4Route> rt = rp->RouteOutput(pkt, header,
nullptr, sockerr);
2334 rpElements.push_back(elem);
2338 std::ostringstream oss;
2339 oss << rt->GetGateway();
2341 if (rt->GetGateway() ==
"0.0.0.0")
2344 rpElements.push_back(elem);
2348 rpElements.push_back(elem2);
2351 else if (rt->GetGateway() ==
"127.0.0.1")
2354 rpElements.push_back(elem);
2359 rpElements.push_back(elem);
2404 std::stringstream stream;
2407 return stream.str();
2415 NS_LOG_INFO(
"RecursiveIpv4RoutePathSearch from:" << from <<
" to:" << to);
2416 if (from ==
"0.0.0.0" || from ==
"127.0.0.1")
2426 rpElements.push_back(elem);
2455 Ptr<Ipv4Route> rt = rp->RouteOutput(pkt, header,
nullptr, sockerr);
2461 std::ostringstream oss;
2462 oss << rt->GetGateway();
2467 rpElements.push_back(elem);
2471 rpElements.push_back(elem2);
2477 rpElements.push_back(elem);
2504 std::string closeString =
"</" + name +
">\n";
2571 for (std::vector<std::string>::const_iterator i = ipv4Addresses.begin();
2572 i != ipv4Addresses.end();
2587 for (std::vector<std::string>::const_iterator i = ipv6Addresses.begin();
2588 i != ipv6Addresses.end();
2604 element.
AddAttribute(
"info", routingInfo.c_str(),
true);
2610 std::string destination,
2613 std::string tagName =
"rp";
2619 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin(); i != rpElements.end(); ++i)
2637 if (!metaInfo.empty())
2639 element.
AddAttribute(
"meta-info", metaInfo.c_str(),
true);
2646 std::string pktType,
2667 std::string metaInfo)
2673 if (!metaInfo.empty())
2675 element.
AddAttribute(
"meta-info", metaInfo.c_str(),
true);
2685 std::string counterName,
2769 double counterValue)
2799 std::string ipAddress,
2800 std::string channelType)
2812 : m_tagName(tagName),
2817template <
typename T>
2821 std::ostringstream oss;
2822 oss << std::setprecision(10);
2824 std::string attributeString = attribute;
2827 attributeString +=
"=\"";
2828 std::string valueStr = oss.str();
2829 for (std::string::iterator it = valueStr.begin(); it != valueStr.end(); ++it)
2834 attributeString +=
"&";
2837 attributeString +=
""";
2840 attributeString +=
"'";
2843 attributeString +=
"<";
2846 attributeString +=
">";
2849 attributeString += *it;
2853 attributeString +=
"\" ";
2857 attributeString +=
"=\"" + oss.str() +
"\" ";
2859 m_attributes.push_back(attributeString);
2865 m_children.push_back(e.
ToString());
2877 std::string elementString =
"<" + m_tagName +
" ";
2879 for (std::vector<std::string>::const_iterator i = m_attributes.begin(); i != m_attributes.end();
2882 elementString += *i;
2884 if (m_children.empty() && m_text.empty())
2888 elementString +=
"/>";
2893 elementString +=
">";
2894 if (!m_text.empty())
2896 elementString += m_text;
2898 if (!m_children.empty())
2900 elementString +=
"\n";
2901 for (std::vector<std::string>::const_iterator i = m_children.begin();
2902 i != m_children.end();
2905 elementString += *i +
"\n";
2910 elementString +=
"</" + m_tagName +
">";
2914 return elementString + ((autoClose) ?
"\n" :
"");
2924 .SetGroupName(
"NetAnim")
2938 return sizeof(uint64_t);
2956 os <<
"AnimUid=" << m_AnimUid;
2962 m_AnimUid = AnimUid;
2994 m_fbTx(fbTx.GetSeconds()),
double f(double x, void *params)
#define MAX_PKTS_PER_TRACE_FILE
#define CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS
#define CHECK_STARTED_INTIMEWINDOW
a polymophic address class
Byte tag using by Anim to uniquely identify packets.
TypeId GetInstanceTypeId() const override
Get Instance Type Id.
void Serialize(TagBuffer i) const override
Serialize function.
void Print(std::ostream &os) const override
Print tag info.
uint32_t GetSerializedSize() const override
Get Serialized Size.
uint64_t Get() const
Get Uid in tag.
static TypeId GetTypeId()
Get Type Id.
void Deserialize(TagBuffer i) override
Deserialize function.
void Set(uint64_t AnimUid)
Set global Uid in tag.
Ptr< const NetDevice > m_txnd
transmit device
void ProcessRxBegin(Ptr< const NetDevice > nd, const double fbRx)
Process receive begin.
Ptr< const NetDevice > m_rxnd
receive device
uint32_t m_txNodeId
node ID
void AppendChild(AnimXmlElement e)
Append child function.
void SetText(std::string text)
Set text function.
std::string ToString(bool autoClose=true)
Get text for the element function.
AnimXmlElement(std::string tagName, bool emptyElement=true)
Constructor.
void AddAttribute(std::string attribute, T value, bool xmlEscape=false)
Add attribute function.
Interface to network animator.
FILE * m_f
File handle for output (0 if none)
Time m_wifiMacCountersPollInterval
wifi MAC counters poll interval
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
CSMA Phy receive end trace function.
void WriteNodeSizes()
Write node sizes function.
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
void TrackQueueCounters()
Track queue counters function.
void SetMobilityPollInterval(Time t)
Set mobility poll interval:WARNING: setting a low interval can cause slowness.
uint32_t m_wifiMacRxCounterId
wifi MAC receive counter ID
bool IsPacketPending(uint64_t animUid, ProtocolType protocolType)
Is packet pending function.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Node has moved function.
void LrWpanPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
LR-WPAN Phy receive begin trace function.
uint32_t m_queueDropCounterId
queue drop counter ID
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
WIMax transmit trace function.
void LrWpanPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
LR-WPAN Phy receive begin trace function.
Time m_routingPollInterval
routing poll interval
void OutputCsmaPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo)
Output CSMA packet function.
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
Get anim UID from packet function.
EnergyFractionMap m_nodeEnergyFraction
node energy fraction
AnimUidPacketInfoMap m_pendingWavePackets
pending WAVE packets
void GenericWirelessTxTrace(std::string context, Ptr< const Packet > p, ProtocolType protocolType)
Generic wireless transmit trace function.
void LteRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
LTE receive trace function.
std::string ProtocolTypeToString(ProtocolType protocolType)
Protocol type to string function.
NodeCounterMap64 m_nodeLrWpanMacRx
node LR-WPAN MAC receive
std::string m_routingFileName
routing file name
NodeCounterMap64 m_nodeIpv4Tx
node IPv4 transmit
std::map< std::string, uint32_t > m_ipv6ToNodeIdMap
IPv6 to node ID map.
void MobilityAutoCheck()
Mobility auto check function.
void WriteXmlRouting(uint32_t id, std::string routingInfo)
Write XML routing function.
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet > p, WifiPhyRxfailureReason reason)
wifi Phy receive drop trace function
void WifiMacRxDropTrace(std::string context, Ptr< const Packet > p)
wifi MAC receive drop trace function
NodeCounterMap64 m_nodeQueueDrop
node queue drop
void ConnectLteUe(Ptr< Node > n, Ptr< LteUeNetDevice > nd, uint32_t devIndex)
Connect LTE ue function.
void DequeueTrace(std::string context, Ptr< const Packet >)
Dequeue trace function.
void ConnectCallbacks()
Connect callbacks function.
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
Write route path function.
AnimUidPacketInfoMap * ProtocolTypeToPendingPackets(ProtocolType protocolType)
Protocol type to pending packets function.
void RemainingEnergyTrace(std::string context, double previousEnergy, double currentEnergy)
Remaining energy trace function.
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.
NodeColorsMap m_nodeColors
node colors
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
wifi Phy receive begin trace function
void LrWpanMacRxDropTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC receive drop trace function.
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
LTE Spectrum Phy transmit start function.
NodeCounterMap64 m_nodeLrWpanMacTx
node LR-WPAN MAC transmit
void WriteXmlAddNodeCounter(uint32_t counterId, std::string counterName, CounterType counterType)
Write XML add node counter function.
void WriteXmlPRef(uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo="")
Write XMLP Ref function.
NodeCounterMap64 m_nodeWifiPhyTxDrop
node wifi Phy transmit drop
void WriteLinkProperties()
Write link properties function.
void WriteIpv4Addresses()
Write IPv4 Addresses function.
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
Get elements from context.
void WriteXmlAddResource(uint32_t resourceId, std::string resourcePath)
Write XML add resource function.
void OutputWirelessPacketTxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
Output wireless packet transmit info.
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
LTE Spectrum Phy receive start function.
void SetOutputFile(const std::string &fn, bool routing=false)
Set output file function.
NodeCounterMap64 m_nodeWifiMacTx
node wifi MAC transmit
AnimUidPacketInfoMap m_pendingWimaxPackets
pending wimax packets
void LteTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
LTE transmit trace function.
void EnableIpv4L3ProtocolCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Ipv4 L3 Protocol Counters such as Tx, Rx, Drop.
int WriteN(const char *data, uint32_t count, FILE *f)
WriteN function.
std::map< std::string, uint32_t > m_macToNodeIdMap
MAC to node ID map.
Ptr< Node > GetNodeFromContext(const std::string &context) const
Get node from context.
std::map< uint32_t, Vector > m_nodeLocation
node location
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get net device from context.
FILE * m_routingF
File handle for routing table output (0 if None);.
void UpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
Helper function to update the image of a node.
void TrackWifiPhyCounters()
Track wifi phy counters function.
void WavePhyTxBeginTrace(std::string context, Ptr< const Packet > p)
WAVE Phy transmit begin trace function.
AnimUidPacketInfoMap m_pendingUanPackets
pending UAN packets
void TrackIpv4RoutePaths()
Track IPv4 route paths function.
double GetNodeEnergyFraction(Ptr< const Node > node) const
Get node's energy fraction (This used only for testing)
bool IsInTimeWindow()
Is in time window function.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
CSMA Phy transmit begin trace function.
bool m_enablePacketMetadata
enable packet metadata
void PurgePendingPackets(ProtocolType protocolType)
Purge pending packets function.
void SetMaxPktsPerTraceFile(uint64_t maxPktsPerFile)
Set Max packets per trace file.
uint64_t m_maxPktsPerFile
maximum pakets per file
uint32_t m_ipv4L3ProtocolRxCounterId
IPv4 L3 protocol receive counter ID.
NodeCounterMap64 m_nodeIpv4Rx
node IPv4 receive
~AnimationInterface()
Destructor for the animator interface.
void AddToIpv4AddressNodeIdTable(std::string ipv4Address, uint32_t nodeId)
Add to IPv4 address node ID table function.
NodeIdIpv4Map m_nodeIdIpv4Map
node ID to IPv4 map
Time m_queueCountersPollInterval
queue counters poll interval
std::vector< std::string > GetIpv6Addresses(Ptr< NetDevice > nd)
Get IPv6 addresses.
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
void Ipv4RxTrace(std::string context, Ptr< const Packet > p, Ptr< Ipv4 > ipv4, uint32_t interfaceIndex)
IPv4 receive trace function.
bool IsStarted()
Is AnimationInterface started.
NodeCounterMap64 m_nodeQueueEnqueue
node queue enqueue
void WriteXmlUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
Write XML update node counter function.
std::vector< std::string > GetIpv4Addresses(Ptr< NetDevice > nd)
Get IPv4 addresses.
Time m_wifiPhyCountersPollInterval
wifi Phy counters poll interval
uint32_t m_queueDequeueCounterId
queue dequeue counter ID
NodeCounterMap64 m_nodeWifiMacRx
node wifi MAC receive
void AddToIpv6AddressNodeIdTable(std::string ipv6Address, uint32_t nodeId)
Add to IPv6 address node ID table function.
AnimationInterface & AddSourceDestination(uint32_t fromNodeId, std::string destinationIpv4Address)
Helper function to print the routing path from a source node to destination IP.
NodeCounterMap64 m_nodeIpv4Drop
node IPv4 drop
Time m_ipv4L3ProtocolCountersStopTime
IPv4 L3 protocol counters stop time.
uint32_t m_queueEnqueueCounterId
queue enqueue counter ID
void AddByteTag(uint64_t animUid, Ptr< const Packet > p)
Add byte tag function.
Time m_ipv4L3ProtocolCountersPollInterval
IPv4 L3 protocol counters poll interval.
void WriteNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
Write non P2P link properties function.
void StopAnimation(bool onlyAnimation=false)
Stop animation function.
std::vector< Ipv4RoutePathElement > Ipv4RoutePathElements
Ipv4RoutePathElements typedef.
void UanPhyGenTxTrace(std::string context, Ptr< const Packet >)
UAN Phy gen transmit trace function.
void WifiMacTxDropTrace(std::string context, Ptr< const Packet > p)
wifi MAC transmit drop trace function
uint32_t m_ipv4L3ProtocolTxCounterId
IPv4 L3 protocol transmit counter ID.
Time m_queueCountersStopTime
queue counters stop time
std::string CounterTypeToString(CounterType counterType)
Counter type to string function.
ProtocolType
ProtocolType enumeration.
CounterType
Counter Types.
std::string GetMacAddress(Ptr< NetDevice > nd)
Get MAC address function.
std::vector< Ptr< Node > > GetMovedNodes()
Get moved nodes function.
uint32_t m_wifiMacTxCounterId
wifi MAC transmit counter ID
void SkipPacketTracing()
Do not trace packets.
NodeCounterMap64 m_nodeWifiMacRxDrop
node wifi MAC receive drop
NodeDescriptionsMap m_nodeDescriptions
node description
void WriteXmlAnim(bool routing=false)
Write XML anim function.
void SetStartTime(Time t)
Specify the time at which capture should start.
uint32_t AddResource(std::string resourcePath)
Add a resource such as the path to an image file.
AnimationInterface(const std::string filename)
Constructor.
std::string GetIpv6Address(Ptr< NetDevice > nd)
Get IPv6 address.
void WriteNodeEnergies()
Write node energies function.
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
CSMA MAC receive trace function.
void WifiPhyTxBeginTrace(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
wifi Phy transmit PSDU begin trace function
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
UAN Phy gen receive trace function.
LinkPropertiesMap m_linkProperties
link properties
void WriteXmlUpdateNodeDescription(uint32_t nodeId)
Write XML update node description function.
std::map< uint32_t, NodeSize > m_nodeSizes
node sizes
std::pair< uint32_t, std::string > NodeIdIpv6Pair
NodeIdIpv6Pair typedef.
void ConnectLte()
Connect LTE function.
bool m_trackPackets
track packets
std::string GetNetAnimVersion()
Get netanim version function.
void WriteXmlNonP2pLinkProperties(uint32_t id, std::string ipAddress, std::string channelType)
Write XML non P2P link properties function.
void UpdateNodeSize(uint32_t nodeId, double width, double height)
Helper function to update the size of a node.
AnimationInterface & EnableIpv4RouteTracking(std::string fileName, Time startTime, Time stopTime, Time pollInterval=Seconds(5))
Enable tracking of the Ipv4 routing table for all Nodes.
void WriteXmlClose(std::string name, bool routing=false)
Write XML close function.
uint64_t gAnimUid
Packet unique identifier used by AnimationInterface.
void CheckMaxPktsPerTraceFile()
Check maximum packets per trace file function.
NodeCounterMap64 m_nodeLrWpanMacTxDrop
node LR-WPAN MAC transmit drop
NodeIdIpv6Map m_nodeIdIpv6Map
node ID to IPv6 map
void TrackIpv4Route()
Track IPv4 router function.
void EnableWifiPhyCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Phy Counters such as TxDrop, RxDrop.
AnimUidPacketInfoMap m_pendingWifiPackets
pending wifi packets
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
Time m_routingStopTime
routing stop time
void SetStopTime(Time t)
Specify the time at which capture should stop.
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
Mobility course change trace function.
void EnableWifiMacCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Mac Counters such as Tx, TxDrop, Rx, RxDrop.
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.
uint32_t m_wifiMacTxDropCounterId
wifi MAC transmit drop counter ID
void WriteXmlRp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
Write XMLRP function.
AnimUidPacketInfoMap m_pendingLrWpanPackets
pending LR-WPAN packets
void WifiMacTxTrace(std::string context, Ptr< const Packet > p)
wifi MAC transmit trace function
void ResetAnimWriteCallback()
Reset the write callback function.
void WimaxRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &m)
WIMax receive trace function.
void LrWpanMacTxDropTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC transmit drop trace function.
void LrWpanMacRxTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC receive trace function.
uint64_t GetTracePktCount()
Get trace file packet count (This used only for testing)
std::vector< std::string > m_nodeCounters
node counters
void WriteXmlNode(uint32_t id, uint32_t sysId, double locX, double locY)
Write XML node function.
AnimWriteCallback m_writeCallback
write callback
NodeCounterMap64 m_nodeWifiMacTxDrop
node wifi MAC transmit drop
uint64_t m_currentPktCount
current packet count
std::string GetIpv4RoutingTable(Ptr< Node > n)
Get IPv4 routing table function.
void Ipv4TxTrace(std::string context, Ptr< const Packet > p, Ptr< Ipv4 > ipv4, uint32_t interfaceIndex)
IPv4 transmit trace function.
std::pair< uint32_t, std::string > NodeIdIpv4Pair
NodeIdIpv4Pair typedef.
void EnqueueTrace(std::string context, Ptr< const Packet >)
Enqueue trace function.
void WriteXmlUpdateNodeColor(uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
Write XML update node color function.
Vector UpdatePosition(Ptr< Node > n)
Update position function.
std::string m_outputFileName
output file name
void WriteIpv6Addresses()
Write IPv6 Addresses function.
void AddPendingPacket(ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo)
Add pending packet function.
NodeCounterMap64 m_nodeWifiPhyRxDrop
node wifi Phy receive drop
void WriteXmlIpv4Addresses(uint32_t nodeId, std::vector< std::string > ipv4Addresses)
Write XML Ipv4 addresses function.
Vector GetPosition(Ptr< Node > n)
Get position function.
AnimUidPacketInfoMap m_pendingLtePackets
pending LTE packets
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
void WriteNodes()
Write nodes function.
NodeCounterMap64 m_nodeLrWpanMacRxDrop
node LR-WPAN MAC receive drop
Time m_wifiMacCountersStopTime
wifi MAC counters stop time
void WriteNodeColors()
Write node colors function.
Time m_startTime
start time
void RecursiveIpv4RoutePathSearch(std::string from, std::string to, Ipv4RoutePathElements &rpElements)
Recursive IPv4 route path search function.
static bool IsInitialized()
Check if AnimationInterface is initialized.
void LrWpanMacTxTrace(std::string context, Ptr< const Packet > p)
LR-WPAN MAC transmit trace function.
void WriteXmlUpdateBackground(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Write XML update background function.
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
CSMA Phy transmit end trace function.
void WriteXmlUpdateNodeSize(uint32_t nodeId, double width, double height)
Write XML update node size function.
uint32_t m_remainingEnergyCounterId
remaining energy counter ID
void WriteXmlUpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
Write XML update node image function.
uint32_t m_wifiMacRxDropCounterId
wifi MAC receive drop counter ID
void TrackWifiMacCounters()
Track wifi MAC counters function.
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
NodeCounterMap64 m_nodeQueueDequeue
node queue dequeue
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet > p)
wifi Phy transmit drop trace function
uint32_t m_wifiPhyRxDropCounterId
wifi Phy receive drop counter ID
void WriteXmlUpdateLink(uint32_t fromId, uint32_t toId, std::string linkDescription)
Write XML update link counter function.
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
Connect LTE ENB function.
void GenericWirelessRxTrace(std::string context, Ptr< const Packet > p, ProtocolType protocolType)
Generic wireless receive trace function.
std::string GetPacketMetadata(Ptr< const Packet > p)
Get packet metadata function.
uint32_t m_wifiPhyTxDropCounterId
wifi Phy transmit drop counter ID
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
IPv route track elements.
void EnableQueueCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Queue Counters such as Enqueue, Dequeue, Queue Drops.
uint32_t m_ipv4L3ProtocolDropCounterId
IPv4 protocol drop counter ID.
Time m_wifiPhyCountersStopTime
wifi Phy counters stop time
Time m_mobilityPollInterval
mobility poll interval
void OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
Output wireless packet receive info.
std::map< std::string, uint32_t > m_ipv4ToNodeIdMap
IPv4 to node ID map.
AnimUidPacketInfoMap m_pendingCsmaPackets
pending CSMA packets
std::vector< std::string > m_resources
resources
void TrackIpv4L3ProtocolCounters()
Track IPv4 L3 protocol counters function.
void WriteXmlUpdateNodePosition(uint32_t nodeId, double x, double y)
Write XML update node position function.
void StartAnimation(bool restart=false)
Start animation function.
void DevTxTrace(std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
Device transmit trace function.
std::string GetIpv4Address(Ptr< NetDevice > nd)
Get IPv4 address.
void WavePhyRxBeginTrace(std::string context, Ptr< const Packet > p)
WAVE Phy receive begin trace function.
void WifiMacRxTrace(std::string context, Ptr< const Packet > p)
wifi MAC receive trace function
void WriteXmlIpv6Addresses(uint32_t nodeId, std::vector< std::string > ipv6Addresses)
Write XML Ipv6 addresses function.
NodeContainer m_routingNc
routing node container
void SetAnimWriteCallback(AnimWriteCallback cb)
Set a callback function to listen to AnimationInterface write events.
void QueueDropTrace(std::string context, Ptr< const Packet >)
Queue trace function.
void WriteXmlLink(uint32_t fromId, uint32_t toLp, uint32_t toId)
Write XML link counter function.
std::map< uint64_t, AnimPacketInfo > AnimUidPacketInfoMap
AnimUidPacketInfoMap typedef.
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Iterator over the set of byte tags in a packet.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const =0
virtual std::size_t GetNDevices() const =0
Mobility model for which the current position does not change once it has been set and until it is se...
A Device for a Csma Network Link.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Introspection did not find any typical Config paths.
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol() const =0
Get the routing protocol to be used by this Ipv4 stack.
a class to store IPv4 address information on an interface
Ipv4Address GetLocal() const
Get the local address.
DropReason
Reason why a packet has been dropped.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Ipv6Address GetAddress() const
Get the IPv6 address.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
Ptr< LteEnbPhy > GetPhy() const
This class can contain 16 bit addresses.
Keep track of the current position and velocity of an object.
Vector GetPosition() const
virtual Ptr< Node > GetNode() const =0
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
uint32_t GetSystemId() const
uint32_t GetNDevices() const
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
static Ptr< Node > GetNode(uint32_t n)
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void Print(std::ostream &os) const
Print the packet contents.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
static void EnablePrinting()
Enable printing packets metadata.
ByteTagIterator GetByteTagIterator() const
Returns an iterator over the set of byte tags included in this packet.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static bool IsFinished()
Check if the simulation should finish.
static Time Now()
Return the current simulation virtual time.
SocketErrno
Enumeration of the possible errors returned by a socket.
void WriteU64(uint64_t v)
tag a set of bytes in a packet
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::string GetName() const
Get the name.
Net device for UAN models.
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
Hold together all Wifi-related objects.
Ptr< WifiMac > GetMac() const
Ptr< Node > GetNode() const override
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
bool ConnectFailSafe(std::string path, const CallbackBase &cb)
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static bool initialized
Initialization flag.
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Ipv4RoutePathElement structure.
std::string nextHop
next hop
Ipv4RouteTrackElement structure.
uint32_t fromNodeId
from node ID
std::string destination
destination
LinkProperties structure.
std::string fromNodeDescription
from node description
std::string linkDescription
link description
std::string toNodeDescription
to node description
P2pLinkNodeIdPair structure.
uint32_t fromNode
from node