A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::AnimationInterface Class Reference

Interface to network animator. More...

#include <animation-interface.h>

+ Collaboration diagram for ns3::AnimationInterface:

Public Types

typedef void(* AnimWriteCallback )(const char *str)
 typedef for WriteCallBack used for listening to AnimationInterface write messages

Public Member Functions

 AnimationInterface (const std::string filename, uint64_t maxPktsPerFile=MAX_PKTS_PER_TRACE_FILE, bool usingXML=true)
 Constructor.
 ~AnimationInterface ()
 Destructor for the animator interface.
int64_t AssignStreams (int64_t stream)
void EnablePacketMetadata (bool enable)
 Enable Packet metadata.
uint64_t GetTracePktCount ()
 Get trace file packet count (This used only for testing)
bool IsStarted (void)
 Is AnimationInterface started.
void ResetAnimWriteCallback ()
 Reset the write callback function.
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.
bool SetOutputFile (const std::string &fn)
 Specify that animation commands are to be written to the specified output file.
void SetRandomPosition (bool setRandPos)
 Set random position if a Mobility Model does not exists for the node.
void SetStartTime (Time t)
 Specify the time at which capture should start.
void SetStopTime (Time t)
 Specify the time at which capture should stop.
void SetXMLOutput ()
 Specify that animation commands are to be written in XML format.
void ShowAll802_11 (bool showAll)
 Show all 802.11 frames. Default: show only frames accepted by mac layer.
void ShowNode (uint32_t nodeId, bool show=true)
 Helper function to show/hide a node.
void ShowNode (Ptr< Node > n, bool show=true)
 Helper function to show/hide a node.
void StartAnimation (bool restart=false)
 Writes the topology information and sets up the appropriate animation packet tx callback.
void StopAnimation ()
 Closes the interface to the animator.
void UpdateLinkDescription (uint32_t fromNode, uint32_t toNode, std::string linkDescription)
 Helper function to update the description for a link.
void UpdateLinkDescription (Ptr< Node > fromNode, Ptr< Node > toNode, std::string linkDescription)
 Helper function to update the description for a link.
