#include <aodv.h>
Inheritance diagram for AODV:


Definition at line 194 of file aodv.h.
Public Member Functions | |
| nsaddr_t & | addr () |
| AODV (nsaddr_t id) | |
| virtual void | attachApp (Application *app) |
| virtual void | close () |
| virtual void | connect (nsaddr_t dst) |
| nsaddr_t & | daddr () |
| virtual void | debug (const char *fmt,...) |
| nsaddr_t & | dport () |
| virtual void | drop (Packet *p) |
| packet_t | get_pkttype () |
| void | handle_link_failure (nsaddr_t id) |
| int | isdebug () const |
| virtual void | listen () |
| nsaddr_t & | port () |
| virtual void | recv (Packet *p, const char *s) |
| void | recv (Packet *p, Handler *) |
| void | recvOnly (Packet *) |
| void | rt_ll_failed (Packet *p) |
| virtual void | send (int nbytes) |
| virtual void | send (int sz, AppData *data) |
| void | send (Packet *p, Handler *h) |
| virtual void | sendmsg (int nbytes, const char *flags=0) |
| virtual void | sendmsg (int sz, AppData *, const char *flags=0) |
| virtual void | sendto (int nbytes, const char *flags, ns_addr_t dst) |
| virtual void | sendto (int nbytes, const char *flags, nsaddr_t dst) |
| virtual void | sendto (int sz, AppData *, const char *flags, ns_addr_t dst) |
| virtual void | sendto (int sz, AppData *, const char *flags, nsaddr_t dst) |
| void | set_pkttype (packet_t pkttype) |
| void | setDropTarget (NsObject *dt) |
| virtual int & | size () |
| void | target (NsObject *target) |
| NsObject * | target () |
| virtual void | timeout (int tno) |
Protected Member Functions | |
| void | addAgentTrace (const char *name) |
| Packet * | allocpkt (int) const |
| Packet * | allocpkt () const |
| int | command (int, const char *const *) |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | delay_bind_init_all () |
| void | deleteAgentTrace () |
| Packet * | deque (aodv_rt_entry *rt) |
| virtual void | drop (Packet *p, const char *s) |
| void | dumpTracedVars () |
| void | enque (aodv_rt_entry *rt, Packet *p) |
| void | forward (aodv_rt_entry *rt, Packet *p, double delay) |
| void | handle (Event *) |
| void | id_insert (nsaddr_t id, u_int32_t bid) |
| bool | id_lookup (nsaddr_t id, u_int32_t bid) |
| void | id_purge (void) |
| virtual void | idle () |
| int | initialized () |
| void | initpkt (Packet *) const |
| void | insertOldValue (TracedVar *v, const char *value) |
| void | local_rt_repair (aodv_rt_entry *rt, Packet *p) |
| void | log_link_broke (Packet *p) |
| void | log_link_del (nsaddr_t dst) |
| void | log_link_kept (nsaddr_t dst) |
| OldValue * | lookupOldValue (TracedVar *v) |
| void | monitorAgentTrace () |
| void | nb_delete (nsaddr_t id) |
| void | nb_insert (nsaddr_t id) |
| AODV_Neighbor * | nb_lookup (nsaddr_t id) |
| void | nb_purge (void) |
| double | PerHopTime (aodv_rt_entry *rt) |
| void | recvAODV (Packet *p) |
| virtual void | recvBytes (int bytes) |
| void | recvError (Packet *p) |
| void | recvHello (Packet *p) |
| void | recvReply (Packet *p) |
| void | recvRequest (Packet *p) |
| virtual void | reset () |
| void | rt_down (aodv_rt_entry *rt) |
| void | rt_purge (void) |
| void | rt_resolve (Packet *p) |
| void | rt_update (aodv_rt_entry *rt, u_int32_t seqnum, u_int16_t metric, nsaddr_t nexthop, double expire_time) |
| void | sendError (Packet *p, bool jitter=true) |
| void | sendHello (void) |
| void | sendReply (nsaddr_t ipdst, u_int32_t hop_count, nsaddr_t rpdst, u_int32_t rpseq, u_int32_t lifetime, double timestamp) |
| void | sendRequest (nsaddr_t dst) |
| virtual void | trace (TracedVar *v) |
| virtual void | trace_event (char *eventtype) |
Protected Attributes | |
| Application * | app_ |
| int | bid |
| aodv_bcache | bihead |
| BroadcastTimer | btimer |
| Tcl_Channel | channel_ |
| int | debug_ |
| int | defttl_ |
| PortClassifier * | dmux_ |
| NsObject * | drop_ |
| ns_addr_t | dst_ |
| EventTrace * | et_ |
| int | fid_ |
| int | flags_ |
| ns_addr_t | here_ |
| HelloTimer | htimer |
| PriQueue * | ifqueue |
| nsaddr_t | index |
| Trace * | logtarget |
| LocalRepairTimer | lrtimer |
| aodv_ncache | nbhead |
| NeighborTimer | ntimer |
| OldValue * | oldValueList_ |
| int | prio_ |
| aodv_rqueue | rqueue |
| aodv_rtable | rtable |
| aodv_rtable | rthead |
| RouteCacheTimer | rtimer |
| u_int32_t | seqno |
| int | size_ |
| NsObject * | target_ |
| char * | traceName_ |
| packet_t | type_ |
Static Protected Attributes | |
| static int | uidcnt_ |
Friends | |
| class | aodv_rt_entry |
| class | BroadcastTimer |
| class | HelloTimer |
| class | LocalRepairTimer |
| class | NeighborTimer |
| class | RouteCacheTimer |
|
|
Definition at line 140 of file aodv.cc. References bid, bihead, index, LIST_INIT, logtarget, nbhead, and seqno. 00140 : Agent(PT_AODV), 00141 btimer(this), htimer(this), ntimer(this), 00142 rtimer(this), lrtimer(this), rqueue() { 00143 00144 00145 index = id; 00146 seqno = 2; 00147 bid = 1; 00148 00149 LIST_INIT(&nbhead); 00150 LIST_INIT(&bihead); 00151 00152 logtarget = 0; 00153 ifqueue = 0; 00154 }
|
|
|
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 528 of file agent.cc. References Packet::allocdata(), and Agent::allocpkt(). 00529 { 00530 Packet* p = allocpkt(); 00531 00532 if (n > 0) 00533 p->allocdata(n); 00534 00535 return(p); 00536 }
Here is the call graph for this function: ![]() |
|
|
|
Definition at line 372 of file agent.cc. References Agent::app_. Referenced by WormApp::command(), 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().
|
|
||||||||||||
|
Reimplemented from Agent. Definition at line 78 of file aodv.cc. References btimer, Agent::command(), aodv_rqueue::command(), dmux_, RouteCacheTimer::handle(), NeighborTimer::handle(), HelloTimer::handle(), BroadcastTimer::handle(), htimer, index, logtarget, ntimer, rqueue, and rtimer. 00078 { 00079 if(argc == 2) { 00080 Tcl& tcl = Tcl::instance(); 00081 00082 if(strncasecmp(argv[1], "id", 2) == 0) { 00083 tcl.resultf("%d", index); 00084 return TCL_OK; 00085 } 00086 00087 if(strncasecmp(argv[1], "start", 2) == 0) { 00088 btimer.handle((Event*) 0); 00089 00090 #ifndef AODV_LINK_LAYER_DETECTION 00091 htimer.handle((Event*) 0); 00092 ntimer.handle((Event*) 0); 00093 #endif // LINK LAYER DETECTION 00094 00095 rtimer.handle((Event*) 0); 00096 return TCL_OK; 00097 } 00098 } 00099 else if(argc == 3) { 00100 if(strcmp(argv[1], "index") == 0) { 00101 index = atoi(argv[2]); 00102 return TCL_OK; 00103 } 00104 00105 else if(strcmp(argv[1], "log-target") == 0 || strcmp(argv[1], "tracetarget") == 0) { 00106 logtarget = (Trace*) TclObject::lookup(argv[2]); 00107 if(logtarget == 0) 00108 return TCL_ERROR; 00109 return TCL_OK; 00110 } 00111 else if(strcmp(argv[1], "drop-target") == 0) { 00112 int stat = rqueue.command(argc,argv); 00113 if (stat != TCL_OK) return stat; 00114 return Agent::command(argc, argv); 00115 } 00116 else if(strcmp(argv[1], "if-queue") == 0) { 00117 ifqueue = (PriQueue*) TclObject::lookup(argv[2]); 00118 00119 if(ifqueue == 0) 00120 return TCL_ERROR; 00121 return TCL_OK; 00122 } 00123 else if (strcmp(argv[1], "port-dmux") == 0) { 00124 dmux_ = (PortClassifier *)TclObject::lookup(argv[2]); 00125 if (dmux_ == 0) { 00126 fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, 00127 argv[1], argv[2]); 00128 return TCL_ERROR; 00129 } 00130 return TCL_OK; 00131 } 00132 } 00133 return Agent::command(argc, argv); 00134 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 389 of file agent.cc. Referenced by Agent::command().
|
|
|
||||||||||||
|
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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. 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 XcpSink::delay_bind_dispatch(), TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), SctpAgent::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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. Definition at line 78 of file agent.cc. References NsObject::delay_bind_init_all(). Referenced by XcpSink::delay_bind_init_all(), TcpAgent::delay_bind_init_all(), TcpSink::delay_bind_init_all(), SctpAgent::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 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: ![]() |
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 998 of file aodv.cc. References __PRETTY_FUNCTION__, ACTIVE_ROUTE_TIMEOUT, ns_addr_t::addr_, hdr_cmn::addr_type(), CURRENT_TIME, hdr_ip::daddr(), hdr_cmn::direction(), dmux_, hdr_cmn::DOWN, Connector::drop(), DROP_RTR_TTL, HDR_CMN, HDR_IP, Agent::here_, Scheduler::instance(), IP_BROADCAST, hdr_cmn::next_hop_, NS_AF_INET, NS_AF_NONE, PT_AODV, hdr_cmn::ptype(), Classifier::recv(), aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_nexthop, RTF_UP, Scheduler::schedule(), Connector::target_, hdr_ip::ttl_, Random::uniform(), and hdr_cmn::UP. Referenced by recvReply(), recvRequest(), rt_purge(), and rt_resolve(). 00998 { 00999 struct hdr_cmn *ch = HDR_CMN(p); 01000 struct hdr_ip *ih = HDR_IP(p); 01001 01002 if(ih->ttl_ == 0) { 01003 01004 #ifdef DEBUG 01005 fprintf(stderr, "%s: calling drop()\n", __PRETTY_FUNCTION__); 01006 #endif // DEBUG 01007 01008 drop(p, DROP_RTR_TTL); 01009 return; 01010 } 01011 01012 if (ch->ptype() != PT_AODV && ch->direction() == hdr_cmn::UP && 01013 ((u_int32_t)ih->daddr() == IP_BROADCAST) 01014 || (ih->daddr() == here_.addr_)) { 01015 dmux_->recv(p,0); 01016 return; 01017 } 01018 01019 if (rt) { 01020 assert(rt->rt_flags == RTF_UP); 01021 rt->rt_expire = CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT; 01022 ch->next_hop_ = rt->rt_nexthop; 01023 ch->addr_type() = NS_AF_INET; 01024 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction 01025 } 01026 else { // if it is a broadcast packet 01027 // assert(ch->ptype() == PT_AODV); // maybe a diff pkt type like gaf 01028 assert(ih->daddr() == (nsaddr_t) IP_BROADCAST); 01029 ch->addr_type() = NS_AF_NONE; 01030 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction 01031 } 01032 01033 if (ih->daddr() == (nsaddr_t) IP_BROADCAST) { 01034 // If it is a broadcast packet 01035 assert(rt == 0); 01036 /* 01037 * Jitter the sending of broadcast packets by 10ms 01038 */ 01039 Scheduler::instance().schedule(target_, p, 01040 0.01 * Random::uniform()); 01041 } 01042 else { // Not a broadcast packet 01043 if(delay > 0.0) { 01044 Scheduler::instance().schedule(target_, p, delay); 01045 } 01046 else { 01047 // Not a broadcast packet, no delay, send immediately 01048 Scheduler::instance().schedule(target_, p, 0.); 01049 } 01050 } 01051 01052 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 104 of file agent.h. References Agent::type_. 00104 { 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 350 of file aodv.cc. References Packet::alloc(), CURRENT_TIME, hdr_aodv_error::DestCount, HDR_AODV_ERROR, aodv_rtable::head(), index, INFINITY2, aodv_rt_entry::pc_delete(), rt_down(), aodv_rt_entry::rt_dst, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rt_entry::rt_nexthop, aodv_rt_entry::rt_seqno, rtable, RTF_UP, hdr_aodv_error::unreachable_dst, and hdr_aodv_error::unreachable_dst_seqno. 00350 { 00351 aodv_rt_entry *rt, *rtn; 00352 Packet *rerr = Packet::alloc(); 00353 struct hdr_aodv_error *re = HDR_AODV_ERROR(rerr); 00354 00355 re->DestCount = 0; 00356 for(rt = rtable.head(); rt; rt = rtn) { // for each rt entry 00357 rtn = rt->rt_link.le_next; 00358 if ((rt->rt_hops != INFINITY2) && (rt->rt_nexthop == id) ) { 00359 assert (rt->rt_flags == RTF_UP); 00360 assert((rt->rt_seqno%2) == 0); 00361 rt->rt_seqno++; 00362 re->unreachable_dst[re->DestCount] = rt->rt_dst; 00363 re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno; 00364 #ifdef DEBUG 00365 fprintf(stderr, "%s(%f): %d\t(%d\t%u\t%d)\n", __FUNCTION__, CURRENT_TIME, 00366 index, re->unreachable_dst[re->DestCount], 00367 re->unreachable_dst_seqno[re->DestCount], rt->rt_nexthop); 00368 #endif // DEBUG 00369 re->DestCount += 1; 00370 rt_down(rt); 00371 } 00372 // remove the lost neighbor from all the precursor lists 00373 rt->pc_delete(id); 00374 } 00375 00376 if (re->DestCount > 0) { 00377 #ifdef DEBUG 00378 fprintf(stderr, "%s(%f): %d\tsending RERR...\n", __FUNCTION__, CURRENT_TIME, index); 00379 #endif // DEBUG 00380 sendError(rerr, false); 00381 } 00382 else { 00383 Packet::free(rerr); 00384 } 00385 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 223 of file aodv.cc. References b, BCAST_ID_SAVE, bihead, CURRENT_TIME, and LIST_INSERT_HEAD. Referenced by recvRequest(). 00223 { 00224 BroadcastID *b = new BroadcastID(id, bid); 00225 00226 assert(b); 00227 b->expire = CURRENT_TIME + BCAST_ID_SAVE; 00228 LIST_INSERT_HEAD(&bihead, b, link); 00229 }
|
|
||||||||||||
|
Definition at line 233 of file aodv.cc. Referenced by recvRequest(). 00233 { 00234 BroadcastID *b = bihead.lh_first; 00235 00236 // Search the list for a match of source and bid 00237 for( ; b; b = b->link.le_next) { 00238 if ((b->src == id) && (b->id == bid)) 00239 return true; 00240 } 00241 return false; 00242 }
|
|
|
Definition at line 245 of file aodv.cc. References b, bihead, CURRENT_TIME, and LIST_REMOVE. Referenced by BroadcastTimer::handle(). 00245 { 00246 BroadcastID *b = bihead.lh_first; 00247 BroadcastID *bn; 00248 double now = CURRENT_TIME; 00249 00250 for(; b; b = bn) { 00251 bn = b->link.le_next; 00252 if(b->expire <= now) { 00253 LIST_REMOVE(b,link); 00254 delete b; 00255 } 00256 } 00257 }
|
|
|
Definition at line 363 of file agent.cc. References Agent::app_, and Application::resume(). Referenced by FullTcpAgent::foutput(), XcpAgent::output(), TcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), UdpAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), MessagePassingAgent::sendmsg(), TPAgent::sendto(), and MessagePassingAgent::sendto().
Here is the call graph for this function: ![]() |
|
|
Definition at line 214 of file aodv.h. Referenced by recv(). 00214 { return 1 && target_; }
|
|
|
Definition at line 456 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(), hdr_flags::qs_, NixVec::Reset(), hdr_ip::saddr(), hdr_cmn::size(), Agent::size_, hdr_ip::sport(), hdr_cmn::timestamp(), hdr_ip::ttl(), Agent::type_, hdr_cmn::uid(), Agent::uidcnt_, UNKN_IFACE, and iface_literal::value(). Referenced by Agent::allocpkt(), and PingResponder::recv(). 00457 { 00458 hdr_cmn* ch = hdr_cmn::access(p); 00459 ch->uid() = uidcnt_++; 00460 ch->ptype() = type_; 00461 ch->size() = size_; 00462 ch->timestamp() = Scheduler::instance().clock(); 00463 ch->iface() = UNKN_IFACE.value(); // from packet.h (agent is local) 00464 ch->direction() = hdr_cmn::NONE; 00465 00466 ch->error() = 0; /* pkt not corrupt to start with */ 00467 00468 hdr_ip* iph = hdr_ip::access(p); 00469 iph->saddr() = here_.addr_; 00470 iph->sport() = here_.port_; 00471 iph->daddr() = dst_.addr_; 00472 iph->dport() = dst_.port_; 00473 00474 //DEBUG 00475 //if (dst_ != -1) 00476 // printf("pl break\n"); 00477 00478 iph->flowid() = fid_; 00479 iph->prio() = prio_; 00480 iph->ttl() = defttl_; 00481 00482 hdr_flags* hf = hdr_flags::access(p); 00483 hf->ecn_capable_ = 0; 00484 hf->ecn_ = 0; 00485 hf->eln_ = 0; 00486 hf->ecn_to_echo_ = 0; 00487 hf->fs_ = 0; 00488 hf->no_ts_ = 0; 00489 hf->pri_ = 0; 00490 hf->cong_action_ = 0; 00491 hf->qs_ = 0; 00492 #ifdef HAVE_STL 00493 00494 hdr_nv* nv = hdr_nv::access(p); 00495 if (0) 00496 printf("Off hdr_nv %d, ip_hdr %d myaddr %d\n", 00497 hdr_nv::offset(), hdr_ip::offset(), here_.addr_); 00498 NixNode* pNixNode = NixNode::GetNodeObject(here_.addr_); 00499 if (0) 00500 printf("Node Object %p\n", pNixNode); 00501 if (pNixNode) { 00502 // If we get non-null, indicates nixvector routing in use 00503 // Delete any left over nv in the packet 00504 // Get a nixvector to the target (may create new) 00505 NixVec* pNv = pNixNode->GetNixVector(dst_.addr_); 00506 pNv->Reset(); 00507 nv->nv() = pNv; // And set the nixvec in the packet 00508 nv->h_used = 0; // And reset used portion to 0 00509 } 00510 #endif //HAVE_STL 00511 }
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().
|
|
||||||||||||
|
Definition at line 388 of file aodv.cc. References Packet::copy(), aodv_rqueue::enque(), Scheduler::instance(), lrtimer, rqueue, aodv_rt_entry::rt_dst, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_req_timeout, RTF_IN_REPAIR, Scheduler::schedule(), and sendRequest(). 00388 { 00389 #ifdef DEBUG 00390 fprintf(stderr,"%s: Dst - %d\n", __FUNCTION__, rt->rt_dst); 00391 #endif 00392 // Buffer the packet 00393 rqueue.enque(p); 00394 00395 // mark the route as under repair 00396 rt->rt_flags = RTF_IN_REPAIR; 00397 00398 sendRequest(rt->rt_dst); 00399 00400 // set up a timer interrupt 00401 Scheduler::instance().schedule(&lrtimer, p->copy(), rt->rt_req_timeout); 00402 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 65 of file aodv_logs.cc. References BaseTrace::buffer(), CURRENT_TIME, BaseTrace::dump(), HDR_CMN, index, logtarget, hdr_cmn::next_hop_, Trace::pt_, hdr_cmn::uid_, verbose, and hdr_cmn::xmit_reason_. 00066 { 00067 static int link_broke = 0; 00068 struct hdr_cmn *ch = HDR_CMN(p); 00069 00070 if(! logtarget || ! verbose) return; 00071 00072 sprintf(logtarget->pt_->buffer(), 00073 "A %.9f _%d_ LL unable to deliver packet %d to %d (%d) (reason = %d, ifqlen = %d)", 00074 CURRENT_TIME, 00075 index, 00076 ch->uid_, 00077 ch->next_hop_, 00078 ++link_broke, 00079 ch->xmit_reason_, 00080 ifqueue->length()); 00081 logtarget->pt_->dump(); 00082 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 43 of file aodv_logs.cc. References BaseTrace::buffer(), CURRENT_TIME, BaseTrace::dump(), God::hops(), index, God::instance(), logtarget, Trace::pt_, and verbose. Referenced by nb_delete(). 00044 { 00045 static int link_del = 0; 00046 00047 if(! logtarget || ! verbose) return; 00048 00049 /* 00050 * If "god" thinks that these two nodes are still 00051 * reachable then this is an erroneous deletion. 00052 */ 00053 sprintf(logtarget->pt_->buffer(), 00054 "A %.9f _%d_ deleting LL hop to %d (delete %d is %s)", 00055 CURRENT_TIME, 00056 index, 00057 dst, 00058 ++link_del, 00059 God::instance()->hops(index, dst) != 1 ? "VALID" : "INVALID"); 00060 logtarget->pt_->dump(); 00061 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 85 of file aodv_logs.cc. References BaseTrace::buffer(), CURRENT_TIME, BaseTrace::dump(), God::hops(), index, God::instance(), logtarget, Trace::pt_, and verbose. 00086 { 00087 static int link_kept = 0; 00088 00089 if(! logtarget || ! verbose) return; 00090 00091 00092 /* 00093 * If "god" thinks that these two nodes are now 00094 * unreachable, then we are erroneously keeping 00095 * a bad route. 00096 */ 00097 sprintf(logtarget->pt_->buffer(), 00098 "A %.9f _%d_ keeping LL hop to %d (keep %d is %s)", 00099 CURRENT_TIME, 00100 index, 00101 dst, 00102 ++link_kept, 00103 God::instance()->hops(index, dst) == 1 ? "VALID" : "INVALID"); 00104 logtarget->pt_->dump(); 00105 }
Here is the call graph for this function: ![]() |
|
|
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 1347 of file aodv.cc. References LIST_REMOVE, log_link_del(), AODV_Neighbor::nb_addr, nbhead, and seqno. Referenced by nb_purge(). 01347 { 01348 AODV_Neighbor *nb = nbhead.lh_first; 01349 01350 log_link_del(id); 01351 seqno += 2; // Set of neighbors changed 01352 assert ((seqno%2) == 0); 01353 01354 for(; nb; nb = nb->nb_link.le_next) { 01355 if(nb->nb_addr == id) { 01356 LIST_REMOVE(nb,nb_link); 01357 delete nb; 01358 break; 01359 } 01360 } 01361 01362 handle_link_failure(id); 01363 01364 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 1319 of file aodv.cc. References ALLOWED_HELLO_LOSS, CURRENT_TIME, HELLO_INTERVAL, LIST_INSERT_HEAD, AODV_Neighbor::nb_expire, nbhead, and seqno. Referenced by recvHello(). 01319 { 01320 AODV_Neighbor *nb = new AODV_Neighbor(id); 01321 01322 assert(nb); 01323 nb->nb_expire = CURRENT_TIME + 01324 (1.5 * ALLOWED_HELLO_LOSS * HELLO_INTERVAL); 01325 LIST_INSERT_HEAD(&nbhead, nb, nb_link); 01326 seqno += 2; // set of neighbors changed 01327 assert ((seqno%2) == 0); 01328 }
|
|
|
Definition at line 1332 of file aodv.cc. References AODV_Neighbor::nb_addr, and nbhead. Referenced by recvHello(). 01332 { 01333 AODV_Neighbor *nb = nbhead.lh_first; 01334 01335 for(; nb; nb = nb->nb_link.le_next) { 01336 if(nb->nb_addr == id) break; 01337 } 01338 return nb; 01339 }
|
|
|
Definition at line 1372 of file aodv.cc. References CURRENT_TIME, AODV_Neighbor::nb_addr, nb_delete(), AODV_Neighbor::nb_expire, and nbhead. Referenced by NeighborTimer::handle(). 01372 { 01373 AODV_Neighbor *nb = nbhead.lh_first; 01374 AODV_Neighbor *nbn; 01375 double now = CURRENT_TIME; 01376 01377 for(; nb; nb = nbn) { 01378 nbn = nb->nb_link.le_next; 01379 if(nb->nb_expire <= now) { 01380 nb_delete(nb->nb_addr); 01381 } 01382 } 01383 01384 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 264 of file aodv.cc. References MAX_HISTORY, NODE_TRAVERSAL_TIME, and aodv_rt_entry::rt_disc_latency. Referenced by sendRequest(). 00264 { 00265 int num_non_zero = 0, i; 00266 double total_latency = 0.0; 00267 00268 if (!rt) 00269 return ((double) NODE_TRAVERSAL_TIME ); 00270 00271 for (i=0; i < MAX_HISTORY; i++) { 00272 if (rt->rt_disc_latency[i] > 0.0) { 00273 num_non_zero++; 00274 total_latency += rt->rt_disc_latency[i]; 00275 } 00276 } 00277 if (num_non_zero > 0) 00278 return(total_latency / (double) num_non_zero); 00279 else 00280 return((double) NODE_TRAVERSAL_TIME); 00281 00282 }
|
|
|
||||||||||||
|
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 559 of file aodv.cc. References HDR_CMN, HDR_IP, initialized(), PT_AODV, hdr_cmn::ptype(), recvAODV(), and hdr_ip::ttl_. 00559 { 00560 struct hdr_cmn *ch = HDR_CMN(p); 00561 struct hdr_ip *ih = HDR_IP(p); 00562 00563 assert(initialized()); 00564 //assert(p->incoming == 0); 00565 // XXXXX NOTE: use of incoming flag has been depracated; In order to track direction of pkt flow, direction_ in hdr_cmn is used instead. see packet.h for details. 00566 00567 if(ch->ptype() == PT_AODV) { 00568 ih->ttl_ -= 1; 00569 recvAODV(p); 00570 return; 00571 } 00572 00573 00574 /* 00575 * Must be a packet I'm originating... 00576 */ 00577 if((ih->saddr() == index) && (ch->num_forwards() == 0)) { 00578 /* 00579 * Add the IP Header 00580 */ 00581 ch->size() += IP_HDR_LEN; 00582 // Added by Parag Dadhania && John Novatnack to handle broadcasting 00583 if ( (u_int32_t)ih->daddr() != IP_BROADCAST) 00584 ih->ttl_ = NETWORK_DIAMETER; 00585 } 00586 /* 00587 * I received a packet that I sent. Probably 00588 * a routing loop. 00589 */ 00590 else if(ih->saddr() == index) { 00591 drop(p, DROP_RTR_ROUTE_LOOP); 00592 return; 00593 } 00594 /* 00595 * Packet I'm forwarding... 00596 */ 00597 else { 00598 /* 00599 * Check the TTL. If it is zero, then discard. 00600 */ 00601 if(--ih->ttl_ == 0) { 00602 drop(p, DROP_RTR_TTL); 00603 return; 00604 } 00605 } 00606 // Added by Parag Dadhania && John Novatnack to handle broadcasting 00607 if ( (u_int32_t)ih->daddr() != IP_BROADCAST) 00608 rt_resolve(p); 00609 else 00610 forward((aodv_rt_entry*) 0, p, NO_DELAY); 00611 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 615 of file aodv.cc. References hdr_aodv::ah_type, AODVTYPE_HELLO, AODVTYPE_RERR, AODVTYPE_RREP, AODVTYPE_RREQ, Agent::dport(), HDR_AODV, HDR_IP, recvError(), recvHello(), recvReply(), recvRequest(), and RT_PORT. Referenced by recv(). 00615 { 00616 struct hdr_aodv *ah = HDR_AODV(p); 00617 00618 assert(HDR_IP (p)->sport() == RT_PORT); 00619 assert(HDR_IP (p)->dport() == RT_PORT); 00620 00621 /* 00622 * Incoming Packets. 00623 */ 00624 switch(ah->ah_type) { 00625 00626 case AODVTYPE_RREQ: 00627 recvRequest(p); 00628 break; 00629 00630 case AODVTYPE_RREP: 00631 recvReply(p); 00632 break; 00633 00634 case AODVTYPE_RERR: 00635 recvError(p); 00636 break; 00637 00638 case AODVTYPE_HELLO: 00639 recvHello(p); 00640 break; 00641 00642 default: 00643 fprintf(stderr, "Invalid AODV type (%x)\n", ah->ah_type); 00644 exit(1); 00645 } 00646 00647 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 354 of file agent.cc. References Agent::app_, and Application::recv(). Referenced by TcpAsymSink::recv(). 00355 { 00356 if (app_) 00357 app_->recv(nbytes); 00358 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 936 of file aodv.cc. References Packet::alloc(), CURRENT_TIME, hdr_aodv_error::DestCount, Connector::drop(), DROP_RTR_MAC_CALLBACK, HDR_AODV_ERROR, HDR_IP, index, INFINITY2, rt_down(), aodv_rt_entry::rt_dst, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rtable::rt_lookup(), aodv_rt_entry::rt_nexthop, aodv_rt_entry::rt_seqno, rtable, RTF_UP, hdr_ip::saddr(), hdr_aodv_error::unreachable_dst, and hdr_aodv_error::unreachable_dst_seqno. Referenced by recvAODV(). 00936 { 00937 struct hdr_ip *ih = HDR_IP(p); 00938 struct hdr_aodv_error *re = HDR_AODV_ERROR(p); 00939 aodv_rt_entry *rt; 00940 u_int8_t i; 00941 Packet *rerr = Packet::alloc(); 00942 struct hdr_aodv_error *nre = HDR_AODV_ERROR(rerr); 00943 00944 nre->DestCount = 0; 00945 00946 for (i=0; i<re->DestCount; i++) { 00947 // For each unreachable destination 00948 rt = rtable.rt_lookup(re->unreachable_dst[i]); 00949 if ( rt && (rt->rt_hops != INFINITY2) && 00950 (rt->rt_nexthop == ih->saddr()) && 00951 (rt->rt_seqno <= re->unreachable_dst_seqno[i]) ) { 00952 assert(rt->rt_flags == RTF_UP); 00953 assert((rt->rt_seqno%2) == 0); // is the seqno even? 00954 #ifdef DEBUG 00955 fprintf(stderr, "%s(%f): %d\t(%d\t%u\t%d)\t(%d\t%u\t%d)\n", __FUNCTION__,CURRENT_TIME, 00956 index, rt->rt_dst, rt->rt_seqno, rt->rt_nexthop, 00957 re->unreachable_dst[i],re->unreachable_dst_seqno[i], 00958 ih->saddr()); 00959 #endif // DEBUG 00960 rt->rt_seqno = re->unreachable_dst_seqno[i]; 00961 rt_down(rt); 00962 00963 // Not sure whether this is the right thing to do 00964 Packet *pkt; 00965 while((pkt = ifqueue->filter(ih->saddr()))) { 00966 drop(pkt, DROP_RTR_MAC_CALLBACK); 00967 } 00968 00969 // if precursor list non-empty add to RERR and delete the precursor list 00970 if (!rt->pc_empty()) { 00971 nre->unreachable_dst[nre->DestCount] = rt->rt_dst; 00972 nre->unreachable_dst_seqno[nre->DestCount] = rt->rt_seqno; 00973 nre->DestCount += 1; 00974 rt->pc_delete(); 00975 } 00976 } 00977 } 00978 00979 if (nre->DestCount > 0) { 00980 #ifdef DEBUG 00981 fprintf(stderr, "%s(%f): %d\t sending RERR...\n", __FUNCTION__, CURRENT_TIME, index); 00982 #endif // DEBUG 00983 sendError(rerr); 00984 } 00985 else { 00986 Packet::free(rerr); 00987 } 00988 00989 Packet::free(p); 00990 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 1301 of file aodv.cc. References ALLOWED_HELLO_LOSS, CURRENT_TIME, Packet::free(), HDR_AODV_REPLY, HELLO_INTERVAL, AODV_Neighbor::nb_expire, nb_insert(), nb_lookup(), and hdr_aodv_reply::rp_dst. Referenced by recvAODV(). 01301 { 01302 //struct hdr_ip *ih = HDR_IP(p); 01303 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p); 01304 AODV_Neighbor *nb; 01305 01306 nb = nb_lookup(rp->rp_dst); 01307 if(nb == 0) { 01308 nb_insert(rp->rp_dst); 01309 } 01310 else { 01311 nb->nb_expire = CURRENT_TIME + 01312 (1.5 * ALLOWED_HELLO_LOSS * HELLO_INTERVAL); 01313 } 01314 01315 Packet::free(p); 01316 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented from NsObject. Definition at line 78 of file agent.h.
|
|
|
Definition at line 821 of file aodv.cc. References ARP_DELAY, CURRENT_TIME, hdr_ip::daddr(), aodv_rqueue::deque(), forward(), HDR_AODV_REPLY, HDR_IP, aodv_rt_entry::hist_indx, index, INFINITY2, MAX_HISTORY, hdr_aodv_reply::rp_dst, hdr_aodv_reply::rp_dst_seqno, hdr_aodv_reply::rp_hop_count, hdr_aodv_reply::rp_lifetime, hdr_aodv_reply::rp_src, hdr_aodv_reply::rp_timestamp, rqueue, aodv_rtable::rt_add(), aodv_rt_entry::rt_disc_latency, aodv_rt_entry::rt_dst, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rtable::rt_lookup(), aodv_rt_entry::rt_req_cnt, aodv_rt_entry::rt_req_last_ttl, aodv_rt_entry::rt_req_timeout, aodv_rt_entry::rt_seqno, rt_update(), rtable, and RTF_UP. Referenced by recvAODV(). 00821 { 00822 //struct hdr_cmn *ch = HDR_CMN(p); 00823 struct hdr_ip *ih = HDR_IP(p); 00824 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p); 00825 aodv_rt_entry *rt; 00826 char suppress_reply = 0; 00827 double delay = 0.0; 00828 00829 #ifdef DEBUG 00830 fprintf(stderr, "%d - %s: received a REPLY\n", index, __FUNCTION__); 00831 #endif // DEBUG 00832 00833 00834 /* 00835 * Got a reply. So reset the "soft state" maintained for 00836 * route requests in the request table. We don't really have 00837 * have a separate request table. It is just a part of the 00838 * routing table itself. 00839 */ 00840 // Note that rp_dst is the dest of the data packets, not the 00841 // the dest of the reply, which is the src of the data packets. 00842 00843 rt = rtable.rt_lookup(rp->rp_dst); 00844 00845 /* 00846 * If I don't have a rt entry to this host... adding 00847 */ 00848 if(rt == 0) { 00849 rt = rtable.rt_add(rp->rp_dst); 00850 } 00851 00852 /* 00853 * Add a forward route table entry... here I am following 00854 * Perkins-Royer AODV paper almost literally - SRD 5/99 00855 */ 00856 00857 if ( (rt->rt_seqno < rp->rp_dst_seqno) || // newer route 00858 ((rt->rt_seqno == rp->rp_dst_seqno) && 00859 (rt->rt_hops > rp->rp_hop_count)) ) { // shorter or better route 00860 00861 // Update the rt entry 00862 rt_update(rt, rp->rp_dst_seqno, rp->rp_hop_count, 00863 rp->rp_src, CURRENT_TIME + rp->rp_lifetime); 00864 00865 // reset the soft state 00866 rt->rt_req_cnt = 0; 00867 rt->rt_req_timeout = 0.0; 00868 rt->rt_req_last_ttl = rp->rp_hop_count; 00869 00870 if (ih->daddr() == index) { // If I am the original source 00871 // Update the route discovery latency statistics 00872 // rp->rp_timestamp is the time of request origination 00873 00874 rt->rt_disc_latency[(unsigned char)rt->hist_indx] = (CURRENT_TIME - rp->rp_timestamp) 00875 / (double) rp->rp_hop_count; 00876 // increment indx for next time 00877 rt->hist_indx = (rt->hist_indx + 1) % MAX_HISTORY; 00878 } 00879 00880 /* 00881 * Send all packets queued in the sendbuffer destined for 00882 * this destination. 00883 * XXX - observe the "second" use of p. 00884 */ 00885 Packet *buf_pkt; 00886 while((buf_pkt = rqueue.deque(rt->rt_dst))) { 00887 if(rt->rt_hops != INFINITY2) { 00888 assert (rt->rt_flags == RTF_UP); 00889 // Delay them a little to help ARP. Otherwise ARP 00890 // may drop packets. -SRD 5/23/99 00891 forward(rt, buf_pkt, delay); 00892 delay += ARP_DELAY; 00893 } 00894 } 00895 } 00896 else { 00897 suppress_reply = 1; 00898 } 00899 00900 /* 00901 * If reply is for me, discard it. 00902 */ 00903 00904 if(ih->daddr() == index || suppress_reply) { 00905 Packet::free(p); 00906 } 00907 /* 00908 * Otherwise, forward the Route Reply. 00909 */ 00910 else { 00911 // Find the rt entry 00912 aodv_rt_entry *rt0 = rtable.rt_lookup(ih->daddr()); 00913 // If the rt is up, forward 00914 if(rt0 && (rt0->rt_hops != INFINITY2)) { 00915 assert (rt0->rt_flags == RTF_UP); 00916 rp->rp_hop_count += 1; 00917 rp->rp_src = index; 00918 forward(rt0, p, NO_DELAY); 00919 // Insert the nexthop towards the RREQ source to 00920 // the precursor list of the RREQ destination 00921 rt->pc_insert(rt0->rt_nexthop); // nexthop to RREQ source 00922 00923 } 00924 else { 00925 // I don't know how to forward .. drop the reply. 00926 #ifdef DEBUG 00927 fprintf(stderr, "%s: dropping Route Reply\n", __FUNCTION__); 00928 #endif // DEBUG 00929 drop(p, DROP_RTR_NO_ROUTE); 00930 } 00931 } 00932 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 651 of file aodv.cc. References ACTIVE_ROUTE_TIMEOUT, CURRENT_TIME, aodv_rqueue::deque(), forward(), Packet::free(), HDR_AODV_REQUEST, HDR_IP, id_insert(), id_lookup(), index, INFINITY2, max, NO_DELAY, REV_ROUTE_LIFE, hdr_aodv_request::rq_bcast_id, hdr_aodv_request::rq_hop_count, hdr_aodv_request::rq_src, hdr_aodv_request::rq_src_seqno, rqueue, aodv_rtable::rt_add(), aodv_rt_entry::rt_dst, aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rtable::rt_lookup(), aodv_rt_entry::rt_req_cnt, aodv_rt_entry::rt_req_last_ttl, aodv_rt_entry::rt_req_timeout, aodv_rt_entry::rt_seqno, rt_update(), rtable, RTF_UP, and hdr_ip::saddr(). Referenced by recvAODV(). 00651 { 00652 struct hdr_ip *ih = HDR_IP(p); 00653 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p); 00654 aodv_rt_entry *rt; 00655 00656 /* 00657 * Drop if: 00658 * - I'm the source 00659 * - I recently heard this request. 00660 */ 00661 00662 if(rq->rq_src == index) { 00663 #ifdef DEBUG 00664 fprintf(stderr, "%s: got my own REQUEST\n", __FUNCTION__); 00665 #endif // DEBUG 00666 Packet::free(p); 00667 return; 00668 } 00669 00670 if (id_lookup(rq->rq_src, rq->rq_bcast_id)) { 00671 00672 #ifdef DEBUG 00673 fprintf(stderr, "%s: discarding request\n", __FUNCTION__); 00674 #endif // DEBUG 00675 00676 Packet::free(p); 00677 return; 00678 } 00679 00680 /* 00681 * Cache the broadcast ID 00682 */ 00683 id_insert(rq->rq_src, rq->rq_bcast_id); 00684 00685 00686 00687 /* 00688 * We are either going to forward the REQUEST or generate a 00689 * REPLY. Before we do anything, we make sure that the REVERSE 00690 * route is in the route table. 00691 */ 00692 aodv_rt_entry *rt0; // rt0 is the reverse route 00693 00694 rt0 = rtable.rt_lookup(rq->rq_src); 00695 if(rt0 == 0) { /* if not in the route table */ 00696 // create an entry for the reverse route. 00697 rt0 = rtable.rt_add(rq->rq_src); 00698 } 00699 00700 rt0->rt_expire = max(rt0->rt_expire, (CURRENT_TIME + REV_ROUTE_LIFE)); 00701 00702 if ( (rq->rq_src_seqno > rt0->rt_seqno ) || 00703 ((rq->rq_src_seqno == rt0->rt_seqno) && 00704 (rq->rq_hop_count < rt0->rt_hops)) ) { 00705 // If we have a fresher seq no. or lesser #hops for the 00706 // same seq no., update the rt entry. Else don't bother. 00707 rt_update(rt0, rq->rq_src_seqno, rq->rq_hop_count, ih->saddr(), 00708 max(rt0->rt_expire, (CURRENT_TIME + REV_ROUTE_LIFE)) ); 00709 if (rt0->rt_req_timeout > 0.0) { 00710 // Reset the soft state and 00711 // Set expiry time to CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT 00712 // This is because route is used in the forward direction, 00713 // but only sources get benefited by this change 00714 rt0->rt_req_cnt = 0; 00715 rt0->rt_req_timeout = 0.0; 00716 rt0->rt_req_last_ttl = rq->rq_hop_count; 00717 rt0->rt_expire = CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT; 00718 } 00719 00720 /* Find out whether any buffered packet can benefit from the 00721 * reverse route. 00722 * May need some change in the following code - Mahesh 09/11/99 00723 */ 00724 assert (rt0->rt_flags == RTF_UP); 00725 Packet *buffered_pkt; 00726 while ((buffered_pkt = rqueue.deque(rt0->rt_dst))) { 00727 if (rt0 && (rt0->rt_flags == RTF_UP)) { 00728 assert(rt0->rt_hops != INFINITY2); 00729 forward(rt0, buffered_pkt, NO_DELAY); 00730 } 00731 } 00732 } 00733 // End for putting reverse route in rt table 00734 00735 00736 /* 00737 * We have taken care of the reverse route stuff. 00738 * Now see whether we can send a route reply. 00739 */ 00740 00741 rt = rtable.rt_lookup(rq->rq_dst); 00742 00743 // First check if I am the destination .. 00744 00745 if(rq->rq_dst == index) { 00746 00747 #ifdef DEBUG 00748 fprintf(stderr, "%d - %s: destination sending reply\n", 00749 index, __FUNCTION__); 00750 #endif // DEBUG 00751 00752 00753 // Just to be safe, I use the max. Somebody may have 00754 // incremented the dst seqno. 00755 seqno = max(seqno, rq->rq_dst_seqno)+1; 00756 if (seqno%2) seqno++; 00757 00758 sendReply(rq->rq_src, // IP Destination 00759 1, // Hop Count 00760 index, // Dest IP Address 00761 seqno, // Dest Sequence Num 00762 MY_ROUTE_TIMEOUT, // Lifetime 00763 rq->rq_timestamp); // timestamp 00764 00765 Packet::free(p); 00766 } 00767 00768 // I am not the destination, but I may have a fresh enough route. 00769 00770 else if (rt && (rt->rt_hops != INFINITY2) && 00771 (rt->rt_seqno >= rq->rq_dst_seqno) ) { 00772 00773 //assert (rt->rt_flags == RTF_UP); 00774 assert(rq->rq_dst == rt->rt_dst); 00775 //assert ((rt->rt_seqno%2) == 0); // is the seqno even? 00776 sendReply(rq->rq_src, 00777 rt->rt_hops + 1, 00778 rq->rq_dst, 00779 rt->rt_seqno, 00780 (u_int32_t) (rt->rt_expire - CURRENT_TIME), 00781 // rt->rt_expire - CURRENT_TIME, 00782 rq->rq_timestamp); 00783 // Insert nexthops to RREQ source and RREQ destination in the 00784 // precursor lists of destination and source respectively 00785 rt->pc_insert(rt0->rt_nexthop); // nexthop to RREQ source 00786 rt0->pc_insert(rt->rt_nexthop); // nexthop to RREQ destination 00787 00788 #ifdef RREQ_GRAT_RREP 00789 00790 sendReply(rq->rq_dst, 00791 rq->rq_hop_count, 00792 rq->rq_src, 00793 rq->rq_src_seqno, 00794 (u_int32_t) (rt->rt_expire - CURRENT_TIME), 00795 // rt->rt_expire - CURRENT_TIME, 00796 rq->rq_timestamp); 00797 #endif 00798 00799 // TODO: send grat RREP to dst if G flag set in RREQ using rq->rq_src_seqno, rq->rq_hop_counT 00800 00801 // DONE: Included gratuitous replies to be sent as per IETF aodv draft specification. As of now, G flag has not been dynamically used and is always set or reset in aodv-packet.h --- Anant Utgikar, 09/16/02. 00802 00803 Packet::free(p); 00804 } 00805 /* 00806 * Can't reply. So forward the Route Request 00807 */ 00808 else { 00809 ih->saddr() = index; 00810 ih->daddr() = IP_BROADCAST; 00811 rq->rq_hop_count += 1; 00812 // Maximum sequence number seen en route 00813 if (rt) rq->rq_dst_seqno = max(rt->rt_seqno, rq->rq_dst_seqno); 00814 forward((aodv_rt_entry*) 0, p, DELAY); 00815 } 00816 00817 }
Here is the call graph for this function: ![]() |
|
|
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().
|
|
|
Definition at line 416 of file aodv.cc. References INFINITY2, aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rt_entry::rt_last_hop_count, aodv_rt_entry::rt_nexthop, and RTF_DOWN. Referenced by LocalRepairTimer::handle(), handle_link_failure(), recvError(), and rt_purge(). 00416 { 00417 /* 00418 * Make sure that you don't "down" a route more than once. 00419 */ 00420 00421 if(rt->rt_flags == RTF_DOWN) { 00422 return; 00423 } 00424 00425 // assert (rt->rt_seqno%2); // is the seqno odd? 00426 rt->rt_last_hop_count = rt->rt_hops; 00427 rt->rt_hops = INFINITY2; 00428 rt->rt_flags = RTF_DOWN; 00429 rt->rt_nexthop = 0; 00430 rt->rt_expire = 0; 00431 00432 } /* rt_down function */
|
|
|
Definition at line 297 of file aodv.cc. References hdr_ip::daddr(), DATA_PACKET, Connector::drop(), DROP_RTR_MAC_CALLBACK, HDR_CMN, HDR_IP, IP_BROADCAST, hdr_cmn::next_hop_, and hdr_cmn::ptype(). 00297 { 00298 struct hdr_cmn *ch = HDR_CMN(p); 00299 struct hdr_ip *ih = HDR_IP(p); 00300 aodv_rt_entry *rt; 00301 nsaddr_t broken_nbr = ch->next_hop_; 00302 00303 #ifndef AODV_LINK_LAYER_DETECTION 00304 drop(p, DROP_RTR_MAC_CALLBACK); 00305 #else 00306 00307 /* 00308 * Non-data packets and Broadcast Packets can be dropped. 00309 */ 00310 if(! DATA_PACKET(ch->ptype()) || 00311 (u_int32_t) ih->daddr() == IP_BROADCAST) { 00312 drop(p, DROP_RTR_MAC_CALLBACK); 00313 return; 00314 } 00315 log_link_broke(p); 00316 if((rt = rtable.rt_lookup(ih->daddr())) == 0) { 00317 drop(p, DROP_RTR_MAC_CALLBACK); 00318 return; 00319 } 00320 log_link_del(ch->next_hop_); 00321 00322 #ifdef AODV_LOCAL_REPAIR 00323 /* if the broken link is closer to the dest than source, 00324 attempt a local repair. Otherwise, bring down the route. */ 00325 00326 00327 if (ch->num_forwards() > rt->rt_hops) { 00328 local_rt_repair(rt, p); // local repair 00329 // retrieve all the packets in the ifq using this link, 00330 // queue the packets for which local repair is done, 00331 return; 00332 } 00333 else 00334 #endif // LOCAL REPAIR 00335 00336 { 00337 drop(p, DROP_RTR_MAC_CALLBACK); 00338 // Do the same thing for other packets in the interface queue using the 00339 // broken link -Mahesh 00340 while((p = ifqueue->filter(broken_nbr))) { 00341 drop(p, DROP_RTR_MAC_CALLBACK); 00342 } 00343 nb_delete(broken_nbr); 00344 } 00345 00346 #endif // LINK LAYER DETECTION 00347 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 506 of file aodv.cc. References ARP_DELAY, CURRENT_TIME, aodv_rqueue::deque(), Connector::drop(), DROP_RTR_NO_ROUTE, aodv_rqueue::find(), forward(), aodv_rtable::head(), INFINITY2, rqueue, rt_down(), aodv_rt_entry::rt_dst, aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rt_entry::rt_seqno, rtable, RTF_UP, and sendRequest(). Referenced by RouteCacheTimer::handle(). 00506 { 00507 aodv_rt_entry *rt, *rtn; 00508 double now = CURRENT_TIME; 00509 double delay = 0.0; 00510 Packet *p; 00511 00512 for(rt = rtable.head(); rt; rt = rtn) { // for each rt entry 00513 rtn = rt->rt_link.le_next; 00514 if ((rt->rt_flags == RTF_UP) && (rt->rt_expire < now)) { 00515 // if a valid route has expired, purge all packets from 00516 // send buffer and invalidate the route. 00517 assert(rt->rt_hops != INFINITY2); 00518 while((p = rqueue.deque(rt->rt_dst))) { 00519 #ifdef DEBUG 00520 fprintf(stderr, "%s: calling drop()\n", 00521 __FUNCTION__); 00522 #endif // DEBUG 00523 drop(p, DROP_RTR_NO_ROUTE); 00524 } 00525 rt->rt_seqno++; 00526 assert (rt->rt_seqno%2); 00527 rt_down(rt); 00528 } 00529 else if (rt->rt_flags == RTF_UP) { 00530 // If the route is not expired, 00531 // and there are packets in the sendbuffer waiting, 00532 // forward them. This should not be needed, but this extra 00533 // check does no harm. 00534 assert(rt->rt_hops != INFINITY2); 00535 while((p = rqueue.deque(rt->rt_dst))) { 00536 forward (rt, p, delay); 00537 delay += ARP_DELAY; 00538 } 00539 } 00540 else if (rqueue.find(rt->rt_dst)) 00541 // If the route is down and 00542 // if there is a packet for this destination waiting in 00543 // the sendbuffer, then send out route request. sendRequest 00544 // will check whether it is time to really send out request 00545 // or not. 00546 // This may not be crucial to do it here, as each generated 00547 // packet will do a sendRequest anyway. 00548 00549 sendRequest(rt->rt_dst); 00550 } 00551 00552 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 439 of file aodv.cc. References aodv_rt_failed_callback(), hdr_ip::daddr(), aodv_rqueue::enque(), forward(), HDR_CMN, HDR_IP, index, INFINITY2, NO_DELAY, rqueue, aodv_rtable::rt_add(), aodv_rt_entry::rt_dst, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rtable::rt_lookup(), rtable, RTF_UP, hdr_ip::saddr(), sendRequest(), hdr_cmn::xmit_failure_, and hdr_cmn::xmit_failure_data_. 00439 { 00440 struct hdr_cmn *ch = HDR_CMN(p); 00441 struct hdr_ip *ih = HDR_IP(p); 00442 aodv_rt_entry *rt; 00443 00444 /* 00445 * Set the transmit failure callback. That 00446 * won't change. 00447 */ 00448 ch->xmit_failure_ = aodv_rt_failed_callback; 00449 ch->xmit_failure_data_ = (void*) this; 00450 rt = rtable.rt_lookup(ih->daddr()); 00451 if(rt == 0) { 00452 rt = rtable.rt_add(ih->daddr()); 00453 } 00454 00455 /* 00456 * If the route is up, forward the packet 00457 */ 00458 00459 if(rt->rt_flags == RTF_UP) { 00460 assert(rt->rt_hops != INFINITY2); 00461 forward(rt, p, NO_DELAY); 00462 } 00463 /* 00464 * if I am the source of the packet, then do a Route Request. 00465 */ 00466 else if(ih->saddr() == index) { 00467 rqueue.enque(p); 00468 sendRequest(rt->rt_dst); 00469 } 00470 /* 00471 * A local repair is in progress. Buffer the packet. 00472 */ 00473 else if (rt->rt_flags == RTF_IN_REPAIR) { 00474 rqueue.enque(p); 00475 } 00476 00477 /* 00478 * I am trying to forward a packet for someone else to which 00479 * I don't have a route. 00480 */ 00481 else { 00482 Packet *rerr = Packet::alloc(); 00483 struct hdr_aodv_error *re = HDR_AODV_ERROR(rerr); 00484 /* 00485 * For now, drop the packet and send error upstream. 00486 * Now the route errors are broadcast to upstream 00487 * neighbors - Mahesh 09/11/99 00488 */ 00489 00490 assert (rt->rt_flags == RTF_DOWN); 00491 re->DestCount = 0; 00492 re->unreachable_dst[re->DestCount] = rt->rt_dst; 00493 re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno; 00494 re->DestCount += 1; 00495 #ifdef DEBUG 00496 fprintf(stderr, "%s: sending RERR...\n", __FUNCTION__); 00497 #endif 00498 sendError(rerr, false); 00499 00500 drop(p, DROP_RTR_NO_ROUTE); 00501 } 00502 00503 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||||||||||
|
Definition at line 405 of file aodv.cc. References aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rt_entry::rt_nexthop, aodv_rt_entry::rt_seqno, and RTF_UP. Referenced by recvReply(), and recvRequest(). 00406 { 00407 00408 rt->rt_seqno = seqnum; 00409 rt->rt_hops = metric; 00410 rt->rt_flags = RTF_UP; 00411 rt->rt_nexthop = nexthop; 00412 rt->rt_expire = expire_time; 00413 }
|
|
|
Reimplemented in SRMAgent. Definition at line 91 of file agent.h. References Agent::sendmsg(). 00091 { 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: ![]() |
|
||||||||||||
|
||||||||||||
|
Definition at line 1222 of file aodv.cc. References hdr_cmn::addr_type(), AODVTYPE_RERR, hdr_ip::daddr(), hdr_cmn::direction(), hdr_cmn::DOWN, hdr_ip::dport(), hdr_cmn::error(), HDR_AODV_ERROR, HDR_CMN, HDR_IP, hdr_cmn::iface(), index, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, hdr_cmn::next_hop_, NS_AF_NONE, hdr_cmn::prev_hop_, PT_AODV, hdr_cmn::ptype(), hdr_aodv_error::re_type, RT_PORT, hdr_ip::saddr(), Scheduler::schedule(), hdr_aodv_error::size(), hdr_cmn::size(), hdr_ip::sport(), Connector::target_, hdr_ip::ttl_, and Random::uniform(). 01222 { 01223 struct hdr_cmn *ch = HDR_CMN(p); 01224 struct hdr_ip *ih = HDR_IP(p); 01225 struct hdr_aodv_error *re = HDR_AODV_ERROR(p); 01226 01227 #ifdef ERROR 01228 fprintf(stderr, "sending Error from %d at %.2f\n", index, Scheduler::instance().clock()); 01229 #endif // DEBUG 01230 01231 re->re_type = AODVTYPE_RERR; 01232 //re->reserved[0] = 0x00; re->reserved[1] = 0x00; 01233 // DestCount and list of unreachable destinations are already filled 01234 01235 // ch->uid() = 0; 01236 ch->ptype() = PT_AODV; 01237 ch->size() = IP_HDR_LEN + re->size(); 01238 ch->iface() = -2; 01239 ch->error() = 0; 01240 ch->addr_type() = NS_AF_NONE; 01241 ch->next_hop_ = 0; 01242 ch->prev_hop_ = index; // AODV hack 01243 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction 01244 01245 ih->saddr() = index; 01246 ih->daddr() = IP_BROADCAST; 01247 ih->sport() = RT_PORT; 01248 ih->dport() = RT_PORT; 01249 ih->ttl_ = 1; 01250 01251 // Do we need any jitter? Yes 01252 if (jitter) 01253 Scheduler::instance().schedule(target_, p, 0.01*Random::uniform()); 01254 else 01255 Scheduler::instance().schedule(target_, p, 0.0); 01256 01257 }
Here is the call graph for this function: ![]() |
|
|
||||||||||||
|
Reimplemented in SA_Agent, RTPAgent, UdpAgent, MessagePassingAgent, LmsSender, SRMAgent, SctpAgent, FullTcpAgent, TcpAgent, TfrcAgent, and SimpleTcpAgent. Definition at line 407 of file agent.cc.
|
|
||||||||||||||||
|
Reimplemented in UdpAgent, and MessagePassingAgent. Definition at line 400 of file agent.cc. References abort(). Referenced by Agent::command(), Application::send(), Agent::send(), TrafficTrace::timeout(), TelnetApp::timeout(), SctpApp1::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 1056 of file aodv.cc. References hdr_cmn::addr_type(), Packet::alloc(), AODVTYPE_RREQ, bid, CURRENT_TIME, hdr_ip::daddr(), aodv_rqueue::deque(), hdr_ip::dport(), Connector::drop(), DROP_RTR_NO_ROUTE, hdr_cmn::error(), Packet::free(), HDR_AODV_REQUEST, HDR_CMN, HDR_IP, hdr_cmn::iface(), index, INFINITY2, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, max, MAX_RREQ_TIMEOUT, NETWORK_DIAMETER, NS_AF_NONE, PerHopTime(), hdr_cmn::prev_hop_, PT_AODV, hdr_cmn::ptype(), hdr_aodv_request::rq_bcast_id, hdr_aodv_request::rq_dst, hdr_aodv_request::rq_dst_seqno, hdr_aodv_request::rq_hop_count, hdr_aodv_request::rq_src, hdr_aodv_request::rq_src_seqno, hdr_aodv_request::rq_timestamp, hdr_aodv_request::rq_type, rqueue, RREQ_RETRIES, aodv_rt_entry::rt_dst, aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_hops, aodv_rt_entry::rt_last_hop_count, aodv_rtable::rt_lookup(), RT_PORT, aodv_rt_entry::rt_req_cnt, aodv_rt_entry::rt_req_last_ttl, aodv_rt_entry::rt_req_timeout, aodv_rt_entry::rt_seqno, rtable, RTF_UP, hdr_ip::saddr(), Scheduler::schedule(), seqno, hdr_aodv_request::size(), hdr_cmn::size(), hdr_ip::sport(), Connector::target_, hdr_ip::ttl_, TTL_INCREMENT, TTL_START, and TTL_THRESHOLD. Referenced by local_rt_repair(), rt_purge(), and rt_resolve(). 01056 { 01057 // Allocate a RREQ packet 01058 Packet *p = Packet::alloc(); 01059 struct hdr_cmn *ch = HDR_CMN(p); 01060 struct hdr_ip *ih = HDR_IP(p); 01061 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p); 01062 aodv_rt_entry *rt = rtable.rt_lookup(dst); 01063 01064 assert(rt); 01065 01066 /* 01067 * Rate limit sending of Route Requests. We are very conservative 01068 * about sending out route requests. 01069 */ 01070 01071 if (rt->rt_flags == RTF_UP) { 01072 assert(rt->rt_hops != INFINITY2); 01073 Packet::free((Packet *)p); 01074 return; 01075 } 01076 01077 if (rt->rt_req_timeout > CURRENT_TIME) { 01078 Packet::free((Packet *)p); 01079 return; 01080 } 01081 01082 // rt_req_cnt is the no. of times we did network-wide broadcast 01083 // RREQ_RETRIES is the maximum number we will allow before 01084 // going to a long timeout. 01085 01086 if (rt->rt_req_cnt > RREQ_RETRIES) { 01087 rt->rt_req_timeout = CURRENT_TIME + MAX_RREQ_TIMEOUT; 01088 rt->rt_req_cnt = 0; 01089 Packet *buf_pkt; 01090 while ((buf_pkt = rqueue.deque(rt->rt_dst))) { 01091 drop(buf_pkt, DROP_RTR_NO_ROUTE); 01092 } 01093 Packet::free((Packet *)p); 01094 return; 01095 } 01096 01097 #ifdef DEBUG 01098 fprintf(stderr, "(%2d) - %2d sending Route Request, dst: %d\n", 01099 ++route_request, index, rt->rt_dst); 01100 #endif // DEBUG 01101 01102 // Determine the TTL to be used this time. 01103 // Dynamic TTL evaluation - SRD 01104 01105 rt->rt_req_last_ttl = max(rt->rt_req_last_ttl,rt->rt_last_hop_count); 01106 01107 if (0 == rt->rt_req_last_ttl) { 01108 // first time query broadcast 01109 ih->ttl_ = TTL_START; 01110 } 01111 else { 01112 // Expanding ring search. 01113 if (rt->rt_req_last_ttl < TTL_THRESHOLD) 01114 ih->ttl_ = rt->rt_req_last_ttl + TTL_INCREMENT; 01115 else { 01116 // network-wide broadcast 01117 ih->ttl_ = NETWORK_DIAMETER; 01118 rt->rt_req_cnt += 1; 01119 } 01120 } 01121 01122 // remember the TTL used for the next time 01123 rt->rt_req_last_ttl = ih->ttl_; 01124 01125 // PerHopTime is the roundtrip time per hop for route requests. 01126 // The factor 2.0 is just to be safe .. SRD 5/22/99 01127 // Also note that we are making timeouts to be larger if we have 01128 // done network wide broadcast before. 01129 01130 rt->rt_req_timeout = 2.0 * (double) ih->ttl_ * PerHopTime(rt); 01131 if (rt->rt_req_cnt > 0) 01132 rt->rt_req_timeout *= rt->rt_req_cnt; 01133 rt->rt_req_timeout += CURRENT_TIME; 01134 01135 // Don't let the timeout to be too large, however .. SRD 6/8/99 01136 if (rt->rt_req_timeout > CURRENT_TIME + MAX_RREQ_TIMEOUT) 01137 rt->rt_req_timeout = CURRENT_TIME + MAX_RREQ_TIMEOUT; 01138 rt->rt_expire = 0; 01139 01140 #ifdef DEBUG 01141 fprintf(stderr, "(%2d) - %2d sending Route Request, dst: %d, tout %f ms\n", 01142 ++route_request, 01143 index, rt->rt_dst, 01144 rt->rt_req_timeout - CURRENT_TIME); 01145 #endif // DEBUG 01146 01147 01148 // Fill out the RREQ packet 01149 // ch->uid() = 0; 01150 ch->ptype() = PT_AODV; 01151 ch->size() = IP_HDR_LEN + rq->size(); 01152 ch->iface() = -2; 01153 ch->error() = 0; 01154 ch->addr_type() = NS_AF_NONE; 01155 ch->prev_hop_ = index; // AODV hack 01156 01157 ih->saddr() = index; 01158 ih->daddr() = IP_BROADCAST; 01159 ih->sport() = RT_PORT; 01160 ih->dport() = RT_PORT; 01161 01162 // Fill up some more fields. 01163 rq->rq_type = AODVTYPE_RREQ; 01164 rq->rq_hop_count = 1; 01165 rq->rq_bcast_id = bid++; 01166 rq->rq_dst = dst; 01167 rq->rq_dst_seqno = (rt ? rt->rt_seqno : 0); 01168 rq->rq_src = index; 01169 seqno += 2; 01170 assert ((seqno%2) == 0); 01171 rq->rq_src_seqno = seqno; 01172 rq->rq_timestamp = CURRENT_TIME; 01173 01174 Scheduler::instance().schedule(target_, p, 0.); 01175 01176 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Reimplemented in MessagePassingAgent. |
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
Reimplemented in MessagePassingAgent. Definition at line 420 of file agent.cc.
|
|
||||||||||||||||||||
|
Definition at line 411 of file agent.cc. References abort(). Referenced by Agent::command(), AnWormApp::probe(), and DnhWormApp::send_probe(). 00413 { 00414 fprintf(stderr, 00415 "Agent::sendmsg(int, AppData*, const char*) not implemented\n"); 00416 abort(); 00417 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 103 of file agent.h. References Agent::type_. Referenced by Agent::command(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), and CBR_PP_Traffic::init(). 00103 { type_ = pkttype; }
|
|
|
Definition at line 51 of file connector.h. References Connector::drop_. Referenced by XCPWrapQ::command(). 00051 {drop_ = dt; }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 98 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(), TelnetApp::timeout(), and SctpApp1::timeout(). 00098 { return size_; }
|
|
|
Definition at line 49 of file connector.h. References Connector::target(), and Connector::target_.
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(), MIPMHAgent::reg(), MIPBSAgent::send_ads(), and Connector::target(). 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().
|
|
|
Reimplemented in SctpAgent, and 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 149 of file agent.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented in BayFullTcpAgent. Definition at line 137 of file agent.h. Referenced by Agent::attachApp(), Agent::idle(), RapAgent::IpgTimeout(), UdpAgent::recv(), TPAgent::recv(), SimpleTcpAgent::recv(), RapAgent::recv(), MessagePassingAgent::recv(), HttpInvalAgent::recv(), Agent::recv(), and Agent::recvBytes(). |
|
|
Definition at line 280 of file aodv.h. Referenced by AODV(), and sendRequest(). |
|
|
Definition at line 284 of file aodv.h. Referenced by AODV(), id_insert(), id_lookup(), and id_purge(). |
|
|
Definition at line 289 of file aodv.h. Referenced by command(). |
|
|
|
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(). |
|
|
Definition at line 124 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
|
|
|
Definition at line 59 of file connector.h. Referenced by XCPWrapQ::command(), Connector::command(), Connector::drop(), ErrorModel::recv(), and Connector::setDropTarget(). |
|
|
Reimplemented in AckRecons. Definition at line 118 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 148 of file agent.h. Referenced by TcpAgent::command(), and TcpAgent::trace_event(). |
|
|
Definition at line 121 of file agent.h. Referenced by Agent::delay_bind_dispatch(), AbsTcpAgent::flowid(), Agent::initpkt(), CtrMcastEncap::recv(), Sack1TcpAgent::timeout(), and TcpAgent::trace_event(). |
|
|
Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent. Definition at line 123 of file agent.h. Referenced by Agent::delay_bind_dispatch(). |
|
|
|
Definition at line 290 of file aodv.h. Referenced by command(). |
|
|
|
|
|
Definition at line 278 of file aodv.h. Referenced by AODV(), command(), handle_link_failure(), log_link_broke(), log_link_del(), log_link_kept(), recvError(), recvReply(), recvRequest(), rt_resolve(), sendError(), sendHello(), sendReply(), and sendRequest(). |
|
|
Definition at line 309 of file aodv.h. Referenced by AODV(), command(), log_link_broke(), log_link_del(), and log_link_kept(). |
|
|
Definition at line 293 of file aodv.h. Referenced by local_rt_repair(). |
|
|
Definition at line 283 of file aodv.h. Referenced by AODV(), nb_delete(), nb_insert(), nb_lookup(), and nb_purge(). |
|
|
Definition at line 291 of file aodv.h. Referenced by command(). |
|
|
Definition at line 135 of file agent.h. Referenced by Agent::insertOldValue(), Agent::lookupOldValue(), and Agent::~Agent(). |
|
|
Definition at line 122 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 303 of file aodv.h. Referenced by command(), local_rt_repair(), recvReply(), recvRequest(), rt_purge(), rt_resolve(), and sendRequest(). |
|
|
Definition at line 298 of file aodv.h. Referenced by LocalRepairTimer::handle(), handle_link_failure(), recvError(), recvReply(), recvRequest(), rt_purge(), rt_resolve(), sendReply(), and sendRequest(). |
|
|
|
|
|
Definition at line 292 of file aodv.h. Referenced by command(). |
|
|
Definition at line 279 of file aodv.h. Referenced by AODV(), nb_delete(), nb_insert(), sendHello(), and sendRequest(). |
|
|
|
|
Definition at line 134 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::deleteAgentTrace(), Agent::flushAVar(), Agent::monitorAgentTrace(), and Agent::trace(). |
|
|
Definition at line 120 of file agent.h. Referenced by Agent::get_pkttype(), Agent::initpkt(), FullTcpAgent::listen(), BayFullTcpAgent::listen(), RapAgent::SendAck(), SRMAgent::sendmsg(), RapAgent::SendPacket(), Agent::set_pkttype(), and XcpAgent::XcpAgent(). |
|
|
Definition at line 131 of file agent.h. Referenced by imepAgent::handlerControlTimer(), Agent::initpkt(), imepAgent::sendAck(), imepAgent::sendBeacon(), toraAgent::sendCLR(), imepAgent::sendHello(), toraAgent::sendQRY(), and toraAgent::sendUPD(). |
1.4.6