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

ACTP_ADC Class Reference

Inheritance diagram for ACTP_ADC:

Inheritance graph
[legend]
Collaboration diagram for ACTP_ADC:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACTP_ADC ()
void teardown_action (int, double, int)
void rej_action (int, double, int)
int command (int, const char *const *)
void recv (Packet *, Handler *)
virtual void recv (Packet *p, const char *s)
void setest (int cl, Estimator *est)
double peak_rate (int cl, double r, int b)
char * type ()
virtual void recvOnly (Packet *)
virtual void delay_bind_init_all ()
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
int isdebug () const
virtual void debug (const char *fmt,...)

Protected Member Functions

int admit_flow (int, double, int)
virtual void reset ()
void handle (Event *)

Protected Attributes

int rejected_
double s_
double sump_
Estimatorest_ [CLASS]
double bandwidth_
char * type_
Tcl_Channel tchan_
int src_
int dst_
int backoff_
int dobump_
int debug_

Constructor & Destructor Documentation

ACTP_ADC::ACTP_ADC  ) 
 

Definition at line 44 of file actp-adc.cc.

References s_, and ADC::type_.

00044                    : rejected_(0), sump_(0)
00045 {
00046         bind("s_", &s_);
00047         type_ = new char[5];
00048         strcpy(type_, "ACTP");
00049 }


Member Function Documentation

int ACTP_ADC::admit_flow int  ,
double  ,
int 
[protected, virtual]
 

Implements ADC.

Definition at line 53 of file actp-adc.cc.

References Estimator::avload(), ADC::backoff_, ADC::bandwidth_, Estimator::change_avload(), ADC::dobump_, ADC::est_, ADC::peak_rate(), rejected_, s_, and sump_.

00054 {
00055         //get peak rate this class of flow
00056         double p=peak_rate(cl,r,b);
00057 
00058         if (backoff_) {
00059                 if (rejected_)
00060                         return 0;
00061         }
00062         
00063         //fprintf (stderr,"%f %f %f\n",sump_*(1-exp(-p*s_)),exp(-p*s_)*est_[cl]->avload(),est_[cl]->avload());
00064         if (sump_*(1-exp(-p*s_))+exp(-p*s_)*est_[cl]->avload() <= bandwidth_) {
00065                 sump_+= p;
00066                 if (dobump_) {
00067                         est_[cl]->change_avload(p);
00068                 }
00069                 return 1;
00070         }
00071         else {
00072                 rejected_=1;
00073                 return 0;
00074         }
00075 }

Here is the call graph for this function:

int ADC::command int  ,
const char *const * 
[virtual, inherited]
 

Reimplemented from NsObject.

Definition at line 37 of file adc.cc.

References NsObject::command(), ADC::est_, ADC::setest(), Estimator::setmeasmod(), Estimator::start(), and ADC::tchan_.

00038 {
00039         
00040         Tcl& tcl = Tcl::instance();
00041         if (argc==2) {
00042                 if (strcmp(argv[1],"start") ==0) {
00043                         /* $adc start */
00044                         est_[1]->start();
00045                         return (TCL_OK);
00046                 }
00047         } else if (argc==4) {
00048                 if (strcmp(argv[1],"attach-measmod") == 0) {
00049                         /* $adc attach-measmod $meas $cl */
00050                         MeasureMod *meas_mod = (MeasureMod *)TclObject::lookup(argv[2]);
00051                         if (meas_mod== 0) {
00052                                 tcl.resultf("no measuremod found");
00053                                 return(TCL_ERROR);
00054                         }
00055                         int cl=atoi(argv[3]);
00056                         est_[cl]->setmeasmod(meas_mod);
00057                         return(TCL_OK);
00058                 } else if (strcmp(argv[1],"attach-est") == 0 ) {
00059                         /* $adc attach-est $est $cl */
00060                         Estimator *est_mod = (Estimator *)TclObject::lookup(argv[2]);
00061                         if (est_mod== 0) {
00062                                 tcl.resultf("no estmod found");
00063                                 return(TCL_ERROR);
00064                         }
00065                         int cl=atoi(argv[3]);
00066                         setest(cl,est_mod);
00067                         return(TCL_OK);
00068                 }
00069         }
00070         else if (argc == 3) {
00071                 if (strcmp(argv[1], "attach") == 0) {
00072                         int mode;
00073                         const char* id = argv[2];
00074                         tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00075                         if (tchan_ == 0) {
00076                                 tcl.resultf("ADC: trace: can't attach %s for writing", id);
00077                                 return (TCL_ERROR);
00078                         }
00079                         return (TCL_OK);
00080                         
00081                 }
00082                 if (strcmp(argv[1], "setbuf") == 0) {
00083                         /* some sub classes actually do something here */
00084                         return(TCL_OK);
00085                 }
00086 
00087 
00088         }
00089         return (NsObject::command(argc,argv));
00090 }

Here is the call graph for this function:

void NsObject::debug const char *  fmt,
... 
[virtual, inherited]
 

Definition at line 102 of file object.cc.

References NsObject::debug_.

