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

SALink Class Reference

#include <salink.h>

Inheritance diagram for SALink:

Inheritance graph
[legend]
Collaboration diagram for SALink:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SALink ()
int command (int argc, const char *const *argv)
void trace (TracedVar *v)
NsObjecttarget ()
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

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

Constructor & Destructor Documentation

SALink::SALink  ) 
 

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 }


Member Function Documentation

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

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:

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

Definition at line 106 of file connector.cc.

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

Referenced by DSRAgent::acceptRouteReply(), ARPTable::arpresolve(), 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(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), 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 173 of file salink.cc.

References pending::flowid, NFLOWS, and pending_.

Referenced by recv().

00174 {
00175         int i;
00176         for (i=0;i<NFLOWS;i++)
00177                 {
00178                         if (pending_[i].flowid==-1)
00179                                 return i;
00180                 }
00181         printf("Ran out of pending space \n");
00182         exit(1);
00183         return i;
00184 }

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 164 of file salink.cc.

References pending::flowid, NFLOWS, and pending_.

Referenced by recv().

00165 {
00166         int i;
00167         for (i=0;i<NFLOWS;i++)
00168                 if (pending_[i].flowid==flowid)
00169                         return i;
00170         return(-1);
00171 }

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 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:

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

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

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

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(), QSAgent::recv(), and MIPMHAgent::reg().

00048 { return target_; }

void SALink::trace TracedVar *  v  ) 
 

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:


Member Data Documentation

ADC* SALink::adc_ [protected]
 

Definition at line 40 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(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

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

int SALink::dst_ [protected]
 

Definition at line 49 of file salink.h.

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

int SALink::last_ [protected]
 

Definition at line 50 of file salink.h.

Referenced by recv().

TracedInt SALink::numfl_ [protected]
 

Definition at line 45 of file salink.h.

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

int SALink::onumfl_ [protected]
 

Definition at line 47 of file salink.h.

Referenced by trace().

pending SALink::pending_[NFLOWS] [protected]
 

Definition at line 42 of file salink.h.

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

int SALink::RTT [protected]
 

Definition at line 41 of file salink.h.

int SALink::src_ [protected]
 

Definition at line 48 of file salink.h.

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

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 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(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSRAgent::handlePacketReceipt(), DSDV_Agent::helper_callback(), AODV::initialized(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SatDequeTrace::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), MIPEncapsulator::recv(), LmsAgent::recv(), HackLossyLink::recv(), GAFPartner::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DynamicLink::recv(), DumbAgent::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), PriQueue::recvHighPriority(), Trace::recvOnly(), TapAgent::recvpkt(), Queue< T >::resume(), LinkDelay::send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), LmsSender::solicit_naks(), Connector::target(), TBF::timeout(), and toraAgent::tora_output().

Tcl_Channel SALink::tchan_ [protected]
 

Definition at line 46 of file salink.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:20:05 2004 for NS2.26SourcesOriginal by doxygen 1.3.3