SALink Class Reference

#include <salink.h>

Inheritance diagram for SALink:

Connector NsObject TclObject Handler Collaboration diagram for SALink:

Collaboration graph
[legend]

Detailed Description

Definition at line 53 of file salink.h.

Public Member Functions

int command (int argc, const char *const *argv)
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 ()
virtual void drop (Packet *p)
int isdebug () const
virtual void recv (Packet *p, const char *s)
virtual void recvOnly (Packet *)
 SALink ()
void setDropTarget (NsObject *dt)
void target (NsObject *target)
NsObjecttarget ()
void trace (TracedVar *v)

Protected Member Functions

virtual void drop (Packet *p, const char *s)
int get_nxt ()
void handle (Event *)
int lookup (int)
void recv (Packet *, Handler *)
virtual void reset ()
void send (Packet *p, Handler *h)

Protected Attributes

ADCadc_
int debug_
NsObjectdrop_
int dst_
int last_
TracedInt numfl_
int onumfl_
pending pending_ [NFLOWS]
int RTT
int src_
NsObjecttarget_
Tcl_Channel tchan_


Constructor & Destructor Documentation

SALink::SALink  ) 
 

Definition at line 59 of file salink.cc.

References NFLOWS, pending_, and pending::status.

00059                : adc_(0), numfl_(-1), tchan_(0), onumfl_(0), last_(-1)
00060 {
00061     int i;
00062     for (i=0;i<NFLOWS;i++) {
00063         pending_[i].flowid=-1;
00064         pending_[i].status=0;
00065     }
00066     bind("src_", &src_);
00067     bind("dst_", &dst_);
00068 
00069     numfl_.tracer(this);
00070     numfl_.name("\"Admitted Flows\"");
00071 }


Member Function Documentation

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

Reimplemented from Connector.

Definition at line 143 of file salink.cc.

References adc_, Connector::command(), dst_, numfl_, src_, tchan_, and ADC::type().

00144 {
00145     Tcl& tcl = Tcl::instance();
00146     char wrk[500];
00147     
00148     if (argc ==3) {
00149         if (strcmp(argv[1],"attach-adc") == 0 ) {
00150             adc_=(ADC *)TclObject::lookup(argv[2]);
00151             if (adc_ ==0 ) {
00152                 tcl.resultf("no such node %s", argv[2]);
00153                 return(TCL_ERROR);
00154             }
00155             return(TCL_OK);
00156         }
00157         if (strcmp(argv[1], "attach") == 0) {
00158             int mode;
00159             const char* id = argv[2];
00160             tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00161             if (tchan_ == 0) {
00162                 tcl.resultf("SALink: trace: can't attach %s for writing", id);
00163                 return (TCL_ERROR);
00164             }
00165             return (TCL_OK);
00166         }
00167     }
00168     if (argc == 2) {
00169         if (strcmp(argv[1], "add-trace") == 0) {
00170             if (tchan_) {
00171                 sprintf(wrk, "a -t * -n %s:%d-%d -s %d",
00172                     adc_->type(), src_, dst_, src_);
00173                 int n = strlen(wrk);
00174                 wrk[n] = '\n';
00175                 wrk[n+1] = 0;
00176                 (void)Tcl_Write(tchan_, wrk, n+1);
00177                 numfl_ = 0;
00178             }
00179             return (TCL_OK);
00180         }
00181     }
00182     return Connector::command(argc,argv);
00183 }

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 Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

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:

void Connector::drop Packet p  )  [virtual, inherited]
 

Reimplemented in XCPQueue.

Definition at line 106 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

Referenced by ARPTable::arpresolve(), XCPQueue::drop(), JoBS::dropFront(), Vq::dropPacketForECN(), DSRAgent::dropSendBuff(), JoBS::dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), HDLC::goBackNMode(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), HDLC::handleRR(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), SessionTTLChecker::recv(), TTLChecker::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), Filter::recv(), DynamicLink::recv(), AODV::recvError(), PriQueue::recvHighPriority(), HDLC::recvIncoming(), toraAgent::reset(), HDLC::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), toraAgent::rtRoutePacket(), HDLC::selectiveRepeatMode(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), DropTail::shrink_queue(), PriQueue::Terminate(), DSRAgent::Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and DSRAgent::undeliverablePkt().

