#include <cbr-module.h>
Inheritance diagram for CbrModule:
Public Member Functions | |
CbrModule () | |
~CbrModule () | |
virtual void | recv (Packet *) |
virtual void | recv (Packet *p, Handler *h) |
virtual int | command (int argc, const char *const *argv) |
virtual int | crLayCommand (ClMessage *m) |
virtual double | GetRTT () |
virtual double | GetFTT () |
virtual double | GetFTTpob () |
virtual double | GetPER () |
virtual double | GetTHR () |
virtual double | GetPER_PB () |
virtual double | GetRTTstd () |
virtual double | GetFTTstd () |
virtual void | resetStats () |
Protected Member Functions | |
virtual void | sendPkt () |
virtual void | transmit () |
virtual void | initPkt (Packet *p) |
virtual void | start () |
virtual void | stop () |
virtual void | updateRTT (double rtt) |
virtual void | updateFTT (double ftt) |
virtual void | updateThroughput (int bytes, double dt) |
virtual void | incrPktLost (int npkts) |
virtual void | incrPktRecv () |
virtual void | incrPktOoseq () |
virtual void | incrPktInvalid () |
virtual void | incrPktOutBuff () |
virtual double | getTimeBeforeNextPkt () |
virtual double | getMOS (double Pdrop, double delay, double rsource) |
virtual void | updateMOS (double Pdrop, double delay, double rsource) |
virtual double | GetMOS () |
Protected Attributes | |
nsaddr_t | dstPort_ |
nsaddr_t | dstAddr_ |
double | alpha_ |
int | txsn |
int | hrsn |
int | pkts_recv |
int | pkts_ooseq |
double | addfd_ |
double | fd_ |
double | cr_ |
double | MOS |
int | pob_ |
double | pob_time |
int | pkts_opt |
double | first_pkt_rftt |
int | first_pkt_ |
int | pkts_lost |
int | pkts_invalid |
int | pkts_last_reset |
double | rftt |
double | srtt |
double | sftt |
double | lrtime |
double | sthr |
double | period_ |
int | pktSize_ |
SendTimer | sendTmr_ |
double | sumrtt |
double | sumrtt2 |
int | rttsamples |
double | sumftt |
double | sumftt2 |
int | fttsamples |
double | sumbytes |
double | sumdt |
int | PoissonTraffic_ |
Static Protected Attributes | |
static int | uidcnt_ |
Friends | |
class | SendTimer |
Definition at line 93 of file cbr-module.h.
void CbrModule::recv | ( | Packet * | p | ) | [virtual] |
Abstract method which has to be filled with the ad-hoc operations that the module has to do to the packet received
p | pointer to the packet will be received |
Implements Module.
Definition at line 305 of file cbr-module.cc.
References addfd_, cr_, Module::drop(), dstAddr_, dstPort_, fd_, first_pkt_, first_pkt_rftt, GetFTT(), PlugIn::getId(), GetPER(), hrsn, incrPktInvalid(), incrPktLost(), incrPktOoseq(), incrPktOutBuff(), incrPktRecv(), lrtime, pkts_last_reset, pkts_lost, pkts_recv, pob_, pob_time, hdr_cbr::rftt, rftt, hdr_cbr::rftt_valid, hdr_cbr::sn, hdr_cbr::ts, updateFTT(), updateMOS(), updateRTT(), and updateThroughput().
Referenced by recv().
Here is the call graph for this function:
void CbrModule::recv | ( | Packet * | p, | |
Handler * | callback | |||
) | [virtual] |
Call the recv method with only the Packet parameter in order to hide the callback (not used in this implementation) and mantain compatibility with the old ns2 code
p | pointer to the packet will be received | |
callback | pointer to a Handler class |
Reimplemented from Module.
Definition at line 296 of file cbr-module.cc.
References recv().
Here is the call graph for this function:
int CbrModule::command | ( | int | argc, | |
const char *const * | argv | |||
) | [virtual] |
TCL command interpreter. It implements the following OTcl methods:
Moreover it inherits all the OTcl method of PlugIn
argc | number of arguments in argv | |
argv | array of strings which are the comand parameters (Note that argv[0] is the name of the object) |
Reimplemented from Module.
Definition at line 112 of file cbr-module.cc.
References addfd_, Module::command(), cr_, fd_, GetFTT(), GetFTTpob(), GetFTTstd(), GetMOS(), GetPER(), GetPER_PB(), GetRTT(), GetRTTstd(), GetTHR(), hrsn, pkts_last_reset, pkts_recv, pob_, pob_time, resetStats(), sendPkt(), start(), stop(), PlugIn::tag_, and txsn.
Here is the call graph for this function:
int CbrModule::crLayCommand | ( | ClMessage * | m | ) | [virtual] |
m |
Reimplemented from PlugIn.
Definition at line 224 of file cbr-module.cc.
References PlugIn::crLayCommand(), and ClMessage::type().
Here is the call graph for this function:
void CbrModule::sendPkt | ( | ) | [protected, virtual] |
Generate a packet and transmit it
Definition at line 272 of file cbr-module.cc.
References PlugIn::getId(), initPkt(), and Module::sendDown().
Referenced by command(), and transmit().
Here is the call graph for this function:
void CbrModule::transmit | ( | ) | [protected, virtual] |
Call sendPkt and schedule a new transmission after period_ seconds
Definition at line 283 of file cbr-module.cc.
References getTimeBeforeNextPkt(), sendPkt(), and sendTmr_.
Referenced by SendTimer::expire().
Here is the call graph for this function:
void CbrModule::initPkt | ( | Packet * | p | ) | [protected, virtual] |
initialize a packet before transmission
p | packet to be initialized |
Definition at line 238 of file cbr-module.cc.
References dstAddr_, dstPort_, pktSize_, hdr_cbr::rftt, rftt, hdr_cbr::rftt_valid, hdr_cbr::sn, hdr_cbr::ts, txsn, and uidcnt_.
Referenced by sendPkt().
void CbrModule::start | ( | ) | [protected, virtual] |
start sending packets
Definition at line 267 of file cbr-module.cc.
References getTimeBeforeNextPkt(), and sendTmr_.
Referenced by command().
Here is the call graph for this function:
void CbrModule::stop | ( | ) | [protected, virtual] |
stop sending packets
Definition at line 290 of file cbr-module.cc.
References sendTmr_.
Referenced by command().
int CbrModule::uidcnt_ [static, protected] |
simulation-unique packet ID
Definition at line 125 of file cbr-module.h.
Referenced by CbrModule(), and initPkt().
double CbrModule::alpha_ [protected] |
smoothing factor used for statistics using first order IIR filter
Definition at line 173 of file cbr-module.h.
Referenced by CbrModule(), updateFTT(), updateMOS(), and updateRTT().
int CbrModule::txsn [protected] |
sequence number of next new packet to be transmitted
Definition at line 176 of file cbr-module.h.
int CbrModule::hrsn [protected] |
highest received sequence number
Definition at line 177 of file cbr-module.h.
int CbrModule::pkts_recv [protected] |
total number of received packets. Packet out of sequence are not counted here.
Definition at line 179 of file cbr-module.h.
Referenced by command(), GetPER(), GetPER_PB(), incrPktRecv(), recv(), and resetStats().
int CbrModule::pkts_ooseq [protected] |
total number of packets received out of sequence
Definition at line 181 of file cbr-module.h.
Referenced by incrPktOoseq(), and resetStats().
int CbrModule::pkts_opt [protected] |
total number of packets received out of plyout buffer timeout
Definition at line 200 of file cbr-module.h.
Referenced by GetPER_PB(), and incrPktOutBuff().
int CbrModule::pkts_lost [protected] |
total number of lost packets, including packets received out of sequence
Definition at line 208 of file cbr-module.h.
Referenced by GetPER(), GetPER_PB(), incrPktLost(), recv(), and resetStats().
int CbrModule::pkts_invalid [protected] |
total number of invalid packets received
Definition at line 211 of file cbr-module.h.
Referenced by incrPktInvalid().
int CbrModule::pkts_last_reset [protected] |
for error checking after stats are reset. Set to pkts_lost+pkts_recv each time resetStats is called.
Definition at line 213 of file cbr-module.h.
Referenced by command(), recv(), and resetStats().
double CbrModule::rftt [protected] |
Forward Trip Time seen for last received packet
Definition at line 217 of file cbr-module.h.
Referenced by initPkt(), recv(), and resetStats().
double CbrModule::srtt [protected] |
Smoothed Round Trip Time, calculated as for TCP
Definition at line 220 of file cbr-module.h.
Referenced by resetStats(), and updateRTT().
double CbrModule::sftt [protected] |
Smoothed Forward Trip Time, calculated as srtt
Definition at line 223 of file cbr-module.h.
Referenced by resetStats(), and updateFTT().
double CbrModule::lrtime [protected] |
double CbrModule::sthr [protected] |
Smoothed throughput calculation
Definition at line 227 of file cbr-module.h.
Referenced by resetStats().
double CbrModule::period_ [protected] |
period between two consecutive packet transmissions
Definition at line 230 of file cbr-module.h.
Referenced by CbrModule(), and getTimeBeforeNextPkt().
int CbrModule::pktSize_ [protected] |
SendTimer CbrModule::sendTmr_ [protected] |
timer which schedules packet transmissions
Definition at line 232 of file cbr-module.h.
Referenced by start(), stop(), and transmit().
double CbrModule::sumrtt [protected] |
sum of RTT samples
Definition at line 237 of file cbr-module.h.
Referenced by GetRTT(), GetRTTstd(), resetStats(), and updateRTT().
double CbrModule::sumrtt2 [protected] |
sum of (RTT^2)
Definition at line 238 of file cbr-module.h.
Referenced by GetRTTstd(), resetStats(), and updateRTT().
int CbrModule::rttsamples [protected] |
num of RTT samples
Definition at line 239 of file cbr-module.h.
Referenced by GetRTT(), GetRTTstd(), resetStats(), and updateRTT().
double CbrModule::sumftt [protected] |
sum of FTT samples
Definition at line 241 of file cbr-module.h.
Referenced by GetFTT(), GetFTTpob(), GetFTTstd(), resetStats(), and updateFTT().
double CbrModule::sumftt2 [protected] |
sum of (FTT^2)
Definition at line 242 of file cbr-module.h.
Referenced by GetFTTstd(), resetStats(), and updateFTT().
int CbrModule::fttsamples [protected] |
num of FTT samples
Definition at line 243 of file cbr-module.h.
Referenced by GetFTT(), GetFTTpob(), GetFTTstd(), resetStats(), and updateFTT().