Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

CBR_PP_Traffic Class Reference

Inheritance diagram for CBR_PP_Traffic:

Inheritance graph
[legend]
Collaboration diagram for CBR_PP_Traffic:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CBR_PP_Traffic ()
virtual double next_interval (int &)
double interval ()
virtual int on ()
virtual void recv ()
virtual void recv (int nbytes)
virtual void resume ()
virtual void send (int nbytes)
Process *& target ()
virtual void process_data (int size, AppData *data)
virtual AppDataget_data (int &size, AppData *req_data=0)
virtual void send_data (int size, AppData *data=0)

Protected Member Functions

virtual void start ()
void init ()
void timeout ()
virtual void stop ()
virtual int command (int argc, const char *const *argv)

Protected Attributes

double rate_
double interval_
double random_
int seqno_
int maxpkts_
int PP_
int PBM_
double nextPkttime_
int size_
int running_
TrafficTimer timer_
Agentagent_
int enableRecv_
int enableResume_
Processtarget_

Constructor & Destructor Documentation

CBR_PP_Traffic::CBR_PP_Traffic  ) 
 

Definition at line 63 of file cbr-traffic-PP.cc.

References maxpkts_, PBM_, random_, rate_, and TrafficGenerator::size_.

00063                                : seqno_(0)
00064 {
00065         bind_bw("rate_", &rate_);
00066         bind("random_", &random_);
00067         bind("packetSize_", &size_);
00068         bind("maxpkts_", &maxpkts_);
00069         bind("PBM_", &PBM_);
00070 }


Member Function Documentation

int Application::command int  argc,
const char *const *  argv
[protected, virtual, inherited]
 

Reimplemented from Process.

Reimplemented in MediaApp, QA, EXPOO_Traffic, POO_Traffic, TrafficTrace, HttpUInvalAgent, and TcpApp.

Definition at line 56 of file app.cc.

References Application::agent_, Agent::attachApp(), Process::command(), Application::enableRecv_, Application::enableResume_, Application::send(), Application::start(), and Application::stop().

Referenced by TrafficTrace::command(), TcpApp::command(), POO_Traffic::command(), MediaApp::command(), and EXPOO_Traffic::command().

00057 {
00058         Tcl& tcl = Tcl::instance();
00059 
00060         if (argc == 2) {
00061                 if (strcmp(argv[1], "start") == 0) {
00062                         // enableRecv_ only if recv() exists in Tcl
00063                         tcl.evalf("[%s info class] info instprocs", name_);
00064                         char result[1024];
00065                         sprintf(result, " %s ", tcl.result());
00066                         enableRecv_ = (strstr(result, " recv ") != 0);
00067                         enableResume_ = (strstr(result, " resume ") != 0);
00068                         start();
00069                         return (TCL_OK);
00070                 }
00071                 if (strcmp(argv[1], "stop") == 0) {
00072                         stop();
00073                         return (TCL_OK);
00074                 }
00075                 if (strcmp(argv[1], "agent") == 0) {
00076                         tcl.resultf("%s", agent_->name());
00077                         return (TCL_OK);
00078                 }
00079         }
00080         else if (argc == 3) {
00081                 if (strcmp(argv[1], "attach-agent") == 0) {
00082                         agent_ = (Agent*) TclObject::lookup(argv[2]);
00083                         if (agent_ == 0) {
00084                                 tcl.resultf("no such agent %s", argv[2]);
00085                                 return(TCL_ERROR);
00086                         }
00087                         agent_->attachApp(this);
00088                         return(TCL_OK);
00089                 }
00090                 if (strcmp(argv[1], "send") == 0) {
00091                         send(atoi(argv[2]));
00092                         return(TCL_OK);
00093                 }
00094         }
00095         return (Process::command(argc, argv));
00096 }

Here is the call graph for this function:

AppData * Process::get_data int &  size,
AppData req_data = 0
[virtual, inherited]
 

Reimplemented in MediaApp, QA, HttpApp, HttpUInvalAgent, MediaCache, MediaServer, and TcpApp.

Definition at line 46 of file ns-process.cc.

References abort().

Referenced by QA::check_availability(), MediaApp::get_data(), RapAgent::IpgTimeout(), and QA::output().

00047 {
00048         abort();
00049         /* NOTREACHED */
00050         return NULL; // Make msvc happy 
00051 }

Here is the call graph for this function:

void CBR_PP_Traffic::init  )  [protected, virtual]
 

Reimplemented from TrafficGenerator.

Definition at line 72 of file cbr-traffic-PP.cc.

References Application::agent_, interval_, PBM_, PP_, PT_CBR, rate_, Agent::set_pkttype(), and TrafficGenerator::size_.

Referenced by start().

