A Discrete-Event Network Simulator
API
ns3::PyViz Class Reference

helper class to be used by the visualizer More...

#include "pyviz.h"

+ Collaboration diagram for ns3::PyViz:

Classes

struct  LastPacketsSample
 LastPacketsSample structure. More...
 
struct  NetDeviceStatistics
 NetDeviceStatistics structure. More...
 
struct  NodeStatistics
 NodeStatistics structure. More...
 
struct  PacketCaptureOptions
 PacketCaptureOptions structure. More...
 
struct  PacketDropSample
 PacketDropSample structure. More...
 
struct  PacketSample
 PacketSample structure. More...
 
struct  RxPacketSample
 RxPacketSample structure. More...
 
struct  TransmissionSample
 TransmissionSample structure. More...
 
struct  TransmissionSampleKey
 TransmissionSampleKey structure. More...
 
struct  TransmissionSampleValue
 TransmissionSampleValue structure. More...
 
struct  TxPacketSample
 TxPacketSample structure. More...
 
struct  TxRecordValue
 TxRecordValue structure. More...
 

Public Types

enum  PacketCaptureMode { PACKET_CAPTURE_DISABLED =1, PACKET_CAPTURE_FILTER_HEADERS_OR, PACKET_CAPTURE_FILTER_HEADERS_AND }
 PacketCaptureMode enumeration. More...
 
typedef std::vector< PacketDropSamplePacketDropSampleList
 PacketDropSampleList typedef. More...
 
typedef std::vector< TransmissionSampleTransmissionSampleList
 TransmissionSampleList typedef. More...
 

Public Member Functions

 PyViz ()
 
 ~PyViz ()
 
LastPacketsSample GetLastPackets (uint32_t nodeId) const
 Get last packets function. More...
 
std::vector< NodeStatisticsGetNodesStatistics () const
 Get node statistics. More...
 
PacketDropSampleList GetPacketDropSamples () const
 Get packet drop samples. More...
 
std::vector< std::string > GetPauseMessages () const
 Get pause message function. More...
 
TransmissionSampleList GetTransmissionSamples () const
 Get transmission samples. More...
 
void RegisterCsmaLikeDevice (std::string const &deviceTypeName)
 Register CSMA like device function. More...
 
void RegisterDropTracePath (std::string const &tracePath)
 Register drop trace path function. More...
 
void RegisterPointToPointLikeDevice (std::string const &deviceTypeName)
 Register point to point like device function. More...
 
void RegisterWifiLikeDevice (std::string const &deviceTypeName)
 Register WIFI like device function. More...
 
void SetNodesOfInterest (std::set< uint32_t > nodes)
 Set nodes of interest function. More...
 
void SetPacketCaptureOptions (uint32_t nodeId, PacketCaptureOptions options)
 Set packet capture options function. More...
 
void SimulatorRunUntil (Time time)
 Run simulation until a given (simulated, absolute) time is reached. More...
 

Static Public Member Functions

static void LineClipping (double boundsX1, double boundsY1, double boundsX2, double boundsY2, double &lineX1, double &lineY1, double &lineX2, double &lineY2)
 don't break this line or pybindgen will not be able to pick up the above annotation :( More...
 
static void Pause (std::string const &message)
 Pause function. More...
 

Private Types

typedef std::pair< Ptr< Channel >, uint32_t > TxRecordKey
 TxRecordKey typedef. More...
 

Private Member Functions

void CallbackStopSimulation ()
 stop simulation callback function More...
 
void DoPause (std::string const &message)
 Do pause function. More...
 
NetDeviceStatisticsFindNetDeviceStatistics (int node, int interface)
 Findnet device statistics function. More...
 
bool GetPacketCaptureOptions (uint32_t nodeId, const PacketCaptureOptions **outOptions) const
 Get packet capture options function. More...
 
void TraceDevQueueDrop (std::string context, Ptr< const Packet > packet)
 queue drop trace callback function More...
 
void TraceIpv4Drop (std::string context, ns3::Ipv4Header const &hdr, Ptr< const Packet > packet, ns3::Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > dummy_ipv4, uint32_t interface)
 ipv4 drop trace callback function More...
 
void TraceNetDevPromiscRxCsma (std::string context, Ptr< const Packet > packet)
 CSMA promiscious receive function. More...
 
void TraceNetDevRxCommon (std::string const &context, Ptr< const Packet > packet, Mac48Address const &source)
 network receive common trace callback function More...
 
