Application Class Reference

#include <app.h>

Inheritance diagram for Application:

Process TclObject MediaApp SctpApp1 TcpApp TelnetApp TrafficGenerator WormApp QA HttpUInvalAgent CBR_PP_Traffic CBR_Traffic EXPOO_Traffic POO_Traffic RA_Traffic TrafficTrace AnWormApp DnhWormApp Collaboration diagram for Application:

Collaboration graph
[legend]

Detailed Description

Definition at line 48 of file app.h.

Public Member Functions

 Application ()
virtual AppDataget_data (int &size, AppData *req_data=0)
virtual void process_data (int size, AppData *data)
virtual void recv (int nbytes)
virtual void resume ()
virtual void send (int nbytes)
virtual void send_data (int size, AppData *data=0)
Process *& target ()

Protected Member Functions

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

Protected Attributes

Agentagent_
int enableRecv_
int enableResume_
Processtarget_


Constructor & Destructor Documentation

Application::Application  ) 
 

Definition at line 51 of file app.cc.

00051                          : enableRecv_(0), enableResume_(0)
00052 {
00053 }


Member Function Documentation

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

Reimplemented from Process.

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

Definition at line 56 of file app.cc.

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

Referenced by WormApp::command(), TrafficTrace::command(), TcpApp::command(), POO_Traffic::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 71 of file ns-process.cc.

References abort().

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

00072 {
00073     abort();
00074     /* NOTREACHED */
00075     return NULL; // Make msvc happy 
00076 }

Here is the call graph for this function:

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

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

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

References abort().

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

00067 {
00068     abort();
00069 }

Here is the call graph for this function:

void Application::recv int  nbytes  )  [virtual]
 

Reimplemented in WormApp, DnhWormApp, AnWormApp, and TcpApp.

Definition at line 115 of file app.cc.

References 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]
 

Reimplemented in TrafficGenerator, and TcpApp.

Definition at line 124 of file app.cc.

References 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]
 

Definition at line 109 of file app.cc.

References agent_, and Agent::sendmsg().

Referenced by 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 127 of file ns-process.h.

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

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

00127                                                         {
00128         if (target_)
00129             target_->process_data(size, data);
00130     }

Here is the call graph for this function:

void Application::start  )  [protected, virtual]
 

Reimplemented in SctpApp1, TelnetApp, AnWormApp, CBR_PP_Traffic, MediaApp, CBR_Traffic, TrafficGenerator, and TcpApp.

Definition at line 99 of file app.cc.

Referenced by command().

00100 {
00101 }

void Application::stop  )  [protected, virtual]
 

Reimplemented in SctpApp1, TelnetApp, MediaApp, QA, TrafficGenerator, and TcpApp.

Definition at line 104 of file app.cc.

Referenced by command().

00105 {
00106 }

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

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

References Process::target_.

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

00118 { return target_; }


Field Documentation

Agent* Application::agent_ [protected]
 

Definition at line 60 of file app.h.

Referenced by WormApp::command(), command(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), CBR_PP_Traffic::init(), AnWormApp::probe(), QA::rap(), MediaApp::rap(), send(), DnhWormApp::send_probe(), TcpApp::TcpApp(), TrafficTrace::timeout(), TelnetApp::timeout(), SctpApp1::timeout(), EXPOO_Traffic::timeout(), CBR_PP_Traffic::timeout(), and TcpApp::~TcpApp().

int Application::enableRecv_ [protected]
 

Definition at line 61 of file app.h.

Referenced by command(), and recv().

int Application::enableResume_ [protected]
 

Definition at line 62 of file app.h.

Referenced by command(), and resume().

Process* Process::target_ [protected, inherited]
 

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

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


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:03:02 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6