DESERT 4.0.0
UwCbrModule Class Reference

#include <uwcbr-module.h>

Inheritance diagram for UwCbrModule:
Inheritance graph
Collaboration diagram for UwCbrModule:
Collaboration graph

Public Member Functions

 UwCbrModule ()
 
virtual ~UwCbrModule ()=default
 
virtual void recv (Packet *) override
 
virtual void recv (Packet *p, Handler *h) override
 
virtual int command (int argc, const char *const *argv) override
 
virtual double GetRTT () const
 
virtual double GetFTT () const
 
virtual double GetTxTime () const
 
virtual double GetPER () const
 
virtual double GetTHR () const
 
virtual double GetRTTstd () const
 
virtual double GetFTTstd () const
 
virtual void resetStats ()
 
void printIdsPkts () const
 

Protected Member Functions

virtual void initPkt (Packet *p)
 
virtual void sendPkt ()
 
virtual void sendPktLowPriority ()
 
virtual void sendPktHighPriority ()
 
virtual void transmit ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void updateRTT (const double &)
 
virtual void updateFTT (const double &)
 
virtual void updateThroughput (const int &, const double &)
 
virtual void incrPktLost (const int &)
 
virtual void incrPktRecv ()
 
virtual void incrPktOoseq ()
 
virtual void incrPktInvalid ()
 
virtual double getTimeBeforeNextPkt ()
 
virtual void printReceivedPacket (Packet *p)
 

Static Protected Member Functions

static int getCbrHeaderSize ()
 

Protected Attributes

uint16_t dstPort_
 
std::string log_suffix
 
nsaddr_t dstAddr_
 
char priority_
 
std::ofstream tracefile
 
std::string tracefilename
 
bool * sn_check
 
int PoissonTraffic_
 
int debug_
 
int drop_out_of_order_
 
uint traffic_type_
 
UwSendTimer sendTmr_
 
int txsn
 
int hrsn
 
int pkts_recv
 
int pkts_ooseq
 
int pkts_lost
 
int pkts_invalid
 
int pkts_last_reset
 
int cnt
 
double rftt
 
double srtt
 
double sftt
 
double lrtime
 
double sthr
 
double period_
 
int pktSize_
 
double sumrtt
 
double sumrtt2
 
int rttsamples
 
double sumftt
 
double sumftt2
 
int fttsamples
 
double sumtxtimes = 0
 
double sumbytes
 
double sumdt
 
uint32_t esn
 
int tracefile_enabler_
 

Static Protected Attributes

static int uidcnt_ = 0
 

Friends

class UwSendTimer
 

Detailed Description

UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.

Constructor & Destructor Documentation

◆ UwCbrModule()

UwCbrModule::UwCbrModule ( )

◆ ~UwCbrModule()

virtual UwCbrModule::~UwCbrModule ( )
virtualdefault

Destructor of UwCbrModule class.

Member Function Documentation

◆ command()

int UwCbrModule::command ( int  argc,
const char *const *  argv 
)
overridevirtual

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.

Reimplemented in CoolAddon, UwTrackerModule, UwROVModule, UwROVCtrModule, UwSCROVCtrModule, UwSCFTrackerModule, and UwSCTrackerModule.

References getCbrHeaderSize(), GetFTT(), GetFTTstd(), GetPER(), GetRTT(), GetRTTstd(), GetTHR(), GetTxTime(), hrsn, log_suffix, pkts_last_reset, pkts_recv, printIdsPkts(), priority_, resetStats(), sendPkt(), sendPktHighPriority(), sendPktLowPriority(), start(), stop(), tracefile, tracefile_enabler_, tracefilename, and txsn.

Referenced by CoolAddon::command(), UwTrackerModule::command(), UwROVModule::command(), and UwROVCtrModule::command().

Here is the call graph for this function:

◆ getCbrHeaderSize()

static int UwCbrModule::getCbrHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_uwcbr packet header.

Returns
The size of a hdr_uwcbr packet header.

Referenced by command().

◆ GetFTT()

double UwCbrModule::GetFTT ( ) const
virtual

Returns the mean Forward Trip Time.

Returns
Forward Trip Time.

References fttsamples, and sumftt.

Referenced by command().

◆ GetFTTstd()

double UwCbrModule::GetFTTstd ( ) const
virtual

Returns the mean Forward Trip Time Standard Deviation.

Returns
Forward Trip Time Standard Deviation.

References fttsamples, sumftt, and sumftt2.

Referenced by command().

◆ GetPER()

double UwCbrModule::GetPER ( ) const
virtual

Returns the mean Packet Error Rate.