void TraceNetDevRxCsma (std::string context, Ptr< const Packet > packet)
 CSMA receive trace callback function. More...
 
void TraceNetDevRxLte (std::string context, Ptr< const Packet > packet, Mac48Address const &source)
 LTE receive trace callback function. More...
 
void TraceNetDevRxPointToPoint (std::string context, Ptr< const Packet > packet)
 Point to point receive trace callback function. More...
 
void TraceNetDevRxWifi (std::string context, Ptr< const Packet > packet)
 WIFI receive trace callback function. More...
 
void TraceNetDevRxWimax (std::string context, Ptr< const Packet > packet, Mac48Address const &source)
 WIMax transmit trace callback function. More...
 
void TraceNetDevTxCommon (std::string const &context, Ptr< const Packet > packet, Mac48Address const &destination)
 network transmit common trace callback function More...
 
void TraceNetDevTxCsma (std::string context, Ptr< const Packet > packet)
 CSMA transmit trace callback function. More...
 
void TraceNetDevTxLte (std::string context, Ptr< const Packet > packet, Mac48Address const &destination)
 LTE transmit trace callback function. More...
 
void TraceNetDevTxPointToPoint (std::string context, Ptr< const Packet > packet)
 Point to point transmit trace calllback function. More...
 
void TraceNetDevTxWifi (std::string context, Ptr< const Packet > packet)
 WIFI transmit trace callback function. More...
 
void TraceNetDevTxWimax (std::string context, Ptr< const Packet > packet, Mac48Address const &destination)
 WIMax transmit trace callback function. More...
 

Static Private Member Functions

static bool FilterPacket (Ptr< const Packet > packet, const PacketCaptureOptions &options)
 Filter packet function. More...
 

Private Attributes

std::map< uint32_t, LastPacketsSamplem_lastPackets
 last packets More...
 
std::set< uint32_t > m_nodesOfInterest
 list of node IDs whose transmissions will be monitored More...
 
std::map< uint32_t, std::vector< NetDeviceStatistics > > m_nodesStatistics
 node statsitics More...
 
std::map< uint32_t, PacketCaptureOptionsm_packetCaptureOptions
 packet capture options More...
 
std::map< Ptr< Node >, uint32_t > m_packetDrops
 packt drops More...
 
std::map< uint32_t, Timem_packetsOfInterest
 list of packet UIDs that will be monitored More...
 
std::vector< std::string > m_pauseMessages
 pause message More...
 
Time m_runUntil
 run until time More...
 
bool m_stop
 stop? More...
 
std::map< TransmissionSampleKey, TransmissionSampleValuem_transmissionSamples
 transmission samples More...
 
std::map< TxRecordKey, TxRecordValuem_txRecords
 transmit records More...
 

Detailed Description

helper class to be used by the visualizer

Internal:

This class is not meant to be used by simulations. It is only meant to be used by the visualizer tool (PyViz). The only reason it is public is because Python bindings for it are needed, otherwise it should be considered private.

Definition at line 51 of file pyviz.h.

Member Typedef Documentation

PacketDropSampleList typedef.

Definition at line 117 of file pyviz.h.

TransmissionSampleList typedef.

Definition at line 104 of file pyviz.h.

typedef std::pair<Ptr<Channel>, uint32_t> ns3::PyViz::TxRecordKey
private

TxRecordKey typedef.

Definition at line 236 of file pyviz.h.

Member Enumeration Documentation

PacketCaptureMode enumeration.

Enumerator
PACKET_CAPTURE_DISABLED 
PACKET_CAPTURE_FILTER_HEADERS_OR 
PACKET_CAPTURE_FILTER_HEADERS_AND 

Definition at line 190 of file pyviz.h.

Constructor & Destructor Documentation

ns3::PyViz::~PyViz ( )

Definition at line 241 of file pyviz.cc.

References NS_ASSERT, and NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

void ns3::PyViz::CallbackStopSimulation ( )
private

stop simulation callback function

Definition at line 273 of file pyviz.cc.

References ns3::Simulator::Now(), NS_LOG_FUNCTION_NOARGS, ns3::Seconds(), and ns3::Simulator::Stop().

Referenced by SimulatorRunUntil().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::DoPause ( std::string const &  message)
private

Do pause function.

Parameters
messagethe pause message

Definition at line 249 of file pyviz.cc.

References m_pauseMessages, ns3::Simulator::Now(), and NS_LOG_LOGIC().

