ACTP_ADC Class Reference

Inheritance diagram for ACTP_ADC:

ADC NsObject TclObject Handler Collaboration diagram for ACTP_ADC:

Collaboration graph
[legend]

Detailed Description

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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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


Constructor & Destructor Documentation

ACTP_ADC::ACTP_ADC  ) 
 

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

References s_, and ADC::type_.

00065                    : rejected_(0), sump_(0)
00066 {
00067     bind("s_", &s_);
00068     type_ = new char[5];
00069     strcpy(type_, "ACTP");
00070 }


Member Function Documentation

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

Implements ADC.

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

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

00075 {
00076     //get peak rate this class of flow
00077     double p=peak_rate(cl,r,b);
00078 
00079     if (backoff_) {
00080         if (rejected_)
00081             return 0;
00082     }
00083     
00084     //fprintf (stderr,"%f %f %f\n",sump_*(1-exp(-p*s_)),exp(-p*s_)*est_[cl]->avload(),est_[cl]->avload());
00085     if (sump_*(1-exp(-p*s_))+exp(-p*s_)*est_[cl]->avload() <= bandwidth_) {
00086         sump_+= p;
00087         if (dobump_) {
00088             est_[cl]->change_avload(p);
00089         }
00090         return 1;
00091     }
00092     else {
00093         rejected_=1;
00094         return 0;
00095     }
00096 }

Here is the call graph for this function:

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

Reimplemented from NsObject.

Definition at line 58 of file adc.cc.

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

00059 {
00060     
00061     Tcl& tcl = Tcl::instance();
00062     if (argc==2) {
00063         if (strcmp(argv[1],"start") ==0) {
00064             /* $adc start */
00065             est_[1]->start();
00066             return (TCL_OK);
00067         }
00068     } else if (argc==4) {
00069         if (strcmp(argv[1],"attach-measmod") == 0) {
00070             /* $adc attach-measmod $meas $cl */
00071             MeasureMod *meas_mod = (MeasureMod *)TclObject::lookup(argv[2]);
00072             if (meas_mod== 0) {
00073                 tcl.resultf("no measuremod found");
00074                 return(TCL_ERROR);
00075             }
00076             int cl=atoi(argv[3]);
00077             est_[cl]->setmeasmod(meas_mod);
00078             return(TCL_OK);
00079         } else if (strcmp(argv[1],"attach-est") == 0 ) {
00080             /* $adc attach-est $est $cl */
00081             Estimator *est_mod = (Estimator *)TclObject::lookup(argv[2]);
00082             if (est_mod== 0) {
00083                 tcl.resultf("no estmod found");
00084                 return(TCL_ERROR);
00085             }
00086             int cl=atoi(argv[3]);
00087             setest(cl,est_mod);
00088             return(TCL_OK);
00089         }
00090     }
00091     else if (argc == 3) {
00092         if (strcmp(argv[1], "attach") == 0) {
00093             int mode;
00094             const char* id = argv[2];
00095             tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00096             if (tchan_ == 0) {
00097                 tcl.resultf("ADC: trace: can't attach %s for writing", id);
00098                 return (TCL_ERROR);
00099             }
00100             return (TCL_OK);
00101             
00102         }
00103         if (strcmp(argv[1], "setbuf") == 0) {
00104             /* some sub classes actually do something here */
00105             return(TCL_OK);
00106         }
00107 
00108 
00109     }
00110     return (NsObject::command(argc,argv));
00111 }

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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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 60 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().

00060 {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 57 of file adc.h.

00057 {} 

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 99 of file actp-adc.cc.

References ADC::peak_rate(), and sump_.

00100 {
00101     double p=peak_rate(cl,r,b);
00102     sump_ -= p;
00103 }

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, Queue< T >, and XcpSink.

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 58 of file adc.h.

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

Referenced by ADC::command().

00058                                               {est_[cl]=est;
00059                          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 106 of file actp-adc.cc.

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

00107 {
00108     rejected_=0;
00109     double p=peak_rate(cl,r,b);
00110     sump_ -= p;
00111 }

Here is the call graph for this function:

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

Definition at line 61 of file adc.h.

References ADC::type_.

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

00061 {return type_;}


Field Documentation

int ADC::backoff_ [protected, inherited]
 

Definition at line 69 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 64 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(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send().

int ADC::dobump_ [protected, inherited]
 

Definition at line 70 of file adc.h.

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

int ADC::dst_ [protected, inherited]
 

Definition at line 68 of file adc.h.

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

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

Definition at line 63 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 60 of file actp-adc.cc.

Referenced by admit_flow(), and teardown_action().

double ACTP_ADC::s_ [protected]
 

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

Referenced by ACTP_ADC(), and admit_flow().

int ADC::src_ [protected, inherited]
 

Definition at line 67 of file adc.h.

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

double ACTP_ADC::sump_ [protected]
 

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

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

Tcl_Channel ADC::tchan_ [protected, inherited]
 

Definition at line 66 of file adc.h.

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

char* ADC::type_ [protected, inherited]
 

Definition at line 65 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 Mar 6 17:02:34 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6