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

Class that manages the output of the simulation. ConsoleLog output and Output on .csv file
More...

#include "outputmanager.h"

+ Inheritance diagram for ns3::OutputManager:
+ Collaboration diagram for ns3::OutputManager:

Public Member Functions

 OutputManager ()
 Default constructor. More...
 
 OutputManager (std::string name, uint16_t simNum, uint16_t numNodes, enum Topology, enum Routing, bool printDescription)
 constructor that takes simulation details to print on the csv file or on the console log More...
 
 ~OutputManager ()
 Default destructor. More...
 
void AbortOnion (Time abort_at)
 Called when an onion is deleted. More...
 
void AddNodeDetails (Ipv4Address node_ip, int coord_x, int coord_y)
 register node details: IP, location on the network More...
 
void AddNodeDetails (Ipv4Address node_ip, int coord_x, int coord_y, int n_degree)
 register node details: IP, location on the network and node degree for node degree reference check ns3::Wsn_node::NodeDegree() More...
 
void CreateOutputFile ()
 Create stream wrapper and the output file, if the output file already exists, then delete the content. More...
 
std::string CurrentTime (void)
 return the current time as a string More...
 
enum Routing GetRouting (void)
 return the enum of the current routing algorithm used in the network More...
 
std::string Ipv4ToString (Ipv4Address ip)
 Convert an IpV4 address to a string. More...
 
void NewHandshake (int node_num, Ipv4Address node_ip, Time recv_at)
 Called when the sink receives a new handhake message. More...
 
void OnionRoutingRecv (Time recv_at)
 Called by each node that receives an onion message. More...
 
void OnionRoutingSend (Ipv4Address send_ip, Ipv4Address recv_ip, int packet_size, int head_size, int body_size, Time sent_at)
 Called by each node that sends an onion message. More...
 
void PrintIntro (std::string intro)
 Print the simulation description containing simulation settings on the csv file or on the console log. More...
 
void PrintLine (std::string line)
 print the given argument on the csv file More...
 
void PrintNodeDetails (std::map< uint32_t, std::string > reachable)
 print node details on the csv file, print only nodes reachable by the sink node More...
 
void RecvOnion (Time recv_at)
 Called by the sink node when it receives back the onion message. More...
 
void SendOnion (int packet_size, int head_size, int body_size, int onion_path_len, Time sent_at)
 Called by the sink node when it sends a new onion message. More...
 
void SetRouting (enum Routing routing)
 set the enum of the current routing algorithm used in the network More...
 
void SimulationEnd (std::string end_at)
 Print at the end of the simulation. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Register this type. More...
 

Public Attributes

std::string h_nodeDetailsHeader
 header of CSV format More...
 
std::string h_onionHeader
 header of CSV format More...
 
std::string h_routingHeader
 header of CSV format More...
 
std::string h_timeoutHeader
 header of CSV format More...
 
std::map< uint32_t, std::string > m_nodeDetails
 holds details of nodes in the network for printing at the end of the csv file. More...
 
std::string m_onionData
 holds data of the onion message currently executing in the network More...
 
int m_onionId = 0
 identifies the onion message More...
 
int m_onionPathLength = 0
 the onion path length More...
 
std::string m_outputFilePath
 path to the directory where output files are stored More...
 
bool m_printDescription
 boolean choice to print the description of the simulation parameters More...
 
enum Routing m_routing
 information on the routing protocol More...
 
std::string m_routingData
 holds data of the onion message traveling from hop to hop More...
 
std::string m_routingLog
 holds data of the onion message traveling from hop to hop More...
 
std::string m_simDetails
 holds details of the simulation More...
 
std::string m_simName
 holds the name of the simulation More...
 
Ptr< OutputStreamWrapper > m_simStreamWrapper
 stream wrapper to write on file More...
 
double t_hopDelta = 0
 Hold time information of the onion message traveling from hop to hop. More...
 
double t_onionDelta = 0
 Hold time information of the onion message traveling in the network. More...
 