Referenced by Pause().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::PyViz::FilterPacket ( Ptr< const Packet packet,
const PacketCaptureOptions options 
)
staticprivate

Filter packet function.

Parameters
packetthe packet
optionsthe capture options
Returns
true if successful

Definition at line 415 of file pyviz.cc.

References ns3::Packet::BeginItem(), ns3::PacketMetadata::ItemIterator::HasNext(), ns3::PyViz::PacketCaptureOptions::headers, ns3::PyViz::PacketCaptureOptions::mode, ns3::PacketMetadata::ItemIterator::Next(), NS_FATAL_ERROR, and ns3::PacketMetadata::Item::tid.

+ Here is the call graph for this function:

PyViz::NetDeviceStatistics & ns3::PyViz::FindNetDeviceStatistics ( int  node,
int  interface 
)
inlineprivate

Findnet device statistics function.

Parameters
nodethe node
interfacethe interface number
Returns
the device statistics

Definition at line 384 of file pyviz.cc.

References ns3::NodeList::GetNode().

+ Here is the call graph for this function:

PyViz::LastPacketsSample ns3::PyViz::GetLastPackets ( uint32_t  nodeId) const

Get last packets function.

Parameters
nodeIdthe node ID
Returns
the last packets

Definition at line 922 of file pyviz.cc.

References NS_LOG_DEBUG.

std::vector< PyViz::NodeStatistics > ns3::PyViz::GetNodesStatistics ( ) const

Get node statistics.

Returns
the node statistics

Definition at line 908 of file pyviz.cc.

bool ns3::PyViz::GetPacketCaptureOptions ( uint32_t  nodeId,
const PacketCaptureOptions **  outOptions 
) const
private

Get packet capture options function.

Parameters
nodeIdthe node ID
outOptionsthe packet capture options
Returns
true if successful

Definition at line 401 of file pyviz.cc.

PyViz::PacketDropSampleList ns3::PyViz::GetPacketDropSamples ( ) const

Get packet drop samples.

Returns
the packet drop sample list

Definition at line 881 of file pyviz.cc.

References ns3::PyViz::PacketDropSample::bytes, ns3::Node::GetId(), list, NS_LOG_DEBUG, and ns3::PyViz::PacketDropSample::transmitter.

+ Here is the call graph for this function:

std::vector< std::string > ns3::PyViz::GetPauseMessages ( ) const

Get pause message function.

Returns
the pause message

Definition at line 264 of file pyviz.cc.

References m_pauseMessages, ns3::Simulator::Now(), and NS_LOG_LOGIC().

+ Here is the call graph for this function:

PyViz::TransmissionSampleList ns3::PyViz::GetTransmissionSamples ( ) const

Get transmission samples.

Returns
the transmission sample list

Definition at line 858 of file pyviz.cc.

References ns3::PyViz::TransmissionSample::bytes, ns3::PyViz::TransmissionSample::channel, ns3::Node::GetId(), list, NS_LOG_DEBUG, ns3::PyViz::TransmissionSample::receiver, and ns3::PyViz::TransmissionSample::transmitter.

+ Here is the call graph for this function:

void ns3::PyViz::LineClipping ( double  boundsX1,
double  boundsY1,
double  boundsX2,
double  boundsY2,
double &  lineX1,
double &  lineY1,
double &  lineX2,
double &  lineY2 
)
static

don't break this line or pybindgen will not be able to pick up the above annotation :(

Definition at line 1471 of file pyviz.cc.

void ns3::PyViz::Pause ( std::string const &  message)
static

Pause function.

Parameters
messagethe pause message

Definition at line 257 of file pyviz.cc.

References DoPause(), and NS_ASSERT.

+ Here is the call graph for this function:

void ns3::PyViz::RegisterCsmaLikeDevice ( std::string const &  deviceTypeName)

Register CSMA like device function.

Parameters
deviceTypeNamethe device type name

Definition at line 180 of file pyviz.cc.

References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevPromiscRxCsma(), TraceNetDevRxCsma(), and TraceNetDevTxCsma().

+ Here is the call graph for this function:

void ns3::PyViz::RegisterDropTracePath ( std::string const &  tracePath)

Register drop trace path function.

Parameters
tracePaththe path to trace

Definition at line 236 of file pyviz.cc.

References ns3::Config::Connect(), ns3::MakeCallback(), and TraceDevQueueDrop().

+ Here is the call graph for this function:

void ns3::PyViz::RegisterPointToPointLikeDevice ( std::string const &  deviceTypeName)