00073 {
00074         // compute inter-packet interval 
00075          interval_ = PBM_*(double)(size_ << 3)/(double)rate_;
00076         //interval_ = 1e-100;
00077         PP_ = 0;
00078         if (agent_)
00079                 agent_->set_pkttype(PT_CBR);
00080 }

Here is the call graph for this function:

double CBR_PP_Traffic::interval  )  [inline, virtual]
 

Reimplemented from TrafficGenerator.

Definition at line 40 of file cbr-traffic-PP.cc.

References interval_.

00040 { return (interval_); }

double CBR_PP_Traffic::next_interval int &   )  [virtual]
 

Implements TrafficGenerator.

Definition at line 89 of file cbr-traffic-PP.cc.

References interval_, maxpkts_, PBM_, PP_, random_, rate_, seqno_, TrafficGenerator::size_, and Random::uniform().

Referenced by timeout().

00090 {
00091         // Recompute interval in case rate_ or size_ has changes
00092         if (PP_ >= (PBM_ - 1)){         
00093                 interval_ = PBM_*(double)(size_ << 3)/(double)rate_;
00094                 PP_ = 0;
00095         }
00096         else {
00097                 interval_ = 1e-100;
00098                 PP_ += 1 ;
00099         }
00100         double t = interval_;
00101         if (random_==1)
00102                 t += interval_ * Random::uniform(-0.5, 0.5);    
00103         if (random_==2)
00104                 t += interval_ * Random::uniform(-0.000001, 0.000001);  
00105         size = size_;
00106         if (++seqno_ < maxpkts_)
00107                 return(t);
00108         else
00109                 return(-1); 
00110 }

Here is the call graph for this function:

virtual int TrafficGenerator::on  )  [inline, virtual, inherited]
 

Reimplemented in POO_Traffic.

Definition at line 64 of file trafgen.h.

Referenced by SA_Agent::stoponidle(), and SA_Agent::timeout().

00064 { return 0; }

void Process::process_data int  size,
AppData data
[virtual, inherited]
 

Reimplemented in MediaApp, HttpApp, HttpMInvalCache, HttpUInvalAgent, MediaCache, MediaClient, and TcpApp.

Definition at line 41 of file ns-process.cc.

References abort().

Referenced by HttpUInvalAgent::process_data(), UdpAgent::recv(), RapAgent::recv(), and Process::send_data().

00042 {
00043         abort();
00044 }

Here is the call graph for this function:

void Application::recv int  nbytes  )  [virtual, inherited]
 

Reimplemented in TcpApp.

Definition at line 115 of file app.cc.

References Application::enableRecv_.

Referenced by SimpleTcpAgent::recv(), Agent::recv(), and Agent::recvBytes().

00116 {
00117         if (! enableRecv_)
00118                 return;
00119         Tcl& tcl = Tcl::instance();
00120         tcl.evalf("%s recv %d", name_, nbytes);
00121 }

virtual void TrafficGenerator::recv  )  [inline, virtual, inherited]
 

Definition at line 67 of file trafgen.h.

00067 {}

virtual void TrafficGenerator::resume void   )  [inline, virtual, inherited]
 

Reimplemented from Application.

Definition at line 68 of file trafgen.h.

00068 {}

void Application::send int  nbytes  )  [virtual, inherited]
 

Definition at line 109 of file app.cc.

References Application::agent_, and Agent::sendmsg().

Referenced by Application::command(), TcpApp::send(), and TrafficGenerator::timeout().

00110 {
00111         agent_->sendmsg(nbytes);
00112 }

Here is the call graph for this function:

virtual void Process::send_data int  size,
AppData data = 0
[inline, virtual, inherited]
 

Definition at line 106 of file ns-process.h.

References Process::process_data(), and Process::target_.

Referenced by TcpApp::process_data(), and MediaApp::process_data().

00106                                                             {
00107                 if (target_)
00108                         target_->process_data(size, data);
00109         }

Here is the call graph for this function:

void CBR_PP_Traffic::start  )  [protected, virtual]
 

Reimplemented from TrafficGenerator.

Definition at line 82 of file cbr-traffic-PP.cc.

References init(), TrafficGenerator::running_, and timeout().

00083 {
00084         init();
00085         running_ = 1;
00086         timeout();
00087 }

Here is the call graph for this function:

void TrafficGenerator::stop  )  [protected, virtual, inherited]
 

Reimplemented from Application.

Definition at line 60 of file trafgen.cc.

References TimerHandler::cancel(), TrafficGenerator::running_, and TrafficGenerator::timer_.

00061 {
00062         if (running_)
00063                 timer_.cancel();
00064         running_ = 0;
00065 }

Here is the call graph for this function:

Process*& Process::target  )  [inline, inherited]
 

Definition at line 97 of file ns-process.h.

References Process::target_.