Detailed Description

Class that manages the output of the simulation. ConsoleLog output and Output on .csv file

Definition at line 49 of file outputmanager.h.

Constructor & Destructor Documentation

◆ OutputManager() [1/2]

ns3::OutputManager::OutputManager ( )

Default constructor.

Definition at line 47 of file outputmanager.cc.

◆ OutputManager() [2/2]

ns3::OutputManager::OutputManager ( std::string  name,
uint16_t  simNum,
uint16_t  numNodes,
enum Topology  topology,
enum Routing  routing,
bool  printDescription 
)

constructor that takes simulation details to print on the csv file or on the console log

Definition at line 51 of file outputmanager.cc.

References ns3::AODV, ns3::DISC, ns3::DSDV, ns3::DSR, ns3::GRID, m_printDescription, m_routing, m_simDetails, m_simName, and ns3::OLSR.

◆ ~OutputManager()

ns3::OutputManager::~OutputManager ( )

Default destructor.

Definition at line 101 of file outputmanager.cc.

Member Function Documentation

◆ AbortOnion()

void ns3::OutputManager::AbortOnion ( Time  abort_at)

Called when an onion is deleted.

Definition at line 197 of file outputmanager.cc.

References m_onionId, m_onionPathLength, m_simDetails, m_simName, and PrintLine().

+ Here is the call graph for this function:

◆ AddNodeDetails() [1/2]

void ns3::OutputManager::AddNodeDetails ( Ipv4Address  node_ip,
int  coord_x,
int  coord_y 
)

register node details: IP, location on the network

Definition at line 217 of file outputmanager.cc.

References Ipv4ToString(), m_nodeDetails, m_simDetails, and m_simName.

+ Here is the call graph for this function:

◆ AddNodeDetails() [2/2]

void ns3::OutputManager::AddNodeDetails ( Ipv4Address  node_ip,
int  coord_x,
int  coord_y,
int  n_degree 
)

register node details: IP, location on the network and node degree for node degree reference check ns3::Wsn_node::NodeDegree()

Definition at line 226 of file outputmanager.cc.

References Ipv4ToString(), m_nodeDetails, m_simDetails, and m_simName.

+ Here is the call graph for this function:

◆ CreateOutputFile()

void ns3::OutputManager::CreateOutputFile ( )

Create stream wrapper and the output file, if the output file already exists, then delete the content.

Definition at line 91 of file outputmanager.cc.

References m_outputFilePath, m_simName, and m_simStreamWrapper.

◆ CurrentTime()

std::string ns3::OutputManager::CurrentTime ( void  )

return the current time as a string

Definition at line 262 of file outputmanager.cc.

◆ GetRouting()

enum Routing ns3::OutputManager::GetRouting ( void  )

return the enum of the current routing algorithm used in the network

Definition at line 276 of file outputmanager.cc.

References m_routing.

◆ GetTypeId()

TypeId ns3::OutputManager::GetTypeId ( void  )
static

Register this type.

Returns
The object TypeId.

Definition at line 34 of file outputmanager.cc.

References m_outputFilePath.

◆ Ipv4ToString()

std::string ns3::OutputManager::Ipv4ToString ( Ipv4Address  ip)

Convert an IpV4 address to a string.

Definition at line 254 of file outputmanager.cc.

Referenced by AddNodeDetails(), NewHandshake(), and OnionRoutingSend().

+ Here is the caller graph for this function:

◆ NewHandshake()

void ns3::OutputManager::NewHandshake ( int  node_num,
Ipv4Address  node_ip,
Time  recv_at 
)

Called when the sink receives a new handhake message.

Definition at line 210 of file outputmanager.cc.

References Ipv4ToString().

+ Here is the call graph for this function:

◆ OnionRoutingRecv()

void ns3::OutputManager::OnionRoutingRecv ( Time  recv_at)

Called by each node that receives an onion message.

Definition at line 185 of file outputmanager.cc.

