DESERT 3.5.1
Loading...
Searching...
No Matches
SunIPRoutingSink Class Reference

#include <sun-ipr-sink.h>

Inheritance diagram for SunIPRoutingSink:
Collaboration diagram for SunIPRoutingSink:

Classes

class  SendTimer
 

Public Member Functions

 SunIPRoutingSink ()
 
virtual ~SunIPRoutingSink ()
 

Protected Member Functions

virtual int command (int, const char *const *)
 
virtual void recv (Packet *)
 
virtual int recvSyncClMsg (ClMessage *)
 
virtual int recvAsyncClMsg (ClMessage *)
 
virtual void initialize ()
 
virtual void sendProbe ()
 
const double getDelay (const double &period_) const
 
virtual void start ()
 
virtual void stop ()
 
virtual void transmit ()
 
virtual void setProbeTimer (const double &)
 
virtual const doublegetProbeTimer () const
 
virtual void sendBackAck (const Packet *)
 
virtual void initPktAck (Packet *)
 
const longgetProbeCount () const
 
const longgetAckCount () const
 
virtual void tracePacket (const Packet *const, const string &position="UNDEF___")
 
virtual string createTraceString (const string &, const double &, const int &, const int &, const int &, const int &, const int &, const int &, const int &, const double &, const int &, const int &)
 
virtual void writeInTrace (const string &)
 
virtual void writePathInTrace (const Packet *)
 

Static Protected Member Functions

static string printIP (const nsaddr_t &)
 
static string printIP (const ns_addr_t &)
 
static nsaddr_t str2addr (const char *)
 
static const int getProbePktHeaderSize ()
 
static const int getAckHeaderSize ()
 

Protected Attributes

nsaddr_t ipAddr_
 
double t_probe
 
int PoissonTraffic_
 
double periodPoissonTraffic_
 
int printDebug_
 
int numberofnodes_
 
unsigned int ** arrayofstats_
 
SendTimer sendTmr_
 
bool trace_
 
bool trace_path_
 
chartrace_file_name_
 
chartrace_file_path_name_
 
ostringstream osstream_
 
ofstream trace_file_
 
ofstream trace_file_path_
 
char trace_separator_
 

Static Protected Attributes

static long probe_count_ = 0
 
static long number_of_ackpkt_ = 0
 

Private Member Functions

 SunIPRoutingSink (const SunIPRoutingSink &)
 

Friends

class SendTimer
 

Detailed Description

SunIPRoutingSink class is used to represent the routing layer of a sink.

Definition at line 72 of file sun-ipr-sink.h.

Constructor & Destructor Documentation

◆ SunIPRoutingSink() [1/2]

SunIPRoutingSink::SunIPRoutingSink ( )

Constructor of SunIPRoutingNode class.

Definition at line 76 of file sun-ipr-sink.cpp.

◆ ~SunIPRoutingSink()

SunIPRoutingSink::~SunIPRoutingSink ( )
virtual

Constructor of SunIPRoutingNode class.

Definition at line 93 of file sun-ipr-sink.cpp.

◆ SunIPRoutingSink() [2/2]

SunIPRoutingSink::SunIPRoutingSink ( const SunIPRoutingSink )
private

Copy constructor declared as private.

It is not possible to create a new SunIPRoutingSink object passing to its constructor another SunIPRoutingSink object.

Parameters
SunIPRoutingSink&SunIPRoutingSink object.

Member Function Documentation

◆ command()

int SunIPRoutingSink::command ( int  argc,
const char *const argv 
)
protectedvirtual

TCL command interpreter.

It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

Definition at line 122 of file sun-ipr-sink.cpp.

◆ createTraceString()

string SunIPRoutingSink::createTraceString ( const string info_string,
const double simulation_time_,
const int node_id_,
const int pkt_id_,
const int pkt_sn_,
const int pkt_from_,
const int pkt_next_hop,
const int pkt_source_,
const int pkt_destination_,
const double snr_,
const int direction_,
const int pkt_type 
)
protectedvirtual

Function that accept a list of string and create an entry for the trace file.

Definition at line 540 of file sun-ipr-sink.cpp.

◆ getAckCount()

const long & SunIPRoutingSink::getAckCount ( ) const
inlineprotected

Returns the number of Ack packets processed by the entire network.

Returns
Number of Ack packets processed by the entire network.

Definition at line 308 of file sun-ipr-sink.h.

◆ getAckHeaderSize()

static const int SunIPRoutingSink::getAckHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_sun_ack packet header.

Returns
The size of a hdr_sun_ack packet header.

Definition at line 286 of file sun-ipr-sink.h.

◆ getDelay()

const double SunIPRoutingSink::getDelay ( const double period_) const
inlineprotected

Returns a delay value to use in transmission.

The delay can be 0 or poissonian accordingly with the flag PoissonTraffic_.