Returns
Packet Error Rate.

References drop_out_of_order_, esn, pkts_lost, and pkts_recv.

Referenced by command().

◆ GetRTT()

double UwCbrModule::GetRTT ( ) const
virtual

Returns the mean Round Trip Time.

Returns
Round Trip Time.

References rttsamples, and sumrtt.

Referenced by command().

◆ GetRTTstd()

double UwCbrModule::GetRTTstd ( ) const
virtual

Returns the Round Trip Time Standard Deviation.

Returns
Round Trip Time Standard Deviation.

References rttsamples, sumrtt, and sumrtt2.

Referenced by command().

◆ GetTHR()

double UwCbrModule::GetTHR ( ) const
virtual

Returns the mean Throughput.

Returns
Throughput.

References sumbytes, and sumdt.

Referenced by command().

◆ getTimeBeforeNextPkt()

double UwCbrModule::getTimeBeforeNextPkt ( )
protectedvirtual

Returns the amount of time to wait before the next transmission. It depends on the PoissonTraffic_ flag.

Returns
double Value to use as delay for the next transmission.
See also
PoissonTraffic_

References period_, and PoissonTraffic_.

Referenced by start(), and transmit().

◆ GetTxTime()

double UwCbrModule::GetTxTime ( ) const
virtual

Returns the mean transmission time.

Returns
transmission time.

References fttsamples, and sumtxtimes.

Referenced by command().

◆ incrPktInvalid()

void UwCbrModule::incrPktInvalid ( )
protectedvirtual

Increases by one the number of invalid packets.

References pkts_invalid.

Referenced by recv().

◆ incrPktLost()

void UwCbrModule::incrPktLost ( const int &  npkts)
protectedvirtual

Increases the number of packets lost.

Parameters
int&Number of packets lost.

References pkts_lost.

Referenced by recv().

◆ incrPktOoseq()

void UwCbrModule::incrPktOoseq ( )
protectedvirtual

Increases by one the number of out of sequence packets received.

References pkts_ooseq.

Referenced by recv().

◆ incrPktRecv()

void UwCbrModule::incrPktRecv ( )
protectedvirtual

Increases by one the number of received packets.

References pkts_recv.

Referenced by recv().

◆ initPkt()

void UwCbrModule::initPkt ( Packet *  p)
protectedvirtual

Initializes a data packet passed as argument with the default values.

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

Reimplemented in UwTrackerModule, UwROVModule, UwROVCtrModule, and UwSCFTrackerModule.

References hdr_uwip::access(), hdr_uwudp::access(), hdr_uwip::daddr(), hdr_uwudp::dport(), dstAddr_, dstPort_, pktSize_, hdr_uwcbr::priority(), priority_, PT_UWCBR, hdr_uwcbr::rftt(), rftt, hdr_uwcbr::rftt_valid(), hdr_uwcbr::sn(), hdr_uwcbr::traffic_type(), traffic_type_, txsn, and uidcnt_.

Referenced by UwTrackerModule::initPkt(), UwROVModule::initPkt(), UwROVCtrModule::initPkt(), sendPkt(), sendPktHighPriority(), sendPktLowPriority(), and CoolAddon::sendTHRWarning().

Here is the call graph for this function:

◆ printIdsPkts()

void UwCbrModule::printIdsPkts ( ) const
inline

Prints the IDs of the packet's headers defined by UWCBR.

References PT_UWCBR.

Referenced by command().

◆ printReceivedPacket()

void UwCbrModule::printReceivedPacket ( Packet *  p)
protectedvirtual

Print to tracefile details about a received packet

Parameters
Packet*Pointer to the received packet

Reimplemented in UwTrackerModule.

References hdr_uwip::access(), hdr_uwip::daddr(), hdr_uwip::saddr(), hdr_uwcbr::sn(), tracefile, and tracefile_enabler_.

Referenced by recv().

Here is the call graph for this function:

◆ recv() [1/2]

void UwCbrModule::recv ( Packet *  p)
overridevirtual

◆ recv() [2/2]

void UwCbrModule::recv ( Packet *  p,
Handler *  h 
)
overridevirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.
Handler*Handler.

Reimplemented in UwROVModule, and UwROVCtrModule.

References recv().

Here is the call graph for this function:

◆ resetStats()

void UwCbrModule::resetStats ( )
virtual

Resets all the statistics of the UWCBR module.

References fttsamples, pkts_last_reset, pkts_lost, pkts_ooseq, pkts_recv, rftt, rttsamples, sftt, srtt, sthr, sumbytes, sumdt, sumftt, sumftt2, sumrtt, and sumrtt2.