References m_routingData, m_routingLog, PrintLine(), and t_hopDelta.

+ Here is the call graph for this function:

◆ OnionRoutingSend()

void ns3::OutputManager::OnionRoutingSend ( Ipv4Address  send_ip,
Ipv4Address  recv_ip,
int  packet_size,
int  head_size,
int  body_size,
Time  sent_at 
)

Called by each node that sends an onion message.

Definition at line 167 of file outputmanager.cc.

References Ipv4ToString(), m_onionId, m_routingData, m_routingLog, m_simDetails, m_simName, and t_hopDelta.

+ Here is the call graph for this function:

◆ PrintIntro()

void ns3::OutputManager::PrintIntro ( std::string  intro)

Print the simulation description containing simulation settings on the csv file or on the console log.

Definition at line 106 of file outputmanager.cc.

References h_nodeDetailsHeader, h_onionHeader, h_routingHeader, h_timeoutHeader, m_printDescription, and PrintLine().

+ Here is the call graph for this function:

◆ PrintLine()

void ns3::OutputManager::PrintLine ( std::string  line)

print the given argument on the csv file

Definition at line 247 of file outputmanager.cc.

References m_simStreamWrapper.

Referenced by AbortOnion(), OnionRoutingRecv(), PrintIntro(), PrintNodeDetails(), RecvOnion(), and SimulationEnd().

+ Here is the caller graph for this function:

◆ PrintNodeDetails()

void ns3::OutputManager::PrintNodeDetails ( std::map< uint32_t, std::string >  reachable)

print node details on the csv file, print only nodes reachable by the sink node

Parameters
[in]reachablethe set of nodes reachable by the sink node

Definition at line 235 of file outputmanager.cc.

References m_nodeDetails, and PrintLine().

+ Here is the call graph for this function:

◆ RecvOnion()

void ns3::OutputManager::RecvOnion ( Time  recv_at)

Called by the sink node when it receives back the onion message.

Definition at line 154 of file outputmanager.cc.

References m_onionData, m_onionId, PrintLine(), and t_onionDelta.

+ Here is the call graph for this function:

◆ SendOnion()

void ns3::OutputManager::SendOnion ( int  packet_size,
int  head_size,
int  body_size,
int  onion_path_len,
Time  sent_at 
)

Called by the sink node when it sends a new onion message.

Definition at line 135 of file outputmanager.cc.

References m_onionData, m_onionId, m_onionPathLength, m_simDetails, m_simName, and t_onionDelta.

◆ SetRouting()

void ns3::OutputManager::SetRouting ( enum Routing  routing)

set the enum of the current routing algorithm used in the network

Definition at line 270 of file outputmanager.cc.

References m_routing.

◆ SimulationEnd()

void ns3::OutputManager::SimulationEnd ( std::string  end_at)

Print at the end of the simulation.

Definition at line 126 of file outputmanager.cc.

References m_printDescription, and PrintLine().

+ Here is the call graph for this function:

Member Data Documentation

◆ h_nodeDetailsHeader

std::string ns3::OutputManager::h_nodeDetailsHeader
Initial value:
= "node_details,sim_name,sim_num,num_of_nodes,topology,routing,"
"coord_x,coord_y,node_degree"

header of CSV format

Definition at line 224 of file outputmanager.h.

Referenced by PrintIntro().

◆ h_onionHeader

std::string ns3::OutputManager::h_onionHeader
Initial value:
=
"onion_details,sim_name,sim_num,num_of_nodes,topology,routing,onion_"
"id,packet_size,onion_head_size,onion_body_size,onion_"
"path_length,sent_at,recv_at,query_time_to_return"

header of CSV format

Definition at line 215 of file outputmanager.h.

Referenced by PrintIntro().

◆ h_routingHeader

std::string ns3::OutputManager::h_routingHeader
Initial value:
= "onion_routing,sim_name,sim_num,num_of_nodes,topology,routing,"
"onion_id,send_ip,recv_ip,packet_size,onion_head_size,onion_body_"
"size,sent_at,recv_at,hop_time"

