

Public Member Functions | |
| LmsAgent () | |
| int | command (int argc, const char *const *argv) |
| void | recv (Packet *, Handler *) |
| virtual void | recv (Packet *p, const char *s) |
| void | recvOnly (Packet *) |
| void | send (Packet *p, Handler *h) |
| virtual void | send (int sz, AppData *data) |
| virtual void | send (int nbytes) |
| virtual void | timeout (int tno) |
| virtual void | sendmsg (int sz, AppData *, const char *flags=0) |
| virtual void | sendmsg (int nbytes, const char *flags=0) |
| virtual void | sendto (int sz, AppData *, const char *flags, nsaddr_t dst) |
| virtual void | sendto (int nbytes, const char *flags, nsaddr_t dst) |
| virtual void | connect (nsaddr_t dst) |
| virtual void | close () |
| virtual void | listen () |
| virtual void | attachApp (Application *app) |
| virtual int & | size () |
| nsaddr_t & | addr () |
| nsaddr_t & | port () |
| nsaddr_t & | daddr () |
| nsaddr_t & | dport () |
| void | set_pkttype (packet_t pkttype) |
| packet_t | get_pkttype () |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| NsObject * | iface2link (int iface) |
| NsObject * | pkt2agent (Packet *pkt) |
| void | send_upstream (Packet *p) |
| void | send_downstream (Packet *p) |
| void | send2replier (Packet *p) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | recvBytes (int bytes) |
| virtual void | idle () |
| Packet * | allocpkt () const |
| Packet * | allocpkt (int) const |
| void | initpkt (Packet *) const |
| virtual void | trace (TracedVar *v) |
| void | deleteAgentTrace () |
| void | addAgentTrace (const char *name) |
| void | monitorAgentTrace () |
| OldValue * | lookupOldValue (TracedVar *v) |
| void | insertOldValue (TracedVar *v, const char *value) |
| void | dumpTracedVars () |
| virtual void | trace_event (char *eventtype) |
| virtual void | drop (Packet *p, const char *s) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| char | uname_ [16] |
| int | lms_enabled_ |
| NsObject * | replier_ |
| int | replier_iface_ |
| int | replier_cost_ |
| int | replier_dist_ |
| nsaddr_t | upstream_lms_ |
| ns_addr_t | downstream_lms_ |
| int | upstream_iface_ |
| int | have_rcvr_ |
| ns_addr_t | here_ |
| ns_addr_t | dst_ |
| int | size_ |
| packet_t | type_ |
| int | fid_ |
| int | prio_ |
| int | flags_ |
| int | defttl_ |
| Tcl_Channel | channel_ |
| char * | traceName_ |
| OldValue * | oldValueList_ |
| Application * | app_ |
| EventTrace * | et_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Static Protected Attributes | |
| int | uidcnt_ |
|
|
Definition at line 115 of file lms-agent.cc. References ns_addr_t::addr_, downstream_lms_, have_rcvr_, lms_agent_uid_, lms_enabled_, LMS_INFINITY, LMS_NOADDR, LMS_NOIFACE, LMS_NOPORT, ns_addr_t::port_, PT_LMS, replier_, replier_cost_, replier_dist_, replier_iface_, Agent::size_, uname_, and upstream_lms_.
00115 : Agent(PT_LMS) 00116 { 00117 sprintf (uname_, "lms%d", lms_agent_uid_++); 00118 replier_ = NULL; 00119 replier_iface_ = LMS_NOIFACE; 00120 replier_cost_ = LMS_INFINITY; 00121 replier_dist_ = 0; 00122 upstream_lms_ = LMS_NOADDR; 00123 downstream_lms_.addr_ = LMS_NOADDR; 00124 downstream_lms_.port_ = LMS_NOPORT; 00125 have_rcvr_ = 0; 00126 00127 bind("lms_enabled_", &lms_enabled_); 00128 bind("packetSize_", &size_); 00129 // bind("off_ip_", &off_ip_); 00130 // bind("off_lms_", &off_lms_); 00131 } |
|
|
Definition at line 326 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::dst_, Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_. Referenced by Agent::command().
00327 {
00328 char wrk[256];
00329 int n;
00330 double curTime = (&Scheduler::instance() == NULL ? 0 :
00331 Scheduler::instance().clock());
00332
00333 sprintf(wrk, "a -t "TIME_FORMAT" -s %d -d %d -n %s",
00334 curTime, here_.addr_, dst_.addr_, name);
00335 n = strlen(wrk);
00336 wrk[n] = '\n';
00337 wrk[n+1] = 0;
00338 if (channel_)
00339 (void)Tcl_Write(channel_, wrk, n+1);
00340 // keep agent trace name
00341 if (traceName_ != NULL)
00342 delete[] traceName_;
00343 traceName_ = new char[strlen(name)+1];
00344 strcpy(traceName_, name);
00345 }
|
Here is the call graph for this function:

|
|
|
Definition at line 517 of file agent.cc. References Packet::allocdata(), and Agent::allocpkt().
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Definition at line 372 of file agent.cc. References Agent::app_. Referenced by HttpMInvalCache::command(), Application::command(), TcpApp::TcpApp(), and TcpApp::~TcpApp().
00373 {
00374 app_ = app;
00375 }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 377 of file agent.cc. Referenced by Agent::command().
00378 {
00379 }
|
|
||||||||||||
|
Reimplemented from Agent. Definition at line 420 of file lms-agent.cc. References Agent::allocpkt(), Agent::command(), hdr_lms::from(), hdr_lms::group(), HDR_LMS, Agent::send(), hdr_lms::src(), and hdr_lms::type().
00421 {
00422 Tcl& tcl = Tcl::instance();
00423
00424 if (argc == 6) {
00425 if (strcmp(argv[1], "send-lms") == 0) {
00426 Packet* pkt = allocpkt();
00427 hdr_lms* ph = HDR_LMS(pkt);
00428
00429 ph->type() = atoi (argv[2]);
00430 ph->from() = atoi(argv[3]);
00431 ph->src() = atoi(argv[4]);
00432 ph->group() = atoi(argv[5]);
00433
00434 send(pkt, 0);
00435 return (TCL_OK);
00436 }
00437 }
00438
00439 return (Agent::command(argc, argv));
00440 }
|
Here is the call graph for this function:

|
|
Definition at line 389 of file agent.cc. Referenced by Agent::command().
00390 {
00391 /*
00392 dst_ = dst;
00393 */
00394 }
|
|
|
||||||||||||
|
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 from NsObject. Reimplemented in BayFullTcpAgent, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 93 of file agent.cc. References ns_addr_t::addr_, Agent::defttl_, NsObject::delay_bind_dispatch(), Agent::dst_, Agent::fid_, Agent::flags_, Agent::here_, ns_addr_t::port_, and Agent::prio_. Referenced by TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), and LDPAgent::delay_bind_dispatch().
00094 {
00095 if (delay_bind(varName, localName, "agent_addr_", (int*)&(here_.addr_), tracer)) return TCL_OK;
00096 if (delay_bind(varName, localName, "agent_port_", (int*)&(here_.port_), tracer)) return TCL_OK;
00097 if (delay_bind(varName, localName, "dst_addr_", (int*)&(dst_.addr_), tracer)) return TCL_OK;
00098 if (delay_bind(varName, localName, "dst_port_", (int*)&(dst_.port_), tracer)) return TCL_OK;
00099 if (delay_bind(varName, localName, "fid_", (int*)&fid_, tracer)) return TCL_OK;
00100 if (delay_bind(varName, localName, "prio_", (int*)&prio_, tracer)) return TCL_OK;
00101 if (delay_bind(varName, localName, "flags_", (int*)&flags_, tracer)) return TCL_OK;
00102 if (delay_bind(varName, localName, "ttl_", &defttl_, tracer)) return TCL_OK;
00103 if (delay_bind(varName, localName, "class_", (int*)&fid_, tracer)) return TCL_OK;
00104 return Connector::delay_bind_dispatch(varName, localName, tracer);
00105 }
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Reimplemented in BayFullTcpAgent, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 78 of file agent.cc. References NsObject::delay_bind_init_all(). Referenced by TcpAgent::delay_bind_init_all(), TcpSink::delay_bind_init_all(), and LDPAgent::delay_bind_init_all().
00079 {
00080 delay_bind_init_one("agent_addr_");
00081 delay_bind_init_one("agent_port_");
00082 delay_bind_init_one("dst_addr_");
00083 delay_bind_init_one("dst_port_");
00084 delay_bind_init_one("fid_");
00085 delay_bind_init_one("prio_");
00086 delay_bind_init_one("flags_");
00087 delay_bind_init_one("ttl_");
00088 delay_bind_init_one("class_");
00089 Connector::delay_bind_init_all();
00090 }
|
Here is the call graph for this function:

