#include <salink.h>
Inheritance diagram for SALink:


Public Member Functions | |
| SALink () | |
| int | command (int argc, const char *const *argv) |
| void | trace (TracedVar *v) |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| virtual void | recv (Packet *p, const char *s) |
| 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 | |
| void | recv (Packet *, Handler *) |
| int | lookup (int) |
| int | get_nxt () |
| virtual void | drop (Packet *p, const char *s) |
| void | send (Packet *p, Handler *h) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| ADC * | adc_ |
| int | RTT |
| pending | pending_ [NFLOWS] |
| TracedInt | numfl_ |
| Tcl_Channel | tchan_ |
| int | onumfl_ |
| int | src_ |
| int | dst_ |
| int | last_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
|
|
Definition at line 38 of file salink.cc. References dst_, pending::flowid, NFLOWS, numfl_, pending_, src_, and pending::status.
00038 : adc_(0), numfl_(-1), tchan_(0), onumfl_(0), last_(-1) 00039 { 00040 int i; 00041 for (i=0;i<NFLOWS;i++) { 00042 pending_[i].flowid=-1; 00043 pending_[i].status=0; 00044 } 00045 bind("src_", &src_); 00046 bind("dst_", &dst_); 00047 00048 numfl_.tracer(this); 00049 numfl_.name("\"Admitted Flows\""); 00050 } |
|
||||||||||||
|
Reimplemented from Connector. Definition at line 122 of file salink.cc. References adc_, Connector::command(), dst_, numfl_, src_, tchan_, and ADC::type().
00123 {
00124 Tcl& tcl = Tcl::instance();
00125 char wrk[500];
00126
00127 if (argc ==3) {
00128 if (strcmp(argv[1],"attach-adc") == 0 ) {
00129 adc_=(ADC *)TclObject::lookup(argv[2]);
00130 if (adc_ ==0 ) {
00131 tcl.resultf("no such node %s", argv[2]);
00132 return(TCL_ERROR);
00133 }
00134 return(TCL_OK);
00135 }
00136 if (strcmp(argv[1], "attach") == 0) {
00137 int mode;
00138 const char* id = argv[2];
00139 tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00140 if (tchan_ == 0) {
00141 tcl.resultf("SALink: trace: can't attach %s for writing", id);
00142 return (TCL_ERROR);
00143 }
00144 return (TCL_OK);
00145 }
00146 }
00147 if (argc == 2) {
00148 if (strcmp(argv[1], "add-trace") == 0) {
00149 if (tchan_) {
00150 sprintf(wrk, "a -t * -n %s:%d-%d -s %d",
00151 adc_->type(), src_, dst_, src_);
00152 int n = strlen(wrk);
00153 wrk[n] = '\n';
00154 wrk[n+1] = 0;
00155 (void)Tcl_Write(tchan_, wrk, n+1);
00156 numfl_ = 0;
00157 }
00158 return (TCL_OK);
00159 }
00160 }
00161 return Connector::command(argc,argv);
00162 }
|
Here is the call graph for this function:

|
||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
Definition at line 114 of file connector.cc. References Connector::drop_, Packet::free(), and NsObject::recv().
00115 {
00116 if (drop_ != 0)
00117 drop_->recv(p, s);
00118 else
00119 Packet::free(p);
00120 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Definition at line 173 of file salink.cc. References pending::flowid, NFLOWS, and pending_. Referenced by recv().
|
|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
|
Here is the call graph for this function:

|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Definition at line 164 of file salink.cc. References pending::flowid, NFLOWS, and pending_. Referenced by recv().
|
|
||||||||||||
|
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:

|
||||||||||||
|
Reimplemented from Connector. Definition at line 53 of file salink.cc. References abort(), hdr_resv::access(), hdr_ip::access(), hdr_cmn::access(), adc_, ADC::admit_flow(), hdr_resv::bucket(), Scheduler::clock(), hdr_resv::decision(), dst_, pending::flowid, hdr_ip::flowid(), get_nxt(), Scheduler::instance(), last_, lookup(), numfl_, pending_, PT_ACCEPT, PT_CONFIRM, PT_REJECT, PT_REQUEST, PT_TEARDOWN, hdr_cmn::ptype(), hdr_resv::rate(), ADC::rej_action(), Connector::send(), src_, tchan_, and ADC::teardown_action().
00054 {
00055 int decide;
00056 int j;
00057
00058 hdr_cmn *ch=hdr_cmn::access(p);
00059 hdr_ip *iph=hdr_ip::access(p);
00060 hdr_resv *rv=hdr_resv::access(p);
00061
00062 //CLEAN THIS UP
00063 int cl=(iph->flowid())?1:0;
00064
00065 switch(ch->ptype()) {
00066 case PT_REQUEST:
00067 decide=adc_->admit_flow(cl,rv->rate(),rv->bucket());
00068 if (tchan_)
00069 if (last_ != decide) {
00070 int n;
00071 char wrk[50];
00072 double t = Scheduler::instance().clock();
00073 sprintf(wrk, "l -t %g -s %d -d %d -S COLOR -c %s",
00074 t, src_, dst_, decide ? "MediumBlue" : "red" );
00075 n = strlen(wrk);
00076 wrk[n] = '\n';
00077 wrk[n+1] = 0;
00078 (void)Tcl_Write(tchan_, wrk, n+1);
00079 last_ = decide;
00080 }
00081 //put decide in the packet
00082 rv->decision() &= decide;
00083 if (decide) {
00084 j=get_nxt();
00085 pending_[j].flowid=iph->flowid();
00086 //pending_[j].status=decide;
00087 numfl_++;
00088 }
00089 break;
00090 case PT_ACCEPT:
00091 case PT_REJECT:
00092 break;
00093 case PT_CONFIRM:
00094 {
00095 j=lookup(iph->flowid());
00096 if (j!=-1) {
00097 if (!rv->decision()) {
00098 //decrease the avload for this class
00099 adc_->rej_action(cl,rv->rate(),rv->bucket());
00100 numfl_--;
00101 }
00102 pending_[j].flowid=-1;
00103 }
00104 break;
00105 }
00106 case PT_TEARDOWN:
00107 {
00108 adc_->teardown_action(cl,rv->rate(),rv->bucket());
00109 numfl_--;
00110 break;
00111 }
00112 default:
00113 #ifdef notdef
00114 error("unknown signalling message type : %d",ch->ptype());
00115 abort();
00116 #endif
00117 break;
00118 }
00119 send(p,h);
00120 }
|
Here is the call graph for this function:

|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
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 }
|
|
||||||||||||
|
Reimplemented in Agent, and LinkDelay. Definition at line 54 of file connector.h. References NsObject::recv(), and Connector::target_. Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().
|
Here is the call graph for this function:

|
|
Definition at line 48 of file connector.h. References Connector::target_. Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().
00048 { return target_; }
|
|
|
Definition at line 186 of file salink.cc. References adc_, Scheduler::clock(), dst_, Scheduler::instance(), onumfl_, src_, tchan_, and ADC::type().
00187 {
00188
00189 char wrk[500];
00190 int *p, newval;
00191
00192 if (strcmp(v->name(), "\"Admitted Flows\"") == 0) {
00193 p = &onumfl_;
00194 }
00195 else {
00196 fprintf(stderr, "SALink: unknown trace var %s\n", v->name());
00197 return;
00198 }
00199
00200 newval = int(*((TracedInt*)v));
00201
00202 if (tchan_) {
00203 int n;
00204 double t = Scheduler::instance().clock();
00205 /* f -t 0.0 -s 1 -a SA -T v -n Num -v 0 -o 0 */
00206 sprintf(wrk, "f -t %g -s %d -a %s:%d-%d -T v -n %s -v %d -o %d",
00207 t, src_, adc_->type(), src_, dst_, v->name(), newval, *p);
00208 n = strlen(wrk);
00209 wrk[n] = '\n';
00210 wrk[n+1] = 0;
00211 (void)Tcl_Write(tchan_, wrk, n+1);
00212
00213 }
00214
00215 *p = newval;
00216
00217 return;
00218 }
|
Here is the call graph for this function:

|
|
|
|
|
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(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
|
|
|
Definition at line 50 of file salink.h. Referenced by recv(). |
|
|
|
|
|
Definition at line 47 of file salink.h. Referenced by trace(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
1.3.3