void UpdateNodeColor (Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
 Helper function to update the node color.
void UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
 Helper function to update the node color.
void UpdateNodeDescription (Ptr< Node > n, std::string descr)
 Helper function to update the description for a given node.
void UpdateNodeDescription (uint32_t nodeId, std::string descr)
 Helper function to update the description for a given node.

Static Public Member Functions

static bool IsInitialized (void)
 Check if AnimationInterface is initialized.
static void SetConstantPosition (Ptr< Node > n, double x, double y, double z=0)
 Helper function to set Constant Position for a given node.
static void SetLinkDescription (uint32_t fromNode, uint32_t toNode, std::string linkDescription, std::string fromNodeDescription="", std::string toNodeDescription="")
 Helper function to set the description for a link.
static void SetLinkDescription (Ptr< Node > fromNode, Ptr< Node > toNode, std::string linkDescription, std::string fromNodeDescription="", std::string toNodeDescription="")
 Helper function to set the description for a link.
static void SetNodeColor (Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
 Helper function to set the node color.
static void SetNodeColor (NodeContainer nc, uint8_t r, uint8_t g, uint8_t b)
 Helper function to set the color of nodes in a container.
static void SetNodeDescription (Ptr< Node > n, std::string descr)
 Helper function to set a brief description for a given node.
static void SetNodeDescription (NodeContainer nc, std::string descr)
 Helper function to set a brief description for nodes in a Node Container.

Private Member Functions

void AddMargin ()
void AddPendingCsmaPacket (uint64_t AnimUid, AnimPacketInfo &)
void AddPendingLtePacket (uint64_t AnimUid, AnimPacketInfo &)
void AddPendingUanPacket (uint64_t AnimUid, AnimPacketInfo &)
void AddPendingWifiPacket (uint64_t AnimUid, AnimPacketInfo &)
void AddPendingWimaxPacket (uint64_t AnimUid, AnimPacketInfo &)
void ConnectCallbacks ()
void ConnectLte ()
void ConnectLteEnb (Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
void ConnectLteUe (Ptr< Node > n, Ptr< LteUeNetDevice > nd, uint32_t devIndex)
void CsmaMacRxTrace (std::string context, Ptr< const Packet > p)
bool CsmaPacketIsPending (uint64_t AnimUid)
void CsmaPhyRxEndTrace (std::string context, Ptr< const Packet > p)
void CsmaPhyTxBeginTrace (std::string context, Ptr< const Packet > p)
void CsmaPhyTxEndTrace (std::string context, Ptr< const Packet > p)
void DevTxTrace (std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
uint64_t GetAnimUidFromPacket (Ptr< const Packet >)
std::vector< std::string > GetElementsFromContext (std::string context)
std::string GetIpv4Address (Ptr< NetDevice > nd)
std::string GetNetAnimVersion ()
Ptr< NetDeviceGetNetDeviceFromContext (std::string context)
std::string GetPacketMetadata (Ptr< const Packet > p)
Vector GetPosition (Ptr< Node > n)
std::string GetPreamble (void)
std::string GetXMLClose (std::string name)
std::string GetXMLOpen_anim (uint32_t lp)
std::string GetXMLOpen_packet (uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, std::string auxInfo="")
std::string GetXMLOpen_topology (double minX, double minY, double maxX, double maxY)
std::string GetXMLOpen_wpacket (uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range)
std::string GetXMLOpenClose_link (uint32_t fromLp, uint32_t fromId, uint32_t toLp, uint32_t toId)
std::string GetXMLOpenClose_linkupdate (uint32_t fromId, uint32_t toId, std::string)
std::string GetXMLOpenClose_meta (std::string metaInfo)
std::string GetXMLOpenClose_node (uint32_t lp, uint32_t id, double locX, double locY)
std::string GetXMLOpenClose_node (uint32_t lp, uint32_t id, double locX, double locY, struct Rgb rgb)
std::string GetXMLOpenClose_nodeupdate (uint32_t id, bool visible=true)
std::string GetXMLOpenClose_rx (uint32_t toLp, uint32_t toId, double fbRx, double lbRx)
bool IsInTimeWindow ()
bool LtePacketIsPending (uint64_t AnimUid)
void LteRxTrace (std::string context, Ptr< const Packet > p, const Mac48Address &)
void LteSpectrumPhyRxStart (std::string context, Ptr< const PacketBurst > pb)
void LteSpectrumPhyTxStart (std::string context, Ptr< const PacketBurst > pb)
void LteTxTrace (std::string context, Ptr< const Packet > p, const Mac48Address &)
void MobilityAutoCheck ()
void MobilityCourseChangeTrace (Ptr< const MobilityModel > mob)
bool NodeHasMoved (Ptr< Node > n, Vector newLocation)
void OutputCsmaPacket (Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
void OutputWirelessPacket (Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
void PurgePendingCsma ()
void PurgePendingLte ()
void PurgePendingWifi ()
void PurgePendingWimax ()
void RecalcTopoBounds (Vector v)
std::vector< Ptr< Node > > RecalcTopoBounds ()
void StartNewTraceFile ()
bool UanPacketIsPending (uint64_t AnimUid)
void UanPhyGenRxTrace (std::string context, Ptr< const Packet >)
void UanPhyGenTxTrace (std::string context, Ptr< const Packet >)
Vector UpdatePosition (Ptr< Node > n)
Vector UpdatePosition (Ptr< Node > n, Vector v)
void WifiMacRxTrace (std::string context, Ptr< const Packet > p)
bool WifiPacketIsPending (uint64_t AnimUid)
void WifiPhyRxBeginTrace (std::string context, Ptr< const Packet > p)
void WifiPhyRxDropTrace (std::string context, Ptr< const Packet > p)
void WifiPhyRxEndTrace (std::string context, Ptr< const Packet > p)
void WifiPhyTxBeginTrace (std::string context, Ptr< const Packet > p)
void WifiPhyTxDropTrace (std::string context, Ptr< const Packet > p)
void WifiPhyTxEndTrace (std::string context, Ptr< const Packet > p)
bool WimaxPacketIsPending (uint64_t AnimUid)
void WimaxRxTrace (std::string context, Ptr< const Packet > p, const Mac48Address &)
void WimaxTxTrace (std::string context, Ptr< const Packet > p, const Mac48Address &)
void WriteDummyPacket ()
int WriteN (const char *, uint32_t)
int WriteN (const std::string &)

Private Attributes

uint64_t gAnimUid
uint64_t m_currentPktCount
bool m_enablePacketMetadata
FILE * m_f
std::map< std::string, uint32_t > m_macToNodeIdMap
uint64_t m_maxPktsPerFile
Time m_mobilityPollInterval
std::map< uint32_t, Vectorm_nodeLocation
std::string m_originalFileName
std::string m_outputFileName
bool m_outputFileSet
std::map< uint64_t,
AnimPacketInfo
m_pendingCsmaPackets
std::map< uint64_t,
AnimPacketInfo
m_pendingLtePackets
std::map< uint64_t,
AnimPacketInfo
m_pendingUanPackets
std::map< uint64_t,
AnimPacketInfo
m_pendingWifiPackets
std::map< uint64_t,
AnimPacketInfo
m_pendingWimaxPackets
bool m_randomPosition
bool m_started
Time m_startTime
Time m_stopTime
double m_topoMaxX
double m_topoMaxY
double m_topoMinX
double m_topoMinY
Ptr< UniformRandomVariablem_uniformRandomVariable
 Provides uniform random variables.
AnimWriteCallback m_writeCallback
bool m_xml

Static Private Attributes

static std::map
< P2pLinkNodeIdPair,
LinkProperties,
LinkPairCompare
linkProperties
static std::map< uint32_t, RgbnodeColors
static std::map< uint32_t,
std::string > 
nodeDescriptions

Detailed Description

Interface to network animator.

Provides functions that facilitate communications with an external or internal network animator.

Definition at line 92 of file animation-interface.h.

Member Typedef Documentation

typedef void(* ns3::AnimationInterface::AnimWriteCallback)(const char *str)

typedef for WriteCallBack used for listening to AnimationInterface write messages

Definition at line 206 of file animation-interface.h.

Constructor & Destructor Documentation

ns3::AnimationInterface::AnimationInterface ( const std::string  filename,
uint64_t  maxPktsPerFile = MAX_PKTS_PER_TRACE_FILE,
bool  usingXML = true 
)

Constructor.

Parameters
filenameThe Filename for the trace file used by the Animator
maxPktsPerFileThe maximum number of packets per trace file. AnimationInterface will create trace files with the following filenames : filename, filename-1, filename-2..., filename-N where each file contains packet info for 'maxPktPerFile' number of packets
usingXMLSet to true if XML output traces are required

Definition at line 63 of file animation-interface.cc.

References ns3::initialized, m_uniformRandomVariable, and StartAnimation().

+ Here is the call graph for this function:

ns3::AnimationInterface::~AnimationInterface ( )

Destructor for the animator interface.

Definition at line 77 of file animation-interface.cc.

References StopAnimation().

+ Here is the call graph for this function:

Member Function Documentation

void ns3::AnimationInterface::AddMargin ( )
private

Definition at line 625 of file animation-interface.cc.

References m_topoMaxX, m_topoMaxY, m_topoMinX, m_topoMinY, NS_LOG_INFO, and visualizer.higcontainer::w.

Referenced by RecalcTopoBounds(), and StartAnimation().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::AddPendingCsmaPacket ( uint64_t  AnimUid,
AnimPacketInfo pktinfo 
)
private

Definition at line 799 of file animation-interface.cc.

References m_pendingCsmaPackets, ns3::AnimPacketInfo::m_txnd, and NS_ASSERT.

Referenced by CsmaPhyTxBeginTrace(), and CsmaPhyTxEndTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::AddPendingLtePacket ( uint64_t  AnimUid,
AnimPacketInfo pktinfo 
)
private

Definition at line 793 of file animation-interface.cc.

References m_pendingLtePackets, ns3::AnimPacketInfo::m_txnd, and NS_ASSERT.

Referenced by LteSpectrumPhyTxStart(), and LteTxTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::AddPendingUanPacket ( uint64_t  AnimUid,
AnimPacketInfo pktinfo 
)
private

Definition at line 776 of file animation-interface.cc.

References m_pendingUanPackets.

Referenced by UanPhyGenTxTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::AddPendingWifiPacket ( uint64_t  AnimUid,
AnimPacketInfo pktinfo 
)
private

Definition at line 782 of file animation-interface.cc.

References m_pendingWifiPackets.

Referenced by WifiPhyRxBeginTrace(), WifiPhyRxEndTrace(), and WifiPhyTxBeginTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::AddPendingWimaxPacket ( uint64_t  AnimUid,
AnimPacketInfo pktinfo 
)
private

Definition at line 787 of file animation-interface.cc.

References m_pendingWimaxPackets, ns3::AnimPacketInfo::m_txnd, and NS_ASSERT.

Referenced by WimaxTxTrace().

+ Here is the caller graph for this function:

int64_t ns3::AnimationInterface::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 1319 of file animation-interface.cc.

References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

void ns3::AnimationInterface::ConnectLte ( )
private

Definition at line 535 of file animation-interface.cc.

References ns3::NodeList::Begin(), ConnectLteEnb(), ConnectLteUe(), ns3::NodeList::End(), ns3::Node::GetDevice(), ns3::Node::GetNDevices(), and NS_ASSERT.

Referenced by ConnectCallbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::ConnectLteEnb ( Ptr< Node n,
Ptr< LteEnbNetDevice nd,
uint32_t  devIndex 
)
private
void ns3::AnimationInterface::ConnectLteUe ( Ptr< Node n,
Ptr< LteUeNetDevice nd,
uint32_t  devIndex 
)
private

Definition at line 514 of file animation-interface.cc.

References ns3::LtePhy::GetDownlinkSpectrumPhy(), ns3::Node::GetId(), ns3::LtePhy::GetUplinkSpectrumPhy(), LteSpectrumPhyRxStart(), LteSpectrumPhyTxStart(), ns3::MakeCallback(), and ns3::ObjectBase::TraceConnect().

Referenced by ConnectLte().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::CsmaMacRxTrace ( std::string  context,
Ptr< const Packet p 
)
private
bool ns3::AnimationInterface::CsmaPacketIsPending ( uint64_t  AnimUid)
private

Definition at line 186 of file animation-interface.cc.

References m_pendingCsmaPackets.

Referenced by CsmaMacRxTrace(), CsmaPhyRxEndTrace(), and CsmaPhyTxEndTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::CsmaPhyRxEndTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::CsmaPhyTxBeginTrace ( std::string  context,
Ptr< const Packet p 
)
private

Definition at line 1149 of file animation-interface.cc.

References ns3::Packet::AddByteTag(), AddPendingCsmaPacket(), gAnimUid, GetNetDeviceFromContext(), ns3::NetDevice::GetNode(), IsInTimeWindow(), m_started, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_INFO, ns3::AnimByteTag::Set(), and UpdatePosition().

Referenced by ConnectCallbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::CsmaPhyTxEndTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::DevTxTrace ( std::string  context,
Ptr< const Packet p,
Ptr< NetDevice tx,
Ptr< NetDevice rx,
Time  txTime,
Time  rxTime 
)
private
void ns3::AnimationInterface::EnablePacketMetadata ( bool  enable)

Enable Packet metadata.

Parameters
enableif true enables writing the packet metadata to the XML trace file if false disables writing the packet metadata

Definition at line 139 of file animation-interface.cc.

References ns3::Packet::EnablePrinting(), and m_enablePacketMetadata.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< std::string > ns3::AnimationInterface::GetElementsFromContext ( std::string  context)
private

Definition at line 1754 of file animation-interface.cc.

Referenced by GetNetDeviceFromContext().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetIpv4Address ( Ptr< NetDevice nd)
private

Definition at line 361 of file animation-interface.cc.

References ns3::Ipv4::GetAddress(), ns3::Node::GetId(), ns3::Ipv4::GetInterfaceForDevice(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::NodeList::GetNode(), and ns3::NetDevice::GetNode().

Referenced by StartAnimation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetNetAnimVersion ( )
private

Definition at line 106 of file animation-interface.cc.

Referenced by GetXMLOpen_anim().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetPacketMetadata ( Ptr< const Packet p)
private

Definition at line 1306 of file animation-interface.cc.

References ns3::Packet::Print().

Referenced by DevTxTrace(), OutputCsmaPacket(), and OutputWirelessPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Vector ns3::AnimationInterface::GetPosition ( Ptr< Node n)
private

Definition at line 242 of file animation-interface.cc.

References ns3::Node::GetId(), m_nodeLocation, and NS_FATAL_ERROR.

Referenced by MobilityAutoCheck(), MobilityCourseChangeTrace(), NodeHasMoved(), RecalcTopoBounds(), and StartAnimation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetPreamble ( void  )
private

Definition at line 1330 of file animation-interface.cc.

Referenced by StartAnimation().

+ Here is the caller graph for this function:

uint64_t ns3::AnimationInterface::GetTracePktCount ( )

Get trace file packet count (This used only for testing)

returns Number of packets recorded in the current trace file

Definition at line 1313 of file animation-interface.cc.

References m_currentPktCount.

std::string ns3::AnimationInterface::GetXMLClose ( std::string  name)
inlineprivate
std::string ns3::AnimationInterface::GetXMLOpen_anim ( uint32_t  lp)
private

Definition at line 1587 of file animation-interface.cc.

References GetNetAnimVersion().

Referenced by StartAnimation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpen_packet ( uint32_t  fromLp,
uint32_t  fromId,
double  fbTx,
double  lbTx,
std::string  auxInfo = "" 
)
private

Definition at line 1711 of file animation-interface.cc.

Referenced by DevTxTrace(), OutputCsmaPacket(), and WriteDummyPacket().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpen_topology ( double  minX,
double  minY,
double  maxX,
double  maxY 
)
private

Definition at line 1593 of file animation-interface.cc.

Referenced by MobilityAutoCheck(), MobilityCourseChangeTrace(), and StartAnimation().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpen_wpacket ( uint32_t  fromLp,
uint32_t  fromId,
double  fbTx,
double  lbTx,
double  range 
)
private

Definition at line 1723 of file animation-interface.cc.

Referenced by OutputWirelessPacket().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_link ( uint32_t  fromLp,
uint32_t  fromId,
uint32_t  toLp,
uint32_t  toId 
)
private

Definition at line 1680 of file animation-interface.cc.

References ns3::LinkProperties::fromNodeDescription, ns3::LinkProperties::linkDescription, linkProperties, and ns3::LinkProperties::toNodeDescription.

Referenced by StartAnimation().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_linkupdate ( uint32_t  fromId,
uint32_t  toId,
std::string  linkDescription 
)
private

Definition at line 1666 of file animation-interface.cc.

References ns3::Time::GetSeconds(), and ns3::Now().

Referenced by UpdateLinkDescription().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_meta ( std::string  metaInfo)
private

Definition at line 1746 of file animation-interface.cc.

Referenced by DevTxTrace(), OutputCsmaPacket(), and OutputWirelessPacket().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_node ( uint32_t  lp,
uint32_t  id,
double  locX,
double  locY 
)
private

Definition at line 1630 of file animation-interface.cc.

References nodeDescriptions.

Referenced by MobilityAutoCheck(), MobilityCourseChangeTrace(), and StartAnimation().

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_node ( uint32_t  lp,
uint32_t  id,
double  locX,
double  locY,
struct Rgb  rgb 
)
private

Definition at line 1646 of file animation-interface.cc.

References ns3::Rgb::b, ns3::Rgb::g, nodeDescriptions, and ns3::Rgb::r.

std::string ns3::AnimationInterface::GetXMLOpenClose_nodeupdate ( uint32_t  id,
bool  visible = true 
)
private

Definition at line 1603 of file animation-interface.cc.

References ns3::Rgb::b, ns3::Rgb::g, ns3::Time::GetSeconds(), nodeColors, nodeDescriptions, ns3::Now(), and ns3::Rgb::r.

Referenced by ShowNode(), UpdateNodeColor(), and UpdateNodeDescription().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::AnimationInterface::GetXMLOpenClose_rx ( uint32_t  toLp,
uint32_t  toId,
double  fbRx,
double  lbRx 
)
private

Definition at line 1735 of file animation-interface.cc.

Referenced by DevTxTrace(), OutputCsmaPacket(), OutputWirelessPacket(), and WriteDummyPacket().

+ Here is the caller graph for this function:

bool ns3::AnimationInterface::IsInitialized ( void  )
static

Check if AnimationInterface is initialized.

Returns
true if AnimationInterface was already initialized

Definition at line 146 of file animation-interface.cc.

References ns3::initialized.

bool ns3::AnimationInterface::IsStarted ( void  )

Is AnimationInterface started.

Returns
true if AnimationInterface was started

Definition at line 151 of file animation-interface.cc.

References m_started.

bool ns3::AnimationInterface::LtePacketIsPending ( uint64_t  AnimUid)
private

Definition at line 197 of file animation-interface.cc.

References m_pendingLtePackets.

Referenced by LteRxTrace(), and LteSpectrumPhyRxStart().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::LteRxTrace ( std::string  context,
Ptr< const Packet p,
const Mac48Address m 
)
private
void ns3::AnimationInterface::LteSpectrumPhyRxStart ( std::string  context,
Ptr< const PacketBurst pb 
)
private
void ns3::AnimationInterface::LteSpectrumPhyTxStart ( std::string  context,
Ptr< const PacketBurst pb 
)
private
void ns3::AnimationInterface::LteTxTrace ( std::string  context,
Ptr< const Packet p,
const Mac48Address m 
)
private
void ns3::AnimationInterface::MobilityCourseChangeTrace ( Ptr< const MobilityModel mob)
private
bool ns3::AnimationInterface::NodeHasMoved ( Ptr< Node n,
Vector  newLocation 
)
private

Definition at line 1264 of file animation-interface.cc.

References GetPosition(), ns3::Vector3D::x, and ns3::Vector3D::y.

Referenced by RecalcTopoBounds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::OutputCsmaPacket ( Ptr< const Packet p,
AnimPacketInfo pktInfo,
AnimRxInfo  pktrxInfo 
)
private
void ns3::AnimationInterface::PurgePendingCsma ( )
private

Definition at line 334 of file animation-interface.cc.

References ns3::Time::GetSeconds(), ns3::AnimPacketInfo::m_fbTx, m_pendingCsmaPackets, ns3::Now(), and PURGE_INTERVAL.

Referenced by MobilityAutoCheck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::PurgePendingLte ( )
private

Definition at line 308 of file animation-interface.cc.

References ns3::Time::GetSeconds(), ns3::AnimPacketInfo::m_fbTx, m_pendingLtePackets, ns3::Now(), and PURGE_INTERVAL.

Referenced by MobilityAutoCheck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::PurgePendingWifi ( )
private

Definition at line 253 of file animation-interface.cc.

References ns3::Time::GetSeconds(), ns3::AnimPacketInfo::m_fbTx, m_pendingWifiPackets, ns3::Now(), and PURGE_INTERVAL.

Referenced by MobilityAutoCheck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::PurgePendingWimax ( )
private

Definition at line 280 of file animation-interface.cc.

References ns3::Time::GetSeconds(), ns3::AnimPacketInfo::m_fbTx, m_pendingWimaxPackets, ns3::Now(), and PURGE_INTERVAL.

Referenced by MobilityAutoCheck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::RecalcTopoBounds ( Vector  v)
private

Definition at line 669 of file animation-interface.cc.

References AddMargin(), m_topoMaxX, m_topoMaxY, m_topoMinX, m_topoMinY, ns3::Vector3D::x, and ns3::Vector3D::y.

+ Here is the call graph for this function:

std::vector< Ptr< Node > > ns3::AnimationInterface::RecalcTopoBounds ( )
private

Definition at line 638 of file animation-interface.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Object::GetObject(), ns3::MobilityModel::GetPosition(), GetPosition(), NodeHasMoved(), NS_ASSERT, and UpdatePosition().

Referenced by MobilityAutoCheck(), and MobilityCourseChangeTrace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::ResetAnimWriteCallback ( )

Reset the write callback function.

Definition at line 162 of file animation-interface.cc.

References m_writeCallback.

Referenced by StopAnimation().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetAnimWriteCallback ( AnimWriteCallback  cb)

Set a callback function to listen to AnimationInterface write events.

Parameters
cbAddress of callback function

Definition at line 157 of file animation-interface.cc.

References m_writeCallback.

void ns3::AnimationInterface::SetConstantPosition ( Ptr< Node n,
double  x,
double  y,
double  z = 0 
)
static

Helper function to set Constant Position for a given node.

Parameters
nPtr to the node
xX co-ordinate of the node
yY co-ordinate of the node
zZ co-ordinate of the node

Definition at line 1426 of file animation-interface.cc.

References ns3::Object::AggregateObject(), ns3::Node::GetId(), ns3::Object::GetObject(), NS_ASSERT, and NS_LOG_INFO.

Referenced by ns3::AnimationInterfaceTestCase::DoRun(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetLinkDescription ( uint32_t  fromNode,
uint32_t  toNode,
std::string  linkDescription,
std::string  fromNodeDescription = "",
std::string  toNodeDescription = "" 
)
static

Helper function to set the description for a link.

Parameters
fromNodeNode Id of the "from Node" of the p2p link
toNodeNode Id of the "to Node" of the p2p link
linkDescriptionDescription of the link such as link bandwidth
fromNodeDescriptionDescription at the "from Node" end such as IP address
toNodeDescriptionDescription at the "to Node" end such as Ip address

Definition at line 1513 of file animation-interface.cc.

References ns3::P2pLinkNodeIdPair::fromNode, linkProperties, and ns3::P2pLinkNodeIdPair::toNode.

Referenced by SetLinkDescription(), and StartAnimation().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetLinkDescription ( Ptr< Node fromNode,
Ptr< Node toNode,
std::string  linkDescription,
std::string  fromNodeDescription = "",
std::string  toNodeDescription = "" 
)
static

Helper function to set the description for a link.

Parameters
fromNodePtr to the "from Node" of the p2p link
toNodePtr the "to Node" of the p2p link
linkDescriptionDescription of the link such as link bandwidth
fromNodeDescriptionDescription at the "from Node" end such as IP address
toNodeDescriptionDescription at the "to Node" end such as Ip address

Definition at line 1537 of file animation-interface.cc.

References ns3::Node::GetId(), NS_ASSERT, and SetLinkDescription().

+ Here is the call graph for this function:

void ns3::AnimationInterface::SetMobilityPollInterval ( Time  t)

Set mobility poll interval:WARNING: setting a low interval can cause slowness.

Parameters
tTime interval between fetching mobility/position information Default: 0.25s

Definition at line 202 of file animation-interface.cc.

References m_mobilityPollInterval.

void ns3::AnimationInterface::SetNodeColor ( Ptr< Node n,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
static

Helper function to set the node color.

Parameters
nPtr to the node
rRed component value (0-255)
gGreen component value (0-255)
bBlue component value (0-255)

Definition at line 1441 of file animation-interface.cc.

References ns3::Node::GetId(), ns3::initialized, nodeColors, NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_INFO.

Referenced by main(), and SetNodeColor().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetNodeColor ( NodeContainer  nc,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
static

Helper function to set the color of nodes in a container.

Parameters
nPtr to the node
rRed component value (0-255)
gGreen component value (0-255)
bBlue component value (0-255)

Definition at line 1484 of file animation-interface.cc.

References ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), NS_ASSERT, and SetNodeColor().

+ Here is the call graph for this function:

void ns3::AnimationInterface::SetNodeDescription ( Ptr< Node n,
std::string  descr 
)
static

Helper function to set a brief description for a given node.

Parameters
nPtr to the node
descrA string to briefly describe the node

Definition at line 1548 of file animation-interface.cc.

References ns3::Node::GetId(), ns3::initialized, nodeDescriptions, NS_ASSERT, and NS_FATAL_ERROR.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetNodeDescription ( NodeContainer  nc,
std::string  descr 
)
static

Helper function to set a brief description for nodes in a Node Container.

Parameters
ncNodeContainer containing the nodes
descrA string to briefly describe the nodes

Definition at line 1572 of file animation-interface.cc.

References ns3::NodeContainer::Get(), ns3::Node::GetId(), ns3::NodeContainer::GetN(), ns3::initialized, nodeDescriptions, NS_ASSERT, and NS_FATAL_ERROR.

+ Here is the call graph for this function:

bool ns3::AnimationInterface::SetOutputFile ( const std::string &  fn)

Specify that animation commands are to be written to the specified output file.

This call is used to write the animation information to a text file that can later be used as input to the network animator tool.

Parameters
fnThe name of the output file.
Returns
true if successful open.

Definition at line 121 of file animation-interface.cc.

References m_f, m_outputFileName, m_outputFileSet, NS_FATAL_ERROR, and NS_LOG_INFO.

Referenced by StartAnimation().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::SetRandomPosition ( bool  setRandPos)

Set random position if a Mobility Model does not exists for the node.

Parameters
setRandPosTrue if a random position can be set for a node without a Mobililty model

Definition at line 207 of file animation-interface.cc.

References m_randomPosition.

void ns3::AnimationInterface::SetStartTime ( Time  t)

Specify the time at which capture should start.

Parameters
tThe time at which AnimationInterface should begin capture of traffic info
Returns
none

Definition at line 111 of file animation-interface.cc.

References m_startTime.

void ns3::AnimationInterface::SetStopTime ( Time  t)

Specify the time at which capture should stop.

Parameters
tThe time at which AnimationInterface should stop capture of traffic info
Returns
none

Definition at line 116 of file animation-interface.cc.

References m_stopTime.

void ns3::AnimationInterface::SetXMLOutput ( )

Specify that animation commands are to be written in XML format.

Returns
none

Definition at line 82 of file animation-interface.cc.

References m_xml, and NS_LOG_INFO.

void ns3::AnimationInterface::ShowAll802_11 ( bool  showAll)

Show all 802.11 frames. Default: show only frames accepted by mac layer.

Parameters
showAllif true shows all 802.11 frames including beacons, association request and acks (very chatty). if false only frames accepted by mac layer
void ns3::AnimationInterface::ShowNode ( uint32_t  nodeId,
bool  show = true 
)

Helper function to show/hide a node.

Parameters
nodeIdId of the node
showSet to true to show node, set to false to hide

Definition at line 1451 of file animation-interface.cc.

References ns3::NodeList::GetNode(), GetXMLOpenClose_nodeupdate(), NS_ASSERT, NS_LOG_INFO, and WriteN().

Referenced by modify(), and ShowNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::ShowNode ( Ptr< Node n,
bool  show = true 
)

Helper function to show/hide a node.

Parameters
nPtr to the node
showSet to true to show node, set to false to hide

Definition at line 1461 of file animation-interface.cc.

References ShowNode().

+ Here is the call graph for this function:

void ns3::AnimationInterface::StartAnimation ( bool  restart = false)

Writes the topology information and sets up the appropriate animation packet tx callback.

Writes the topology information to the appropriate output, depending on prior calls to SetOutputFile, SetServerPort, or SetInternalAnimation. Then creates the callbacks needed for the animator to start processing packets.

Parameters
restartTrue when restarting animation

Definition at line 373 of file animation-interface.cc.

References AddMargin(), ns3::NodeList::Begin(), ConnectCallbacks(), ns3::NodeList::End(), ns3::NetDevice::GetChannel(), ns3::Channel::GetDevice(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Object::GetInstanceTypeId(), GetIpv4Address(), ns3::TypeId::GetName(), ns3::Channel::GetNDevices(), ns3::Node::GetNDevices(), ns3::NodeList::GetNNodes(), ns3::NetDevice::GetNode(), GetPosition(), GetPreamble(), GetXMLClose(), GetXMLOpen_anim(), GetXMLOpen_topology(), GetXMLOpenClose_link(), GetXMLOpenClose_node(), linkProperties, m_currentPktCount, m_mobilityPollInterval, m_outputFileName, m_started, m_topoMaxX, m_topoMaxY, m_topoMinX, m_topoMinY, m_xml, MobilityAutoCheck(), nodeColors, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_INFO, ns3::Simulator::Schedule(), SetLinkDescription(), SetOutputFile(), UpdatePosition(), WriteN(), ns3::Vector3D::x, and ns3::Vector3D::y.

Referenced by AnimationInterface(), and StartNewTraceFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::StartNewTraceFile ( )
private

Definition at line 89 of file animation-interface.cc.

References m_currentPktCount, m_maxPktsPerFile, m_originalFileName, m_outputFileName, StartAnimation(), and StopAnimation().

Referenced by DevTxTrace(), OutputCsmaPacket(), and OutputWirelessPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::StopAnimation ( )

Closes the interface to the animator.

Definition at line 599 of file animation-interface.cc.

References GetXMLClose(), m_f, m_outputFileSet, m_started, m_xml, NS_LOG_INFO, ResetAnimWriteCallback(), and WriteN().

Referenced by StartNewTraceFile(), and ~AnimationInterface().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::AnimationInterface::UanPacketIsPending ( uint64_t  AnimUid)
private

Definition at line 176 of file animation-interface.cc.

References m_pendingUanPackets.

Referenced by UanPhyGenRxTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::UanPhyGenRxTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::UanPhyGenTxTrace ( std::string  context,
Ptr< const Packet p 
)
private

Definition at line 830 of file animation-interface.cc.

References ns3::Packet::AddByteTag(), AddPendingUanPacket(), gAnimUid, GetNetDeviceFromContext(), ns3::NetDevice::GetNode(), IsInTimeWindow(), m_started, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_INFO, ns3::AnimByteTag::Set(), and UpdatePosition().

Referenced by ConnectCallbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::UpdateLinkDescription ( uint32_t  fromNode,
uint32_t  toNode,
std::string  linkDescription 
)

Helper function to update the description for a link.

Parameters
fromNodeNode Id of the "from Node" of the p2p link
toNodeNode Id of the "to Node" of the p2p link
linkDescriptionDescription of the link such as link bandwidth

Definition at line 1495 of file animation-interface.cc.

References GetXMLOpenClose_linkupdate(), and WriteN().

Referenced by modify().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::UpdateLinkDescription ( Ptr< Node fromNode,
Ptr< Node toNode,
std::string  linkDescription 
)

Helper function to update the description for a link.

Parameters
fromNodePtr to the "from Node" of the p2p link
toNodePtr to the "to Node" of the p2p link
linkDescriptionDescription of the link such as link bandwidth

Definition at line 1503 of file animation-interface.cc.

References ns3::Node::GetId(), GetXMLOpenClose_linkupdate(), NS_ASSERT, and WriteN().

+ Here is the call graph for this function:

void ns3::AnimationInterface::UpdateNodeColor ( Ptr< Node n,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Helper function to update the node color.

Parameters
nPtr to the node
rRed component value (0-255)
gGreen component value (0-255)
bBlue component value (0-255)

Definition at line 1466 of file animation-interface.cc.

References ns3::Node::GetId().

Referenced by modify().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::UpdateNodeColor ( uint32_t  nodeId,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Helper function to update the node color.

Parameters
nodeIdId of the node
rRed component value (0-255)
gGreen component value (0-255)
bBlue component value (0-255)

Definition at line 1471 of file animation-interface.cc.

References ns3::NodeList::GetNode(), GetXMLOpenClose_nodeupdate(), nodeColors, NS_ASSERT, NS_LOG_INFO, and WriteN().

+ Here is the call graph for this function:

void ns3::AnimationInterface::UpdateNodeDescription ( Ptr< Node n,
std::string  descr 
)

Helper function to update the description for a given node.

Parameters
nPtr to the node
descrA string to briefly describe the node

Definition at line 1556 of file animation-interface.cc.

References ns3::Node::GetId().

Referenced by modify().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::AnimationInterface::UpdateNodeDescription ( uint32_t  nodeId,
std::string  descr 
)

Helper function to update the description for a given node.

Parameters
nodeIdId of the node
descrA string to briefly describe the node

Definition at line 1561 of file animation-interface.cc.

References ns3::NodeList::GetNode(), GetXMLOpenClose_nodeupdate(), nodeDescriptions, NS_ASSERT, and WriteN().

+ Here is the call graph for this function:

Vector ns3::AnimationInterface::UpdatePosition ( Ptr< Node n,
Vector  v 
)
private

Definition at line 236 of file animation-interface.cc.

References ns3::Node::GetId(), and m_nodeLocation.

+ Here is the call graph for this function:

void ns3::AnimationInterface::WifiMacRxTrace ( std::string  context,
Ptr< const Packet p 
)
private
bool ns3::AnimationInterface::WifiPacketIsPending ( uint64_t  AnimUid)
private

Definition at line 181 of file animation-interface.cc.

References m_pendingWifiPackets.

Referenced by WifiMacRxTrace(), WifiPhyRxBeginTrace(), WifiPhyRxEndTrace(), and WifiPhyTxDropTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::WifiPhyRxBeginTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::WifiPhyRxDropTrace ( std::string  context,
Ptr< const Packet p 
)
private

Definition at line 1007 of file animation-interface.cc.

void ns3::AnimationInterface::WifiPhyTxBeginTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::WifiPhyTxDropTrace ( std::string  context,
Ptr< const Packet p 
)
private
void ns3::AnimationInterface::WifiPhyTxEndTrace ( std::string  context,
Ptr< const Packet p 
)
private

Definition at line 896 of file animation-interface.cc.

bool ns3::AnimationInterface::WimaxPacketIsPending ( uint64_t  AnimUid)
private

Definition at line 192 of file animation-interface.cc.

References m_pendingWimaxPackets.

Referenced by WimaxRxTrace().

+ Here is the caller graph for this function:

void ns3::AnimationInterface::WimaxRxTrace ( std::string  context,
Ptr< const Packet p,
const Mac48Address m 
)
private
void ns3::AnimationInterface::WimaxTxTrace ( std::string  context,
Ptr< const Packet p,
const Mac48Address m 
)
private
void ns3::AnimationInterface::WriteDummyPacket ( )
private

Definition at line 707 of file animation-interface.cc.

References ns3::Time::GetSeconds(), GetXMLClose(), GetXMLOpen_packet(), GetXMLOpenClose_rx(), m_xml, ns3::Now(), and WriteN().

Referenced by MobilityAutoCheck(), and MobilityCourseChangeTrace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::AnimationInterface::WriteN ( const char *  data,
uint32_t  count 
)
private
int ns3::AnimationInterface::WriteN ( const std::string &  st)
private

Definition at line 615 of file animation-interface.cc.

References m_writeCallback, and WriteN().

+ Here is the call graph for this function:

Member Data Documentation

uint64_t ns3::AnimationInterface::gAnimUid
private
std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > ns3::AnimationInterface::linkProperties
staticprivate

Definition at line 550 of file animation-interface.h.

Referenced by GetXMLOpenClose_link(), SetLinkDescription(), and StartAnimation().

uint64_t ns3::AnimationInterface::m_currentPktCount
private
bool ns3::AnimationInterface::m_enablePacketMetadata
private
FILE* ns3::AnimationInterface::m_f
private

Definition at line 416 of file animation-interface.h.

Referenced by SetOutputFile(), StopAnimation(), and WriteN().

std::map<std::string, uint32_t> ns3::AnimationInterface::m_macToNodeIdMap
private

Definition at line 541 of file animation-interface.h.

Referenced by WifiPhyRxBeginTrace(), and WifiPhyTxBeginTrace().

uint64_t ns3::AnimationInterface::m_maxPktsPerFile
private

Definition at line 430 of file animation-interface.h.

Referenced by StartNewTraceFile().

Time ns3::AnimationInterface::m_mobilityPollInterval
private
std::map<uint32_t, Vector> ns3::AnimationInterface::m_nodeLocation
private

Definition at line 518 of file animation-interface.h.

Referenced by GetPosition(), and UpdatePosition().

std::string ns3::AnimationInterface::m_originalFileName
private

Definition at line 431 of file animation-interface.h.

Referenced by StartNewTraceFile().

std::string ns3::AnimationInterface::m_outputFileName
private

Definition at line 421 of file animation-interface.h.

Referenced by SetOutputFile(), StartAnimation(), and StartNewTraceFile().

bool ns3::AnimationInterface::m_outputFileSet
private

Definition at line 422 of file animation-interface.h.

Referenced by SetOutputFile(), and StopAnimation().

std::map<uint64_t, AnimPacketInfo> ns3::AnimationInterface::m_pendingCsmaPackets
private
std::map<uint64_t, AnimPacketInfo> ns3::AnimationInterface::m_pendingLtePackets
private
std::map<uint64_t, AnimPacketInfo> ns3::AnimationInterface::m_pendingUanPackets
private
std::map<uint64_t, AnimPacketInfo> ns3::AnimationInterface::m_pendingWifiPackets
private
std::map<uint64_t, AnimPacketInfo> ns3::AnimationInterface::m_pendingWimaxPackets
private
bool ns3::AnimationInterface::m_randomPosition
private

Definition at line 424 of file animation-interface.h.

Referenced by SetRandomPosition(), and UpdatePosition().

Time ns3::AnimationInterface::m_startTime
private

Definition at line 428 of file animation-interface.h.

Referenced by IsInTimeWindow(), and SetStartTime().

Time ns3::AnimationInterface::m_stopTime
private

Definition at line 429 of file animation-interface.h.

Referenced by IsInTimeWindow(), and SetStopTime().

double ns3::AnimationInterface::m_topoMaxX
private
double ns3::AnimationInterface::m_topoMaxY
private
double ns3::AnimationInterface::m_topoMinX
private
double ns3::AnimationInterface::m_topoMinY
private
Ptr<UniformRandomVariable> ns3::AnimationInterface::m_uniformRandomVariable
private

Provides uniform random variables.

Definition at line 582 of file animation-interface.h.

Referenced by AnimationInterface(), AssignStreams(), and UpdatePosition().

AnimWriteCallback ns3::AnimationInterface::m_writeCallback
private

Definition at line 425 of file animation-interface.h.

Referenced by ResetAnimWriteCallback(), SetAnimWriteCallback(), and WriteN().

bool ns3::AnimationInterface::m_xml
private
std::map< uint32_t, Rgb > ns3::AnimationInterface::nodeColors
staticprivate
std::map< uint32_t, std::string > ns3::AnimationInterface::nodeDescriptions
staticprivate

The documentation for this class was generated from the following files: