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


Public Member Functions | |
| AODV (nsaddr_t id) | |
| void | recv (Packet *p, Handler *) |
| void | rt_ll_failed (Packet *p) |
| void | handle_link_failure (nsaddr_t id) |
| 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 | |
| int | command (int, const char *const *) |
| int | initialized () |
| 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 | rt_down (aodv_rt_entry *rt) |
| void | local_rt_repair (aodv_rt_entry *rt, Packet *p) |
| void | rt_purge (void) |
| void | enque (aodv_rt_entry *rt, Packet *p) |
| Packet * | deque (aodv_rt_entry *rt) |
| void | nb_insert (nsaddr_t id) |
| AODV_Neighbor * | nb_lookup (nsaddr_t id) |
| void | nb_delete (nsaddr_t id) |
| void | nb_purge (void) |
| void | id_insert (nsaddr_t id, u_int32_t bid) |
| bool | id_lookup (nsaddr_t id, u_int32_t bid) |
| void | id_purge (void) |
| void | forward (aodv_rt_entry *rt, Packet *p, double delay) |
| void | sendHello (void) |
| void | sendRequest (nsaddr_t dst) |
| void | sendReply (nsaddr_t ipdst, u_int32_t hop_count, nsaddr_t rpdst, u_int32_t rpseq, u_int32_t lifetime, double timestamp) |
| void | sendError (Packet *p, bool jitter=true) |
| void | recvAODV (Packet *p) |
| void | recvHello (Packet *p) |
| void | recvRequest (Packet *p) |
| void | recvReply (Packet *p) |
| void | recvError (Packet *p) |
| double | PerHopTime (aodv_rt_entry *rt) |
| void | log_link_del (nsaddr_t dst) |
| void | log_link_broke (Packet *p) |
| void | log_link_kept (nsaddr_t dst) |
| 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 | |
| nsaddr_t | index |
| u_int32_t | seqno |
| int | bid |
| aodv_rtable | rthead |
| aodv_ncache | nbhead |
| aodv_bcache | bihead |
| BroadcastTimer | btimer |
| HelloTimer | htimer |
| NeighborTimer | ntimer |
| RouteCacheTimer | rtimer |
| LocalRepairTimer | lrtimer |
| aodv_rtable | rtable |
| aodv_rqueue | rqueue |
| Trace * | logtarget |
| PriQueue * | ifqueue |
| 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_ |
Friends | |
| class | aodv_rt_entry |
| class | BroadcastTimer |
| class | HelloTimer |
| class | NeighborTimer |
| class | RouteCacheTimer |
| class | LocalRepairTimer |
|
|
Definition at line 133 of file aodv.cc. References bid, bihead, index, LIST_INIT, logtarget, nbhead, PT_AODV, and seqno.
|
|
|
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 80 of file aodv.cc. References btimer, Agent::command(), aodv_rqueue::command(), RouteCacheTimer::handle(), NeighborTimer::handle(), HelloTimer::handle(), BroadcastTimer::handle(), htimer, index, logtarget, ntimer, rqueue, and rtimer.
00080 {
00081 if(argc == 2) {
00082 Tcl& tcl = Tcl::instance();
00083
00084 if(strncasecmp(argv[1], "id", 2) == 0) {
00085 tcl.resultf("%d", index);
00086 return TCL_OK;
00087 }
00088
00089 if(strncasecmp(argv[1], "start", 2) == 0) {
00090 btimer.handle((Event*) 0);
00091
00092 #ifndef AODV_LINK_LAYER_DETECTION
00093 htimer.handle((Event*) 0);
00094 ntimer.handle((Event*) 0);
00095 #endif // LINK LAYER DETECTION
00096
00097 rtimer.handle((Event*) 0);
00098 return TCL_OK;
00099 }
00100 }
00101 else if(argc == 3) {
00102 if(strcmp(argv[1], "index") == 0) {
00103 index = atoi(argv[2]);
00104 return TCL_OK;
00105 }
00106
00107 else if(strcmp(argv[1], "log-target") == 0 || strcmp(argv[1], "tracetarget") == 0) {
00108 logtarget = (Trace*) TclObject::lookup(argv[2]);
00109 if(logtarget == 0)
00110 return TCL_ERROR;
00111 return TCL_OK;
00112 }
00113 else if(strcmp(argv[1], "drop-target") == 0) {
00114 int stat = rqueue.command(argc,argv);
00115 if (stat != TCL_OK) return stat;
00116 return Agent::command(argc, argv);
00117 }
00118 else if(strcmp(argv[1], "if-queue") == 0) {
00119 ifqueue = (PriQueue*) TclObject::lookup(argv[2]);
00120
00121 if(ifqueue == 0)
00122 return TCL_ERROR;
00123 return TCL_OK;
00124 }
00125 }
00126 return Agent::command(argc, argv);
00127 }
|
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 991 of file aodv.cc. References __PRETTY_FUNCTION__, ACTIVE_ROUTE_TIMEOUT, CURRENT_TIME, hdr_cmn::DOWN, Connector::drop(), DROP_RTR_TTL, HDR_CMN, HDR_IP, Scheduler::instance(), IP_BROADCAST, NS_AF_INET, NS_AF_NONE, nsaddr_t, aodv_rt_entry::rt_expire, aodv_rt_entry::rt_flags, aodv_rt_entry::rt_nexthop, RTF_UP, Scheduler::schedule(), Connector::target_, and Random::uniform(). Referenced by recv(), recvReply(), recvRequest(), rt_purge(), and rt_resolve().
00991 {
00992 struct hdr_cmn *ch = HDR_CMN(p);
00993 struct hdr_ip *ih = HDR_IP(p);
00994
00995 if(ih->ttl_ == 0) {
00996
00997 #ifdef DEBUG
00998 fprintf(stderr, "%s: calling drop()\n", __PRETTY_FUNCTION__);
00999 #endif // DEBUG
01000
01001 drop(p, DROP_RTR_TTL);
01002 return;
01003 }
01004
01005 if (rt) {
01006 assert(rt->rt_flags == RTF_UP);
01007 rt->rt_expire = CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT;
01008 ch->next_hop_ = rt->rt_nexthop;
01009 ch->addr_type() = NS_AF_INET;
01010 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction
01011 }
01012 else { // if it is a broadcast packet
01013 // assert(ch->ptype() == PT_AODV); // maybe a diff pkt type like gaf
01014 assert(ih->daddr() == (nsaddr_t) IP_BROADCAST);
01015 ch->addr_type() = NS_AF_NONE;
01016 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction
01017 }
01018
01019 if (ih->daddr() == (nsaddr_t) IP_BROADCAST) {
01020 // If it is a broadcast packet
01021 assert(rt == 0);
01022 /*
01023 * Jitter the sending of broadcast packets by 10ms
01024 */
01025 Scheduler::instance().schedule(target_, p,
01026 0.01 * Random::uniform());
01027 }
01028 else { // Not a broadcast packet
01029 if(delay > 0.0) {
01030 Scheduler::instance().schedule(target_, p, delay);
01031 }
01032 else {
01033 // Not a broadcast packet, no delay, send immediately
01034 Scheduler::instance().schedule(target_, p, 0.);
01035 }
01036 }
01037
01038 }
|
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 343 of file aodv.cc. References Packet::alloc(), CURRENT_TIME, Packet::free(), 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, and sendError(). Referenced by nb_delete().
00343 {
00344 aodv_rt_entry *rt, *rtn;
00345 Packet *rerr = Packet::alloc();
00346 struct hdr_aodv_error *re = HDR_AODV_ERROR(rerr);
00347
00348 re->DestCount = 0;
00349 for(rt = rtable.head(); rt; rt = rtn) { // for each rt entry
00350 rtn = rt->rt_link.le_next;
00351 if ((rt->rt_hops != INFINITY2) && (rt->rt_nexthop == id) ) {
00352 assert (rt->rt_flags == RTF_UP);
00353 assert((rt->rt_seqno%2) == 0);
00354 rt->rt_seqno++;
00355 re->unreachable_dst[re->DestCount] = rt->rt_dst;
00356 re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno;
00357 #ifdef DEBUG
00358 fprintf(stderr, "%s(%f): %d\t(%d\t%u\t%d)\n", __FUNCTION__, CURRENT_TIME,
00359 index, re->unreachable_dst[re->DestCount],
00360 re->unreachable_dst_seqno[re->DestCount], rt->rt_nexthop);
00361 #endif // DEBUG
00362 re->DestCount += 1;
00363 rt_down(rt);
00364 }
00365 // remove the lost neighbor from all the precursor lists
00366 rt->pc_delete(id);
00367 }
00368
00369 if (re->DestCount > 0) {
00370 #ifdef DEBUG
00371 fprintf(stderr, "%s(%f): %d\tsending RERR...\n", __FUNCTION__, CURRENT_TIME, index);
00372 #endif // DEBUG
00373 sendError(rerr, false);
00374 }
00375 else {
00376 Packet::free(rerr);
00377 }
00378 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 216 of file aodv.cc. References BCAST_ID_SAVE, bihead, CURRENT_TIME, BroadcastID::expire, and LIST_INSERT_HEAD. Referenced by recvRequest().
00216 {
00217 BroadcastID *b = new BroadcastID(id, bid);
00218
00219 assert(b);
00220 b->expire = CURRENT_TIME + BCAST_ID_SAVE;
00221 LIST_INSERT_HEAD(&bihead, b, link);
00222 }
|
|
||||||||||||
|
Definition at line 226 of file aodv.cc. References bihead, BroadcastID::id, and BroadcastID::src. Referenced by recvRequest().
00226 {
00227 BroadcastID *b = bihead.lh_first;
00228
00229 // Search the list for a match of source and bid
00230 for( ; b; b = b->link.le_next) {
00231 if ((b->src == id) && (b->id == bid))
00232 return true;
00233 }
00234 return false;
00235 }
|
|
|
Definition at line 238 of file aodv.cc. References bihead, CURRENT_TIME, BroadcastID::expire, and LIST_REMOVE. Referenced by BroadcastTimer::handle().
00238 {
00239 BroadcastID *b = bihead.lh_first;
00240 BroadcastID *bn;
00241 double now = CURRENT_TIME;
00242
00243 for(; b; b = bn) {
00244 bn = b->link.le_next;
00245 if(b->expire <= now) {
00246 LIST_REMOVE(b,link);
00247 delete b;
00248 }
00249 }
00250 }
|
|
|
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 215 of file aodv.h. References Connector::target_. Referenced by recv().
00215 { return 1 && target_; }
|
|
|
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 381 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(). Referenced by rt_ll_failed().
00381 {
00382 #ifdef DEBUG
00383 fprintf(stderr,"%s: Dst - %d\n", __FUNCTION__, rt->rt_dst);
00384 #endif
00385 // Buffer the packet
00386 rqueue.enque(p);
00387
00388 // mark the route as under repair
00389 rt->rt_flags = RTF_IN_REPAIR;
00390
00391 sendRequest(rt->rt_dst);
00392
00393 // set up a timer interrupt
00394 Scheduler::instance().schedule(&lrtimer, p->copy(), rt->rt_req_timeout);
00395 }
|
Here is the call graph for this function:

|
|
Definition at line 67 of file aodv_logs.cc. References BaseTrace::buffer(), CURRENT_TIME, BaseTrace::dump(), HDR_CMN, index, logtarget, Trace::pt_, and verbose. Referenced by rt_ll_failed().
00068 {
00069 static int link_broke = 0;
00070 struct hdr_cmn *ch = HDR_CMN(p);
00071
00072 if(! logtarget || ! verbose) return;
00073
00074 sprintf(logtarget->pt_->buffer(),
00075 "A %.9f _%d_ LL unable to deliver packet %d to %d (%d) (reason = %d, ifqlen = %d)",
00076 CURRENT_TIME,
00077 index,
00078 ch->uid_,
00079 ch->next_hop_,
00080 ++link_broke,
00081 ch->xmit_reason_,
00082 ifqueue->length());
00083 logtarget->pt_->dump();
00084 }
|
Here is the call graph for this function:

|
|
Definition at line 45 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(), and rt_ll_failed().
00046 {
00047 static int link_del = 0;
00048
00049 if(! logtarget || ! verbose) return;
00050
00051 /*
00052 * If "god" thinks that these two nodes are still
00053 * reachable then this is an erroneous deletion.
00054 */
00055 sprintf(logtarget->pt_->buffer(),
00056 "A %.9f _%d_ deleting LL hop to %d (delete %d is %s)",
00057 CURRENT_TIME,
00058 index,
00059 dst,
00060 ++link_del,
00061 God::instance()->hops(index, dst) != 1 ? "VALID" : "INVALID");
00062 logtarget->pt_->dump();
00063 }
|
Here is the call graph for this function:

|
|
Definition at line 87 of file aodv_logs.cc. References BaseTrace::buffer(), CURRENT_TIME, BaseTrace::dump(), God::hops(), index, God::instance(), logtarget, Trace::pt_, and verbose.
00088 {
00089 static int link_kept = 0;
00090
00091 if(! logtarget || ! verbose) return;
00092
00093
00094 /*
00095 * If "god" thinks that these two nodes are now
00096 * unreachable, then we are erroneously keeping
00097 * a bad route.
00098 */
00099 sprintf(logtarget->pt_->buffer(),
00100 "A %.9f _%d_ keeping LL hop to %d (keep %d is %s)",
00101 CURRENT_TIME,
00102 index,
00103 dst,
00104 ++link_kept,
00105 God::instance()->hops(index, dst) == 1 ? "VALID" : "INVALID");
00106 logtarget->pt_->dump();
00107 }
|
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 1333 of file aodv.cc. References handle_link_failure(), LIST_REMOVE, log_link_del(), AODV_Neighbor::nb_addr, nbhead, and seqno. Referenced by nb_purge(), and rt_ll_failed().
01333 {
01334 AODV_Neighbor *nb = nbhead.lh_first;
01335
01336 log_link_del(id);
01337 seqno += 2; // Set of neighbors changed
01338 assert ((seqno%2) == 0);
01339
01340 for(; nb; nb = nb->nb_link.le_next) {
01341 if(nb->nb_addr == id) {
01342 LIST_REMOVE(nb,nb_link);
01343 delete nb;
01344 break;
01345 }
01346 }
01347
01348 handle_link_failure(id);
01349
01350 }
|
Here is the call graph for this function:

|
|
Definition at line 1305 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().
01305 {
01306 AODV_Neighbor *nb = new AODV_Neighbor(id);
01307
01308 assert(nb);
01309 nb->nb_expire = CURRENT_TIME +
01310 (1.5 * ALLOWED_HELLO_LOSS * HELLO_INTERVAL);
01311 LIST_INSERT_HEAD(&nbhead, nb, nb_link);
01312 seqno += 2; // set of neighbors changed
01313 assert ((seqno%2) == 0);
01314 }
|
|
|
Definition at line 1318 of file aodv.cc. References AODV_Neighbor::nb_addr, and nbhead. Referenced by recvHello().
01318 {
01319 AODV_Neighbor *nb = nbhead.lh_first;
01320
01321 for(; nb; nb = nb->nb_link.le_next) {
01322 if(nb->nb_addr == id) break;
01323 }
01324 return nb;
01325 }
|
|
|
Definition at line 1358 of file aodv.cc. References CURRENT_TIME, AODV_Neighbor::nb_addr, nb_delete(), AODV_Neighbor::nb_expire, and nbhead. Referenced by NeighborTimer::handle().
01358 {
01359 AODV_Neighbor *nb = nbhead.lh_first;
01360 AODV_Neighbor *nbn;
01361 double now = CURRENT_TIME;
01362
01363 for(; nb; nb = nbn) {
01364 nbn = nb->nb_link.le_next;
01365 if(nb->nb_expire <= now) {
01366 nb_delete(nb->nb_addr);
01367 }
01368 }
01369
01370 }
|
Here is the call graph for this function:

|
|
Definition at line 257 of file aodv.cc. References MAX_HISTORY, NODE_TRAVERSAL_TIME, and aodv_rt_entry::rt_disc_latency. Referenced by sendRequest().
00257 {
00258 int num_non_zero = 0, i;
00259 double total_latency = 0.0;
00260
00261 if (!rt)
00262 return ((double) NODE_TRAVERSAL_TIME );
00263
00264 for (i=0; i < MAX_HISTORY; i++) {
00265 if (rt->rt_disc_latency[i] > 0.0) {
00266 num_non_zero++;
00267 total_latency += rt->rt_disc_latency[i];
00268 }
00269 }
00270 if (num_non_zero > 0)
00271 return(total_latency / (double) num_non_zero);
00272 else
00273 return((double) NODE_TRAVERSAL_TIME);
00274
00275 }
|
|
|
Definition at line 97 of file agent.h. References Agent::here_, nsaddr_t, and ns_addr_t::port_. Referenced by LmsAgent::pkt2agent(), TcpAsymSink::recv(), MIPBSAgent::recv(), LmsAgent::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 552 of file aodv.cc. References Connector::drop(), DROP_RTR_ROUTE_LOOP, DROP_RTR_TTL, forward(), HDR_CMN, HDR_IP, index, initialized(), IP_BROADCAST, IP_HDR_LEN, NETWORK_DIAMETER, NO_DELAY, PT_AODV, recvAODV(), rt_resolve(), and u_int32_t.
00552 {
00553 struct hdr_cmn *ch = HDR_CMN(p);
00554 struct hdr_ip *ih = HDR_IP(p);
00555
00556 assert(initialized());
00557 //assert(p->incoming == 0);
00558 // 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.
00559
00560 if(ch->ptype() == PT_AODV) {
00561 ih->ttl_ -= 1;
00562 recvAODV(p);
00563 return;
00564 }
00565
00566 /*
00567 * Must be a packet I'm originating...
00568 */
00569 if((ih->saddr() == index) && (ch->num_forwards() == 0)) {
00570 /*
00571 * Add the IP Header
00572 */
00573 ch->size() += IP_HDR_LEN;
00574 // Added by Parag Dadhania && John Novatnack to handle broadcasting
00575 if ( (u_int32_t)ih->daddr() != IP_BROADCAST)
00576 ih->ttl_ = NETWORK_DIAMETER;
00577 }
00578 /*
00579 * I received a packet that I sent. Probably
00580 * a routing loop.
00581 */
00582 else if(ih->saddr() == index) {
00583 drop(p, DROP_RTR_ROUTE_LOOP);
00584 return;
00585 }
00586 /*
00587 * Packet I'm forwarding...
00588 */
00589 else {
00590 /*
00591 * Check the TTL. If it is zero, then discard.
00592 */
00593 if(--ih->ttl_ == 0) {
00594 drop(p, DROP_RTR_TTL);
00595 return;
00596 }
00597 }
00598 // Added by Parag Dadhania && John Novatnack to handle broadcasting
00599 if ( (u_int32_t)ih->daddr() != IP_BROADCAST)
00600 rt_resolve(p);
00601 else
00602 forward((aodv_rt_entry*) 0, p, NO_DELAY);
00603 }
|
Here is the call graph for this function:

|
|
Definition at line 607 of file aodv.cc. References AODVTYPE_HELLO, AODVTYPE_RERR, AODVTYPE_RREP, AODVTYPE_RREQ, HDR_AODV, HDR_IP, recvError(), recvHello(), recvReply(), recvRequest(), and RT_PORT. Referenced by recv().
00607 {
00608 struct hdr_aodv *ah = HDR_AODV(p);
00609 struct hdr_ip *ih = HDR_IP(p);
00610
00611 assert(ih->sport() == RT_PORT);
00612 assert(ih->dport() == RT_PORT);
00613
00614 /*
00615 * Incoming Packets.
00616 */
00617 switch(ah->ah_type) {
00618
00619 case AODVTYPE_RREQ:
00620 recvRequest(p);
00621 break;
00622
00623 case AODVTYPE_RREP:
00624 recvReply(p);
00625 break;
00626
00627 case AODVTYPE_RERR:
00628 recvError(p);
00629 break;
00630
00631 case AODVTYPE_HELLO:
00632 recvHello(p);
00633 break;
00634
00635 default:
00636 fprintf(stderr, "Invalid AODV type (%x)\n", ah->ah_type);
00637 exit(1);
00638 }
00639
00640 }
|
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:

|
|
Definition at line 929 of file aodv.cc. References Packet::alloc(), CURRENT_TIME, Connector::drop(), DROP_RTR_MAC_CALLBACK, Packet::free(), HDR_AODV_ERROR, HDR_IP, index, INFINITY2, aodv_rt_entry::pc_delete(), aodv_rt_entry::pc_empty(), 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, sendError(), and u_int8_t. Referenced by recvAODV().
00929 {
00930 struct hdr_ip *ih = HDR_IP(p);
00931 struct hdr_aodv_error *re = HDR_AODV_ERROR(p);
00932 aodv_rt_entry *rt;
00933 u_int8_t i;
00934 Packet *rerr = Packet::alloc();
00935 struct hdr_aodv_error *nre = HDR_AODV_ERROR(rerr);
00936
00937 nre->DestCount = 0;
00938
00939 for (i=0; i<re->DestCount; i++) {
00940 // For each unreachable destination
00941 rt = rtable.rt_lookup(re->unreachable_dst[i]);
00942 if ( rt && (rt->rt_hops != INFINITY2) &&
00943 (rt->rt_nexthop == ih->saddr()) &&
00944 (rt->rt_seqno <= re->unreachable_dst_seqno[i]) ) {
00945 assert(rt->rt_flags == RTF_UP);
00946 assert((rt->rt_seqno%2) == 0); // is the seqno even?
00947 #ifdef DEBUG
00948 fprintf(stderr, "%s(%f): %d\t(%d\t%u\t%d)\t(%d\t%u\t%d)\n", __FUNCTION__,CURRENT_TIME,
00949 index, rt->rt_dst, rt->rt_seqno, rt->rt_nexthop,
00950 re->unreachable_dst[i],re->unreachable_dst_seqno[i],
00951 ih->saddr());
00952 #endif // DEBUG
00953 rt->rt_seqno = re->unreachable_dst_seqno[i];
00954 rt_down(rt);
00955
00956 // Not sure whether this is the right thing to do
00957 Packet *pkt;
00958 while((pkt = ifqueue->filter(ih->saddr()))) {
00959 drop(pkt, DROP_RTR_MAC_CALLBACK);
00960 }
00961
00962 // if precursor list non-empty add to RERR and delete the precursor list
00963 if (!rt->pc_empty()) {
00964 nre->unreachable_dst[nre->DestCount] = rt->rt_dst;
00965 nre->unreachable_dst_seqno[nre->DestCount] = rt->rt_seqno;
00966 nre->DestCount += 1;
00967 rt->pc_delete();
00968 }
00969 }
00970 }
00971
00972 if (nre->DestCount > 0) {
00973 #ifdef DEBUG
00974 fprintf(stderr, "%s(%f): %d\t sending RERR...\n", __FUNCTION__, CURRENT_TIME, index);
00975 #endif // DEBUG
00976 sendError(rerr);
00977 }
00978 else {
00979 Packet::free(rerr);
00980 }
00981
00982 Packet::free(p);
00983 }
|
Here is the call graph for this function:

|
|
Definition at line 1287 of file aodv.cc. References ALLOWED_HELLO_LOSS, CURRENT_TIME, Packet::free(), HDR_AODV_REPLY, HELLO_INTERVAL, AODV_Neighbor::nb_expire, nb_insert(), and nb_lookup(). Referenced by recvAODV().
01287 {
01288 //struct hdr_ip *ih = HDR_IP(p);
01289 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
01290 AODV_Neighbor *nb;
01291
01292 nb = nb_lookup(rp->rp_dst);
01293 if(nb == 0) {
01294 nb_insert(rp->rp_dst);
01295 }
01296 else {
01297 nb->nb_expire = CURRENT_TIME +
01298 (1.5 * ALLOWED_HELLO_LOSS * HELLO_INTERVAL);
01299 }
01300
01301 Packet::free(p);
01302 }
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Definition at line 78 of file agent.h.
00078 {};
|
|
|
Definition at line 814 of file aodv.cc. References ARP_DELAY, CURRENT_TIME, aodv_rqueue::deque(), Connector::drop(), DROP_RTR_NO_ROUTE, forward(), Packet::free(), HDR_AODV_REPLY, HDR_IP, aodv_rt_entry::hist_indx, index, INFINITY2, MAX_HISTORY, NO_DELAY, aodv_rt_entry::pc_insert(), 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_nexthop, 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().
00814 {
00815 //struct hdr_cmn *ch = HDR_CMN(p);
00816 struct hdr_ip *ih = HDR_IP(p);
00817 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
00818 aodv_rt_entry *rt;
00819 char suppress_reply = 0;
00820 double delay = 0.0;
00821
00822 #ifdef DEBUG
00823 fprintf(stderr, "%d - %s: received a REPLY\n", index, __FUNCTION__);
00824 #endif // DEBUG
00825
00826
00827 /*
00828 * Got a reply. So reset the "soft state" maintained for
00829 * route requests in the request table. We don't really have
00830 * have a separate request table. It is just a part of the
00831 * routing table itself.
00832 */
00833 // Note that rp_dst is the dest of the data packets, not the
00834 // the dest of the reply, which is the src of the data packets.
00835
00836 rt = rtable.rt_lookup(rp->rp_dst);
00837
00838 /*
00839 * If I don't have a rt entry to this host... adding
00840 */
00841 if(rt == 0) {
00842 rt = rtable.rt_add(rp->rp_dst);
00843 }
00844
00845 /*
00846 * Add a forward route table entry... here I am following
00847 * Perkins-Royer AODV paper almost literally - SRD 5/99
00848 */
00849
00850 if ( (rt->rt_seqno < rp->rp_dst_seqno) || // newer route
00851 ((rt->rt_seqno == rp->rp_dst_seqno) &&
00852 (rt->rt_hops > rp->rp_hop_count)) ) { // shorter or better route
00853
00854 // Update the rt entry
00855 rt_update(rt, rp->rp_dst_seqno, rp->rp_hop_count,
00856 rp->rp_src, CURRENT_TIME + rp->rp_lifetime);
00857
00858 // reset the soft state
00859 rt->rt_req_cnt = 0;
00860 rt->rt_req_timeout = 0.0;
00861 rt->rt_req_last_ttl = rp->rp_hop_count;
00862
00863 if (ih->daddr() == index) { // If I am the original source
00864 // Update the route discovery latency statistics
00865 // rp->rp_timestamp is the time of request origination
00866
00867 rt->rt_disc_latency[rt->hist_indx] = (CURRENT_TIME - rp->rp_timestamp)
00868 / (double) rp->rp_hop_count;
00869 // increment indx for next time
00870 rt->hist_indx = (rt->hist_indx + 1) % MAX_HISTORY;
00871 }
00872
00873 /*
00874 * Send all packets queued in the sendbuffer destined for
00875 * this destination.
00876 * XXX - observe the "second" use of p.
00877 */
00878 Packet *buf_pkt;
00879 while((buf_pkt = rqueue.deque(rt->rt_dst))) {
00880 if(rt->rt_hops != INFINITY2) {
00881 assert (rt->rt_flags == RTF_UP);
00882 // Delay them a little to help ARP. Otherwise ARP
00883 // may drop packets. -SRD 5/23/99
00884 forward(rt, buf_pkt, delay);
00885 delay += ARP_DELAY;
00886 }
00887 }
00888 }
00889 else {
00890 suppress_reply = 1;
00891 }
00892
00893 /*
00894 * If reply is for me, discard it.
00895 */
00896
00897 if(ih->daddr() == index || suppress_reply) {
00898 Packet::free(p);
00899 }
00900 /*
00901 * Otherwise, forward the Route Reply.
00902 */
00903 else {
00904 // Find the rt entry
00905 aodv_rt_entry *rt0 = rtable.rt_lookup(ih->daddr());
00906 // If the rt is up, forward
00907 if(rt0 && (rt0->rt_hops != INFINITY2)) {
00908 assert (rt0->rt_flags == RTF_UP);
00909 rp->rp_hop_count += 1;
00910 rp->rp_src = index;
00911 forward(rt0, p, NO_DELAY);
00912 // Insert the nexthop towards the RREQ source to
00913 // the precursor list of the RREQ destination
00914 rt->pc_insert(rt0->rt_nexthop); // nexthop to RREQ source
00915
00916 }
00917 else {
00918 // I don't know how to forward .. drop the reply.
00919 #ifdef DEBUG
00920 fprintf(stderr, "%s: dropping Route Reply\n", __FUNCTION__);
00921 #endif // DEBUG
00922 drop(p, DROP_RTR_NO_ROUTE);
00923 }
00924 }
00925 }
|
Here is the call graph for this function:

|
|
Definition at line 644 of file aodv.cc. References ACTIVE_ROUTE_TIMEOUT, CURRENT_TIME, DELAY, aodv_rqueue::deque(), forward(), Packet::free(), HDR_AODV_REQUEST, HDR_IP, id_insert(), id_lookup(), index, INFINITY2, IP_BROADCAST, max, MY_ROUTE_TIMEOUT, NO_DELAY, aodv_rt_entry::pc_insert(), REV_ROUTE_LIFE, 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_nexthop, 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, sendReply(), seqno, and u_int32_t. Referenced by recvAODV().
00644 {
00645 struct hdr_ip *ih = HDR_IP(p);
00646 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
00647 aodv_rt_entry *rt;
00648
00649 /*
00650 * Drop if:
00651 * - I'm the source
00652 * - I recently heard this request.
00653 */
00654
00655 if(rq->rq_src == index) {
00656 #ifdef DEBUG
00657 fprintf(stderr, "%s: got my own REQUEST\n", __FUNCTION__);
00658 #endif // DEBUG
00659 Packet::free(p);
00660 return;
00661 }
00662
00663 if (id_lookup(rq->rq_src, rq->rq_bcast_id)) {
00664
00665 #ifdef DEBUG
00666 fprintf(stderr, "%s: discarding request\n", __FUNCTION__);
00667 #endif // DEBUG
00668
00669 Packet::free(p);
00670 return;
00671 }
00672
00673 /*
00674 * Cache the broadcast ID
00675 */
00676 id_insert(rq->rq_src, rq->rq_bcast_id);
00677
00678
00679
00680 /*
00681 * We are either going to forward the REQUEST or generate a
00682 * REPLY. Before we do anything, we make sure that the REVERSE
00683 * route is in the route table.
00684 */
00685 aodv_rt_entry *rt0; // rt0 is the reverse route
00686
00687 rt0 = rtable.rt_lookup(rq->rq_src);
00688 if(rt0 == 0) { /* if not in the route table */
00689 // create an entry for the reverse route.
00690 rt0 = rtable.rt_add(rq->rq_src);
00691 }
00692
00693 rt0->rt_expire = max(rt0->rt_expire, (CURRENT_TIME + REV_ROUTE_LIFE));
00694
00695 if ( (rq->rq_src_seqno > rt0->rt_seqno ) ||
00696 ((rq->rq_src_seqno == rt0->rt_seqno) &&
00697 (rq->rq_hop_count < rt0->rt_hops)) ) {
00698 // If we have a fresher seq no. or lesser #hops for the
00699 // same seq no., update the rt entry. Else don't bother.
00700 rt_update(rt0, rq->rq_src_seqno, rq->rq_hop_count, ih->saddr(),
00701 max(rt0->rt_expire, (CURRENT_TIME + REV_ROUTE_LIFE)) );
00702 if (rt0->rt_req_timeout > 0.0) {
00703 // Reset the soft state and
00704 // Set expiry time to CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT
00705 // This is because route is used in the forward direction,
00706 // but only sources get benefited by this change
00707 rt0->rt_req_cnt = 0;
00708 rt0->rt_req_timeout = 0.0;
00709 rt0->rt_req_last_ttl = rq->rq_hop_count;
00710 rt0->rt_expire = CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT;
00711 }
00712
00713 /* Find out whether any buffered packet can benefit from the
00714 * reverse route.
00715 * May need some change in the following code - Mahesh 09/11/99
00716 */
00717 assert (rt0->rt_flags == RTF_UP);
00718 Packet *buffered_pkt;
00719 while ((buffered_pkt = rqueue.deque(rt0->rt_dst))) {
00720 if (rt0 && (rt0->rt_flags == RTF_UP)) {
00721 assert(rt0->rt_hops != INFINITY2);
00722 forward(rt0, buffered_pkt, NO_DELAY);
00723 }
00724 }
00725 }
00726 // End for putting reverse route in rt table
00727
00728
00729 /*
00730 * We have taken care of the reverse route stuff.
00731 * Now see whether we can send a route reply.
00732 */
00733
00734 rt = rtable.rt_lookup(rq->rq_dst);
00735
00736 // First check if I am the destination ..
00737
00738 if(rq->rq_dst == index) {
00739
00740 #ifdef DEBUG
00741 fprintf(stderr, "%d - %s: destination sending reply\n",
00742 index, __FUNCTION__);
00743 #endif // DEBUG
00744
00745
00746 // Just to be safe, I use the max. Somebody may have
00747 // incremented the dst seqno.
00748 seqno = max(seqno, rq->rq_dst_seqno)+1;
00749 if (seqno%2) seqno++;
00750
00751 sendReply(rq->rq_src, // IP Destination
00752 1, // Hop Count
00753 index, // Dest IP Address
00754 seqno, // Dest Sequence Num
00755 MY_ROUTE_TIMEOUT, // Lifetime
00756 rq->rq_timestamp); // timestamp
00757
00758 Packet::free(p);
00759 }
00760
00761 // I am not the destination, but I may have a fresh enough route.
00762
00763 else if (rt && (rt->rt_hops != INFINITY2) &&
00764 (rt->rt_seqno >= rq->rq_dst_seqno) ) {
00765
00766 //assert (rt->rt_flags == RTF_UP);
00767 assert(rq->rq_dst == rt->rt_dst);
00768 //assert ((rt->rt_seqno%2) == 0); // is the seqno even?
00769 sendReply(rq->rq_src,
00770 rt->rt_hops + 1,
00771 rq->rq_dst,
00772 rt->rt_seqno,
00773 (u_int32_t) (rt->rt_expire - CURRENT_TIME),
00774 // rt->rt_expire - CURRENT_TIME,
00775 rq->rq_timestamp);
00776 // Insert nexthops to RREQ source and RREQ destination in the
00777 // precursor lists of destination and source respectively
00778 rt->pc_insert(rt0->rt_nexthop); // nexthop to RREQ source
00779 rt0->pc_insert(rt->rt_nexthop); // nexthop to RREQ destination
00780
00781 #ifdef RREQ_GRAT_RREP
00782
00783 sendReply(rq->rq_dst,
00784 rq->rq_hop_count,
00785 rq->rq_src,
00786 rq->rq_src_seqno,
00787 (u_int32_t) (rt->rt_expire - CURRENT_TIME),
00788 // rt->rt_expire - CURRENT_TIME,
00789 rq->rq_timestamp);
00790 #endif
00791
00792 // TODO: send grat RREP to dst if G flag set in RREQ using rq->rq_src_seqno, rq->rq_hop_counT
00793
00794 // 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.
00795
00796 Packet::free(p);
00797 }
00798 /*
00799 * Can't reply. So forward the Route Request
00800 */
00801 else {
00802 ih->saddr() = index;
00803 ih->daddr() = IP_BROADCAST;
00804 rq->rq_hop_count += 1;
00805 // Maximum sequence number seen en route
00806 if (rt) rq->rq_dst_seqno = max(rt->rt_seqno, rq->rq_dst_seqno);
00807 forward((aodv_rt_entry*) 0, p, DELAY);
00808 }
00809
00810 }
|
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, and Queue< T >. Definition at line 70 of file object.cc. Referenced by NsObject::command().
00071 {
00072 }
|
|
|
Definition at line 409 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().
00409 {
00410 /*
00411 * Make sure that you don't "down" a route more than once.
00412 */
00413
00414 if(rt->rt_flags == RTF_DOWN) {
00415 return;
00416 }
00417
00418 // assert (rt->rt_seqno%2); // is the seqno odd?
00419 rt->rt_last_hop_count = rt->rt_hops;
00420 rt->rt_hops = INFINITY2;
00421 rt->rt_flags = RTF_DOWN;
00422 rt->rt_nexthop = 0;
00423 rt->rt_expire = 0;
00424
00425 } /* rt_down function */
|
|
|
Definition at line 290 of file aodv.cc. References DATA_PACKET, Connector::drop(), DROP_RTR_MAC_CALLBACK, HDR_CMN, HDR_IP, IP_BROADCAST, local_rt_repair(), log_link_broke(), log_link_del(), nb_delete(), nsaddr_t, aodv_rt_entry::rt_hops, aodv_rtable::rt_lookup(), rtable, and u_int32_t.
00290 {
00291 struct hdr_cmn *ch = HDR_CMN(p);
00292 struct hdr_ip *ih = HDR_IP(p);
00293 aodv_rt_entry *rt;
00294 nsaddr_t broken_nbr = ch->next_hop_;
00295
00296 #ifndef AODV_LINK_LAYER_DETECTION
00297 drop(p, DROP_RTR_MAC_CALLBACK);
00298 #else
00299
00300 /*
00301 * Non-data packets and Broadcast Packets can be dropped.
00302 */
00303 if(! DATA_PACKET(ch->ptype()) ||
00304 (u_int32_t) ih->daddr() == IP_BROADCAST) {
00305 drop(p, DROP_RTR_MAC_CALLBACK);
00306 return;
00307 }
00308 log_link_broke(p);
00309 if((rt = rtable.rt_lookup(ih->daddr())) == 0) {
00310 drop(p, DROP_RTR_MAC_CALLBACK);
00311 return;
00312 }
00313 log_link_del(ch->next_hop_);
00314
00315 #ifdef AODV_LOCAL_REPAIR
00316 /* if the broken link is closer to the dest than source,
00317 attempt a local repair. Otherwise, bring down the route. */
00318
00319
00320 if (ch->num_forwards() > rt->rt_hops) {
00321 local_rt_repair(rt, p); // local repair
00322 // retrieve all the packets in the ifq using this link,
00323 // queue the packets for which local repair is done,
00324 return;
00325 }
00326 else
00327 #endif // LOCAL REPAIR
00328
00329 {
00330 drop(p, DROP_RTR_MAC_CALLBACK);
00331 // Do the same thing for other packets in the interface queue using the
00332 // broken link -Mahesh
00333 while((p = ifqueue->filter(broken_nbr))) {
00334 drop(p, DROP_RTR_MAC_CALLBACK);
00335 }
00336 nb_delete(broken_nbr);
00337 }
00338
00339 #endif // LINK LAYER DETECTION
00340 }
|
Here is the call graph for this function:

|
|
Definition at line 499 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().
00499 {
00500 aodv_rt_entry *rt, *rtn;
00501 double now = CURRENT_TIME;
00502 double delay = 0.0;
00503 Packet *p;
00504
00505 for(rt = rtable.head(); rt; rt = rtn) { // for each rt entry
00506 rtn = rt->rt_link.le_next;
00507 if ((rt->rt_flags == RTF_UP) && (rt->rt_expire < now)) {
00508 // if a valid route has expired, purge all packets from
00509 // send buffer and invalidate the route.
00510 assert(rt->rt_hops != INFINITY2);
00511 while((p = rqueue.deque(rt->rt_dst))) {
00512 #ifdef DEBUG
00513 fprintf(stderr, "%s: calling drop()\n",
00514 __FUNCTION__);
00515 #endif // DEBUG
00516 drop(p, DROP_RTR_NO_ROUTE);
00517 }
00518 rt->rt_seqno++;
00519 assert (rt->rt_seqno%2);
00520 rt_down(rt);
00521 }
00522 else if (rt->rt_flags == RTF_UP) {
00523 // If the route is not expired,
00524 // and there are packets in the sendbuffer waiting,
00525 // forward them. This should not be needed, but this extra
00526 // check does no harm.
00527 assert(rt->rt_hops != INFINITY2);
00528 while((p = rqueue.deque(rt->rt_dst))) {
00529 forward (rt, p, delay);
00530 delay += ARP_DELAY;
00531 }
00532 }
00533 else if (rqueue.find(rt->rt_dst))
00534 // If the route is down and
00535 // if there is a packet for this destination waiting in
00536 // the sendbuffer, then send out route request. sendRequest
00537 // will check whether it is time to really send out request
00538 // or not.
00539 // This may not be crucial to do it here, as each generated
00540 // packet will do a sendRequest anyway.
00541
00542 sendRequest(rt->rt_dst);
00543 }
00544
00545 }
|
Here is the call graph for this function:

|
|
Definition at line 432 of file aodv.cc. References Packet::alloc(), aodv_rt_failed_callback(), Connector::drop(), DROP_RTR_NO_ROUTE, aodv_rqueue::enque(), forward(), HDR_AODV_ERROR, 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(), aodv_rt_entry::rt_seqno, rtable, RTF_DOWN, RTF_IN_REPAIR, RTF_UP, sendError(), and sendRequest(). Referenced by recv().
00432 {
00433 struct hdr_cmn *ch = HDR_CMN(p);
00434 struct hdr_ip *ih = HDR_IP(p);
00435 aodv_rt_entry *rt;
00436
00437 /*
00438 * Set the transmit failure callback. That
00439 * won't change.
00440 */
00441 ch->xmit_failure_ = aodv_rt_failed_callback;
00442 ch->xmit_failure_data_ = (void*) this;
00443 rt = rtable.rt_lookup(ih->daddr());
00444 if(rt == 0) {
00445 rt = rtable.rt_add(ih->daddr());
00446 }
00447
00448 /*
00449 * If the route is up, forward the packet
00450 */
00451
00452 if(rt->rt_flags == RTF_UP) {
00453 assert(rt->rt_hops != INFINITY2);
00454 forward(rt, p, NO_DELAY);
00455 }
00456 /*
00457 * if I am the source of the packet, then do a Route Request.
00458 */
00459 else if(ih->saddr() == index) {
00460 rqueue.enque(p);
00461 sendRequest(rt->rt_dst);
00462 }
00463 /*
00464 * A local repair is in progress. Buffer the packet.
00465 */
00466 else if (rt->rt_flags == RTF_IN_REPAIR) {
00467 rqueue.enque(p);
00468 }
00469
00470 /*
00471 * I am trying to forward a packet for someone else to which
00472 * I don't have a route.
00473 */
00474 else {
00475 Packet *rerr = Packet::alloc();
00476 struct hdr_aodv_error *re = HDR_AODV_ERROR(rerr);
00477 /*
00478 * For now, drop the packet and send error upstream.
00479 * Now the route errors are broadcast to upstream
00480 * neighbors - Mahesh 09/11/99
00481 */
00482
00483 assert (rt->rt_flags == RTF_DOWN);
00484 re->DestCount = 0;
00485 re->unreachable_dst[re->DestCount] = rt->rt_dst;
00486 re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno;
00487 re->DestCount += 1;
00488 #ifdef DEBUG
00489 fprintf(stderr, "%s: sending RERR...\n", __FUNCTION__);
00490 #endif
00491 sendError(rerr, false);
00492
00493 drop(p, DROP_RTR_NO_ROUTE);
00494 }
00495
00496 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 398 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().
|
|
|
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 1208 of file aodv.cc. References AODVTYPE_RERR, hdr_cmn::DOWN, HDR_AODV_ERROR, HDR_CMN, HDR_IP, index, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, NS_AF_NONE, PT_AODV, RT_PORT, Scheduler::schedule(), Connector::target_, and Random::uniform(). Referenced by handle_link_failure(), recvError(), and rt_resolve().
01208 {
01209 struct hdr_cmn *ch = HDR_CMN(p);
01210 struct hdr_ip *ih = HDR_IP(p);
01211 struct hdr_aodv_error *re = HDR_AODV_ERROR(p);
01212
01213 #ifdef ERROR
01214 fprintf(stderr, "sending Error from %d at %.2f\n", index, Scheduler::instance().clock());
01215 #endif // DEBUG
01216
01217 re->re_type = AODVTYPE_RERR;
01218 //re->reserved[0] = 0x00; re->reserved[1] = 0x00;
01219 // DestCount and list of unreachable destinations are already filled
01220
01221 // ch->uid() = 0;
01222 ch->ptype() = PT_AODV;
01223 ch->size() = IP_HDR_LEN + re->size();
01224 ch->iface() = -2;
01225 ch->error() = 0;
01226 ch->addr_type() = NS_AF_NONE;
01227 ch->next_hop_ = 0;
01228 ch->prev_hop_ = index; // AODV hack
01229 ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction
01230
01231 ih->saddr() = index;
01232 ih->daddr() = IP_BROADCAST;
01233 ih->sport() = RT_PORT;
01234 ih->dport() = RT_PORT;
01235 ih->ttl_ = 1;
01236
01237 // Do we need any jitter? Yes
01238 if (jitter)
01239 Scheduler::instance().schedule(target_, p, 0.01*Random::uniform());
01240 else
01241 Scheduler::instance().schedule(target_, p, 0.0);
01242
01243 }
|
Here is the call graph for this function:

|
|
Definition at line 1251 of file aodv.cc. References Packet::alloc(), ALLOWED_HELLO_LOSS, AODVTYPE_HELLO, HDR_AODV_REPLY, HDR_CMN, HDR_IP, HELLO_INTERVAL, index, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, NS_AF_NONE, PT_AODV, RT_PORT, Scheduler::schedule(), seqno, and Connector::target_. Referenced by HelloTimer::handle().
01251 {
01252 Packet *p = Packet::alloc();
01253 struct hdr_cmn *ch = HDR_CMN(p);
01254 struct hdr_ip *ih = HDR_IP(p);
01255 struct hdr_aodv_reply *rh = HDR_AODV_REPLY(p);
01256
01257 #ifdef DEBUG
01258 fprintf(stderr, "sending Hello from %d at %.2f\n", index, Scheduler::instance().clock());
01259 #endif // DEBUG
01260
01261 rh->rp_type = AODVTYPE_HELLO;
01262 //rh->rp_flags = 0x00;
01263 rh->rp_hop_count = 1;
01264 rh->rp_dst = index;
01265 rh->rp_dst_seqno = seqno;
01266 rh->rp_lifetime = (1 + ALLOWED_HELLO_LOSS) * HELLO_INTERVAL;
01267
01268 // ch->uid() = 0;
01269 ch->ptype() = PT_AODV;
01270 ch->size() = IP_HDR_LEN + rh->size();
01271 ch->iface() = -2;
01272 ch->error() = 0;
01273 ch->addr_type() = NS_AF_NONE;
01274 ch->prev_hop_ = index; // AODV hack
01275
01276 ih->saddr() = index;
01277 ih->daddr() = IP_BROADCAST;
01278 ih->sport() = RT_PORT;
01279 ih->dport() = RT_PORT;
01280 ih->ttl_ = 1;
01281
01282 Scheduler::instance().schedule(target_, p, 0.0);
01283 }
|
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 1165 of file aodv.cc. References Packet::alloc(), AODVTYPE_RREP, hdr_cmn::DOWN, HDR_AODV_REPLY, HDR_CMN, HDR_IP, index, Scheduler::instance(), IP_HDR_LEN, NETWORK_DIAMETER, NS_AF_INET, PT_AODV, aodv_rtable::rt_lookup(), aodv_rt_entry::rt_nexthop, RT_PORT, rtable, Scheduler::schedule(), and Connector::target_. Referenced by recvRequest().
01166 {
01167 Packet *p = Packet::alloc();
01168 struct hdr_cmn *ch = HDR_CMN(p);
01169 struct hdr_ip *ih = HDR_IP(p);
01170 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
01171 aodv_rt_entry *rt = rtable.rt_lookup(ipdst);
01172
01173 #ifdef DEBUG
01174 fprintf(stderr, "sending Reply from %d at %.2f\n", index, Scheduler::instance().clock());
01175 #endif // DEBUG
01176 assert(rt);
01177
01178 rp->rp_type = AODVTYPE_RREP;
01179 //rp->rp_flags = 0x00;
01180 rp->rp_hop_count = hop_count;
01181 rp->rp_dst = rpdst;
01182 rp->rp_dst_seqno = rpseq;
01183 rp->rp_src = index;
01184 rp->rp_lifetime = lifetime;
01185 rp->rp_timestamp = timestamp;
01186
01187 // ch->uid() = 0;
01188 ch->ptype() = PT_AODV;
01189 ch->size() = IP_HDR_LEN + rp->size();
01190 ch->iface() = -2;
01191 ch->error() = 0;
01192 ch->addr_type() = NS_AF_INET;
01193 ch->next_hop_ = rt->rt_nexthop;
01194 ch->prev_hop_ = index; // AODV hack
01195 ch->direction() = hdr_cmn::DOWN;
01196
01197 ih->saddr() = index;
01198 ih->daddr() = ipdst;
01199 ih->sport() = RT_PORT;
01200 ih->dport() = RT_PORT;
01201 ih->ttl_ = NETWORK_DIAMETER;
01202
01203 Scheduler::instance().schedule(target_, p, 0.);
01204
01205 }
|
Here is the call graph for this function:

|
|
Definition at line 1042 of file aodv.cc. References Packet::alloc(), AODVTYPE_RREQ, bid, CURRENT_TIME, aodv_rqueue::deque(), Connector::drop(), DROP_RTR_NO_ROUTE, Packet::free(), HDR_AODV_REQUEST, HDR_CMN, HDR_IP, index, INFINITY2, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, max, MAX_RREQ_TIMEOUT, NETWORK_DIAMETER, NS_AF_NONE, PerHopTime(), PT_AODV, 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, Scheduler::schedule(), seqno, Connector::target_, TTL_INCREMENT, TTL_START, and TTL_THRESHOLD. Referenced by local_rt_repair(), rt_purge(), and rt_resolve().
01042 {
01043 // Allocate a RREQ packet
01044 Packet *p = Packet::alloc();
01045 struct hdr_cmn *ch = HDR_CMN(p);
01046 struct hdr_ip *ih = HDR_IP(p);
01047 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
01048 aodv_rt_entry *rt = rtable.rt_lookup(dst);
01049
01050 assert(rt);
01051
01052 /*
01053 * Rate limit sending of Route Requests. We are very conservative
01054 * about sending out route requests.
01055 */
01056
01057 if (rt->rt_flags == RTF_UP) {
01058 assert(rt->rt_hops != INFINITY2);
01059 Packet::free((Packet *)p);
01060 return;
01061 }
01062
01063 if (rt->rt_req_timeout > CURRENT_TIME) {
01064 Packet::free((Packet *)p);
01065 return;
01066 }
01067
01068 // rt_req_cnt is the no. of times we did network-wide broadcast
01069 // RREQ_RETRIES is the maximum number we will allow before
01070 // going to a long timeout.
01071
01072 if (rt->rt_req_cnt > RREQ_RETRIES) {
01073 rt->rt_req_timeout = CURRENT_TIME + MAX_RREQ_TIMEOUT;
01074 rt->rt_req_cnt = 0;
01075 Packet *buf_pkt;
01076 while ((buf_pkt = rqueue.deque(rt->rt_dst))) {
01077 drop(buf_pkt, DROP_RTR_NO_ROUTE);
01078 }
01079 Packet::free((Packet *)p);
01080 return;
01081 }
01082
01083 #ifdef DEBUG
01084 fprintf(stderr, "(%2d) - %2d sending Route Request, dst: %d\n",
01085 ++route_request, index, rt->rt_dst);
01086 #endif // DEBUG
01087
01088 // Determine the TTL to be used this time.
01089 // Dynamic TTL evaluation - SRD
01090
01091 rt->rt_req_last_ttl = max(rt->rt_req_last_ttl,rt->rt_last_hop_count);
01092
01093 if (0 == rt->rt_req_last_ttl) {
01094 // first time query broadcast
01095 ih->ttl_ = TTL_START;
01096 }
01097 else {
01098 // Expanding ring search.
01099 if (rt->rt_req_last_ttl < TTL_THRESHOLD)
01100 ih->ttl_ = rt->rt_req_last_ttl + TTL_INCREMENT;
01101 else {
01102 // network-wide broadcast
01103 ih->ttl_ = NETWORK_DIAMETER;
01104 rt->rt_req_cnt += 1;
01105 }
01106 }
01107
01108 // remember the TTL used for the next time
01109 rt->rt_req_last_ttl = ih->ttl_;
01110
01111 // PerHopTime is the roundtrip time per hop for route requests.
01112 // The factor 2.0 is just to be safe .. SRD 5/22/99
01113 // Also note that we are making timeouts to be larger if we have
01114 // done network wide broadcast before.
01115
01116 rt->rt_req_timeout = 2.0 * (double) ih->ttl_ * PerHopTime(rt);
01117 if (rt->rt_req_cnt > 0)
01118 rt->rt_req_timeout *= rt->rt_req_cnt;
01119 rt->rt_req_timeout += CURRENT_TIME;
01120
01121 // Don't let the timeout to be too large, however .. SRD 6/8/99
01122 if (rt->rt_req_timeout > CURRENT_TIME + MAX_RREQ_TIMEOUT)
01123 rt->rt_req_timeout = CURRENT_TIME + MAX_RREQ_TIMEOUT;
01124 rt->rt_expire = 0;
01125
01126 #ifdef DEBUG
01127 fprintf(stderr, "(%2d) - %2d sending Route Request, dst: %d, tout %f ms\n",
01128 ++route_request,
01129 index, rt->rt_dst,
01130 rt->rt_req_timeout - CURRENT_TIME);
01131 #endif // DEBUG
01132
01133
01134 // Fill out the RREQ packet
01135 // ch->uid() = 0;
01136 ch->ptype() = PT_AODV;
01137 ch->size() = IP_HDR_LEN + rq->size();
01138 ch->iface() = -2;
01139 ch->error() = 0;
01140 ch->addr_type() = NS_AF_NONE;
01141 ch->prev_hop_ = index; // AODV hack
01142
01143 ih->saddr() = index;
01144 ih->daddr() = IP_BROADCAST;
01145 ih->sport() = RT_PORT;
01146 ih->dport() = RT_PORT;
01147
01148 // Fill up some more fields.
01149 rq->rq_type = AODVTYPE_RREQ;
01150 rq->rq_hop_count = 1;
01151 rq->rq_bcast_id = bid++;
01152 rq->rq_dst = dst;
01153 rq->rq_dst_seqno = (rt ? rt->rt_seqno : 0);
01154 rq->rq_src = index;
01155 seqno += 2;
01156 assert ((seqno%2) == 0);
01157 rq->rq_src_seqno = seqno;
01158 rq->rq_timestamp = CURRENT_TIME;
01159
01160 Scheduler::instance().schedule(target_, p, 0.);
01161
01162 }
|
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 281 of file aodv.h. Referenced by AODV(), and sendRequest(). |
|
|
Definition at line 285 of file aodv.h. Referenced by AODV(), id_insert(), id_lookup(), and id_purge(). |
|
|
Definition at line 290 of file aodv.h. Referenced by command(). |
|
|
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 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 291 of file aodv.h. Referenced by command(). |
|
|
|
|
|
Definition at line 279 of file aodv.h. Referenced by AODV(), command(), handle_link_failure(), log_link_broke(), log_link_del(), log_link_kept(), recv(), recvError(), recvReply(), recvRequest(), rt_resolve(), sendError(), sendHello(), sendReply(), and sendRequest(). |
|
|
Definition at line 310 of file aodv.h. Referenced by AODV(), command(), log_link_broke(), log_link_del(), and log_link_kept(). |
|
|
Definition at line 294 of file aodv.h. Referenced by local_rt_repair(). |
|
|
Definition at line 284 of file aodv.h. Referenced by AODV(), nb_delete(), nb_insert(), nb_lookup(), and nb_purge(). |
|
|
Definition at line 292 of file aodv.h. Referenced by command(). |
|
|
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 304 of file aodv.h. Referenced by command(), local_rt_repair(), recvReply(), recvRequest(), rt_purge(), rt_resolve(), and sendRequest(). |
|
|
Definition at line 299 of file aodv.h. Referenced by LocalRepairTimer::handle(), handle_link_failure(), recvError(), recvReply(), recvRequest(), rt_ll_failed(), rt_purge(), rt_resolve(), sendReply(), and sendRequest(). |
|
|
|
|
|
Definition at line 293 of file aodv.h. Referenced by command(). |
|
|
Definition at line 280 of file aodv.h. Referenced by AODV(), nb_delete(), nb_insert(), recvRequest(), sendHello(), and sendRequest(). |
|
|
|
|
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(). |
1.3.3