00103 {
00104         if (!debug_)
00105                 return;
00106         va_list ap;
00107         va_start(ap, fmt);
00108         vprintf(fmt, ap);
00109 }

int NsObject::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 63 of file object.cc.

References NsObject::debug_.

Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().

00064 {
00065         if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 
00066                 return TCL_OK;
00067         return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 57 of file object.cc.

Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().

00058 {
00059         delay_bind_init_one("debug_");
00060 }

void NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093         recv((Packet*)e);
00094 }

Here is the call graph for this function:

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

double ADC::peak_rate int  cl,
double  r,
int  b
[inline, inherited]
 

Definition at line 38 of file adc.h.

References ADC::est_, and Estimator::period().

Referenced by HB_ADC::admit_flow(), admit_flow(), ACTO_ADC::admit_flow(), MSPK_ADC::get_rate(), HB_ADC::rej_action(), rej_action(), HB_ADC::teardown_action(), and teardown_action().

00038 {return r+b/est_[cl]->period();}

Here is the call graph for this function:

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

00097 {
00098         Packet::free(p);
00099 }

Here is the call graph for this function:

void ADC::recv Packet ,
Handler
[inline, virtual, inherited]
 

Implements NsObject.

Definition at line 35 of file adc.h.

00035 {} 

virtual void NsObject::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented in Agent, and Trace.

Definition at line 56 of file object.h.

Referenced by Trace::recvOnly().

00056 {};

void ACTP_ADC::rej_action int  ,
double  ,
int 
[virtual]
 

Reimplemented from ADC.

Definition at line 78 of file actp-adc.cc.

References ADC::peak_rate(), and sump_.

00079 {
00080         double p=peak_rate(cl,r,b);
00081         sump_ -= p;
00082 }

Here is the call graph for this function:

void NsObject::reset  )  [protected, virtual, inherited]
 

Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void ADC::setest int  cl,
Estimator est
[inline, inherited]
 

Definition at line 36 of file adc.h.

References ADC::est_, Estimator::setactype(), and ADC::type_.

Referenced by ADC::command().

00036                                                   {est_[cl]=est;
00037                                                  est_[cl]->setactype(type_);}

Here is the call graph for this function:

void ACTP_ADC::teardown_action int  ,
double  ,
int 
[virtual]
 

Reimplemented from ADC.

Definition at line 85 of file actp-adc.cc.

References ADC::peak_rate(), rejected_, and sump_.

00086 {
00087         rejected_=0;
00088         double p=peak_rate(cl,r,b);
00089         sump_ -= p;
00090 }

Here is the call graph for this function:

char* ADC::type  )  [inline, inherited]
 

Definition at line 39 of file adc.h.

References ADC::type_.

Referenced by SALink::command(), and SALink::trace().

00039 {return type_;}


Member Data Documentation

int ADC::backoff_ [protected, inherited]
 

Definition at line 47 of file adc.h.

Referenced by ADC::ADC(), HB_ADC::admit_flow(), admit_flow(), and ACTO_ADC::admit_flow().

double ADC::bandwidth_ [protected, inherited]
 

Definition at line 42 of file adc.h.

Referenced by ADC::ADC(), Param_ADC::admit_flow(), MS_ADC::admit_flow(), HB_ADC::admit_flow(), admit_flow(), and ACTO_ADC::admit_flow().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

int ADC::dobump_ [protected, inherited]
 

Definition at line 48 of file adc.h.

Referenced by ADC::ADC(), admit_flow(), and ACTO_ADC::admit_flow().

int ADC::dst_ [protected, inherited]
 

Definition at line 46 of file adc.h.

Referenced by ADC::ADC(), and Param_ADC::trace().

Estimator* ADC::est_[CLASS] [protected, inherited]
 

Definition at line 41 of file adc.h.

Referenced by MS_ADC::admit_flow(), HB_ADC::admit_flow(), admit_flow(), ACTO_ADC::admit_flow(), ADC::command(), ADC::peak_rate(), MS_ADC::rej_action(), and ADC::setest().

int ACTP_ADC::rejected_ [protected]
 

Definition at line 39 of file actp-adc.cc.

Referenced by admit_flow(), and teardown_action().

double ACTP_ADC::s_ [protected]
 

Definition at line 40 of file actp-adc.cc.

Referenced by ACTP_ADC(), and admit_flow().

int ADC::src_ [protected, inherited]
 

Definition at line 45 of file adc.h.

Referenced by ADC::ADC(), and Param_ADC::trace().

double ACTP_ADC::sump_ [protected]
 

Definition at line 41 of file actp-adc.cc.

Referenced by admit_flow(), rej_action(), and teardown_action().

Tcl_Channel ADC::tchan_ [protected, inherited]
 

Definition at line 44 of file adc.h.

Referenced by ADC::command(), and Param_ADC::trace().

char* ADC::type_ [protected, inherited]
 

Definition at line 43 of file adc.h.

Referenced by ACTO_ADC::ACTO_ADC(), ACTP_ADC(), HB_ADC::HB_ADC(), MS_ADC::MS_ADC(), Param_ADC::Param_ADC(), ADC::setest(), Param_ADC::trace(), and ADC::type().


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