helper class to be used by the visualizer More...
#include "pyviz.h"
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< PacketDropSample > | PacketDropSampleList |
PacketDropSampleList typedef. | |
typedef std::vector< TransmissionSample > | TransmissionSampleList |
TransmissionSampleList typedef. | |
Public Member Functions | |
PyViz () | |
~PyViz () | |
LastPacketsSample | GetLastPackets (uint32_t nodeId) const |
Get last packets function. | |
std::vector< NodeStatistics > | GetNodesStatistics () const |
Get node statistics. | |
PacketDropSampleList | GetPacketDropSamples () const |
Get packet drop samples. | |
std::vector< std::string > | GetPauseMessages () const |
Get pause message function. | |
TransmissionSampleList | GetTransmissionSamples () const |
Get transmission samples. | |
void | RegisterCsmaLikeDevice (const std::string &deviceTypeName) |
Register CSMA like device function. | |
void | RegisterDropTracePath (const std::string &tracePath) |
Register drop trace path function. | |
void | RegisterPointToPointLikeDevice (const std::string &deviceTypeName) |
Register point to point like device function. | |
void | RegisterWifiLikeDevice (const std::string &deviceTypeName) |
Register WIFI like device function. | |
void | SetNodesOfInterest (std::set< uint32_t > nodes) |
Set nodes of interest function. | |
void | SetPacketCaptureOptions (uint32_t nodeId, PacketCaptureOptions options) |
Set packet capture options function. | |
void | SimulatorRunUntil (Time time) |
Run simulation until a given (simulated, absolute) time is reached. | |
Static Public Member Functions | |
static void | LineClipping (double boundsX1, double boundsY1, double boundsX2, double boundsY2, double &lineX1, double &lineY1, double &lineX2, double &lineY2) |
Utility function - clips a line to a bounding box. | |
static void | Pause (const std::string &message) |
Pause function. | |
Private Types | |
typedef std::pair< Ptr< Channel >, uint32_t > | TxRecordKey |
TxRecordKey typedef. | |
Private Member Functions | |
void | CallbackStopSimulation () |
Stop simulation callback function. | |
void | DoPause (const std::string &message) |
Do pause function. | |
NetDeviceStatistics & | FindNetDeviceStatistics (int node, int interface) |
Find net device statistics function. | |
bool | GetPacketCaptureOptions (uint32_t nodeId, const PacketCaptureOptions **outOptions) const |
Get packet capture options function. | |
void | TraceDevQueueDrop (std::string context, Ptr< const Packet > packet) |
Queue drop trace callback function. | |
void | TraceIpv4Drop (std::string context, const ns3::Ipv4Header &hdr, Ptr< const Packet > packet, ns3::Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > dummy_ipv4, uint32_t interface) |
Ipv4 drop trace callback function. | |
void | TraceNetDevPromiscRxCsma (std::string context, Ptr< const Packet > packet) |
CSMA promiscuous receive function. | |
void | TraceNetDevRxCommon (const std::string &context, Ptr< const Packet > packet, const Mac48Address &source) |
Network receive common trace callback function. | |
void | TraceNetDevRxCsma (std::string context, Ptr< const Packet > packet) |
CSMA receive trace callback function. | |
void | TraceNetDevRxLte (std::string context, Ptr< const Packet > packet, const Mac48Address &source) |
LTE receive trace callback function. | |
void | TraceNetDevRxPointToPoint (std::string context, Ptr< const Packet > packet) |
Point to point receive trace callback function. | |
void | TraceNetDevRxWifi (std::string context, Ptr< const Packet > packet) |
Wi-Fi receive trace callback function. | |
void | TraceNetDevRxWimax (std::string context, Ptr< const Packet > packet, const Mac48Address &source) |
WiMax transmit trace callback function. | |
void | TraceNetDevTxCommon (const std::string &context, Ptr< const Packet > packet, const Mac48Address &destination) |
Network transmit common trace callback function. | |
void | TraceNetDevTxCsma (std::string context, Ptr< const Packet > packet) |
CSMA transmit trace callback function. | |
void | TraceNetDevTxLte (std::string context, Ptr< const Packet > packet, const Mac48Address &destination) |
LTE transmit trace callback function. | |
void | TraceNetDevTxPointToPoint (std::string context, Ptr< const Packet > packet) |
Point to point transmit trace callback function. | |
void | TraceNetDevTxWifi (std::string context, Ptr< const Packet > packet) |
Wi-Fi transmit trace callback function. | |
void | TraceNetDevTxWimax (std::string context, Ptr< const Packet > packet, const Mac48Address &destination) |
WiMax transmit trace callback function. | |
Static Private Member Functions | |
static bool | FilterPacket (Ptr< const Packet > packet, const PacketCaptureOptions &options) |
Filter packet function. | |
Private Attributes | |
std::map< uint32_t, LastPacketsSample > | m_lastPackets |
last packets | |
std::set< uint32_t > | m_nodesOfInterest |
list of node IDs whose transmissions will be monitored | |
std::map< uint32_t, std::vector< NetDeviceStatistics > > | m_nodesStatistics |
node statistics | |
std::map< uint32_t, PacketCaptureOptions > | m_packetCaptureOptions |
packet capture options | |
std::map< Ptr< Node >, uint32_t > | m_packetDrops |
packet drops | |
std::map< uint32_t, Time > | m_packetsOfInterest |
list of packet UIDs that will be monitored | |
std::vector< std::string > | m_pauseMessages |
pause message | |
Time | m_runUntil |
run until time | |
bool | m_stop |
stop? | |
std::map< TransmissionSampleKey, TransmissionSampleValue > | m_transmissionSamples |
transmission samples | |
std::map< TxRecordKey, TxRecordValue > | m_txRecords |
transmit records | |
helper class to be used by the visualizer
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.
typedef std::vector<PacketDropSample> ns3::PyViz::PacketDropSampleList |
typedef std::vector<TransmissionSample> ns3::PyViz::TransmissionSampleList |
|
private |
ns3::PyViz::PyViz | ( | ) |
Definition at line 120 of file pyviz.cc.
References ns3::Config::ConnectFailSafe(), ns3::g_visualizer, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION_NOARGS, TraceDevQueueDrop(), TraceIpv4Drop(), TraceNetDevPromiscRxCsma(), TraceNetDevRxCsma(), TraceNetDevRxLte(), TraceNetDevRxPointToPoint(), TraceNetDevRxWifi(), TraceNetDevRxWimax(), TraceNetDevTxCsma(), TraceNetDevTxLte(), TraceNetDevTxPointToPoint(), TraceNetDevTxWifi(), and TraceNetDevTxWimax().
ns3::PyViz::~PyViz | ( | ) |
Definition at line 234 of file pyviz.cc.
References ns3::g_visualizer, NS_ASSERT, and NS_LOG_FUNCTION_NOARGS.
|
private |
Stop simulation callback function.
Definition at line 268 of file pyviz.cc.
References m_runUntil, m_stop, ns3::Simulator::Now(), NS_LOG_FUNCTION_NOARGS, ns3::Seconds(), and ns3::Simulator::Stop().
Referenced by SimulatorRunUntil().
|
private |
Do pause function.
message | the pause message |
Definition at line 243 of file pyviz.cc.
References ns3::g_visualizer, m_pauseMessages, m_stop, ns3::Simulator::Now(), NS_LOG_LOGIC, and ns3::Time::S.
Referenced by Pause().
|
staticprivate |
Filter packet function.
packet | the packet |
options | the capture options |
Definition at line 406 of file pyviz.cc.
References ns3::PacketMetadata::ItemIterator::HasNext(), ns3::PyViz::PacketCaptureOptions::headers, ns3::PyViz::PacketCaptureOptions::mode, ns3::PacketMetadata::ItemIterator::Next(), NS_FATAL_ERROR, PACKET_CAPTURE_DISABLED, PACKET_CAPTURE_FILTER_HEADERS_AND, PACKET_CAPTURE_FILTER_HEADERS_OR, and ns3::PacketMetadata::Item::tid.
Referenced by TraceDevQueueDrop(), TraceNetDevRxCommon(), and TraceNetDevTxCommon().
|
inlineprivate |
Find net device statistics function.
node | the node |
interface | the interface number |
Definition at line 373 of file pyviz.cc.
References ns3::NodeList::GetNode(), and m_nodesStatistics.
Referenced by TraceNetDevRxCommon(), and TraceNetDevTxCommon().
PyViz::LastPacketsSample ns3::PyViz::GetLastPackets | ( | uint32_t | nodeId | ) | const |
Get last packets function.
nodeId | the node ID |
Definition at line 890 of file pyviz.cc.
References m_lastPackets, and NS_LOG_DEBUG.
std::vector< PyViz::NodeStatistics > ns3::PyViz::GetNodesStatistics | ( | ) | const |
Get node statistics.
Definition at line 878 of file pyviz.cc.
References m_nodesStatistics.
|
private |
Get packet capture options function.
nodeId | the node ID |
outOptions | the packet capture options |
Definition at line 391 of file pyviz.cc.
References m_packetCaptureOptions.
Referenced by TraceDevQueueDrop(), TraceNetDevRxCommon(), and TraceNetDevTxCommon().
PyViz::PacketDropSampleList ns3::PyViz::GetPacketDropSamples | ( | ) | const |
Get packet drop samples.
Definition at line 854 of file pyviz.cc.
References ns3::PyViz::PacketDropSample::bytes, ns3::Node::GetId(), list, m_packetDrops, NS_LOG_DEBUG, and ns3::PyViz::PacketDropSample::transmitter.
std::vector< std::string > ns3::PyViz::GetPauseMessages | ( | ) | const |
Get pause message function.
Definition at line 259 of file pyviz.cc.
References ns3::g_visualizer, m_pauseMessages, ns3::Simulator::Now(), NS_LOG_LOGIC, and ns3::Time::S.
PyViz::TransmissionSampleList ns3::PyViz::GetTransmissionSamples | ( | ) | const |
Get transmission samples.
Definition at line 834 of file pyviz.cc.
References ns3::PyViz::TransmissionSample::bytes, ns3::PyViz::TransmissionSample::channel, ns3::Node::GetId(), list, m_transmissionSamples, NS_LOG_DEBUG, ns3::PyViz::TransmissionSample::receiver, and ns3::PyViz::TransmissionSample::transmitter.
|
static |
Utility function - clips a line to a bounding box.
[in] | boundsX1 | Bounding box, minimum X coord |
[in] | boundsY1 | Bounding box, minimum Y coord |
[in] | boundsX2 | Bounding box, maximum X coord |
[in] | boundsY2 | Bounding box, maximum Y coord |
[in,out] | lineX1 | Line, minimum X coord (any on input, clipped to the bounding box on output) |
[in,out] | lineY1 | Line, minimum Y coord (any on input, clipped to the bounding box on output) |
[in,out] | lineX2 | Line, maximum X coord (any on input, clipped to the bounding box on output) |
[in,out] | lineY2 | Line, maximum Y coord (any on input, clipped to the bounding box on output) |
|
static |
Pause function.
message | the pause message |
Definition at line 252 of file pyviz.cc.
References DoPause(), ns3::g_visualizer, and NS_ASSERT.
void ns3::PyViz::RegisterCsmaLikeDevice | ( | const std::string & | deviceTypeName | ) |
Register CSMA like device function.
deviceTypeName | the device type name |
Definition at line 173 of file pyviz.cc.
References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevPromiscRxCsma(), TraceNetDevRxCsma(), and TraceNetDevTxCsma().
void ns3::PyViz::RegisterDropTracePath | ( | const std::string & | tracePath | ) |
Register drop trace path function.
tracePath | the path to trace |
Definition at line 229 of file pyviz.cc.
References ns3::Config::Connect(), ns3::MakeCallback(), and TraceDevQueueDrop().
void ns3::PyViz::RegisterPointToPointLikeDevice | ( | const std::string & | deviceTypeName | ) |
Register point to point like device function.
deviceTypeName | the device type name |
Definition at line 205 of file pyviz.cc.
References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevRxPointToPoint(), and TraceNetDevTxPointToPoint().
void ns3::PyViz::RegisterWifiLikeDevice | ( | const std::string & | deviceTypeName | ) |
Register WIFI like device function.
deviceTypeName | the device type name |
Definition at line 191 of file pyviz.cc.
References ns3::Config::Connect(), ns3::TypeId::LookupByName(), ns3::MakeCallback(), TraceNetDevRxWifi(), and TraceNetDevTxWifi().
void ns3::PyViz::SetNodesOfInterest | ( | std::set< uint32_t > | nodes | ) |
Set nodes of interest function.
nodes | the collection of nodes |
Definition at line 872 of file pyviz.cc.
References m_nodesOfInterest, and nodes.
void ns3::PyViz::SetPacketCaptureOptions | ( | uint32_t | nodeId, |
PacketCaptureOptions | options ) |
Set packet capture options function.
nodeId | the node ID |
options | the capture options |
Definition at line 219 of file pyviz.cc.
References ns3::PyViz::PacketCaptureOptions::headers, m_packetCaptureOptions, 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.
time | the run time |
Definition at line 279 of file pyviz.cc.
References CallbackStopSimulation(), ns3::DynamicCast(), ns3::Simulator::GetImplementation(), m_packetDrops, m_packetsOfInterest, m_pauseMessages, m_runUntil, m_stop, m_transmissionSamples, m_txRecords, ns3::Simulator::NO_CONTEXT, ns3::Simulator::Now(), NS_LOG_LOGIC, ns3::Simulator::ScheduleWithContext(), and ns3::Seconds().
Queue drop trace callback function.
context | the context |
packet | the packet |
Definition at line 448 of file pyviz.cc.
References ns3::PyViz::PacketSample::device, FilterPacket(), ns3::NodeList::GetNode(), GetPacketCaptureOptions(), ns3::PyViz::LastPacketsSample::lastDroppedPackets, m_lastPackets, m_nodesOfInterest, m_packetDrops, m_packetsOfInterest, 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(), RegisterDropTracePath(), and TraceIpv4Drop().
|
private |
Ipv4 drop trace callback function.
context | the context |
hdr | the header |
packet | the packet |
reason | the drop reason |
dummy_ipv4 | the dummy Ipv4 |
interface | the interface |
Definition at line 495 of file pyviz.cc.
References TraceDevQueueDrop().
Referenced by PyViz().
|
private |
CSMA promiscuous receive function.
context | the context |
packet | the packet |
Definition at line 784 of file pyviz.cc.
References ns3::EthernetHeader::GetDestination(), NS_ABORT_IF, ns3::NetDevice::PACKET_OTHERHOST, and TraceNetDevRxCommon().
Referenced by PyViz(), and RegisterCsmaLikeDevice().
|
private |
Network receive common trace callback function.
context | the context |
packet | the packet |
source | the source MAC address |
Definition at line 621 of file pyviz.cc.
References ns3::PyViz::TransmissionSampleValue::bytes, ns3::PyViz::PacketSample::device, FilterPacket(), FindNetDeviceStatistics(), ns3::PyViz::RxPacketSample::from, ns3::Node::GetId(), ns3::NodeList::GetNode(), GetPacketCaptureOptions(), ns3::PyViz::LastPacketsSample::lastReceivedPackets, ns3::LOG_DEBUG, m_lastPackets, ns3::PyVizPacketTag::m_packetId, m_packetsOfInterest, m_transmissionSamples, m_txRecords, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::PyViz::PacketCaptureOptions::numLastPackets, ns3::PyViz::PacketSample::packet, PathSplit(), ns3::PyViz::NetDeviceStatistics::receivedBytes, ns3::PyViz::NetDeviceStatistics::receivedPackets, ns3::PyViz::TransmissionSampleKey::receiver, ns3::PyViz::TxRecordValue::srcNode, ns3::PyViz::PacketSample::time, and ns3::PyViz::TransmissionSampleKey::transmitter.
Referenced by TraceNetDevPromiscRxCsma(), TraceNetDevRxCsma(), TraceNetDevRxLte(), TraceNetDevRxPointToPoint(), TraceNetDevRxWifi(), and TraceNetDevRxWimax().
CSMA receive trace callback function.
context | the context |
packet | the packet |
Definition at line 770 of file pyviz.cc.
References ns3::EthernetHeader::GetSource(), NS_ABORT_IF, and TraceNetDevRxCommon().
Referenced by PyViz(), and RegisterCsmaLikeDevice().
|
private |
LTE receive trace callback function.
context | the context |
packet | the packet |
source | the MAC address of the source |
Definition at line 825 of file pyviz.cc.
References NS_LOG_FUNCTION, and TraceNetDevRxCommon().
Referenced by PyViz().
|
private |
Point to point receive trace callback function.
context | the context |
packet | the packet |
Definition at line 778 of file pyviz.cc.
References TraceNetDevRxCommon().
Referenced by PyViz(), and RegisterPointToPointLikeDevice().
Wi-Fi receive trace callback function.
context | the context |
packet | the packet |
Definition at line 738 of file pyviz.cc.
References ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiMacHeader::GetAddr4(), ns3::WifiMacHeader::IsFromDs(), ns3::WifiMacHeader::IsToDs(), NS_ABORT_IF, NS_LOG_FUNCTION, and TraceNetDevRxCommon().
Referenced by PyViz(), and RegisterWifiLikeDevice().
|
private |
WiMax transmit trace callback function.
context | the context |
packet | the packet |
source | the source MAC address |
Definition at line 809 of file pyviz.cc.
References NS_LOG_FUNCTION, and TraceNetDevRxCommon().
Referenced by PyViz().
|
private |
Network transmit common trace callback function.
context | the context |
packet | the packet |
destination | the destination MAC address |
Definition at line 510 of file pyviz.cc.
References ns3::PyViz::PacketSample::device, FilterPacket(), FindNetDeviceStatistics(), ns3::NodeList::GetNode(), GetPacketCaptureOptions(), ns3::PyViz::TxRecordValue::isBroadcast, ns3::PyViz::LastPacketsSample::lastTransmittedPackets, m_lastPackets, m_nodesOfInterest, ns3::PyVizPacketTag::m_packetId, m_packetsOfInterest, m_txRecords, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::PyViz::PacketCaptureOptions::numLastPackets, ns3::PyViz::PacketSample::packet, PathSplit(), ns3::PyViz::PacketSample::time, ns3::PyViz::TxPacketSample::to, ns3::PyViz::NetDeviceStatistics::transmittedBytes, and ns3::PyViz::NetDeviceStatistics::transmittedPackets.
Referenced by TraceNetDevTxCsma(), TraceNetDevTxLte(), TraceNetDevTxPointToPoint(), TraceNetDevTxWifi(), and TraceNetDevTxWimax().
CSMA transmit trace callback function.
context | the context |
packet | the packet |
Definition at line 605 of file pyviz.cc.
References ns3::EthernetHeader::GetDestination(), NS_ABORT_IF, and TraceNetDevTxCommon().
Referenced by PyViz(), and RegisterCsmaLikeDevice().
|
private |
LTE transmit trace callback function.
context | the context |
packet | the packet |
destination | the destination MAC address |
Definition at line 816 of file pyviz.cc.
References NS_LOG_FUNCTION, and TraceNetDevTxCommon().
Referenced by PyViz().
|
private |
Point to point transmit trace callback function.
context | the context |
packet | the packet |
Definition at line 613 of file pyviz.cc.
References TraceNetDevTxCommon().
Referenced by PyViz(), and RegisterPointToPointLikeDevice().
Wi-Fi transmit trace callback function.
context | the context |
packet | the packet |
Definition at line 578 of file pyviz.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiMacHeader::IsToDs(), NS_ABORT_IF, NS_LOG_FUNCTION, and TraceNetDevTxCommon().
Referenced by PyViz(), and RegisterWifiLikeDevice().
|
private |
WiMax transmit trace callback function.
context | the context |
packet | the packet |
destination | the destination MAC address |
Definition at line 800 of file pyviz.cc.
References NS_LOG_FUNCTION, and TraceNetDevTxCommon().
Referenced by PyViz().
|
private |
last packets
Definition at line 305 of file pyviz.h.
Referenced by GetLastPackets(), TraceDevQueueDrop(), TraceNetDevRxCommon(), and TraceNetDevTxCommon().
|
private |
list of node IDs whose transmissions will be monitored
Definition at line 303 of file pyviz.h.
Referenced by SetNodesOfInterest(), TraceDevQueueDrop(), and TraceNetDevTxCommon().
|
private |
node statistics
Definition at line 306 of file pyviz.h.
Referenced by FindNetDeviceStatistics(), and GetNodesStatistics().
|
private |
packet capture options
Definition at line 296 of file pyviz.h.
Referenced by GetPacketCaptureOptions(), and SetPacketCaptureOptions().
packet drops
Definition at line 301 of file pyviz.h.
Referenced by GetPacketDropSamples(), SimulatorRunUntil(), and TraceDevQueueDrop().
list of packet UIDs that will be monitored
Definition at line 304 of file pyviz.h.
Referenced by SimulatorRunUntil(), TraceDevQueueDrop(), TraceNetDevRxCommon(), and TraceNetDevTxCommon().
|
private |
pause message
Definition at line 297 of file pyviz.h.
Referenced by DoPause(), GetPauseMessages(), and SimulatorRunUntil().
|
private |
run until time
Definition at line 448 of file pyviz.h.
Referenced by CallbackStopSimulation(), and SimulatorRunUntil().
|
private |
stop?
Definition at line 447 of file pyviz.h.
Referenced by CallbackStopSimulation(), DoPause(), and SimulatorRunUntil().
|
private |
transmission samples
Definition at line 300 of file pyviz.h.
Referenced by GetTransmissionSamples(), SimulatorRunUntil(), and TraceNetDevRxCommon().
|
private |
transmit records
Definition at line 298 of file pyviz.h.
Referenced by SimulatorRunUntil(), TraceNetDevRxCommon(), and TraceNetDevTxCommon().