Register point to point like device function.

Parameters
deviceTypeNamethe device type name

Definition at line 212 of file pyviz.cc.

References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevRxPointToPoint(), and TraceNetDevTxPointToPoint().

+ Here is the call graph for this function:

void ns3::PyViz::RegisterWifiLikeDevice ( std::string const &  deviceTypeName)

Register WIFI like device function.

Parameters
deviceTypeNamethe device type name

Definition at line 198 of file pyviz.cc.

References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevRxWifi(), and TraceNetDevTxWifi().

+ Here is the call graph for this function:

void ns3::PyViz::SetNodesOfInterest ( std::set< uint32_t >  nodes)

Set nodes of interest function.

Parameters
nodesthe collection of nodes

Definition at line 902 of file pyviz.cc.

References first::nodes.

void ns3::PyViz::SetPacketCaptureOptions ( uint32_t  nodeId,
PacketCaptureOptions  options 
)

Set packet capture options function.

Parameters
nodeIdthe node ID
optionsthe capture options

Definition at line 226 of file pyviz.cc.

References ns3::PyViz::PacketCaptureOptions::headers, ns3::PyViz::PacketCaptureOptions::mode, NS_LOG_DEBUG, and ns3::PyViz::PacketCaptureOptions::numLastPackets.

void ns3::PyViz::SimulatorRunUntil ( Time  time)

Run simulation until a given (simulated, absolute) time is reached.

Parameters
timethe run time

Definition at line 284 of file pyviz.cc.

References CallbackStopSimulation(), ns3::Simulator::GetImplementation(), ns3::Simulator::NO_CONTEXT, ns3::Simulator::Now(), NS_LOG_LOGIC(), ns3::Simulator::ScheduleWithContext(), and ns3::Seconds().

+ Here is the call graph for this function:

void ns3::PyViz::TraceDevQueueDrop ( std::string  context,
Ptr< const Packet packet 
)
private

queue drop trace callback function

Parameters
contextthe context
packetthe packet

Definition at line 466 of file pyviz.cc.