Returns
Transmission delay.
See also
PoissonTraffic_
periodPoissonTraffic_

Definition at line 204 of file sun-ipr-sink.h.

◆ getProbeCount()

const long & SunIPRoutingSink::getProbeCount ( ) const
inlineprotected

Returns the number of Probe packets processed by the entire network.

Returns
Number of Probe packets processed by the entire network.

Definition at line 297 of file sun-ipr-sink.h.

◆ getProbePktHeaderSize()

static const int SunIPRoutingSink::getProbePktHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_sun_probe packet header.

Returns
The size of a hdr_sun_probe packet header.

Definition at line 275 of file sun-ipr-sink.h.

◆ getProbeTimer()

const double & SunIPRoutingSink::getProbeTimer ( ) const
protectedvirtual

Returns the current time interval between two consecutive probes.

Returns
The time interval between two consecutive probes.

Definition at line 427 of file sun-ipr-sink.cpp.

◆ initialize()

void SunIPRoutingSink::initialize ( )
protectedvirtual

Initializes a SunIPRoutingNode node.

It sends to the lower layers a Sync message asking for the IP of the node.

See also
UWIPClMsgReqAddr(int src)
sendSyncClMsgDown(ClMessage* m)

Definition at line 292 of file sun-ipr-sink.cpp.

◆ initPktAck()

void SunIPRoutingSink::initPktAck ( Packet p)
protectedvirtual

Initializes an ack packet passed as argument with the default values.

Parameters
Packet*Pointer to a packet already allocated to fill with the right values.

Definition at line 468 of file sun-ipr-sink.cpp.

◆ printIP() [1/2]

string SunIPRoutingSink::printIP ( const ns_addr_t ipt_)
staticprotected

Return a string with an IP in the classic form "x.x.x.x" converting an ns2 ns_addr_t address.

Parameters
ns_addr_t&ns2 address
Returns
String that contains a printable IP in the classic form "x.x.x.x"

Definition at line 362 of file sun-ipr-sink.cpp.

◆ printIP() [2/2]

string SunIPRoutingSink::printIP ( const nsaddr_t ip_)
staticprotected

Return a string with an IP in the classic form "x.x.x.x" converting an ns2 nsaddr_t address.

Parameters
nsaddr_t&ns2 address
Returns
String that contains a printable IP in the classic form "x.x.x.x"

Definition at line 343 of file sun-ipr-sink.cpp.

◆ recv()

void SunIPRoutingSink::recv ( Packet p)
protectedvirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.

Definition at line 223 of file sun-ipr-sink.cpp.

◆ recvAsyncClMsg()

int SunIPRoutingSink::recvAsyncClMsg ( ClMessage *  m)
protectedvirtual

Cross-Layer messages asynchronous interpreter.

Used to retrive the IP od the current node from the IP module.

Parameters
ClMessage*an instance of ClMessage that represent the message received and used for the answer.
Returns
0 if successful.

Definition at line 110 of file sun-ipr-sink.cpp.

◆ recvSyncClMsg()

int SunIPRoutingSink::recvSyncClMsg ( ClMessage *  m)
protectedvirtual

Cross-Layer messages synchronous interpreter.

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

Definition at line 102 of file sun-ipr-sink.cpp.

◆ sendBackAck()

void SunIPRoutingSink::sendBackAck ( const Packet p)
protectedvirtual

Creates an ack packet and sends it to the previous hop using the information contained in the header of the data packet passed as input parameter.

It is an ack to the previous hop, and not to the source of the packet.

Parameters
Packet*Pointer to a Data packet to acknowledge.
See also
SunIPRoutingSink::initPktAck()

Definition at line 435 of file sun-ipr-sink.cpp.

◆ sendProbe()

void SunIPRoutingSink::sendProbe ( )
protectedvirtual

Creates and sends in broadcast a probe message to notify the presence of the sink.

Definition at line 305 of file sun-ipr-sink.cpp.

◆ setProbeTimer()

void SunIPRoutingSink::setProbeTimer ( const double t_)
protectedvirtual

Sets the probe interval timer.

Parameters
double&Time t in seconds between two consecutive probes.

Definition at line 417 of file sun-ipr-sink.cpp.

◆ start()

void SunIPRoutingSink::start ( )
protectedvirtual

Starts to send Probe packets.

Definition at line 392 of file sun-ipr-sink.cpp.

◆ stop()

void SunIPRoutingSink::stop ( )
protectedvirtual

Stops to send Probe packets.

Definition at line 400 of file sun-ipr-sink.cpp.

◆ str2addr()

nsaddr_t SunIPRoutingSink::str2addr ( const char str)
staticprotected

Returns a nsaddr_t address from an IP written as a string in the form "x.x.x.x".

Parameters
char*IP in string form
Returns
nsaddr_t that contains the IP converter from the input string