Referenced by command().

◆ sendPkt()

void UwCbrModule::sendPkt ( )
protectedvirtual

Allocates, initialize and sends a packet with the default priority flag set from tcl.

See also
UwCbrModule::initPkt()

Reimplemented in UwSCFTrackerModule, and UwTrackerModule.

References initPkt(), and hdr_uwcbr::sn().

Referenced by command(), UwROVModule::recv(), UwROVModule::sendAck(), UwTrackerModule::sendPkt(), transmit(), and UwROVCtrModule::transmit().

Here is the call graph for this function:

◆ sendPktHighPriority()

void UwCbrModule::sendPktHighPriority ( )
protectedvirtual

Allocates, initialize and sends a packet with the default priority flag set from tcl.

See also
UwCbrModule::initPkt()

References initPkt(), hdr_uwcbr::priority(), and hdr_uwcbr::sn().

Referenced by command(), UwROVModule::recv(), and UwROVModule::sendAck().

Here is the call graph for this function:

◆ sendPktLowPriority()

void UwCbrModule::sendPktLowPriority ( )
protectedvirtual

Allocates, initialize and sends a packet with the default priority flag set from tcl.

See also
UwCbrModule::initPkt()

References initPkt(), hdr_uwcbr::priority(), and hdr_uwcbr::sn().

Referenced by command().

Here is the call graph for this function:

◆ start()

void UwCbrModule::start ( )
protectedvirtual

Start to send packets.

Reimplemented in CoolAddon, UwTrackerModule, UwROVCtrModule, and UwSCFTrackerModule.

References getTimeBeforeNextPkt(), and sendTmr_.

Referenced by command(), CoolAddon::start(), and UwTrackerModule::start().

Here is the call graph for this function:

◆ stop()

void UwCbrModule::stop ( )
protectedvirtual

Stop to send packets.

Reimplemented in CoolAddon, UwTrackerModule, and UwSCFTrackerModule.

References sendTmr_.

Referenced by command(), CoolAddon::stop(), and UwTrackerModule::stop().

◆ transmit()

void UwCbrModule::transmit ( )
protectedvirtual

Creates and transmits a packet and schedules a new transmission.

See also
UwCbrModule::sendPkt()

Reimplemented in UwROVCtrModule.

References getTimeBeforeNextPkt(), sendPkt(), and sendTmr_.

Here is the call graph for this function:

◆ updateFTT()

void UwCbrModule::updateFTT ( const double &  ftt)
protectedvirtual

Updates the Forward Trip Time.

Parameters
double&New Forward Trip Time entry.

References fttsamples, sumftt, and sumftt2.

Referenced by recv().

◆ updateRTT()

void UwCbrModule::updateRTT ( const double &  rtt)
protectedvirtual

Updates the Round Trip Time.

Parameters
double&New Round Trip Time entry.

References rttsamples, sumrtt, and sumrtt2.

Referenced by recv().

◆ updateThroughput()

void UwCbrModule::updateThroughput ( const int &  bytes,
const double &  dt 
)
protectedvirtual

Updates the Throughput.

Parameters
int&Bytes of the payload of the last packet received.
double&Delay Time between the last two receipts.

References sumbytes, and sumdt.

Referenced by recv().

Friends And Related Symbol Documentation

◆ UwSendTimer

friend class UwSendTimer
friend

Member Data Documentation

◆ cnt

int UwCbrModule::cnt
protected

Used for check if is the first time that tracefile<ip of sink> is opened.

◆ debug_

◆ drop_out_of_order_

int UwCbrModule::drop_out_of_order_
protected

Flag to enable or disable the check for out of order packets.

Referenced by GetPER(), recv(), and UwCbrModule().

◆ dstAddr_

nsaddr_t UwCbrModule::dstAddr_
protected

IP of the destination.

Referenced by initPkt(), and UwCbrModule().

◆ dstPort_

uint16_t UwCbrModule::dstPort_
protected

Destination port.

Referenced by initPkt(), and UwCbrModule().

◆ esn

uint32_t UwCbrModule::esn
protected

Expected serial number.

Referenced by GetPER(), and recv().

◆ fttsamples

int UwCbrModule::fttsamples
protected

Number of FTT samples.

Referenced by GetFTT(), GetFTTstd(), GetTxTime(), resetStats(), and updateFTT().

◆ hrsn

int UwCbrModule::hrsn
protected

Highest received sequence number.

Referenced by command(), and recv().

◆ log_suffix

std::string UwCbrModule::log_suffix
protected

Possibility to insert a log suffix

Referenced by command().

◆ lrtime

double UwCbrModule::lrtime
protected

