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

TelnetApp Class Reference

#include <telnet.h>

Inheritance diagram for TelnetApp:

Inheritance graph
[legend]
Collaboration diagram for TelnetApp:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TelnetApp ()
void timeout ()
virtual void send (int nbytes)
virtual void recv (int nbytes)
virtual void resume ()
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

void start ()
void stop ()
double next ()
virtual int command (int argc, const char *const *argv)

Protected Attributes

double interval_
int running_
TelnetAppTimer timer_
Agentagent_
int enableRecv_
int enableResume_
Processtarget_

Constructor & Destructor Documentation

TelnetApp::TelnetApp  ) 
 

Definition at line 52 of file telnet.cc.

References interval_.

00052                      : running_(0), timer_(this)
00053 {
00054         bind("interval_", &interval_);
00055 }


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:

double TelnetApp::next  )  [inline, protected]
 

Definition at line 87 of file telnet.cc.

References Random::exponential(), interval_, and tcplib_telnet_interarrival().

Referenced by start(), and timeout().

00088 {
00089         if (interval_ == 0)
00090                 /* use tcplib */
00091                 return tcplib_telnet_interarrival();
00092         else
00093                 return Random::exponential() * interval_;
00094 }

Here is the call graph for this function:

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 }

void Application::resume  )  [virtual, inherited]
 

Reimplemented in TrafficGenerator, and TcpApp.

Definition at line 124 of file app.cc.

References Application::enableResume_.

Referenced by Agent::idle().

00125 {
00126         if (! enableResume_)
00127                 return;
00128         Tcl& tcl = Tcl::instance();
00129         tcl.evalf("%s resume", name_);
00130 }

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 TelnetApp::start  )  [protected, virtual]
 

Reimplemented from Application.

Definition at line 64 of file telnet.cc.

References next(), running_, TimerHandler::sched(), and timer_.

00065 {
00066         running_ = 1;
00067         double t = next();
00068         timer_.sched(t);
00069 }

Here is the call graph for this function:

void TelnetApp::stop  )  [protected, virtual]
 

Reimplemented from Application.

Definition at line 71 of file telnet.cc.

References running_.

00072 {
00073         running_ = 0;
00074 }

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 TelnetApp::timeout  ) 
 

Definition at line 76 of file telnet.cc.

References Application::agent_, next(), TimerHandler::resched(), running_, Agent::sendmsg(), Agent::size(), and timer_.

Referenced by TelnetAppTimer::expire().

00077 {
00078         if (running_) {
00079                 /* call the TCP advance method */
00080                 agent_->sendmsg(agent_->size());
00081                 /* reschedule the timer */
00082                 double t = next();
00083                 timer_.resched(t);
00084         }
00085 }

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(), CBR_PP_Traffic::init(), QA::rap(), MediaApp::rap(), Application::send(), TcpApp::TcpApp(), TrafficTrace::timeout(), timeout(), EXPOO_Traffic::timeout(), CBR_PP_Traffic::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 TelnetApp::interval_ [protected]
 

Definition at line 65 of file telnet.h.

Referenced by next(), and TelnetApp().

int TelnetApp::running_ [protected]
 

Definition at line 66 of file telnet.h.

Referenced by start(), stop(), 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().

TelnetAppTimer TelnetApp::timer_ [protected]
 

Definition at line 67 of file telnet.h.

Referenced by start(), and timeout().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:32:06 2004 for NS2.26SourcesOriginal by doxygen 1.3.3