Definition at line 368 of file sun-ipr-sink.cpp.

◆ tracePacket()

void SunIPRoutingSink::tracePacket ( const Packet * const  p,
const string position = "UNDEF___" 
)
protectedvirtual

Traces a packet.

Parameters
Packetto be traced.
Stringoptional for the packet.

Definition at line 493 of file sun-ipr-sink.cpp.

◆ transmit()

void SunIPRoutingSink::transmit ( )
protectedvirtual

Sends a single Probe packet.

Definition at line 408 of file sun-ipr-sink.cpp.

◆ writeInTrace()

void SunIPRoutingSink::writeInTrace ( const string string_to_write_)
protectedvirtual

Opens the trace file, writes the string passed as input and closes the file.

Parameters
Stringto write in the trace file.

Definition at line 564 of file sun-ipr-sink.cpp.

◆ writePathInTrace()

void SunIPRoutingSink::writePathInTrace ( const Packet p)
protectedvirtual

Writes in the Path Trace file the path contained in the Packet.

Parameters
Packetto analyze.

Definition at line 575 of file sun-ipr-sink.cpp.

Friends And Related Symbol Documentation

◆ SendTimer

Definition at line 75 of file sun-ipr-sink.h.

Member Data Documentation

◆ arrayofstats_

unsigned int** SunIPRoutingSink::arrayofstats_
protected

Structure that contains the number of data packets received by the the sink, for different nodes and for different values of hop count.

It is used for statistics purposes.

Definition at line 365 of file sun-ipr-sink.h.

◆ ipAddr_

nsaddr_t SunIPRoutingSink::ipAddr_
protected

IP of the current node.

Definition at line 349 of file sun-ipr-sink.h.

◆ number_of_ackpkt_

long SunIPRoutingSink::number_of_ackpkt_ = 0
staticprotected

Comulative number of Ack packets processed by SunIPRoutingNode objects.

Definition at line 360 of file sun-ipr-sink.h.

◆ numberofnodes_

int SunIPRoutingSink::numberofnodes_
protected

Number of nodes in the network, used for statistic purposes.

Definition at line 363 of file sun-ipr-sink.h.

◆ osstream_

ostringstream SunIPRoutingSink::osstream_
protected

Used to convert to string.

Definition at line 387 of file sun-ipr-sink.h.

◆ periodPoissonTraffic_

double SunIPRoutingSink::periodPoissonTraffic_
protected

Period of the Poisson traffic.

Definition at line 353 of file sun-ipr-sink.h.

◆ PoissonTraffic_

int SunIPRoutingSink::PoissonTraffic_
protected

Enable (1) or disable (0) the Poisson traffic for SUN packets.

Definition at line 351 of file sun-ipr-sink.h.

◆ printDebug_

int SunIPRoutingSink::printDebug_
protected

Flag to enable or disable dirrefent levels of debug.

Definition at line 354 of file sun-ipr-sink.h.

◆ probe_count_

long SunIPRoutingSink::probe_count_ = 0
staticprotected

Comulative number of probes sent by SunIPRoutingSink objects.

Definition at line 358 of file sun-ipr-sink.h.

◆ sendTmr_

SendTimer SunIPRoutingSink::sendTmr_
protected

SendTimer object.

Definition at line 373 of file sun-ipr-sink.h.

◆ t_probe

double SunIPRoutingSink::t_probe
protected

Period of the probing.

Definition at line 350 of file sun-ipr-sink.h.

◆ trace_

bool SunIPRoutingSink::trace_
protected

Flag used to enable or disable the trace file for nodes,.

Definition at line 376 of file sun-ipr-sink.h.

◆ trace_file_

ofstream SunIPRoutingSink::trace_file_
protected

Ofstream used to write the trace file in the disk.

Definition at line 388 of file sun-ipr-sink.h.

◆ trace_file_name_

char* SunIPRoutingSink::trace_file_name_
protected

Name of the trace file writter for the current node.

Definition at line 381 of file sun-ipr-sink.h.

◆ trace_file_path_

ofstream SunIPRoutingSink::trace_file_path_
protected

Ofstream used to write the path trace file in the disk.

Definition at line 390 of file sun-ipr-sink.h.

◆ trace_file_path_name_

char* SunIPRoutingSink::trace_file_path_name_
protected

Name of the trace file that contains the list of paths of the data packets received.

Definition at line 384 of file sun-ipr-sink.h.

◆ trace_path_

bool SunIPRoutingSink::trace_path_
protected

Flag used to enable or disable the path trace file for nodes,.

Definition at line 378 of file sun-ipr-sink.h.

◆ trace_separator_

char SunIPRoutingSink::trace_separator_
protected

Used as separator among elements in an entr of the tracefile.

Definition at line 392 of file sun-ipr-sink.h.


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