AODV Class Reference

#include <aodv.h>

Inheritance diagram for AODV:

Agent Connector NsObject TclObject Handler Collaboration diagram for AODV:

Collaboration graph
[legend]

Detailed Description

Definition at line 194 of file aodv.h.

Public Member Functions

nsaddr_taddr ()
 AODV (nsaddr_t id)
virtual void attachApp (Application *app)
virtual void close ()
virtual void connect (nsaddr_t dst)
nsaddr_tdaddr ()
virtual void debug (const char *fmt,...)
nsaddr_tdport ()
virtual void drop (Packet *p)
packet_t get_pkttype ()
void handle_link_failure (nsaddr_t id)
int isdebug () const
virtual void listen ()
nsaddr_tport ()
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)
NsObjecttarget ()
virtual void timeout (int tno)

Protected Member Functions

void addAgentTrace (const char *name)
Packetallocpkt (int) const
Packetallocpkt () 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 ()
Packetdeque (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)
OldValuelookupOldValue (TracedVar *v)
void monitorAgentTrace ()
void nb_delete (nsaddr_t id)
void nb_insert (nsaddr_t id)
AODV_Neighbornb_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

Applicationapp_
int bid
aodv_bcache bihead
BroadcastTimer btimer
Tcl_Channel channel_
int debug_
int defttl_
PortClassifierdmux_
NsObjectdrop_
ns_addr_t dst_
EventTraceet_
int fid_
int flags_
ns_addr_t here_
HelloTimer htimer
PriQueueifqueue
nsaddr_t index
Tracelogtarget
LocalRepairTimer lrtimer
aodv_ncache nbhead
NeighborTimer ntimer
OldValueoldValueList_
int prio_
aodv_rqueue rqueue
aodv_rtable rtable
aodv_rtable rthead
RouteCacheTimer rtimer
u_int32_t seqno
int size_
NsObjecttarget_
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


Constructor & Destructor Documentation

AODV::AODV nsaddr_t  id  ) 
 

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 }


Member Function Documentation

void Agent::addAgentTrace const char *  name  )  [protected, inherited]
 

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:

nsaddr_t& Agent::addr  )  [inline, inherited]
 

Definition at line 99 of file agent.h.

References ns_addr_t::addr_, and Agent::here_.

Referenced by LandmarkAgent::assign_lmaddress(), WormApp::command(), SSMSRMAgent::command(), IntTcpAgent::createTcpSession(), DiffusionProb::DecGradient(), Agent::flushAVar(), SctpAgent::ForceSource(), LmsSender::handle_lms_pkt(), DiffusionProb::IncGradient(), SSMSRMAgent::is_active(), QSAgent::process(), TPAgent::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), QSAgent::recv(), MIPBSAgent::recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), SSMSRMAgent::recv_glb_sess(), SSMSRMAgent::recv_loc_sess(), SSMSRMAgent::recv_rep_sess(), SRMAgent::recv_sess(), MIPMHAgent::reg(), MIPBSAgent::send_ads(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), LmsAgent::send_upstream(), SRMAgent::sendmsg(), SctpAgent::SetSource(), LmsSender::solicit_naks(), SRMAgent::start(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), SctpAgent::TraceAll(), MultipleFastRtxSctpAgent::TraceAll(), MfrTimestampSctpAgent::TraceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), SctpAgent::TraceVar(), MultipleFastRtxSctpAgent::TraceVar(), and MfrTimestampSctpAgent::TraceVar().

00099 { return here_.addr_; }

Packet * Agent::allocpkt int   )  const [protected, inherited]
 

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:

Packet * Agent::allocpkt  )  const [protected, inherited]
 

Definition at line 517 of file agent.cc.

References Packet::alloc(), and Agent::initpkt().

Referenced by XcpSink::ack(), TcpSink::ack(), QSTcpSink::ack(), SctpAgent::AddDestination(), Agent::allocpkt(), PingAgent::command(), MessageAgent::command(), mcastControlAgent::command(), LmsAgent::command(), LDPAgent::command(), LandmarkAgent::command(), IvsReceiver::command(), DSDV_Agent::command(), OmniMcastAgent::create_packet(), FloodingAgent::create_packet(), DiffusionAgent::create_packet(), SinkAgent::create_packet(), SensorQueryAgent::generate_query(), DSRAgent::getRouteForPacket(), LandmarkAgent::makeUpdate(), DSDV_Agent::makeUpdate(), XcpAgent::output(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), AbsTcpAgent::output(), TCPTapAgent::processpkt(), AbsTcpSink::recv(), SAack_Agent::recv(), PingAgent::recv(), Encapsulator::recv(), MIPMHAgent::reg(), DSRAgent::returnSrcRouteToRequestor(), HttpInvalAgent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), GAFAgent::send_discovery(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), RapAgent::SendAck(), UdpAgent::sendmsg(), SimpleTcpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), PushbackAgent::sendMsg(), MessagePassingAgent::sendmsg(), LmsSender::sendmsg(), FullTcpAgent::sendpacket(), BayFullTcpAgent::sendpacket(), SctpAgent::SendPacket(), RapAgent::SendPacket(), TfrcAgent::sendpkt(), TfrcSinkAgent::sendpkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), RLM_Sender::sendpkt(), IvsSource::sendpkt(), IcmpAgent::sendredirect(), SA_Agent::sendreq(), DSRAgent::sendRouteShortening(), SA_Agent::sendteardown(), TPAgent::sendto(), MessagePassingAgent::sendto(), LmsSender::solicit_naks(), and AbsDelAckSink::timeout().

00518 {
00519     Packet* p = Packet::alloc();
00520     initpkt(p);
00521     return (p);
00522 }

Here is the call graph for this function:

void Agent::attachApp Application app  )  [virtual, inherited]
 

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 }

void Agent::close  )  [virtual, inherited]
 

Reimplemented in FullTcpAgent.

Definition at line 377 of file agent.cc.

Referenced by Agent::command().

00378 {
00379 }

int AODV::command int  ,
const char *const * 
[protected, virtual]
 

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:

void Agent::connect nsaddr_t  dst  )  [virtual, inherited]
 

Definition at line 389 of file agent.cc.

Referenced by Agent::command().

00390 {
00391 /*
00392     dst_ = dst;
00393 */
00394 }

nsaddr_t& Agent::daddr  )  [inline, inherited]
 

Definition at line 101 of file agent.h.

References ns_addr_t::addr_, and Agent::dst_.

Referenced by SctpAgent::AddDestination(), IntTcpAgent::createTcpSession(), DSDV_Agent::lost_link(), CtrMcastEncap::recv(), PingResponder::reflect(), IntTcpAgent::rxmit_last(), LmsSender::send_dmcast(), LmsSender::send_lms_pkt(), IntTcpAgent::send_one(), rtProtoDV::sendpkt(), SctpAgent::SetDestination(), LmsSender::solicit_naks(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), SctpAgent::TraceVar(), MultipleFastRtxSctpAgent::TraceVar(), and MfrTimestampSctpAgent::TraceVar().

00101 { return dst_.addr_; }

void NsObject::debug const char *  fmt,
  ...
[virtual, inherited]
 

Definition at line 102 of file object.cc.

References NsObject::debug_.

00103 {
00104     if (!debug_)
00105         return;
00106     va_list ap;
00107     va_start(ap, fmt);
00108     vprintf(fmt, ap);
00109 }

int Agent::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[protected, virtual, inherited]
 

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:

void Agent::delay_bind_init_all  )  [protected, virtual, inherited]
 

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:

void Agent::deleteAgentTrace  )  [protected, inherited]
 

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:

Packet* AODV::deque aodv_rt_entry rt  )  [protected]
 

nsaddr_t& Agent::dport  )  [inline, inherited]
 

Definition at line 102 of file agent.h.

References Agent::dst_, and ns_addr_t::port_.

Referenced by SctpAgent::AddDestination(), DSDV_Agent::lost_link(), CtrMcastEncap::recv(), recvAODV(), toraAgent::recvTORA(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), rtProtoDV::sendpkt(), SctpAgent::SetDestination(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), SctpAgent::TraceVar(), MultipleFastRtxSctpAgent::TraceVar(), and MfrTimestampSctpAgent::TraceVar().

00102 { return dst_.port_; }

void Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

Definition at line 114 of file connector.cc.

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

00115 {
00116     if (drop_ != 0)
00117         drop_->recv(p, s);
00118     else
00119         Packet::free(p);
00120 }

Here is the call graph for this function:

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

Reimplemented in XCPQueue.

Definition at line 106 of file connector.cc.

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

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

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

Here is the call graph for this function:

void Agent::dumpTracedVars  )  [protected, inherited]
 

void AODV::enque aodv_rt_entry rt,
Packet p
[protected]
 

void AODV::forward aodv_rt_entry rt,
Packet p,
double  delay
[protected]
 

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:

packet_t Agent::get_pkttype  )  [inline, inherited]
 

Definition at line 104 of file agent.h.

References Agent::type_.

00104 { return type_; }

void NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093     recv((Packet*)e);
00094 }

Here is the call graph for this function:

void AODV::handle_link_failure nsaddr_t  id  ) 
 

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:

void AODV::id_insert nsaddr_t  id,
u_int32_t  bid
[protected]
 

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 }

bool AODV::id_lookup nsaddr_t  id,
u_int32_t  bid
[protected]
 

Definition at line 233 of file aodv.cc.

References b, and bihead.

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 }

void AODV::id_purge void   )  [protected]
 

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 }

void Agent::idle  )  [protected, virtual, inherited]
 

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

00364 {
00365     if (app_)
00366         app_->resume();
00367 }

Here is the call graph for this function:

int AODV::initialized  )  [inline, protected]
 

Definition at line 214 of file aodv.h.

Referenced by recv().

00214 { return 1 && target_; }

void Agent::initpkt Packet  )  const [protected, inherited]
 

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:

void Agent::insertOldValue TracedVar *  v,
const char *  value
[protected, inherited]
 

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 }

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

void Agent::listen  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent.

Definition at line 381 of file agent.cc.

Referenced by Agent::command().

00382 {
00383 }

void AODV::local_rt_repair aodv_rt_entry rt,
Packet p
[protected]
 

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:

void AODV::log_link_broke Packet p  )  [protected]
 

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:

void AODV::log_link_del nsaddr_t  dst  )  [protected]
 

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:

void AODV::log_link_kept nsaddr_t  dst  )  [protected]
 

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:

OldValue * Agent::lookupOldValue TracedVar *  v  )  [protected, inherited]
 

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 }

void Agent::monitorAgentTrace  )  [protected, inherited]
 

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:

void AODV::nb_delete nsaddr_t  id  )  [protected]
 

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:

void AODV::nb_insert nsaddr_t  id  )  [protected]
 

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 }

AODV_Neighbor * AODV::nb_lookup nsaddr_t  id  )  [protected]
 

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 }

void AODV::nb_purge void   )  [protected]
 

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:

double AODV::PerHopTime aodv_rt_entry rt  )  [protected]
 

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 }

nsaddr_t& Agent::port  )  [inline, inherited]
 

Definition at line 100 of file agent.h.

References Agent::here_, and ns_addr_t::port_.

Referenced by SctpAgent::ForceSource(), LmsAgent::pkt2agent(), MIPBSAgent::recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), LmsReceiver::send_refresh(), IcmpAgent::sendredirect(), SctpAgent::SetSource(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), SctpAgent::TraceAll(), MultipleFastRtxSctpAgent::TraceAll(), MfrTimestampSctpAgent::TraceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), SctpAgent::TraceVar(), MultipleFastRtxSctpAgent::TraceVar(), and MfrTimestampSctpAgent::TraceVar().

00100 { return here_.port_; }

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

00097 {
00098     Packet::free(p);
00099 }

Here is the call graph for this function:

void AODV::recv Packet p,
Handler
[virtual]
 

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:

void AODV::recvAODV Packet p  )  [protected]
 

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:

void Agent::recvBytes int  bytes  )  [protected, virtual, inherited]
 

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:

void AODV::recvError Packet p  )  [protected]
 

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:

void AODV::recvHello Packet p  )  [protected]
 

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:

void Agent::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented from NsObject.

Definition at line 78 of file agent.h.

00078 {};

void AODV::recvReply Packet p  )  [protected]
 

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:

void AODV::recvRequest Packet p  )  [protected]
 

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:

void NsObject::reset  )  [protected, virtual, inherited]
 

Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, Queue< T >, and XcpSink.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void AODV::rt_down aodv_rt_entry rt  )  [protected]
 

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 */

void AODV::rt_ll_failed Packet p  ) 
 

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:

void AODV::rt_purge void   )  [protected]
 

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:

void AODV::rt_resolve Packet p  )  [protected]
 

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:

void AODV::rt_update aodv_rt_entry rt,
u_int32_t  seqnum,
u_int16_t  metric,
nsaddr_t  nexthop,
double  expire_time
[protected]
 

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 }

virtual void Agent::send int  nbytes  )  [inline, virtual, inherited]
 

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:

virtual void Agent::send int  sz,
AppData data
[inline, virtual, inherited]
 

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:

void Agent::send Packet p,
Handler h
[inline, inherited]
 

Reimplemented from Connector.

Definition at line 80 of file agent.h.

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

Referenced by XcpSink::ack(), SinkAgent::bcast_interest(), PingAgent::command(), MessageAgent::command(), mcastControlAgent::command(), LmsAgent::command(), LDPAgent::command(), SinkAgent::data_ready(), DSDV_Agent::forwardPacket(), FullTcpAgent::foutput(), XcpAgent::output(), TcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), AbsTcpAgent::output(), AbsTcpSink::recv(), SRAgent::recv(), PingAgent::recv(), NatAgent::recv(), MIPBSAgent::recv(), Encapsulator::recv(), Decapsulator::recv(), MIPMHAgent::reg(), SctpAgent::RouteCalcDelayTimerExpiration(), HttpInvalAgent::send(), GAFAgent::send_discovery(), RapAgent::SendAck(), SimpleTcpAgent::sendmsg(), PushbackAgent::sendMsg(), FullTcpAgent::sendpacket(), BayFullTcpAgent::sendpacket(), SctpAgent::SendPacket(), RapAgent::SendPacket(), TfrcAgent::sendpkt(), TfrcSinkAgent::sendpkt(), SinkAgent::sendpkt(), IcmpAgent::sendredirect(), and AbsDelAckSink::timeout().

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

Here is the call graph for this function:

void AODV::sendError Packet p,
bool  jitter = true
[protected]
 

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:

void AODV::sendHello void   )  [protected]
 

Definition at line 1265 of file aodv.cc.

References hdr_cmn::addr_type(), Packet::alloc(), ALLOWED_HELLO_LOSS, AODVTYPE_HELLO, hdr_ip::daddr(), hdr_ip::dport(), hdr_cmn::error(), HDR_AODV_REPLY, HDR_CMN, HDR_IP, HELLO_INTERVAL, hdr_cmn::iface(), index, Scheduler::instance(), IP_BROADCAST, IP_HDR_LEN, NS_AF_NONE, hdr_cmn::prev_hop_, PT_AODV, hdr_cmn::ptype(), 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_type, RT_PORT, hdr_ip::saddr(), Scheduler::schedule(), seqno, hdr_aodv_reply::size(), hdr_cmn::size(), hdr_ip::sport(), Connector::target_, and hdr_ip::ttl_.

Referenced by HelloTimer::handle().

01265                 {
01266 Packet *p = Packet::alloc();
01267 struct hdr_cmn *ch = HDR_CMN(p);
01268 struct hdr_ip *ih = HDR_IP(p);
01269 struct hdr_aodv_reply *rh = HDR_AODV_REPLY(p);
01270 
01271 #ifdef DEBUG
01272 fprintf(stderr, "sending Hello from %d at %.2f\n", index, Scheduler::instance().clock());
01273 #endif // DEBUG
01274 
01275  rh->rp_type = AODVTYPE_HELLO;
01276  //rh->rp_flags = 0x00;
01277  rh->rp_hop_count = 1;
01278  rh->rp_dst = index;
01279  rh->rp_dst_seqno = seqno;
01280  rh->rp_lifetime = (1 + ALLOWED_HELLO_LOSS) * HELLO_INTERVAL;
01281 
01282  // ch->uid() = 0;
01283  ch->ptype() = PT_AODV;
01284  ch->size() = IP_HDR_LEN + rh->size();
01285  ch->iface() = -2;
01286  ch->error() = 0;
01287  ch->addr_type() = NS_AF_NONE;
01288  ch->prev_hop_ = index;          // AODV hack
01289 
01290  ih->saddr() = index;
01291  ih->daddr() = IP_BROADCAST;
01292  ih->sport() = RT_PORT;
01293  ih->dport() = RT_PORT;
01294  ih->ttl_ = 1;
01295 
01296  Scheduler::instance().schedule(target_, p, 0.0);
01297 }

Here is the call graph for this function:

void Agent::sendmsg int  nbytes,
const char *  flags = 0
[virtual, inherited]
 

Reimplemented in SA_Agent, RTPAgent, UdpAgent, MessagePassingAgent, LmsSender, SRMAgent, SctpAgent, FullTcpAgent, TcpAgent, TfrcAgent, and SimpleTcpAgent.

Definition at line 407 of file agent.cc.

00408 {
00409 }

void Agent::sendmsg int  sz,
AppData ,
const char *  flags = 0
[virtual, inherited]
 

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:

void AODV::sendReply nsaddr_t  ipdst,
u_int32_t  hop_count,
nsaddr_t  rpdst,
u_int32_t  rpseq,
u_int32_t  lifetime,
double  timestamp
[protected]
 

Definition at line 1179 of file aodv.cc.

References hdr_cmn::addr_type(), Packet::alloc(), AODVTYPE_RREP, hdr_ip::daddr(), hdr_cmn::direction(), hdr_cmn::DOWN, hdr_ip::dport(), hdr_cmn::error(), HDR_AODV_REPLY, HDR_CMN, HDR_IP, hdr_cmn::iface(), index, Scheduler::instance(), IP_HDR_LEN, NETWORK_DIAMETER, hdr_cmn::next_hop_, NS_AF_INET, hdr_cmn::prev_hop_, PT_AODV, hdr_cmn::ptype(), 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, hdr_aodv_reply::rp_type, aodv_rtable::rt_lookup(), aodv_rt_entry::rt_nexthop, RT_PORT, rtable, hdr_ip::saddr(), Scheduler::schedule(), hdr_aodv_reply::size(), hdr_cmn::size(), hdr_ip::sport(), Connector::target_, and hdr_ip::ttl_.

01180                                                                        {
01181 Packet *p = Packet::alloc();
01182 struct hdr_cmn *ch = HDR_CMN(p);
01183 struct hdr_ip *ih = HDR_IP(p);
01184 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
01185 aodv_rt_entry *rt = rtable.rt_lookup(ipdst);
01186 
01187 #ifdef DEBUG
01188 fprintf(stderr, "sending Reply from %d at %.2f\n", index, Scheduler::instance().clock());
01189 #endif // DEBUG
01190  assert(rt);
01191 
01192  rp->rp_type = AODVTYPE_RREP;
01193  //rp->rp_flags = 0x00;
01194  rp->rp_hop_count = hop_count;
01195  rp->rp_dst = rpdst;
01196  rp->rp_dst_seqno = rpseq;
01197  rp->rp_src = index;
01198  rp->rp_lifetime = lifetime;
01199  rp->rp_timestamp = timestamp;
01200    
01201  // ch->uid() = 0;
01202  ch->ptype() = PT_AODV;
01203  ch->size() = IP_HDR_LEN + rp->size();
01204  ch->iface() = -2;
01205  ch->error() = 0;
01206  ch->addr_type() = NS_AF_INET;
01207  ch->next_hop_ = rt->rt_nexthop;
01208  ch->prev_hop_ = index;          // AODV hack
01209  ch->direction() = hdr_cmn::DOWN;
01210 
01211  ih->saddr() = index;
01212  ih->daddr() = ipdst;
01213  ih->sport() = RT_PORT;
01214  ih->dport() = RT_PORT;
01215  ih->ttl_ = NETWORK_DIAMETER;
01216 
01217  Scheduler::instance().schedule(target_, p, 0.);
01218 
01219 }

Here is the call graph for this function:

void AODV::sendRequest nsaddr_t  dst  )  [protected]
 

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:

virtual void Agent::sendto int  nbytes,
const char *  flags,
ns_addr_t  dst
[virtual, inherited]
 

Reimplemented in MessagePassingAgent.

virtual void Agent::sendto int  nbytes,
const char *  flags,
nsaddr_t  dst
[virtual, inherited]
 

void Agent::sendto int  sz,
AppData ,
const char *  flags,
ns_addr_t  dst
[virtual, inherited]
 

Reimplemented in MessagePassingAgent.

Definition at line 420 of file agent.cc.

00422 {
00423 }

void Agent::sendto int  sz,
AppData ,
const char *  flags,
nsaddr_t  dst
[virtual, inherited]
 

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:

void Agent::set_pkttype packet_t  pkttype  )  [inline, inherited]
 

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

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

Definition at line 51 of file connector.h.

References Connector::drop_.

Referenced by XCPWrapQ::command().

00051 {drop_ = dt; } 

virtual int& Agent::size  )  [inline, virtual, inherited]
 

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

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

Definition at line 49 of file connector.h.

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

00049 { target_ = target; }

Here is the call graph for this function:

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

Definition at line 48 of file connector.h.

References Connector::target_.

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

00048 { return target_; }

void Agent::timeout int  tno  )  [virtual, inherited]
 

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 }

void Agent::trace TracedVar *  v  )  [protected, virtual, inherited]
 

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:

virtual void Agent::trace_event char *  eventtype  )  [inline, protected, virtual, inherited]
 

Reimplemented in TcpAgent.

Definition at line 149 of file agent.h.

00149 {}


Friends And Related Function Documentation

friend class aodv_rt_entry [friend]
 

Definition at line 200 of file aodv.h.

friend class BroadcastTimer [friend]
 

Definition at line 201 of file aodv.h.

friend class HelloTimer [friend]
 

Definition at line 202 of file aodv.h.

friend class LocalRepairTimer [friend]
 

Definition at line 205 of file aodv.h.

friend class NeighborTimer [friend]
 

Definition at line 203 of file aodv.h.

friend class RouteCacheTimer [friend]
 

Definition at line 204 of file aodv.h.


Field Documentation

Application* Agent::app_ [protected, inherited]
 

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

int AODV::bid [protected]
 

Definition at line 280 of file aodv.h.

Referenced by AODV(), and sendRequest().

aodv_bcache AODV::bihead [protected]
 

Definition at line 284 of file aodv.h.

Referenced by AODV(), id_insert(), id_lookup(), and id_purge().

BroadcastTimer AODV::btimer [protected]
 

Definition at line 289 of file aodv.h.

Referenced by command().

Tcl_Channel Agent::channel_ [protected, inherited]
 

Definition at line 133 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::command(), Agent::flushAVar(), Agent::monitorAgentTrace(), XcpAgent::output(), XcpAgent::recv_newack_helper(), Agent::trace(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), SctpAgent::TraceAll(), MultipleFastRtxSctpAgent::TraceAll(), MfrTimestampSctpAgent::TraceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), SctpAgent::TraceVar(), MultipleFastRtxSctpAgent::TraceVar(), and MfrTimestampSctpAgent::TraceVar().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send().

int Agent::defttl_ [protected, inherited]
 

Definition at line 124 of file agent.h.

Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt().

PortClassifier* AODV::dmux_ [protected]
 

Definition at line 325 of file aodv.h.

Referenced by command(), and forward().

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 59 of file connector.h.

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

ns_addr_t Agent::dst_ [protected, inherited]
 

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

EventTrace* Agent::et_ [protected, inherited]
 

Definition at line 148 of file agent.h.

Referenced by TcpAgent::command(), and TcpAgent::trace_event().

int Agent::fid_ [protected, inherited]
 

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

int Agent::flags_ [protected, inherited]
 

Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent.

Definition at line 123 of file agent.h.

Referenced by Agent::delay_bind_dispatch().

ns_addr_t Agent::here_ [protected, inherited]
 

Definition at line 117 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::addr(), SinkAgent::bcast_interest(), MessagePassingAgent::command(), SinkAgent::data_ready(), OmniMcastAgent::DataForSink(), FloodingAgent::DataForSink(), DiffusionAgent::DataForSink(), Agent::delay_bind_dispatch(), Agent::deleteAgentTrace(), forward(), DiffusionProb::ForwardData(), DiffusionProb::ForwardTxFailed(), DiffusionRate::FwdOriginal(), DiffusionProb::FwdPosReinf(), DiffusionRate::FwdSubsample(), OmniMcastAgent::GodForwardData(), Agent::initpkt(), OmniMcastAgent::MACprepare(), FloodingAgent::MACprepare(), DiffusionAgent::MACprepare(), Agent::monitorAgentTrace(), Agent::port(), OmniMcastAgent::prepare_message(), FloodingAgent::prepare_message(), DiffusionAgent::prepare_message(), SSMSRMAgent::recv(), PingAgent::recv(), NatAgent::recv(), SinkAgent::sendpkt(), SinkAgent::set_addr(), SinkAgent::Terminate(), and Agent::trace().

HelloTimer AODV::htimer [protected]
 

Definition at line 290 of file aodv.h.

Referenced by command().

PriQueue* AODV::ifqueue [protected]
 

Definition at line 315 of file aodv.h.

nsaddr_t AODV::index [protected]
 

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

Trace* AODV::logtarget [protected]
 

Definition at line 309 of file aodv.h.

Referenced by AODV(), command(), log_link_broke(), log_link_del(), and log_link_kept().

LocalRepairTimer AODV::lrtimer [protected]
 

Definition at line 293 of file aodv.h.

Referenced by local_rt_repair().

aodv_ncache AODV::nbhead [protected]
 

Definition at line 283 of file aodv.h.

Referenced by AODV(), nb_delete(), nb_insert(), nb_lookup(), and nb_purge().

NeighborTimer AODV::ntimer [protected]
 

Definition at line 291 of file aodv.h.

Referenced by command().

OldValue* Agent::oldValueList_ [protected, inherited]
 

Definition at line 135 of file agent.h.

Referenced by Agent::insertOldValue(), Agent::lookupOldValue(), and Agent::~Agent().

int Agent::prio_ [protected, inherited]
 

Definition at line 122 of file agent.h.

Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt().

aodv_rqueue AODV::rqueue [protected]
 

Definition at line 303 of file aodv.h.

Referenced by command(), local_rt_repair(), recvReply(), recvRequest(), rt_purge(), rt_resolve(), and sendRequest().

aodv_rtable AODV::rtable [protected]
 

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

aodv_rtable AODV::rthead [protected]
 

Definition at line 282 of file aodv.h.

RouteCacheTimer AODV::rtimer [protected]
 

Definition at line 292 of file aodv.h.

Referenced by command().

u_int32_t AODV::seqno [protected]
 

Definition at line 279 of file aodv.h.

Referenced by AODV(), nb_delete(), nb_insert(), sendHello(), and sendRequest().

int Agent::size_ [protected, inherited]
 

Reimplemented in SA_Agent, and AckRecons.

Definition at line 119 of file agent.h.

Referenced by AbsDelAckSink::AbsDelAckSink(), AbsTcpAgent::AbsTcpAgent(), AbsTcpRenoAckAgent::AbsTcpRenoAckAgent(), AbsTcpRenoDelAckAgent::AbsTcpRenoDelAckAgent(), AbsTcpSink::AbsTcpSink(), AbsTcpTahoeAckAgent::AbsTcpTahoeAckAgent(), AbsTcpTahoeDelAckAgent::AbsTcpTahoeDelAckAgent(), RTCPAgent::command(), LDPAgent::command(), SinkAgent::command(), TfrcAgent::decrease_rate(), XcpSink::delay_bind_dispatch(), TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), FullTcpAgent::foutput(), DSRAgent::getRouteForPacket(), TfrcAgent::increase_rate(), TfrcAgent::initial_rate(), TcpAgent::initial_window(), Agent::initpkt(), RapAgent::IpgTimeout(), IvsReceiver::IvsReceiver(), LmsAgent::LmsAgent(), LmsReceiver::LmsReceiver(), mcastControlAgent::mcastControlAgent(), MessageAgent::MessageAgent(), MessagePassingAgent::MessagePassingAgent(), MIPBSAgent::MIPBSAgent(), MIPMHAgent::MIPMHAgent(), TfrcAgent::nextpkt(), IntTcpAgent::opencwnd(), XcpAgent::output(), TcpAgent::output(), PingAgent::PingAgent(), TcpAgent::processQuickStart(), RapAgent::RapAgent(), TfrcAgent::recv(), TcpSessionAgent::recv(), NewRenoTcpAgent::recv(), TfrcAgent::reduce_rate_on_no_feedback(), SctpAgent::Reset(), RLM_Sender::RLM_Sender(), RTCPAgent::RTCPAgent(), RTPAgent::RTPAgent(), IntTcpAgent::rxmit_last(), LmsSender::send_lms_pkt(), TcpSessionAgent::send_much(), LmsReceiver::send_nak(), IntTcpAgent::send_one(), LmsReceiver::send_refresh(), LmsSender::send_spm(), UdpAgent::sendmsg(), TfrcAgent::sendmsg(), TcpAgent::sendmsg(), SRMAgent::sendmsg(), RTPAgent::sendmsg(), MessagePassingAgent::sendmsg(), RapAgent::SendPacket(), TfrcAgent::sendpkt(), rtProtoDV::sendpkt(), SinkAgent::sendpkt(), TPAgent::sendto(), MessagePassingAgent::sendto(), SinkAgent::SinkAgent(), Agent::size(), TfrcAgent::slowstart(), LmsSender::solicit_naks(), TfrcAgent::start(), TfrcAgent::TfrcAgent(), TfrcSinkAgent::TfrcSinkAgent(), RTPAgent::timeout(), RTCPAgent::timeout(), TPAgent::TPAgent(), UdpAgent::UdpAgent(), and TfrcSinkAgent::weighted_average1().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 58 of file connector.h.

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

char* Agent::traceName_ [protected, inherited]
 

Definition at line 134 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::command(), Agent::deleteAgentTrace(), Agent::flushAVar(), Agent::monitorAgentTrace(), and Agent::trace().

packet_t Agent::type_ [protected, inherited]
 

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

int Agent::uidcnt_ [static, protected, inherited]
 

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


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