00107 {
00108     if (drop_ != 0)
00109         drop_->recv(p);
00110     else
00111         Packet::free(p);
00112 }

Here is the call graph for this function:

int SALink::get_nxt  )  [protected]
 

Definition at line 194 of file salink.cc.

References NFLOWS, and pending_.

Referenced by recv().

00195 {
00196     int i;
00197     for (i=0;i<NFLOWS;i++)
00198         {
00199             if (pending_[i].flowid==-1)
00200                 return i;
00201         }
00202     printf("Ran out of pending space \n");
00203     exit(1);
00204     return i;
00205 }

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_; }

int SALink::lookup int   )  [protected]
 

Definition at line 185 of file salink.cc.

References NFLOWS, and pending_.

Referenced by recv().

00186 {
00187     int i;
00188     for (i=0;i<NFLOWS;i++)
00189         if (pending_[i].flowid==flowid)
00190             return i;
00191     return(-1);
00192 }

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 SALink::recv Packet ,
Handler
[protected, virtual]
 

Reimplemented from Connector.

Definition at line 74 of file salink.cc.

References 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, hdr_cmn::ptype(), hdr_resv::rate(), ADC::rej_action(), src_, and tchan_.

00075 {
00076     int decide;
00077     int j;
00078     
00079     hdr_cmn *ch=hdr_cmn::access(p);
00080     hdr_ip *iph=hdr_ip::access(p);
00081     hdr_resv *rv=hdr_resv::access(p);
00082     
00083     //CLEAN THIS UP
00084     int cl=(iph->flowid())?1:0;
00085     
00086     switch(ch->ptype()) {
00087     case PT_REQUEST:
00088         decide=adc_->admit_flow(cl,rv->rate(),rv->bucket());
00089         if (tchan_)
00090             if (last_ != decide) {
00091                 int n;
00092                 char wrk[50];
00093                 double t = Scheduler::instance().clock();
00094                 sprintf(wrk, "l -t %g -s %d -d %d -S COLOR -c %s", 
00095                     t, src_, dst_, decide ? "MediumBlue" : "red" );
00096                 n = strlen(wrk);
00097                 wrk[n] = '\n';
00098                 wrk[n+1] = 0;
00099                 (void)Tcl_Write(tchan_, wrk, n+1);
00100                 last_ = decide;
00101             }
00102         //put decide in the packet
00103         rv->decision() &= decide;
00104         if (decide) {
00105             j=get_nxt();
00106             pending_[j].flowid=iph->flowid();
00107             //pending_[j].status=decide;
00108             numfl_++;
00109         }
00110         break;
00111     case PT_ACCEPT:
00112     case PT_REJECT:
00113         break;
00114     case PT_CONFIRM:
00115         {
00116             j=lookup(iph->flowid());
00117             if (j!=-1) {
00118                 if (!rv->decision()) {
00119                     //decrease the avload for this class 
00120                     adc_->rej_action(cl,rv->rate(),rv->bucket());
00121                     numfl_--;
00122                 }
00123                 pending_[j].flowid=-1;
00124             }
00125             break;
00126         }
00127     case PT_TEARDOWN:
00128         {
00129             adc_->teardown_action(cl,rv->rate(),rv->bucket());
00130             numfl_--;
00131             break;
00132         }
00133     default:
00134 #ifdef notdef
00135         error("unknown signalling message type : %d",ch->ptype());
00136         abort();
00137 #endif
00138         break;
00139     }
00140     send(p,h);
00141 }

Here is the call graph for this function:

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 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 Connector::send Packet p,
Handler h
[inline, protected, inherited]
 

Reimplemented in Agent, and LinkDelay.

Definition at line 56 of file connector.h.

References NsObject::recv(), and Connector::target_.

Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), and AddSR::recv().

00056 { target_->recv(p, h); }

Here is the call graph for this function:

void Connector::setDropTarget NsObject dt  )  [inline, inherited]
 

Definition at line 51 of file connector.h.

References Connector::drop_.

Referenced by XCPWrapQ::command().

00051 {drop_ = dt; } 

void Connector::target NsObject target  )  [inline, inherited]
 