Referenced by QA::check_availability(), Process::command(), HttpApp::command(), MediaApp::get_data(), QA::output(), and TcpApp::process_data().

00097 { return target_; }

void CBR_PP_Traffic::timeout  )  [protected, virtual]
 

Reimplemented from TrafficGenerator.

Definition at line 112 of file cbr-traffic-PP.cc.

References Application::agent_, next_interval(), TrafficGenerator::nextPkttime_, PP_, TimerHandler::resched(), TrafficGenerator::running_, Agent::sendmsg(), TrafficGenerator::size_, and TrafficGenerator::timer_.

Referenced by start().

00113 {
00114         if (! running_)
00115                 return;
00116 
00117         /* send a packet */
00118         // The test tcl/ex/test-rcvr.tcl relies on the "NEW_BURST" flag being 
00119         // set at the start of any exponential burst ("talkspurt").  
00120         if (PP_ == 0) 
00121                 agent_->sendmsg(size_, "NEW_BURST");
00122         else 
00123                 agent_->sendmsg(size_);
00124 
00125         /* figure out when to send the next one */
00126         nextPkttime_ = next_interval(size_);
00127         /* schedule it */
00128         if (nextPkttime_ > 0)
00129                 timer_.resched(nextPkttime_);
00130 }

Here is the call graph for this function:


Member Data Documentation

Agent* Application::agent_ [protected, inherited]
 

Definition at line 60 of file app.h.

Referenced by Application::command(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), init(), QA::rap(), MediaApp::rap(), Application::send(), TcpApp::TcpApp(), TrafficTrace::timeout(), TelnetApp::timeout(), EXPOO_Traffic::timeout(), timeout(), and TcpApp::~TcpApp().

int Application::enableRecv_ [protected, inherited]
 

Definition at line 61 of file app.h.

Referenced by Application::command(), and Application::recv().

int Application::enableResume_ [protected, inherited]
 

Definition at line 62 of file app.h.

Referenced by Application::command(), and Application::resume().

double CBR_PP_Traffic::interval_ [protected]
 

Definition at line 46 of file cbr-traffic-PP.cc.

Referenced by init(), interval(), and next_interval().

int CBR_PP_Traffic::maxpkts_ [protected]
 

Definition at line 49 of file cbr-traffic-PP.cc.

Referenced by CBR_PP_Traffic(), and next_interval().

double TrafficGenerator::nextPkttime_ [protected, inherited]
 

Definition at line 74 of file trafgen.h.

Referenced by TrafficGenerator::start(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and timeout().

int CBR_PP_Traffic::PBM_ [protected]
 

Definition at line 51 of file cbr-traffic-PP.cc.

Referenced by CBR_PP_Traffic(), init(), and next_interval().

int CBR_PP_Traffic::PP_ [protected]
 

Definition at line 50 of file cbr-traffic-PP.cc.

Referenced by init(), next_interval(), and timeout().

double CBR_PP_Traffic::random_ [protected]
 

Definition at line 47 of file cbr-traffic-PP.cc.

Referenced by CBR_PP_Traffic(), and next_interval().

double CBR_PP_Traffic::rate_ [protected]
 

Definition at line 45 of file cbr-traffic-PP.cc.

Referenced by CBR_PP_Traffic(), init(), and next_interval().

int TrafficGenerator::running_ [protected, inherited]
 

Definition at line 76 of file trafgen.h.

Referenced by TrafficGenerator::start(), CBR_Traffic::start(), start(), TrafficGenerator::stop(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and timeout().

int CBR_PP_Traffic::seqno_ [protected]
 

Definition at line 48 of file cbr-traffic-PP.cc.

Referenced by next_interval().

int TrafficGenerator::size_ [protected, inherited]
 

Definition at line 75 of file trafgen.h.

Referenced by CBR_PP_Traffic(), CBR_Traffic::CBR_Traffic(), EXPOO_Traffic::EXPOO_Traffic(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), init(), RA_Traffic::next_interval(), POO_Traffic::next_interval(), EXPOO_Traffic::next_interval(), CBR_Traffic::next_interval(), next_interval(), POO_Traffic::POO_Traffic(), RA_Traffic::RA_Traffic(), TrafficGenerator::start(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and timeout().

Process* Process::target_ [protected, inherited]
 

Definition at line 113 of file ns-process.h.

Referenced by HttpUInvalAgent::command(), Process::Process(), HttpUInvalAgent::process_data(), Process::send_data(), and Process::target().

TrafficTimer TrafficGenerator::timer_ [protected, inherited]
 

Definition at line 77 of file trafgen.h.

Referenced by TrafficGenerator::start(), TrafficGenerator::stop(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and timeout().


The documentation for this class was generated from the following file:
Generated on Tue Apr 20 12:35:29 2004 for NS2.26SourcesOriginal by doxygen 1.3.3