References ns3::Packet::Copy(), ns3::PyViz::PacketSample::device, ns3::NodeList::GetNode(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::PyViz::LastPacketsSample::lastDroppedPackets, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::PyViz::PacketCaptureOptions::numLastPackets, ns3::PyViz::PacketSample::packet, PathSplit(), and ns3::PyViz::PacketSample::time.

Referenced by PyViz(), and RegisterDropTracePath().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceIpv4Drop ( std::string  context,
ns3::Ipv4Header const &  hdr,
Ptr< const Packet packet,
ns3::Ipv4L3Protocol::DropReason  reason,
Ptr< Ipv4 dummy_ipv4,
uint32_t  interface 
)
private

ipv4 drop trace callback function

Parameters
contextthe context
hdrthe header
packetthe packet
reasonthe drop reason
dummy_ipv4
interfacethe interface

Definition at line 512 of file pyviz.cc.

References ns3::Packet::AddHeader(), and ns3::Packet::Copy().

Referenced by PyViz().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevPromiscRxCsma ( std::string  context,
Ptr< const Packet packet 
)
private

CSMA promiscious receive function.

Parameters
contextthe context
packetthe packet

Definition at line 812 of file pyviz.cc.

References ns3::EthernetHeader::GetDestination(), NS_ABORT_IF, ns3::NetDevice::PACKET_OTHERHOST, and ns3::Packet::PeekHeader().

Referenced by PyViz(), and RegisterCsmaLikeDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevRxCsma ( std::string  context,
Ptr< const Packet packet 
)
private

CSMA receive trace callback function.

Parameters
contextthe context
packetthe packet

Definition at line 798 of file pyviz.cc.

References ns3::EthernetHeader::GetSource(), NS_ABORT_IF, and ns3::Packet::PeekHeader().

Referenced by PyViz(), and RegisterCsmaLikeDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevRxLte ( std::string  context,
Ptr< const Packet packet,
Mac48Address const &  source 
)
private

LTE receive trace callback function.

Parameters
contextthe context
packetthe packet
sourcethe MAC address of the source

Definition at line 849 of file pyviz.cc.

References NS_LOG_FUNCTION.

Referenced by PyViz().

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevRxPointToPoint ( std::string  context,
Ptr< const Packet packet 
)
private

Point to point receive trace callback function.

Parameters
contextthe context
packetthe packet

Definition at line 806 of file pyviz.cc.

Referenced by PyViz(), and RegisterPointToPointLikeDevice().

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevRxWifi ( std::string  context,
Ptr< const Packet packet 
)
private

WIFI receive trace callback function.

Parameters
contextthe context
packetthe packet

Definition at line 759 of file pyviz.cc.

References ns3::Packet::GetUid(), NS_ABORT_IF, NS_LOG_FUNCTION, and ns3::Packet::PeekHeader().

Referenced by PyViz(), and RegisterWifiLikeDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevRxWimax ( std::string  context,
Ptr< const Packet packet,
Mac48Address const &  source 
)
private

WIMax transmit trace callback function.

Parameters
contextthe context
packetthe packet
sourcethe source MAC address

Definition at line 835 of file pyviz.cc.

References NS_LOG_FUNCTION.

Referenced by PyViz().

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevTxCsma ( std::string  context,
Ptr< const Packet packet 
)
private

CSMA transmit trace callback function.

Parameters
contextthe context
packetthe packet

Definition at line 626 of file pyviz.cc.

References ns3::EthernetHeader::GetDestination(), NS_ABORT_IF, and ns3::Packet::PeekHeader().

Referenced by PyViz(), and RegisterCsmaLikeDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevTxLte ( std::string  context,
Ptr< const Packet packet,
Mac48Address const &  destination 
)
private

LTE transmit trace callback function.

Parameters
contextthe context
packetthe packet
destinationthe destination MAC address

Definition at line 842 of file pyviz.cc.

References NS_LOG_FUNCTION.

Referenced by PyViz().

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevTxPointToPoint ( std::string  context,
Ptr< const Packet packet 
)
private

Point to point transmit trace calllback function.

Parameters
contextthe context
packetthe packet

Definition at line 634 of file pyviz.cc.

Referenced by PyViz(), and RegisterPointToPointLikeDevice().

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevTxWifi ( std::string  context,
Ptr< const Packet packet 
)
private

WIFI transmit trace callback function.

Parameters
contextthe context
packetthe packet

Definition at line 590 of file pyviz.cc.

References ns3::Packet::GetUid(), NS_ABORT_IF, NS_LOG_FUNCTION, and ns3::Packet::PeekHeader().

Referenced by PyViz(), and RegisterWifiLikeDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PyViz::TraceNetDevTxWimax ( std::string  context,
Ptr< const Packet packet,
Mac48Address const &  destination 
)
private

WIMax transmit trace callback function.

Parameters
contextthe context
packetthe packet
destinationthe destination MAC address

Definition at line 828 of file pyviz.cc.

References NS_LOG_FUNCTION.

Referenced by PyViz().

+ Here is the caller graph for this function:

Member Data Documentation

std::map<uint32_t, LastPacketsSample> ns3::PyViz::m_lastPackets
private

last packets

Definition at line 282 of file pyviz.h.

std::set<uint32_t> ns3::PyViz::m_nodesOfInterest
private

list of node IDs whose transmissions will be monitored

Definition at line 280 of file pyviz.h.

std::map<uint32_t, std::vector<NetDeviceStatistics> > ns3::PyViz::m_nodesStatistics
private

node statsitics

Definition at line 283 of file pyviz.h.

std::map<uint32_t, PacketCaptureOptions> ns3::PyViz::m_packetCaptureOptions
private

packet capture options

Definition at line 275 of file pyviz.h.

std::map<Ptr<Node>, uint32_t> ns3::PyViz::m_packetDrops
private

packt drops

Definition at line 279 of file pyviz.h.

std::map<uint32_t, Time> ns3::PyViz::m_packetsOfInterest
private

list of packet UIDs that will be monitored

Definition at line 281 of file pyviz.h.

std::vector<std::string> ns3::PyViz::m_pauseMessages
private

pause message

Definition at line 276 of file pyviz.h.

Referenced by DoPause(), and GetPauseMessages().

Time ns3::PyViz::m_runUntil
private

run until time

Definition at line 409 of file pyviz.h.

bool ns3::PyViz::m_stop
private

stop?

Definition at line 408 of file pyviz.h.

std::map<TransmissionSampleKey, TransmissionSampleValue> ns3::PyViz::m_transmissionSamples
private

transmission samples

Definition at line 278 of file pyviz.h.

std::map<TxRecordKey, TxRecordValue> ns3::PyViz::m_txRecords
private

transmit records

Definition at line 277 of file pyviz.h.


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