Definition at line 49 of file connector.h.

References Connector::target(), and Connector::target_.

00049 { target_ = target; }

Here is the call graph for this function:

NsObject* Connector::target  )  [inline, inherited]
 

Definition at line 48 of file connector.h.

References Connector::target_.

Referenced by JoBS::assignRateDropsADC(), FQ::deque(), MIPMHAgent::reg(), MIPBSAgent::send_ads(), and Connector::target().

00048 { return target_; }

void SALink::trace TracedVar *  v  ) 
 

Definition at line 207 of file salink.cc.

References adc_, Scheduler::clock(), dst_, Scheduler::instance(), onumfl_, src_, tchan_, and ADC::type().

00208 {
00209 
00210     char wrk[500];
00211     int *p, newval;
00212 
00213     if (strcmp(v->name(), "\"Admitted Flows\"") == 0) {
00214         p = &onumfl_;
00215     }
00216     else {
00217         fprintf(stderr, "SALink: unknown trace var %s\n", v->name());
00218         return;
00219     }
00220 
00221     newval = int(*((TracedInt*)v));
00222 
00223     if (tchan_) {
00224         int n;
00225         double t = Scheduler::instance().clock();
00226         /* f -t 0.0 -s 1 -a SA -T v -n Num -v 0 -o 0 */
00227         sprintf(wrk, "f -t %g -s %d -a %s:%d-%d -T v -n %s -v %d -o %d",
00228             t, src_, adc_->type(), src_, dst_, v->name(), newval, *p);
00229         n = strlen(wrk);
00230         wrk[n] = '\n';
00231         wrk[n+1] = 0;
00232         (void)Tcl_Write(tchan_, wrk, n+1);
00233         
00234     }
00235 
00236     *p = newval;
00237 
00238     return;
00239 }

Here is the call graph for this function:


Field Documentation

ADC* SALink::adc_ [protected]
 

Definition at line 61 of file salink.h.

Referenced by command(), recv(), and trace().

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

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 59 of file connector.h.

Referenced by XCPWrapQ::command(), Connector::command(), Connector::drop(), ErrorModel::recv(), and Connector::setDropTarget().

int SALink::dst_ [protected]
 

Definition at line 70 of file salink.h.

Referenced by command(), recv(), and trace().

int SALink::last_ [protected]
 

Definition at line 71 of file salink.h.

Referenced by recv().

TracedInt SALink::numfl_ [protected]
 

Definition at line 66 of file salink.h.

Referenced by command(), and recv().

int SALink::onumfl_ [protected]
 

Definition at line 68 of file salink.h.

Referenced by trace().

pending SALink::pending_[NFLOWS] [protected]
 

Definition at line 63 of file salink.h.

Referenced by get_nxt(), lookup(), recv(), and SALink().

int SALink::RTT [protected]
 

Definition at line 62 of file salink.h.

int SALink::src_ [protected]
 

Definition at line 69 of file salink.h.

Referenced by command(), recv(), and trace().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 58 of file connector.h.

Referenced by SRAgent::command(), SA_Agent::command(), IvsReceiver::command(), MultiFieldFilter::command(), Filter::command(), Connector::command(), DiffusionAgent::DiffusionAgent(), DSRAgent::DSRAgent(), PromotionTimer::expire(), FloodingAgent::FloodingAgent(), SctpAgent::ForceSource(), toraAgent::forward(), AODV::forward(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSDV_Agent::helper_callback(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), MIPEncapsulator::recv(), LmsAgent::recv(), HackLossyLink::recv(), FQ::recv(), ErrorModel::recv(), DynamicLink::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), Trace::recvOnly(), Queue< T >::resume(), LinkDelay::send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), LmsSender::send_lms_pkt(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), MIPMHAgent::send_sols(), LmsSender::send_spm(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), MessagePassingAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), TPAgent::sendto(), MessagePassingAgent::sendto(), SctpAgent::SetSource(), LmsSender::solicit_naks(), Connector::target(), toraAgent::tora_output(), and Delayer::try_send().

Tcl_Channel SALink::tchan_ [protected]
 

Definition at line 67 of file salink.h.

Referenced by command(), recv(), and trace().


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