12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In ~<strong>ns</strong>/tcp.h, three classes are derived from the base class class TimerH<strong>and</strong>ler:class RtxTimer : public TimerH<strong>and</strong>ler {public:RtxTimer(TcpAgent *a) : TimerH<strong>and</strong>ler() { a_ = a; }protected:virtual void expire(Event *e);TcpAgent *a_;};class DelSndTimer : public TimerH<strong>and</strong>ler {public:DelSndTimer(TcpAgent *a) : TimerH<strong>and</strong>ler() { a_ = a; }protected:virtual void expire(Event *e);TcpAgent *a_;};class BurstSndTimer : public TimerH<strong>and</strong>ler {public:BurstSndTimer(TcpAgent *a) : TimerH<strong>and</strong>ler() { a_ = a; }protected:virtual void expire(Event *e);TcpAgent *a_;};In the co<strong>ns</strong>tructor for TcpAgent in tcp.cc, each of these timers is initialized with the this pointer, which is assigned tothe pointer a_.TcpAgent::TcpAgent() : Agent(PT_TCP), rtt_active_(0), rtt_seq_(-1),...rtx_timer_(this), delsnd_timer_(this), burstsnd_timer_(this){...}In the following, we will focus only on the retra<strong>ns</strong>mission timer. Various helper methods may be defined to schedule timerevents; e.g.,/** Set retra<strong>ns</strong>mit timer using current rtt estim<strong>at</strong>e. By calling resched()* it does not m<strong>at</strong>ter whether the timer was already running.*/void TcpAgent::set_rtx_timer(){rtx_timer_.resched(rtt_timeout());}/** Set new retra<strong>ns</strong>mission timer if not all outst<strong>and</strong>ing* d<strong>at</strong>a has been acked. Otherwise, if a timer is still113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!