|
|
Definition at line 222 of file agent.cc. References ns_addr_t::addr_, Agent::dst_, Agent::flushAVar(), Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_. Referenced by Agent::command().
00223 {
00224 char wrk[256];
00225
00226 // XXX we don't know InstVar outside of Tcl! Is there any
00227 // tracedvars hidden in InstVar? If so, shall we have a tclclInt.h?
00228 TracedVar* var = tracedvar_;
00229 for ( ; var != 0; var = var->next_)
00230 flushAVar(var);
00231
00232 // we need to flush all var values to trace file,
00233 // so nam can do backtracing
00234 sprintf(wrk, "a -t "TIME_FORMAT" -s %d -d %d -n %s -x",
00235 Scheduler::instance().clock(), here_.addr_,
00236 dst_.addr_, traceName_);
00237 if (traceName_ != NULL)
00238 delete[] traceName_;
00239 traceName_ = NULL;
00240 }
|
Here is the call graph for this function:

|
|
Definition at line 99 of file agent.h. References Agent::dst_, nsaddr_t, and ns_addr_t::port_. Referenced by DSDV_Agent::lost_link(), TcpAsymSink::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), rtProtoDV::sendpkt(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().
|
|
||||||||||||
|
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 101 of file agent.h. References packet_t, and Agent::type_. Referenced by CBR_Traffic::init().
00101 { return type_; }
|
|
|
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 363 of file agent.cc. References Agent::app_, and Application::resume(). Referenced by FullTcpAgent::foutput(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), UdpAgent::sendmsg(), SA_Agent::sendmsg(), and RTPAgent::sendmsg().
|
Here is the call graph for this function:

|
|
Definition at line 447 of file lms-agent.cc. Referenced by recv().
00448 {
00449 Tcl& tcl = Tcl::instance();
00450 char wrk[64];
00451
00452 sprintf (wrk, "[%s set node_] ifaceGetOutLink %d", name (), iface);
00453 tcl.evalc (wrk);
00454 char* result = tcl.result ();
00455
00456 #ifdef LMS_DEBUG
00457 printf ("[iface2link] agent %s\n", result);
00458 #endif
00459
00460 NsObject* obj = (NsObject*)TclObject::lookup(result);
00461 return (obj);
00462 }
|
|
|
Definition at line 446 of file agent.cc. References hdr_nv::access(), hdr_flags::access(), hdr_ip::access(), hdr_cmn::access(), ns_addr_t::addr_, Scheduler::clock(), hdr_flags::cong_action_, hdr_ip::daddr(), Agent::defttl_, hdr_cmn::direction(), hdr_ip::dport(), Agent::dst_, hdr_flags::ecn_, hdr_flags::ecn_capable_, hdr_flags::ecn_to_echo_, hdr_flags::eln_, hdr_cmn::error(), Agent::fid_, hdr_ip::flowid(), hdr_flags::fs_, NixNode::GetNixVector(), NixNode::GetNodeObject(), hdr_nv::h_used, Agent::here_, hdr_cmn::iface(), Scheduler::instance(), hdr_flags::no_ts_, hdr_cmn::NONE, hdr_nv::nv(), hdr_ip::offset(), hdr_nv::offset(), ns_addr_t::port_, hdr_flags::pri_, hdr_ip::prio(), Agent::prio_, hdr_cmn::ptype(), NixVec::Reset(), hdr_ip::saddr(), hdr_cmn::size(), Agent::size_, hdr_ip::sport(), hdr_cmn::timestamp(), hdr_ip::ttl(), Agent::type_, hdr_cmn::uid(), and Agent::uidcnt_. Referenced by Agent::allocpkt(), and PingResponder::recv().
00447 {
00448 hdr_cmn* ch = hdr_cmn::access(p);
00449 ch->uid() = uidcnt_++;
00450 ch->ptype() = type_;
00451 ch->size() = size_;
00452 ch->timestamp() = Scheduler::instance().clock();
00453 ch->iface() = UNKN_IFACE.value(); // from packet.h (agent is local)
00454 ch->direction() = hdr_cmn::NONE;
00455
00456 ch->error() = 0; /* pkt not corrupt to start with */
00457
00458 hdr_ip* iph = hdr_ip::access(p);
00459 iph->saddr() = here_.addr_;
00460 iph->sport() = here_.port_;
00461 iph->daddr() = dst_.addr_;
00462 iph->dport() = dst_.port_;
00463
00464 //DEBUG
00465 //if (dst_ != -1)
00466 // printf("pl break\n");
00467
00468 iph->flowid() = fid_;
00469 iph->prio() = prio_;
00470 iph->ttl() = defttl_;
00471
00472 hdr_flags* hf = hdr_flags::access(p);
00473 hf->ecn_capable_ = 0;
00474 hf->ecn_ = 0;
00475 hf->eln_ = 0;
00476 hf->ecn_to_echo_ = 0;
00477 hf->fs_ = 0;
00478 hf->no_ts_ = 0;
00479 hf->pri_ = 0;
00480 hf->cong_action_ = 0;
00481 #ifdef HAVE_STL
00482
00483 hdr_nv* nv = hdr_nv::access(p);
00484 if (0)
00485 printf("Off hdr_nv %d, ip_hdr %d myaddr %ld\n",
00486 hdr_nv::offset(), hdr_ip::offset(), here_.addr_);
00487 NixNode* pNixNode = NixNode::GetNodeObject(here_.addr_);
00488 if (0)
00489 printf("Node Object %p\n", pNixNode);
00490 if (pNixNode) {
00491 // If we get non-null, indicates nixvector routing in use
00492 // Delete any left over nv in the packet
00493 // Get a nixvector to the target (may create new)
00494 NixVec* pNv = pNixNode->GetNixVector(dst_.addr_);
00495 pNv->Reset();
00496 nv->nv() = pNv; // And set the nixvec in the packet
00497 nv->h_used = 0; // And reset used portion to 0
00498 }
00499 #endif //HAVE_STL
00500 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 250 of file agent.cc. References min, OldValue::next_, Agent::oldValueList_, TRACEVAR_MAXVALUELENGTH, OldValue::val_, and OldValue::var_. Referenced by Agent::trace().
00251 {
00252 OldValue *p = new OldValue;
00253 assert(p != NULL);
00254 strncpy(p->val_, value, min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00255 p->var_ = v;
00256 p->next_ = NULL;
00257 if (oldValueList_ == NULL)
00258 oldValueList_ = p;
00259 else {
00260 p->next_ = oldValueList_;
00261 oldValueList_ = p;
00262 }
00263 }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent. Definition at line 381 of file agent.cc. Referenced by Agent::command().
00382 {
00383 }
|
|
|
Definition at line 242 of file agent.cc. References OldValue::next_, Agent::oldValueList_, and OldValue::var_. Referenced by Agent::trace().
00243 {
00244 OldValue *p = oldValueList_;
00245 while ((p != NULL) && (p->var_ != v))
00246 p = p->next_;
00247 return p;
00248 }
|
|
|
Definition at line 310 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_. Referenced by Agent::command().
00311 {
00312 char wrk[256];
00313 int n;
00314 double curTime = (&Scheduler::instance() == NULL ? 0 :
00315 Scheduler::instance().clock());
00316
00317 sprintf(wrk, "v -t "TIME_FORMAT" -e monitor_agent %d %s",
00318 curTime, here_.addr_, traceName_);
00319 n = strlen(wrk);
00320 wrk[n] = '\n';
00321 wrk[n+1] = 0;
00322 if (channel_)
00323 (void)Tcl_Write(channel_, wrk, n+1);
00324 }
|
Here is the call graph for this function:

|
|
Definition at line 468 of file lms-agent.cc. References agent, HDR_IP, nsaddr_t, Agent::port(), hdr_ip::saddr(), and hdr_ip::sport(). Referenced by recv().
00469 {
00470 Tcl& tcl = Tcl::instance();
00471 char wrk[64];
00472 char *result;
00473 int port;
00474 NsObject* agent;
00475 hdr_ip* ih = HDR_IP(pkt);
00476 nsaddr_t src = ih->saddr();
00477
00478 port = ih->sport();
00479
00480 sprintf (wrk, "[%s set node_] agent %d", name (), port);
00481 tcl.evalc (wrk);
00482 result = tcl.result ();
00483
00484 #ifdef LMS_DEBUG
00485 printf ("[pkt2agent] port %d, agent %s\n", port, result);
00486 #endif
00487
00488 agent = (NsObject*)TclObject::lookup (result);
00489 return (agent);
00490 }
|
Here is the call graph for this function:

|
|
Definition at line 97 of file agent.h. References Agent::here_, nsaddr_t, and ns_addr_t::port_. Referenced by pkt2agent(), TcpAsymSink::recv(), MIPBSAgent::recv(), recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), LmsReceiver::send_refresh(), IcmpAgent::sendredirect(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().
|
|
||||||||||||
|
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 Agent. Definition at line 136 of file lms-agent.cc. References abort(), Packet::accessdata(), Agent::addr(), ns_addr_t::addr_, Scheduler::clock(), hdr_ip::daddr(), downstream_lms_, Packet::free(), hdr_lms::from(), hdr_lms::from_, hdr_lms::group_, have_rcvr_, HDR_CMN, HDR_IP, HDR_LMS, hdr_cmn::iface(), iface2link(), hdr_cmn::iface_, Scheduler::instance(), LMS_DMCAST, lms_enabled_, LMS_LEAVE, LMS_LINKS, LMS_NOADDR, LMS_NOIFACE, LMS_NOPORT, LMS_REFRESH, LMS_REQ, LMS_SETUP, LMS_SPM, LMS_SRC_REFRESH, nsaddr_t, packet_t, pkt2agent(), Agent::port(), ns_addr_t::port_, hdr_cmn::ptype(), NsObject::recv(), replier_, replier_cost_, replier_dist_, replier_iface_, hdr_ip::saddr(), send2replier(), send_upstream(), hdr_lms::src_, Connector::target_, hdr_lms::tp_addr_, hdr_lms::tp_iface_, hdr_lms::tp_port_, hdr_lms::ttl_, hdr_lms::type(), uname_, upstream_iface_, and upstream_lms_.
00137 {
00138 hdr_cmn* h = HDR_CMN(pkt);
00139 hdr_lms* lh = HDR_LMS(pkt);
00140 double now = Scheduler::instance().clock();
00141
00142 #ifdef LMS_DEBUG
00143 int a1 = lh->from_; int a2 = lh->src_;
00144 printf ("at %f %s received packet type %d from %d:%d src %d:%d group %x iface %d\n\n", now,uname_, lh->type(), a1>>8, a1&0xff, a2>>8, a2&0xff, lh->group_,h->iface());
00145 #endif
00146
00147 // if this agent is not enabled, simply pass on the packet
00148 if (!lms_enabled_)
00149 {
00150 target_->recv (pkt);
00151 return;
00152 }
00153
00154 switch (lh->type())
00155 {
00156 case LMS_SRC_REFRESH:
00157 {
00158 // If we have a replier already, and the upstream adv cost
00159 // is less than our current cost and the upstream distance
00160 // is less than our current distance, then choose the
00161 // upstream link as the replier link.
00162 struct lms_ctl *c = (struct lms_ctl *)pkt->accessdata ();
00163 c->hop_cnt_++;
00164 #ifdef LMS_DEBUG
00165 printf ("%s LMS_SRC_REFRESH from iface %d, cost %d, ttl %d\n\n",
00166 uname_, h->iface(), c->cost_, lh->ttl_);
00167 #endif
00168 assert (upstream_iface_ == h->iface());
00169
00170 if (replier_iface_ == h->iface())
00171 {
00172 if (replier_cost_ != c->cost_)
00173 replier_cost_ = c->cost_;
00174 if (replier_dist_ != c->hop_cnt_)
00175 replier_dist_ = c->hop_cnt_;
00176 }
00177 else if (replier_cost_ >= c->cost_ && replier_dist_ > c->hop_cnt_)
00178 {
00179 #ifdef LMS_DEBUG
00180 printf ("%s chose upstream replier\n\n", uname_);
00181 #endif
00182 replier_cost_ = c->cost_;
00183 replier_dist_ = c->hop_cnt_;
00184 replier_iface_ = h->iface();
00185 if (h->iface() < 0)
00186 {
00187 replier_ = pkt2agent (pkt);
00188 downstream_lms_.addr_ = LMS_NOADDR;
00189 downstream_lms_.port_ = LMS_NOPORT;
00190 }
00191 else {
00192 replier_ = iface2link (h->iface());
00193 downstream_lms_.addr_ = LMS_NOADDR;
00194 downstream_lms_.port_ = LMS_NOPORT;
00195 }
00196 if (--lh->ttl_ > 0)
00197 target_->recv (pkt);
00198 else Packet::free(pkt);
00199 return;
00200 }
00201 break;
00202 }
00203
00204 case LMS_REFRESH:
00205 {
00206 struct lms_ctl *c = (struct lms_ctl *)pkt->accessdata ();
00207 c->hop_cnt_++;
00208 #ifdef LMS_DEBUG
00209 printf("%s replier iface %d, h->iface %d, replier cost %d, c cost %d\n",
00210 uname_, replier_iface_, h->iface(), replier_cost_, c->cost_);
00211 printf("replier_= %d, down_addr_= %d, down_port_ = %d\n\n",
00212 replier_, downstream_lms_.addr_, downstream_lms_.port_);
00213 #endif
00214
00215 // update from existing replier
00216 // adjust cost and distance and send upstream
00217 if (replier_iface_ == h->iface())
00218 {
00219 if (replier_cost_ != c->cost_)
00220 replier_cost_ = c->cost_;
00221 if (replier_dist_ != c->hop_cnt_)
00222 replier_dist_ = c->hop_cnt_;
00223 #ifdef LMS_DEBUG
00224 printf ("%s REPLIER_UPDATE iface %d, cost %d, hops %d\n\n",
00225 uname_, replier_iface_, replier_cost_, replier_dist_);
00226 #endif
00227
00228
00229 if (h->iface() < 0)
00230 {
00231 replier_ = pkt2agent (pkt);
00232 have_rcvr_ = 1;
00233 downstream_lms_.addr_ = LMS_NOADDR;
00234 downstream_lms_.port_ = LMS_NOPORT;
00235 }
00236 else
00237 {
00238 // updates our entry for downstream_lms_
00239 downstream_lms_ = c->downstream_lms_;
00240 // places our own address in downstream_lms_
00241 // before sending it upstream.
00242 c->downstream_lms_.addr_ = addr();
00243 c->downstream_lms_.port_ = port();
00244
00245 replier_ = NULL;
00246 }
00247 send_upstream (pkt);
00248 }
00249
00250 // found a better replier
00251 else if (replier_cost_ > c->cost_)
00252 {
00253 replier_cost_ = c->cost_;
00254 replier_dist_ = c->hop_cnt_;
00255 replier_iface_ = h->iface();
00256
00257 if (h->iface() < 0)
00258 {
00259 replier_ = pkt2agent (pkt);
00260 have_rcvr_ = 1;
00261 downstream_lms_.addr_ = LMS_NOADDR;
00262 downstream_lms_.port_ = LMS_NOPORT;
00263 }
00264 else
00265 {
00266 // updates our entry for downstream_lms_
00267 downstream_lms_ = c->downstream_lms_;
00268 // places our own address in downstream_lms_
00269 // before sending it upstream.
00270 c->downstream_lms_.addr_ = addr();
00271 c->downstream_lms_.port_ = port();
00272
00273 replier_ = NULL;
00274 }
00275 #ifdef LMS_DEBUG
00276 printf ("%s REPLIER iface %d, cost %d, hops %d\n\n",
00277 uname_, replier_iface_, replier_cost_, replier_dist_);
00278 #endif
00279 send_upstream (pkt);
00280 }
00281 else
00282 Packet::free(pkt);
00283 return;
00284 }
00285
00286 case LMS_REQ:
00287 if (replier_iface_ == h->iface())
00288 send_upstream (pkt);
00289 else {
00290 // fill turning point info, but only
00291 // if no-one else has done so already.
00292 if (lh->tp_addr_ == LMS_NOADDR)
00293 {
00294 lh->tp_addr_ = addr();
00295 lh->tp_port_ = port();
00296 lh->tp_iface_ = h->iface_;
00297 }
00298 send2replier (pkt);
00299 }
00300 break;
00301
00302 case LMS_DMCAST:
00303 {
00304 #ifdef LMS_DEBUG
00305 a2 = lh->src_;
00306 printf ("LMS-DMCAST at agent %s, iface %d src %d:%d group %d\n\n",
00307 uname_, lh->tp_iface_, a2>>8, a2&0xff, lh->group_);
00308 #endif
00309 hdr_ip* iph = HDR_IP(pkt);
00310 NsObject* tgt = iface2link (lh->tp_iface_);
00311
00312 if (tgt)
00313 {
00314 packet_t t = h->ptype();
00315 iph->saddr() = lh->src_;
00316 iph->daddr() = lh->group_;
00317 tgt->recv (pkt);
00318 }
00319 else {
00320 printf ("FATAL: %s no such iface %d\n", uname_, lh->tp_iface_);
00321 abort ();
00322 }
00323 }
00324 break;
00325
00326 case LMS_LEAVE:
00327 {
00328
00329 if (replier_iface_ == h->iface())
00330 {
00331 downstream_lms_.addr_ = LMS_NOADDR;
00332 downstream_lms_.port_ = LMS_NOPORT;
00333
00334 replier_ = NULL;
00335 replier_cost_ = 1000000;
00336 replier_iface_ = LMS_NOIFACE;
00337 send_upstream (pkt);
00338 }
00339 else
00340 Packet::free(pkt);
00341
00342 return;
00343 }
00344
00345 case LMS_SETUP:
00346 {
00347
00348 if (h->iface() < 0)
00349 {
00350 // Source is attached - mark it as the replier
00351 replier_ = pkt2agent (pkt);
00352 replier_iface_ = h->iface();
00353 downstream_lms_.addr_ = LMS_NOADDR;
00354 downstream_lms_.port_ = LMS_NOPORT;
00355
00356 replier_cost_ = 0; // XXX
00357
00358 #ifdef LMS_DEBUG
00359 printf ("%s REPLIER iface %d, cost %d\n\n", uname_, replier_iface_, replier_cost_);
00360 #endif
00361
00362 }
00363 upstream_lms_ = lh->from_;
00364 upstream_iface_ = h->iface();
00365
00366 #ifdef LMS_DEBUG
00367 printf ("%s upstream %d\n\n", uname_, upstream_lms_);
00368 #endif
00369
00370 lh->from_ = addr();
00371 Tcl::instance().evalf("[%s set node_] agent %d", name(), port());
00372 target_->recv (pkt);
00373 return;
00374 }
00375
00376 case LMS_SPM:
00377 {
00378 if (upstream_lms_ < 0)
00379 {
00380 struct lms_spm *spm = (struct lms_spm *)pkt->accessdata ();
00381 nsaddr_t adr = spm->spm_path_;
00382 #ifdef LMS_DEBUG
00383 printf ("%s LMS_SPM seqno %d, upstream %d:%d\n\n",
00384 uname_, spm->spm_seqno_, adr>>8, adr&0xff);
00385 #endif
00386
00387 if (upstream_lms_ != spm->spm_path_)
00388 upstream_lms_ = spm->spm_path_;
00389
00390 spm->spm_path_ = addr();
00391 }
00392 break;
00393 }
00394
00395 case LMS_LINKS:
00396 {
00397 Tcl& tcl = Tcl::instance();
00398 char wrk[64];
00399 int n1 = lh->from();
00400 int n2 = addr();
00401
00402 if (n1 != n2 && !have_rcvr_)
00403 {
00404 sprintf (wrk, "lappend tree_links {%d %d}", n1, n2);
00405 tcl.eval (wrk);
00406 }
00407
00408 lh->from_ = addr();
00409 target_->recv (pkt);
00410 return;
00411 }
00412 default:
00413 printf ("FATAL: %s uknown LMS packet type: %d\n", uname_, lh->type());
00414 abort ();
00415 }
00416 }
|
Here is the call graph for this function:

|
|
Definition at line 354 of file agent.cc. References Agent::app_, and Application::recv(). Referenced by DelAckSink::recv(), TcpSink::recv(), QSTcpSink::recv(), FullTcpAgent::recv(), and TcpAsymSink::recv().
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Definition at line 78 of file agent.h.
00078 {};
|
|
|
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 SRMAgent. Definition at line 89 of file agent.h. References Agent::sendmsg().
00089 { sendmsg(nbytes); }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in HttpInvalAgent. Definition at line 84 of file agent.h. References Agent::sendmsg().
00084 { sendmsg(sz, data, 0); }
|
Here is the call graph for this function:

|
||||||||||||
Here is the call graph for this function:

|
|
Definition at line 53 of file lms-agent.cc. References ns_addr_t::addr_, downstream_lms_, HDR_CMN, HDR_IP, LMS_NOADDR, NsObject::recv(), replier_, hdr_ip::saddr(), send_downstream(), send_upstream(), and uname_. Referenced by recv().
00054 {
00055 hdr_ip* piph = HDR_IP(p);
00056 hdr_cmn* c = HDR_CMN(p);
00057 #ifdef LMS_DEBUG
00058 printf("%s send2replier: Got piph->saddr: %d, downstream_addr: %d. Replier: %d\n", uname_, piph->saddr(), downstream_lms_.addr_, replier_ );
00059 #endif
00060 if (replier_ != NULL)
00061 replier_->recv (p);
00062 else if ((downstream_lms_.addr_ != LMS_NOADDR) &&
00063 (piph->saddr() != downstream_lms_.addr_) )
00064 send_downstream(p);
00065 else send_upstream (p);
00066 };
|
Here is the call graph for this function:

|
|
Definition at line 508 of file lms-agent.cc. References abort(), Agent::addr(), ns_addr_t::addr_, hdr_ip::daddr(), downstream_lms_, hdr_ip::dport(), hdr_lms::from_, HDR_IP, HDR_LMS, ns_addr_t::port_, NsObject::recv(), Connector::target_, and uname_. Referenced by send2replier().
00509 {
00510 if (downstream_lms_.addr_ < 0)
00511 {
00512 printf ("FATAL: %s downstream_lms_ not set!\n", uname_);
00513 abort ();
00514 }
00515 hdr_ip* ih = HDR_IP(p);
00516 hdr_lms* lh = HDR_LMS(p);
00517
00518 lh->from_ = addr();
00519 ih->daddr() = downstream_lms_.addr_;
00520 ih->dport() = downstream_lms_.port_;
00521
00522 target_->recv(p);
00523 }
|
Here is the call graph for this function:

|
|
Definition at line 492 of file lms-agent.cc. References abort(), Agent::addr(), hdr_ip::daddr(), hdr_lms::from_, HDR_IP, HDR_LMS, NsObject::recv(), Connector::target_, uname_, and upstream_lms_. Referenced by recv(), and send2replier().
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in SA_Agent, RTPAgent, UdpAgent, LmsSender, SRMAgent, FullTcpAgent, TcpAgent, TfrcAgent, and SimpleTcpAgent. Definition at line 415 of file agent.cc.
00416 {
00417 }
|
|
||||||||||||||||
|
Reimplemented in UdpAgent. Definition at line 400 of file agent.cc. References abort(). Referenced by Agent::command(), Application::send(), Agent::send(), TrafficTrace::timeout(), TelnetApp::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout().
00401 {
00402 fprintf(stderr,
00403 "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00404 abort();
00405 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 407 of file agent.cc. References abort(). Referenced by Agent::command().
00409 {
00410 fprintf(stderr,
00411 "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00412 abort();
00413 }
|
Here is the call graph for this function:

|
|
Definition at line 100 of file agent.h. References Agent::type_. Referenced by Agent::command(), HttpUInvalClass::create(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), and CBR_PP_Traffic::init().
00100 { type_ = pkttype; }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 95 of file agent.h. References Agent::size_. Referenced by rtProtoDV::command(), RLM_Sender::command(), imepAgent::getResponseListSize(), LandmarkAgent::makeUpdate(), Agent::recv(), SSMSRMAgent::send_glb_sess(), SSMSRMAgent::send_loc_sess(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), and TelnetApp::timeout().
00095 { return size_; }
|
|
|
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_; }
|
|
|
Reimplemented in SA_Agent, RTPAgent, FtpClientAgent, BayFullTcpAgent, SinkAgent, RLM_Sender, MIPBSAgent, MIPMHAgent, RapAgent, RTCPAgent, TcpAsymSink, FackTcpAgent, FullTcpAgent, QSNewRenoTcpAgent, RBPVegasTcpAgent, RBPRenoTcpAgent, SackRHTcpAgent, Sack1TcpAgent, TcpSessionAgent, DelAckSink, TcpAgent, RenoTcpAgent, VegasTcpAgent, and SimpleTcpAgent. Definition at line 347 of file agent.cc. Referenced by SimpleTimer::expire().
00348 {
00349 }
|
|
|
Reimplemented in TcpAgent. Definition at line 266 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Agent::dst_, Agent::here_, Agent::insertOldValue(), Scheduler::instance(), Agent::lookupOldValue(), min, TIME_FORMAT, Agent::traceName_, TRACEVAR_MAXVALUELENGTH, and OldValue::val_. Referenced by TcpAgent::trace().
00267 {
00268 if (channel_ == 0)
00269 return;
00270 char wrk[256], value[128];
00271 int n;
00272
00273 // XXX we need to keep track of old values. What's the best way?
00274 v->value(value, 128);
00275
00276 // XXX hack: how do I know ns has not started yet?
00277 // if there's nothing in value, return
00278 static int started = 0;
00279 if (!started) {
00280 Tcl::instance().evalc("[Simulator instance] is-started");
00281 if (Tcl::instance().result()[0] == '0')
00282 // Simulator not started, do nothing
00283 return;
00284 // remember for next time (so we don't always have to call to tcl)
00285 started = 1;
00286 };
00287
00288 OldValue *ov = lookupOldValue(v);
00289 if (ov != NULL) {
00290 sprintf(wrk,
00291 "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -o %s -T v",
00292 Scheduler::instance().clock(), here_.addr_,
00293 dst_.addr_, v->name(), traceName_, value, ov->val_);
00294 strncpy(ov->val_,
00295 value,
00296 min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00297 } else {
00298 // if there is value, insert it into old value list
00299 sprintf(wrk, "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -T v",
00300 Scheduler::instance().clock(), here_.addr_,
00301 dst_.addr_, v->name(), traceName_, value);
00302 insertOldValue(v, value);
00303 }
00304 n = strlen(wrk);
00305 wrk[n] = '\n';
00306 wrk[n+1] = 0;
00307 (void)Tcl_Write(channel_, wrk, n+1);
00308 }
|
Here is the call graph for this function:

|
|
Reimplemented in TcpAgent. Definition at line 146 of file agent.h.
00146 {}
|
|
|
Reimplemented in BayFullTcpAgent. Definition at line 134 of file agent.h. Referenced by Agent::attachApp(), Agent::idle(), RapAgent::IpgTimeout(), UdpAgent::recv(), SimpleTcpAgent::recv(), RapAgent::recv(), HttpInvalAgent::recv(), Agent::recv(), and Agent::recvBytes(). |
|
|
Definition at line 130 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::flushAVar(), Agent::monitorAgentTrace(), TcpAsymSink::recv(), Agent::trace(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar(). |
|
|
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 121 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 75 of file lms-agent.cc. Referenced by LmsAgent(), recv(), send2replier(), and send_downstream(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Reimplemented in AckRecons. Definition at line 115 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::daddr(), Agent::delay_bind_dispatch(), Agent::deleteAgentTrace(), Agent::dport(), DSRProto::DSRProto(), Agent::flushAVar(), Agent::initpkt(), SRMAgent::recv(), SSMSRMAgent::recv(), NatAgent::recv(), SRMAgent::sendmsg(), PushbackAgent::sendMsg(), and Agent::trace(). |
|
|
Definition at line 145 of file agent.h. Referenced by TcpAgent::command(), and TcpAgent::trace_event(). |
|
|
Definition at line 118 of file agent.h. Referenced by Agent::delay_bind_dispatch(), AbsTcpAgent::flowid(), Agent::initpkt(), FullTcpAgent::recv(), CtrMcastEncap::recv(), AbsTcpAgent::send_batch(), Sack1TcpAgent::timeout(), and TcpAgent::trace_event(). |
|
|
Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent. Definition at line 120 of file agent.h. Referenced by Agent::delay_bind_dispatch(). |
|
|
Definition at line 78 of file lms-agent.cc. Referenced by LmsAgent(), and recv(). |
|
|
|
Definition at line 69 of file lms-agent.cc. Referenced by LmsAgent(), and recv(). |
|
|
Definition at line 132 of file agent.h. Referenced by Agent::insertOldValue(), Agent::lookupOldValue(), and Agent::~Agent(). |
|
|
Definition at line 119 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 70 of file lms-agent.cc. Referenced by LmsAgent(), recv(), and send2replier(). |
|
|
Definition at line 72 of file lms-agent.cc. Referenced by LmsAgent(), and recv(). |
|
|
Definition at line 73 of file lms-agent.cc. Referenced by LmsAgent(), and recv(). |
|
|
Definition at line 71 of file lms-agent.cc. Referenced by LmsAgent(), and recv(). |
|
|
|
|
Definition at line 131 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::deleteAgentTrace(), Agent::flushAVar(), Agent::monitorAgentTrace(), and Agent::trace(). |
|
|
Definition at line 117 of file agent.h. Referenced by Agent::get_pkttype(), Agent::initpkt(), FullTcpAgent::listen(), BayFullTcpAgent::listen(), RapAgent::SendAck(), SRMAgent::sendmsg(), RapAgent::SendPacket(), and Agent::set_pkttype(). |
|
|
Definition at line 68 of file agent.cc. Referenced by imepAgent::handlerControlTimer(), imepAgent::handlerReXmitTimer(), Agent::initpkt(), imepAgent::sendAck(), imepAgent::sendBeacon(), toraAgent::sendCLR(), imepAgent::sendHello(), toraAgent::sendQRY(), DSRAgent::sendUnknownFlow(), toraAgent::sendUPD(), and DSRAgent::xmitFailed(). |
|
|
Definition at line 68 of file lms-agent.cc. Referenced by LmsAgent(), recv(), send2replier(), send_downstream(), and send_upstream(). |
|
|
Definition at line 77 of file lms-agent.cc. Referenced by recv(). |
|
|
Definition at line 74 of file lms-agent.cc. Referenced by LmsAgent(), recv(), and send_upstream(). |
1.3.3