header of CSV format

Definition at line 219 of file outputmanager.h.

Referenced by PrintIntro().

◆ h_timeoutHeader

std::string ns3::OutputManager::h_timeoutHeader
Initial value:
= "timeout,sim_name,sim_num,num_of_nodes,topology,routing,onion_id,"
"onion_path_length,abort_time"

header of CSV format

Definition at line 222 of file outputmanager.h.

Referenced by PrintIntro().

◆ m_nodeDetails

std::map<uint32_t,std::string> ns3::OutputManager::m_nodeDetails

holds details of nodes in the network for printing at the end of the csv file.

Definition at line 240 of file outputmanager.h.

Referenced by AddNodeDetails(), and PrintNodeDetails().

◆ m_onionData

std::string ns3::OutputManager::m_onionData

holds data of the onion message currently executing in the network

Definition at line 228 of file outputmanager.h.

Referenced by RecvOnion(), and SendOnion().

◆ m_onionId

int ns3::OutputManager::m_onionId = 0

identifies the onion message

Definition at line 231 of file outputmanager.h.

Referenced by AbortOnion(), OnionRoutingSend(), RecvOnion(), and SendOnion().

◆ m_onionPathLength

int ns3::OutputManager::m_onionPathLength = 0

the onion path length

Definition at line 232 of file outputmanager.h.

Referenced by AbortOnion(), and SendOnion().

◆ m_outputFilePath

std::string ns3::OutputManager::m_outputFilePath

path to the directory where output files are stored

Definition at line 242 of file outputmanager.h.

Referenced by CreateOutputFile(), and GetTypeId().

◆ m_printDescription

bool ns3::OutputManager::m_printDescription

boolean choice to print the description of the simulation parameters

Definition at line 208 of file outputmanager.h.

Referenced by OutputManager(), PrintIntro(), and SimulationEnd().

◆ m_routing

enum Routing ns3::OutputManager::m_routing

information on the routing protocol

Definition at line 237 of file outputmanager.h.

Referenced by GetRouting(), OutputManager(), and SetRouting().

◆ m_routingData

std::string ns3::OutputManager::m_routingData

holds data of the onion message traveling from hop to hop

Definition at line 229 of file outputmanager.h.

Referenced by OnionRoutingRecv(), and OnionRoutingSend().

◆ m_routingLog

std::string ns3::OutputManager::m_routingLog

holds data of the onion message traveling from hop to hop

Definition at line 230 of file outputmanager.h.

Referenced by OnionRoutingRecv(), and OnionRoutingSend().

◆ m_simDetails

std::string ns3::OutputManager::m_simDetails

holds details of the simulation

Definition at line 212 of file outputmanager.h.

Referenced by AbortOnion(), AddNodeDetails(), OnionRoutingSend(), OutputManager(), and SendOnion().

◆ m_simName

std::string ns3::OutputManager::m_simName

holds the name of the simulation

Definition at line 210 of file outputmanager.h.

Referenced by AbortOnion(), AddNodeDetails(), CreateOutputFile(), OnionRoutingSend(), OutputManager(), and SendOnion().

◆ m_simStreamWrapper

Ptr<OutputStreamWrapper> ns3::OutputManager::m_simStreamWrapper

stream wrapper to write on file

Definition at line 206 of file outputmanager.h.

Referenced by CreateOutputFile(), and PrintLine().

◆ t_hopDelta

double ns3::OutputManager::t_hopDelta = 0

Hold time information of the onion message traveling from hop to hop.

Definition at line 235 of file outputmanager.h.

Referenced by OnionRoutingRecv(), and OnionRoutingSend().

◆ t_onionDelta

double ns3::OutputManager::t_onionDelta = 0

Hold time information of the onion message traveling in the network.

Definition at line 234 of file outputmanager.h.

Referenced by RecvOnion(), and SendOnion().


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