Time of last packet reception.

Referenced by recv().

◆ period_

double UwCbrModule::period_
protected

Period between two consecutive packet transmissions.

Referenced by getTimeBeforeNextPkt(), UwROVCtrModule::transmit(), and UwCbrModule().

◆ pkts_invalid

int UwCbrModule::pkts_invalid
protected

Total number of invalid packets received.

Referenced by incrPktInvalid().

◆ pkts_last_reset

int UwCbrModule::pkts_last_reset
protected

Used for error checking after stats are reset. Set to pkts_lost+pkts_recv each time resetStats is called.

Referenced by command(), recv(), and resetStats().

◆ pkts_lost

int UwCbrModule::pkts_lost
protected

Total number of lost packets, including packets received out of sequence.

Referenced by GetPER(), incrPktLost(), recv(), and resetStats().

◆ pkts_ooseq

int UwCbrModule::pkts_ooseq
protected

Total number of packets received out of sequence.

Referenced by incrPktOoseq(), and resetStats().

◆ pkts_recv

int UwCbrModule::pkts_recv
protected

Total number of received packets. Packet out of sequence are not counted here.

Referenced by command(), GetPER(), incrPktRecv(), recv(), and resetStats().

◆ pktSize_

int UwCbrModule::pktSize_
protected

UWCBR packets payload size.

Referenced by initPkt(), and UwCbrModule().

◆ PoissonTraffic_

int UwCbrModule::PoissonTraffic_
protected

1 if the traffic is generated according to a poissonian distribution, 0 otherwise.

Referenced by getTimeBeforeNextPkt(), and UwCbrModule().

◆ priority_

char UwCbrModule::priority_
protected

Priority of the data packets.

Referenced by command(), initPkt(), UwROVModule::initPkt(), and UwROVModule::recv().

◆ rftt

double UwCbrModule::rftt
protected

Forward Trip Time seen for last received packet.

Referenced by initPkt(), recv(), and resetStats().

◆ rttsamples

int UwCbrModule::rttsamples
protected

◆ sendTmr_

UwSendTimer UwCbrModule::sendTmr_
protected

◆ sftt

double UwCbrModule::sftt
protected

Smoothed Forward Trip Time, calculated as srtt.

Referenced by resetStats().

◆ sn_check

bool* UwCbrModule::sn_check
protected

Used to keep track of the packets already received.

Referenced by recv(), and UwCbrModule().

◆ srtt

double UwCbrModule::srtt
protected

Smoothed Round Trip Time, calculated as for TCP.

Referenced by resetStats().

◆ sthr

double UwCbrModule::sthr
protected

Smoothed throughput calculation.

Referenced by resetStats().

◆ sumbytes

double UwCbrModule::sumbytes
protected

Sum of bytes received.

Referenced by GetTHR(), resetStats(), and updateThroughput().

◆ sumdt

double UwCbrModule::sumdt
protected

Sum of the delays.

Referenced by GetTHR(), resetStats(), and updateThroughput().

◆ sumftt

double UwCbrModule::sumftt
protected

Sum of FTT samples.

Referenced by GetFTT(), GetFTTstd(), resetStats(), and updateFTT().

◆ sumftt2

double UwCbrModule::sumftt2
protected

Sum of (FTT^2).

Referenced by GetFTTstd(), resetStats(), and updateFTT().

◆ sumrtt

double UwCbrModule::sumrtt
protected

◆ sumrtt2

double UwCbrModule::sumrtt2
protected

Sum of (RTT^2).

Referenced by GetRTTstd(), resetStats(), and updateRTT().

◆ sumtxtimes

double UwCbrModule::sumtxtimes = 0
protected

Sum of transmission times

Referenced by GetTxTime().

◆ tracefile

std::ofstream UwCbrModule::tracefile
protected

◆ tracefile_enabler_

int UwCbrModule::tracefile_enabler_
protected

True if enable tracefile of received packets, default disabled.

Referenced by command(), UwTrackerModule::printReceivedPacket(), printReceivedPacket(), recv(), and UwCbrModule().

◆ tracefilename

std::string UwCbrModule::tracefilename
protected

Referenced by command().

◆ traffic_type_

uint UwCbrModule::traffic_type_
protected

Traffic type of the packets.

Referenced by initPkt(), and UwCbrModule().

◆ txsn

int UwCbrModule::txsn
protected

Sequence number of the next packet to be transmitted.

Referenced by command(), and initPkt().

◆ uidcnt_

int UwCbrModule::uidcnt_ = 0
staticprotected

Unique id of the packet generated.

Referenced by initPkt().


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