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

DSRAgent Class Reference

#include <dsragent.h>

Inheritance diagram for DSRAgent:

Inheritance graph
[legend]
Collaboration diagram for DSRAgent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual int command (int argc, const char *const *argv)
virtual void recv (Packet *, Handler *callback=0)
void tap (const Packet *p)
void Terminate (void)
void sendOutBCastPkt (Packet *p)
 DSRAgent ()
 ~DSRAgent ()
 LIST_ENTRY (DSRAgent) link
virtual void recv (Packet *p, const char *s)
void recvOnly (Packet *)
void send (Packet *p, Handler *h)
virtual void send (int sz, AppData *data)
virtual void send (int nbytes)
virtual void timeout (int tno)
virtual void sendmsg (int sz, AppData *, const char *flags=0)
virtual void sendmsg (int nbytes, const char *flags=0)
virtual void sendto (int sz, AppData *, const char *flags, nsaddr_t dst)
virtual void sendto (int nbytes, const char *flags, nsaddr_t dst)
virtual void connect (nsaddr_t dst)
virtual void close ()
virtual void listen ()
virtual void attachApp (Application *app)
virtual int & size ()
nsaddr_taddr ()
nsaddr_tport ()
nsaddr_tdaddr ()
nsaddr_tdport ()
void set_pkttype (packet_t pkttype)
packet_t get_pkttype ()
NsObjecttarget ()
virtual void drop (Packet *p)
int isdebug () const
virtual void debug (const char *fmt,...)

Static Public Attributes

DSRAgent_List agthead = { 0 }

Protected Member Functions

virtual void delay_bind_init_all ()
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
virtual void recvBytes (int bytes)
virtual void idle ()
Packetallocpkt () const
Packetallocpkt (int) const
void initpkt (Packet *) const
virtual void trace (TracedVar *v)
void deleteAgentTrace ()
void addAgentTrace (const char *name)
void monitorAgentTrace ()
OldValuelookupOldValue (TracedVar *v)
void insertOldValue (TracedVar *v, const char *value)
void dumpTracedVars ()
virtual void trace_event (char *eventtype)
virtual void drop (Packet *p, const char *s)
virtual void reset ()
void handle (Event *)

Protected Attributes

ns_addr_t here_
ns_addr_t dst_
int size_
packet_t type_
int fid_
int prio_
int flags_
int defttl_
Tcl_Channel channel_
char * traceName_
OldValueoldValueList_
Applicationapp_
EventTraceet_
NsObjecttarget_
NsObjectdrop_
int debug_

Static Protected Attributes

int uidcnt_

Private Member Functions

int diff_subnet (ID dest, ID myid)
void handlePktWithoutSR (SRPacket &p, bool retry)
void handlePacketReceipt (SRPacket &p)
void handleForwarding (SRPacket &p)
void handleRouteRequest (SRPacket &p)
void handleFlowForwarding (SRPacket &p)
void handleFlowForwarding (SRPacket &p, int flowidx)
void handleDefaultForwarding (SRPacket &p)
bool ignoreRouteRequestp (SRPacket &p)
void sendOutPacketWithRoute (SRPacket &p, bool fresh, Time delay=0.0)
void sendOutRtReq (SRPacket &p, int max_prop=MAX_SR_LEN)
void getRouteForPacket (SRPacket &p, bool retry)
void acceptRouteReply (SRPacket &p)
void returnSrcRouteToRequestor (SRPacket &p)
bool replyFromRouteCache (SRPacket &p)
void processUnknownFlowError (SRPacket &p, bool asDefault)
void processFlowARS (const Packet *packet)
void processBrokenRouteError (SRPacket &p)
void sendUnknownFlow (SRPacket &p, bool asDefault, u_int16_t flowid=0)
void xmitFailed (Packet *pkt, const char *reason="DROP_RTR_MAC_CALLBACK")
void xmitFlowFailed (Packet *pkt, const char *reason="DROP_RTR_MAC_CALLBACK")
void undeliverablePkt (Packet *p, int mine)
void dropSendBuff (SRPacket &p)
void stickPacketInSendBuffer (SRPacket &p)
void sendBufferCheck ()
void sendRouteShortening (SRPacket &p, int heard_at, int xmit_at)
void testinit ()
void trace (char *fmt,...)

Private Attributes

Tracelogtarget
int off_mac_
int off_ll_
int off_ip_
int off_sr_
ID net_id
ID MAC_id
NsObjectll
CMUPriQueueifq
Macmac_
MobileNodenode_
NsObjectport_dmux_
int tap_uid_cache [TAP_CACHE_SIZE]
RequestTable request_table
RouteCacheroute_cache
SendBufEntry send_buf [SEND_BUF_SIZE]
SendBufferTimer send_buf_timer
int route_request_num
int num_heldoff_rt_replies
RtRepHoldoff rtrep_holdoff [RTREP_HOLDOFF_SIZE]
GratReplyHoldDown grat_hold [RTREP_HOLDOFF_SIZE]
int grat_hold_victim
FlowTable flow_table
ARSTable ars_table
bool route_error_held
ID err_from
ID err_to
Time route_error_data_time

Friends

class SendBufferTimer
void XmitFailureCallback (Packet *pkt, void *data)
void XmitFlowFailureCallback (Packet *pkt, void *data)
int FilterFailure (Packet *p, void *data)

Constructor & Destructor Documentation

DSRAgent::DSRAgent  ) 
 

Definition at line 315 of file dsragent.cc.

References agthead, grat_hold, grat_hold_victim, ifq, invalid_addr, LIST_INSERT_HEAD, logtarget, mac_, makeRouteCache(), num_heldoff_rt_replies, GratReplyHoldDown::p, PT_DSR, RtRepHoldoff::requested_dest, Path::reset(), route_cache, route_error_held, route_request_num, rtrep_holdoff, RTREP_HOLDOFF_SIZE, GratReplyHoldDown::t, tap_uid_cache, and Connector::target_.

00315                   : Agent(PT_DSR), request_table(128), route_cache(NULL),
00316 send_buf_timer(this), flow_table(), ars_table()
00317 {
00318   int c;
00319   route_request_num = 1;
00320 
00321   route_cache = makeRouteCache();
00322 
00323   for (c = 0 ; c < RTREP_HOLDOFF_SIZE ; c++)
00324           rtrep_holdoff[c].requested_dest = invalid_addr;
00325   num_heldoff_rt_replies = 0;
00326 
00327   target_ = 0;
00328   logtarget = 0;
00329 
00330   grat_hold_victim = 0;
00331   for (c = 0; c < RTREP_HOLDOFF_SIZE ; c++) {
00332     grat_hold[c].t = 0;
00333     grat_hold[c].p.reset();
00334   }
00335 
00336   //bind("off_SR_", &off_sr_);
00337   //bind("off_ll_", &off_ll_);
00338   //bind("off_mac_", &off_mac_);
00339   //bind("off_ip_", &off_ip_);
00340 
00341   ll = 0;
00342   ifq = 0;
00343   mac_ = 0;
00344 
00345   LIST_INSERT_HEAD(&agthead, this, link);
00346 #ifdef DSR_FILTER_TAP
00347   bzero(tap_uid_cache, sizeof(tap_uid_cache));
00348 #endif
00349   route_error_held = false;
00350 }

Here is the call graph for this function:

DSRAgent::~DSRAgent  ) 
 

Definition at line 352 of file dsragent.cc.

00353 {
00354   fprintf(stderr,"DFU: Don't do this! I haven't figured out ~DSRAgent\n");
00355   exit(-1);
00356 }


Member Function Documentation

void DSRAgent::acceptRouteReply SRPacket p  )  [private]
 

Definition at line 1664 of file dsragent.cc.

References abort(), hdr_sr::access(), RouteCache::addRoute(), arp_timeout, MobileNode::base_stn(), SRPacket::dest, diff_subnet(), Connector::drop(), Path::dump(), ID::dump(), RouteCache::findRoute(), RequestTable::getEntry(), HDR_CMN, God::hops(), Scheduler::instance(), God::instance(), Entry::last_rt_req, Path::length(), net_id, node_, SendBufEntry::p, SRPacket::pkt, hdr_sr::reply_addrs(), request_table, SRPacket::route, route_cache, hdr_sr::route_reply(), hdr_sr::route_reply_len(), Entry::rt_reqs_outstanding, hdr_sr::rtreq_seq(), send_buf, SEND_BUF_SIZE, sendOutPacketWithRoute(), SRPacket::src, Time, trace(), verbose, and verbose_srr.

Referenced by handlePacketReceipt().

01668 {
01669   hdr_sr *srh =  hdr_sr::access(p.pkt);
01670   Path reply_route(srh->reply_addrs(), srh->route_reply_len());
01671 
01672   if (!srh->route_reply())
01673     { // somethings wrong...
01674       trace("SDFU non route containing packet given to acceptRouteReply");
01675       fprintf(stderr,
01676               "dfu: non route containing packet given to acceptRouteReply\n");
01677     }
01678 
01679   bool good_reply = true;  
01680   //#ifdef USE_GOD_FEEDBACK
01681   /* check to see if this reply is valid or not using god info */
01682   int i;
01683   
01684   for (i = 0; i < reply_route.length()-1 ; i++) 
01685     if (God::instance()->hops(reply_route[i].getNSAddr_t(), 
01686                               reply_route[i+1].getNSAddr_t()) != 1)
01687       {
01688         good_reply = false;
01689         break;
01690       }
01691   //#endif //GOD_FEEDBACK
01692 
01693   if (verbose_srr)
01694     trace("SRR %.9f _%s_ reply-received %d from %s  %s #%d -> %s %s",
01695           Scheduler::instance().clock(), net_id.dump(),
01696           good_reply ? 1 : 0,
01697           p.src.dump(), reply_route[0].dump(), srh->rtreq_seq(),
01698           reply_route[reply_route.length()-1].dump(),
01699           reply_route.dump());
01700 
01701   // add the new route into our cache
01702   route_cache->addRoute(reply_route, Scheduler::instance().clock(), p.src);
01703 
01704   // back down the route request counters
01705   Entry *e = request_table.getEntry(reply_route[reply_route.length()-1]);
01706   e->rt_reqs_outstanding = 0;
01707   e->last_rt_req = 0.0;  
01708 
01709   // see if the addtion of this route allows us to send out
01710   // any of the packets we have waiting
01711   Time delay = 0.0;
01712   ID dest;
01713   for (int c = 0; c < SEND_BUF_SIZE; c++)
01714     {
01715       if (send_buf[c].p.pkt == NULL) continue;
01716 
01717       // check if pkt is destined to outside domain
01718       if (diff_subnet(send_buf[c].p.dest,net_id)) {
01719         dest = ID(node_->base_stn(),::IP);
01720         send_buf[c].p.dest = dest;
01721       }
01722 
01723       if (route_cache->findRoute(send_buf[c].p.dest, send_buf[c].p.route, 1))
01724         { // we have a route!
01725 #ifdef DEBUG
01726           struct hdr_cmn *ch = HDR_CMN(send_buf[c].p.pkt);
01727           if(ch->size() < 0) {
01728                 drop(send_buf[c].p.pkt, "XXX");
01729                 abort();
01730           }
01731 #endif
01732           if (verbose)
01733             trace("Sdebug %.9f _%s_ liberated from sendbuf %s->%s %s",
01734                   Scheduler::instance().clock(), net_id.dump(),
01735                   send_buf[c].p.src.dump(), send_buf[c].p.dest.dump(), 
01736                   send_buf[c].p.route.dump());
01737           /* we need to spread out the rate at which we send packets
01738              in to the link layer to give ARP time to complete.  If we
01739              dump all the packets in at once, all but the last one will
01740              be dropped.  XXX THIS IS A MASSIVE HACK -dam 4/14/98 */
01741           sendOutPacketWithRoute(send_buf[c].p, true, delay);
01742           delay += arp_timeout; 
01743           send_buf[c].p.pkt = NULL;
01744         }
01745     }
01746 }

Here is the call graph for this function:

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 96 of file agent.h.

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

Referenced by LandmarkAgent::assign_lmaddress(), SSMSRMAgent::command(), IntTcpAgent::createTcpSession(), Agent::flushAVar(), LmsSender::handle_lms_pkt(), SSMSRMAgent::is_active(), QSNewRenoTcpAgent::recv(), TcpAsymSink::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), QSAgent::recv(), MIPBSAgent::recv(), LmsAgent::recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), SSMSRMAgent::recv_glb_sess(), SSMSRMAgent::recv_loc_sess(), SSMSRMAgent::recv_rep_sess(), SRMAgent::recv_sess(), TapAgent::recvpkt(), 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(), LmsSender::solicit_naks(), SRMAgent::start(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().

00096 { return here_.addr_; }

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

Definition at line 517 of file agent.cc.

References Packet::allocdata(), and Agent::allocpkt().

00518 {
00519         Packet* p = allocpkt();
00520 
00521         if (n > 0)
00522                 p->allocdata(n);
00523 
00524         return(p);
00525 }

Here is the call graph for this function:

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

Definition at line 506 of file agent.cc.

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

Referenced by TcpSink::ack(), QSTcpSink::ack(), 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(), getRouteForPacket(), LandmarkAgent::makeUpdate(), DSDV_Agent::makeUpdate(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), AbsTcpAgent::output(), TCPTapAgent::processpkt(), AbsDelAckSink::recv(), AbsTcpSink::recv(), SAack_Agent::recv(), PingAgent::recv(), Encapsulator::recv(), TapAgent::recvpkt(), MIPMHAgent::reg(), replyFromRouteCache(), returnSrcRouteToRequestor(), HttpInvalAgent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), GAFAgent::send_discovery(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), RapAgent::SendAck(), UdpAgent::sendmsg(), SimpleTcpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), PushbackAgent::sendMsg(), LmsSender::sendmsg(), FullTcpAgent::sendpacket(), BayFullTcpAgent::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(), sendRouteShortening(), SA_Agent::sendteardown(), LmsSender::solicit_naks(), and AbsDelAckSink::timeout().

00507 {
00508         Packet* p = Packet::alloc();
00509         initpkt(p);
00510         return (p);
00511 }

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 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 DSRAgent::command int  argc,
const char *const *  argv
[virtual]
 

Reimplemented from Agent.

Definition at line 403 of file dsragent.cc.

References ID::addr, BUFFER_CHECK, RouteCache::command(), Agent::command(), dsragent_dont_salvage_bad_replies, dsragent_propagate_last_error, dsragent_reply_from_cache_on_propagating, dsragent_ring_zero_search, dsragent_salvage_with_cache, dsragent_send_grat_replies, dsragent_snoop_forwarded_errors, dsragent_snoop_source_routes, dsragent_use_tap, flow_table, ifq, Mac::installTap(), Address::instance(), Scheduler::instance(), IP, logtarget, MAC, mac_, RouteCache::MAC_id, MAC_id, RouteCache::net_id, net_id, node_, port_dmux_, route_cache, TimerHandler::sched(), send_buf_timer, FlowTable::setNetAddr(), Address::str2addr(), Terminate(), testinit(), trace(), and Random::uniform().

00404 {
00405   TclObject *obj;  
00406 
00407   if (argc == 2) 
00408     {
00409       if (strcasecmp(argv[1], "testinit") == 0)
00410         {
00411           testinit();
00412           return TCL_OK;
00413         }
00414       if (strcasecmp(argv[1], "reset") == 0)
00415         {
00416           Terminate();
00417           return Agent::command(argc, argv);
00418         }
00419       if (strcasecmp(argv[1], "check-cache") == 0)
00420         {
00421           return route_cache->command(argc, argv);
00422         }
00423       if (strcasecmp(argv[1], "startdsr") == 0)
00424         {
00425           if (ID(1,::IP) == net_id) 
00426             { // log the configuration parameters of the dsragent
00427   trace("Sconfig %.5f tap: %s snoop: rts? %s errs? %s",
00428                     Scheduler::instance().clock(),
00429                     dsragent_use_tap ? "on" : "off",
00430                     dsragent_snoop_source_routes ? "on" : "off",
00431                     dsragent_snoop_forwarded_errors ? "on" : "off");
00432   trace("Sconfig %.5f salvage: %s !bd replies? %s",
00433                     Scheduler::instance().clock(),
00434                     dsragent_salvage_with_cache ? "on" : "off",
00435                     dsragent_dont_salvage_bad_replies ? "on" : "off");
00436   trace("Sconfig %.5f grat error: %s grat reply: %s",
00437                     Scheduler::instance().clock(),
00438                     dsragent_propagate_last_error ? "on" : "off",
00439                     dsragent_send_grat_replies ? "on" : "off");
00440   trace("Sconfig %.5f $reply for props: %s ring 0 search: %s",
00441                     Scheduler::instance().clock(),
00442                     dsragent_reply_from_cache_on_propagating ? "on" : "off",
00443                     dsragent_ring_zero_search ? "on" : "off");
00444             }
00445           // cheap source of jitter
00446           send_buf_timer.sched(BUFFER_CHECK 
00447                                + BUFFER_CHECK * Random::uniform(1.0));    
00448           return route_cache->command(argc,argv);
00449         }
00450     }
00451   else if(argc == 3) 
00452     {
00453       if (strcasecmp(argv[1], "addr") == 0) 
00454         {
00455           int temp;
00456           temp = Address::instance().str2addr(argv[2]);
00457          net_id = ID(temp, ::IP);
00458          flow_table.setNetAddr(net_id.addr);
00459          route_cache->net_id = net_id;
00460          return TCL_OK;
00461         } 
00462       else if(strcasecmp(argv[1], "mac-addr") == 0) 
00463         {
00464           MAC_id = ID(atoi(argv[2]), ::MAC);
00465           route_cache->MAC_id = MAC_id;
00466           return TCL_OK;
00467         }
00468       
00469       if( (obj = TclObject::lookup(argv[2])) == 0) 
00470         {
00471           fprintf(stderr, "DSRAgent: %s lookup of %s failed\n", argv[1],
00472                   argv[2]);
00473           return TCL_ERROR;
00474         }
00475 
00476       if (strcasecmp(argv[1], "log-target") == 0)  {
00477               logtarget = (Trace*) obj;
00478               return route_cache->command(argc, argv);
00479       }
00480       else if (strcasecmp(argv[1], "tracetarget") == 0 )
00481         {
00482           logtarget = (Trace*) obj;
00483           return route_cache->command(argc, argv);
00484         }
00485       else if (strcasecmp(argv[1], "install-tap") == 0)  
00486         {
00487           mac_ = (Mac*) obj;
00488           mac_->installTap(this);
00489           return TCL_OK;
00490         }
00491       else if (strcasecmp(argv[1], "node") == 0)
00492         {
00493           node_ = (MobileNode *) obj;
00494           return TCL_OK;
00495         }
00496       else if (strcasecmp (argv[1], "port-dmux") == 0) 
00497         {
00498           port_dmux_ = (NsObject *) obj;
00499           return TCL_OK;
00500         }
00501     }
00502   else if (argc == 4)
00503     {
00504       if (strcasecmp(argv[1], "add-ll") == 0) 
00505         {
00506           if( (obj = TclObject::lookup(argv[2])) == 0) {
00507             fprintf(stderr, "DSRAgent: %s lookup of %s failed\n", argv[1],
00508                     argv[2]);
00509             return TCL_ERROR;
00510           }
00511           ll = (NsObject*) obj;
00512           if( (obj = TclObject::lookup(argv[3])) == 0) {
00513             fprintf(stderr, "DSRAgent: %s lookup of %s failed\n", argv[1],
00514                     argv[3]);
00515             return TCL_ERROR;
00516           }
00517           ifq = (CMUPriQueue *) obj;
00518           return TCL_OK;
00519 
00520         }
00521 
00522 
00523     }
00524   return Agent::command(argc, argv);
00525 }

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 98 of file agent.h.

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

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

00098 { 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, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 93 of file agent.cc.

References ns_addr_t::addr_, Agent::defttl_, NsObject::delay_bind_dispatch(), Agent::dst_, Agent::fid_, Agent::flags_, Agent::here_, ns_addr_t::port_, and Agent::prio_.

Referenced by TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), and LDPAgent::delay_bind_dispatch().

00094 {
00095         if (delay_bind(varName, localName, "agent_addr_", (int*)&(here_.addr_), tracer)) return TCL_OK;
00096         if (delay_bind(varName, localName, "agent_port_", (int*)&(here_.port_), tracer)) return TCL_OK;
00097         if (delay_bind(varName, localName, "dst_addr_", (int*)&(dst_.addr_), tracer)) return TCL_OK;
00098         if (delay_bind(varName, localName, "dst_port_", (int*)&(dst_.port_), tracer)) return TCL_OK;
00099         if (delay_bind(varName, localName, "fid_", (int*)&fid_, tracer)) return TCL_OK;
00100         if (delay_bind(varName, localName, "prio_", (int*)&prio_, tracer)) return TCL_OK;
00101         if (delay_bind(varName, localName, "flags_", (int*)&flags_, tracer)) return TCL_OK;
00102         if (delay_bind(varName, localName, "ttl_", &defttl_, tracer)) return TCL_OK;
00103         if (delay_bind(varName, localName, "class_", (int*)&fid_, tracer)) return TCL_OK;
00104         return Connector::delay_bind_dispatch(varName, localName, tracer);
00105 }

Here is the call graph for this function:

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

Reimplemented from NsObject.

Reimplemented in BayFullTcpAgent, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 78 of file agent.cc.

References NsObject::delay_bind_init_all().

Referenced by TcpAgent::delay_bind_init_all(), TcpSink::delay_bind_init_all(), and LDPAgent::delay_bind_init_all().

00079 {
00080         delay_bind_init_one("agent_addr_");
00081         delay_bind_init_one("agent_port_");
00082         delay_bind_init_one("dst_addr_");
00083         delay_bind_init_one("dst_port_");
00084         delay_bind_init_one("fid_");
00085         delay_bind_init_one("prio_");
00086         delay_bind_init_one("flags_");
00087         delay_bind_init_one("ttl_");
00088         delay_bind_init_one("class_");
00089         Connector::delay_bind_init_all();
00090 }

Here is the call graph for this function:

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:

int DSRAgent::diff_subnet ID  dest,
ID  myid
[private]
 

Definition at line 1642 of file dsragent.cc.

References ID::addr, Address::get_subnetaddr(), and Address::instance().

Referenced by acceptRouteReply(), handlePktWithoutSR(), and sendOutPacketWithRoute().

01643 {
01644         int dst = dest.addr;
01645         int id = myid.addr;
01646         char* dstnet = Address::instance().get_subnetaddr(dst);
01647         char * subnet = Address::instance().get_subnetaddr(id);
01648         if (subnet != NULL) {
01649                 if (dstnet != NULL) {
01650                         if (strcmp(dstnet, subnet) != 0) {
01651                                 delete [] dstnet;
01652                                 return 1;
01653                         }
01654                         delete [] dstnet;
01655                 }
01656                 delete [] subnet;
01657         }
01658         assert(dstnet == NULL);
01659         return 0;
01660 }

Here is the call graph for this function:

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

Definition at line 99 of file agent.h.

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

Referenced by DSDV_Agent::lost_link(), TcpAsymSink::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), rtProtoDV::sendpkt(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().

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

Definition at line 106 of file connector.cc.

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

Referenced by acceptRouteReply(), ARPTable::arpresolve(), JoBS::dropFront(), Vq::dropPacketForECN(), dropSendBuff(), JoBS::dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), getRouteForPacket(), Snoop::handle(), handleFlowForwarding(), handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), PriQueue::Terminate(), Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and 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 DSRAgent::dropSendBuff SRPacket p  )  [private]
 

Definition at line 202 of file dsragent.cc.

References SRPacket::dest, Connector::drop(), DROP_RTR_QTIMEOUT, ID::dump(), Scheduler::instance(), net_id, SRPacket::pkt, Path::reset(), SRPacket::route, SRPacket::src, and trace().

Referenced by sendBufferCheck(), and stickPacketInSendBuffer().

00204 {
00205   trace("Ssb %.5f _%s_ dropped %s -> %s", Scheduler::instance().clock(), 
00206         net_id.dump(), p.src.dump(), p.dest.dump());
00207   drop(p.pkt, DROP_RTR_QTIMEOUT);
00208   p.pkt = 0;
00209   p.route.reset();
00210 }

Here is the call graph for this function:

void Agent::dumpTracedVars  )  [protected, inherited]
 

packet_t Agent::get_pkttype  )  [inline, inherited]
 

Definition at line 101 of file agent.h.

References packet_t, and Agent::type_.

Referenced by CBR_Traffic::init().

00101 { return type_; }

void DSRAgent::getRouteForPacket SRPacket p,
bool  retry
[private]
 

Definition at line 1414 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), Agent::allocpkt(), arp_timeout, BackOffTest(), Scheduler::clock(), Packet::copy(), Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_ip::dport(), Connector::drop(), DROP_RTR_NO_ROUTE, dsr_salvage_allow_propagating, dsr_salvage_max_requests, dsragent_ring_zero_search, ID::dump(), Packet::free(), RequestTable::getEntry(), ID::getNSAddr_t(), hdr_sr::init(), Address::instance(), Scheduler::instance(), IP_HDR_LEN, Entry::last_arp, Entry::last_type, LIMIT0, MAX_SR_LEN, net_id, hdr_cmn::num_forwards(), SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), request_table, RT_PORT, Entry::rt_reqs_outstanding, hdr_ip::saddr(), sendOutRtReq(), hdr_cmn::size(), Agent::size_, hdr_ip::sport(), SRPacket::src, stickPacketInSendBuffer(), Time, trace(), UNLIMIT, and verbose_srr.

Referenced by handlePktWithoutSR().

01418 {
01419   // since we'll commonly be only one hop away, we should
01420   // arp first before route discovery as an optimization...
01421 
01422   Entry *e = request_table.getEntry(p.dest);
01423   Time time = Scheduler::instance().clock();
01424 
01425 #if 0
01426   /* pre 4/13/98 logic -dam removed b/c it seemed more complicated than
01427      needed since we're not doing piggybacking and we're returning
01428      route replies via a reversed route (the copy in this code is
01429      critical if we need to piggyback route replies on the route request to
01430      discover the return path) */
01431 
01432   /* make the route request packet */
01433   SRPacket rrp = p;
01434   rrp.pkt = p.pkt->copy();
01435   hdr_sr *srh = hdr_sr::access(rrp.pkt);
01436   hdr_ip *iph = hdr_ip::access(rrp.pkt);
01437   hdr_cmn *cmh =  hdr_cmn::access(rrp.pkt);
01438   //iph->daddr() = p.dest.getNSAddr_t();
01439   iph->daddr() = Address::instance().create_ipaddr(p.dest.getNSAddr_t(),RT_PORT);
01440   iph->dport() = RT_PORT;
01441   //iph->saddr() = net_id.getNSAddr_t();
01442   iph->saddr() = Address::instance().create_ipaddr(net_id.getNSAddr_t(),RT_PORT);
01443   iph->sport() = RT_PORT;
01444   cmnh->ptype() = PT_DSR;
01445   cmnh->size() = size_;
01446   cmnh->num_forwards() = 0;
01447 #endif
01448 
01449   /* make the route request packet */
01450   SRPacket rrp;
01451   rrp.dest = p.dest;
01452   rrp.src = net_id;
01453   rrp.pkt = allocpkt();
01454 
01455   hdr_sr *srh = hdr_sr::access(rrp.pkt); 
01456   hdr_ip *iph = hdr_ip::access(rrp.pkt);
01457   hdr_cmn *cmnh =  hdr_cmn::access(rrp.pkt);
01458   
01459   iph->daddr() = Address::instance().create_ipaddr(p.dest.getNSAddr_t(),RT_PORT);
01460   iph->dport() = RT_PORT;
01461   iph->saddr() = Address::instance().create_ipaddr(net_id.getNSAddr_t(),RT_PORT);
01462   iph->sport() = RT_PORT;
01463   cmnh->ptype() = PT_DSR;
01464   cmnh->size() = size_ + IP_HDR_LEN; // add in IP header
01465   cmnh->num_forwards() = 0;
01466   
01467   srh->init();
01468 
01469 
01470   if (BackOffTest(e, time)) {
01471           // it's time to start another route request cycle
01472 
01473 #ifdef NEW_SALVAGE_LOGIC
01474           if(p.src != net_id) {
01475 
01476                   assert(dsr_salvage_max_requests > 0);
01477                   assert(p.pkt);
01478 
01479                   if(e->rt_reqs_outstanding > dsr_salvage_max_requests) {
01480                           drop(p.pkt, DROP_RTR_NO_ROUTE);
01481                           p.pkt = 0;
01482 
01483                           // dump the route request packet we made up
01484                           Packet::free(rrp.pkt);
01485                           rrp.pkt = 0;
01486 
01487                           return;
01488                   }
01489           }
01490 #endif /* NEW_SALVAGE_LOGIC */
01491 
01492           if (dsragent_ring_zero_search) {
01493                   // do a ring zero search
01494                   e->last_type = LIMIT0;
01495                   sendOutRtReq(rrp, 0);
01496           } else {
01497                   // do a propagating route request right now
01498                   e->last_type = UNLIMIT;
01499                   sendOutRtReq(rrp, MAX_SR_LEN);
01500           }
01501 
01502           e->last_arp = time;
01503   }  else if (LIMIT0 == e->last_type &&
01504 #ifdef NEW_SALVAGE_LOGIC
01505               (dsr_salvage_allow_propagating || p.src == net_id) &&
01506 #endif
01507            (time - e->last_arp) > arp_timeout) {
01508           // try propagating rt req since we haven't heard back
01509           // from limited one
01510 
01511           e->last_type = UNLIMIT;
01512           sendOutRtReq(rrp, MAX_SR_LEN);
01513   }
01514   else {
01515           // it's not time to send another route request...
01516           if (!retry && verbose_srr)
01517                   trace("SRR %.5f _%s_ RR-not-sent %s -> %s", 
01518                         Scheduler::instance().clock(), 
01519                         net_id.dump(), rrp.src.dump(), rrp.dest.dump());
01520           Packet::free(rrp.pkt); // dump the route request packet we made up
01521           rrp.pkt = 0;
01522   }
01523 
01524   /* for now, no piggybacking at all, queue all pkts */
01525   if (!retry) {
01526           stickPacketInSendBuffer(p);
01527           p.pkt = 0; // pkt is handled for now (it's in sendbuffer)
01528   }
01529 
01530 }

Here is the call graph for this function:

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 DSRAgent::handleDefaultForwarding SRPacket p  )  [private]
 

Definition at line 746 of file dsragent.cc.

References hdr_ip::access(), ID::addr, FlowTable::defaultFlow(), SRPacket::dest, FlowTable::find(), flow_table, handleFlowForwarding(), SRPacket::pkt, sendUnknownFlow(), SRPacket::src, hdr_ip::ttl(), and u_int16_t.

Referenced by handleForwarding().

00746                                              {
00747   hdr_ip *iph = hdr_ip::access(p.pkt);
00748   u_int16_t flowid;
00749   int       flowidx;
00750 
00751   if (!flow_table.defaultFlow(p.src.addr, p.dest.addr, flowid)) {
00752     sendUnknownFlow(p, true);
00753     assert(p.pkt == 0);
00754     return;
00755   }
00756 
00757   if ((flowidx = flow_table.find(p.src.addr, p.dest.addr, flowid)) == -1) {
00758     sendUnknownFlow(p, false, flowid);
00759     assert(p.pkt == 0);
00760     return;
00761   }
00762 
00763   if (iph->ttl() != flow_table[flowidx].expectedTTL) {
00764     sendUnknownFlow(p, true);
00765     assert(p.pkt == 0);
00766     return;
00767   }
00768 
00769   // XXX should also check prevhop
00770 
00771   handleFlowForwarding(p, flowidx);
00772 }

Here is the call graph for this function:

void DSRAgent::handleFlowForwarding SRPacket p,
int  flowidx
[private]
 

Definition at line 775 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), hdr_cmn::addr_type(), ars_table, Scheduler::clock(), default_flow_timeout, SRPacket::dest, hdr_cmn::direction(), hdr_cmn::DOWN, Connector::drop(), DROP_RTR_TTL, dsragent_always_reestablish, ID::dump(), ARSTable::findAndClear(), flow_table, Path::index(), Scheduler::instance(), net_id, hdr_cmn::next_hop(), hdr_sr::num_addrs(), SRPacket::pkt, SRPacket::route, hdr_sr::salvaged(), Scheduler::schedule(), sendRouteShortening(), SRPacket::src, trace(), hdr_ip::ttl(), hdr_cmn::uid(), hdr_cmn::UP, hdr_cmn::xmit_failure_, hdr_cmn::xmit_failure_data_, and XmitFlowFailureCallback.

00775                                                        {
00776   hdr_sr *srh = hdr_sr::access(p.pkt);
00777   hdr_ip *iph = hdr_ip::access(p.pkt);
00778   hdr_cmn *cmnh =  hdr_cmn::access(p.pkt);
00779   int amt;
00780 
00781   assert(flowidx >= 0);
00782   assert(!srh->num_addrs());
00783 
00784   cmnh->next_hop() = flow_table[flowidx].nextHop;
00785   cmnh->addr_type() = ::IP;
00786 
00787   cmnh->xmit_failure_ = XmitFlowFailureCallback;
00788   cmnh->xmit_failure_data_ = (void *) this;
00789 
00790   // make sure we aren't cycling packets
00791   //assert(p.pkt->incoming == 0); // this is an outgoing packet
00792   assert(cmnh->direction() == hdr_cmn::UP);
00793 
00794   if (!iph->ttl()--) {
00795     drop(p.pkt, DROP_RTR_TTL);
00796     p.pkt = 0;
00797     return;
00798   }
00799 
00800   trace("SFf %.9f _%s_ %d [%s -> %s] %d to %d", 
00801         Scheduler::instance().clock(), net_id.dump(), cmnh->uid(),
00802         p.src.dump(), p.dest.dump(), flow_table[flowidx].flowId,
00803         flow_table[flowidx].nextHop);
00804 
00805   // XXX ych 5/8/01 ARS also should check previous hop
00806   if (!srh->salvaged() && 
00807       (amt = ars_table.findAndClear(cmnh->uid(), flow_table[flowidx].flowId)) &&
00808       p.route.index() - amt > 0) {
00809     trace("SFARS %.9f _%s_ %d [%s -> %s] %d %d", 
00810           Scheduler::instance().clock(), net_id.dump(), cmnh->uid(),
00811           p.src.dump(), p.dest.dump(), flow_table[flowidx].flowId, amt);
00812 
00813     // stamp a route in the packet...
00814     p.route = flow_table[flowidx].sourceRoute;
00815     p.route.index() -= amt;
00816     sendRouteShortening(p, p.route.index(), 
00817                         flow_table[flowidx].sourceRoute.index());
00818   }
00819 
00820   if (dsragent_always_reestablish) {
00821     // XXX this is an utter hack. the flow_table needs to remember the original
00822     // timeout value specified, as well as the original time to timeout. No
00823     // establishment packets are allowed after the original time. Must make sure
00824     // flowids assigned do not overlap. ych 5/8/01
00825     flow_table[flowidx].timeout = Scheduler::instance().clock() + 
00826                                   default_flow_timeout;
00827   }
00828   // set the direction pkt to be down
00829   cmnh->direction() = hdr_cmn::DOWN;
00830   Scheduler::instance().schedule(ll, p.pkt, 0);
00831   p.pkt = 0;
00832 }

Here is the call graph for this function:

void DSRAgent::handleFlowForwarding SRPacket p  )  [private]
 

Definition at line 835 of file dsragent.cc.

References hdr_ip::access(), hdr_sr::access(), ID::addr, FlowTable::cleanup(), Scheduler::clock(), FlowTable::createEntry(), hdr_sr::cur_addr(), SRPacket::dest, FlowTable::find(), hdr_sr::flow_header(), hdr_sr::flow_id(), flow_table, hdr_sr::flow_timeout(), hdr_sr::flow_timeout_time(), hdr_sr::get_next_addr(), hdr_sr::get_next_type(), hdr_sr::hopCount(), Scheduler::instance(), net_id, hdr_sr::num_addrs(), SRPacket::pkt, SRPacket::route, sendUnknownFlow(), SRPacket::src, and hdr_ip::ttl().

Referenced by handleDefaultForwarding(), and handleForwarding().

00835                                           {
00836   hdr_sr *srh = hdr_sr::access(p.pkt);
00837   hdr_ip *iph = hdr_ip::access(p.pkt);
00838   int flowidx = flow_table.find(p.src.addr, p.dest.addr, srh->flow_id());
00839 
00840   assert(srh->flow_header());
00841 
00842   if (srh->num_addrs()) {
00843     assert(srh->flow_timeout());
00844 
00845     if (flowidx == -1) {
00846       flow_table.cleanup();
00847       flowidx = flow_table.createEntry(p.src.addr, p.dest.addr, srh->flow_id());
00848 
00849       assert(flowidx != -1);
00850 
00851       flow_table[flowidx].timeout = Scheduler::instance().clock() + 
00852                                     srh->flow_timeout_time();
00853       flow_table[flowidx].hopCount = srh->hopCount();
00854       flow_table[flowidx].expectedTTL = iph->ttl();
00855       flow_table[flowidx].sourceRoute = p.route;
00856       flow_table[flowidx].nextHop = srh->get_next_addr();
00857       assert(srh->hopCount() == srh->cur_addr());
00858       assert(srh->get_next_type() == ::IP);
00859       assert(flow_table[flowidx].sourceRoute[flow_table[flowidx].hopCount] == 
00860              net_id);
00861 
00862       flow_table[flowidx].count = 0;            // shouldn't be used
00863       flow_table[flowidx].allowDefault = false; // shouldn't be used
00864     }
00865 
00866     assert(flowidx != -1);
00867     //assert(flow_table[flowidx].hopCount == srh->hopCount());
00868     
00869     srh->hopCount()++;
00870     return;
00871   }
00872 
00873   if (flowidx == -1) {
00874     // return an error
00875     sendUnknownFlow(p, false, srh->flow_id());
00876     assert(p.pkt == 0);
00877     return;
00878   }
00879 
00880   //assert(flow_table[flowidx].hopCount == srh->hopCount());
00881 
00882   srh->hopCount()++;
00883 
00884   // forward the packet
00885   handleFlowForwarding(p, flowidx);
00886 }

Here is the call graph for this function:

void DSRAgent::handleForwarding SRPacket p  )  [private]
 

Definition at line 889 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), Scheduler::clock(), Connector::drop(), DROP_RTR_ROUTE_LOOP, DROP_RTR_TTL, dsragent_snoop_source_routes, hdr_sr::flow_header(), handleDefaultForwarding(), handleFlowForwarding(), Path::index(), Scheduler::instance(), Path::length(), MAC_id, net_id, RouteCache::noticeRouteUsed(), hdr_sr::num_addrs(), SRPacket::pkt, SRPacket::route, route_cache, sendOutPacketWithRoute(), hdr_sr::size(), hdr_cmn::size(), trace(), and hdr_ip::ttl().

Referenced by recv().

00892 {
00893   hdr_sr *srh =  hdr_sr::access(p.pkt);
00894   hdr_ip *iph = hdr_ip::access(p.pkt);
00895   hdr_cmn *ch =  hdr_cmn::access(p.pkt);
00896   bool flowOnly = !srh->num_addrs();
00897 
00898   if (srh->flow_header())
00899     handleFlowForwarding(p);
00900   else if (!srh->num_addrs())
00901     handleDefaultForwarding(p);
00902 
00903   if (flowOnly)
00904     return;
00905 
00906   assert(p.pkt); // make sure flow state didn't eat the pkt
00907 
00908   // first make sure we are the ``current'' host along the source route.
00909   // if we're not, the previous node set up the source route incorrectly.
00910   assert(p.route[p.route.index()] == net_id
00911          || p.route[p.route.index()] == MAC_id);
00912 
00913   if (p.route.index() >= p.route.length())
00914     {
00915       fprintf(stderr,"dfu: ran off the end of a source route\n");
00916       trace("SDFU:  ran off the end of a source route\n");
00917       drop(p.pkt, DROP_RTR_ROUTE_LOOP);
00918       p.pkt = 0;
00919       // maybe we should send this packet back as an error...
00920       return;
00921     }
00922 
00923   // if there's a source route, maybe we should snoop it too
00924   if (dsragent_snoop_source_routes)
00925     route_cache->noticeRouteUsed(p.route, Scheduler::instance().clock(), 
00926                                  net_id);
00927 
00928   // sendOutPacketWithRoute will add in the size of the src hdr, so
00929   // we have to subtract it out here
00930   ch->size() -= srh->size();
00931 
00932   // we need to manually decr this, since nothing else does.
00933   if (!iph->ttl()--) {
00934     drop(p.pkt, DROP_RTR_TTL);
00935     p.pkt = 0;
00936     return;
00937   }
00938 
00939   // now forward the packet...
00940   sendOutPacketWithRoute(p, false);
00941 }

Here is the call graph for this function:

void DSRAgent::handlePacketReceipt SRPacket p  )  [private]
 

Definition at line 683 of file dsragent.cc.

References acceptRouteReply(), hdr_sr::access(), hdr_cmn::access(), SRPacket::dest, dsragent_reply_only_to_first_rtreq, hdr_sr::flow_default_unknown(), hdr_sr::flow_unknown(), Packet::free(), ignoreRouteRequestp(), RequestTable::insert(), Address::instance(), IP_HDR_LEN, MAC_id, net_id, SRPacket::pkt, processBrokenRouteError(), processUnknownFlowError(), NsObject::recv(), request_table, returnSrcRouteToRequestor(), hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_request(), hdr_sr::rtreq_seq(), hdr_sr::size(), hdr_cmn::size(), SRPacket::src, Connector::target_, and hdr_sr::valid().

Referenced by handlePktWithoutSR(), and recv().

00685 {
00686   hdr_cmn *cmh =  hdr_cmn::access(p.pkt);
00687   hdr_sr *srh =  hdr_sr::access(p.pkt);
00688 
00689   if (srh->route_reply())
00690     { // we got a route_reply piggybacked on a route_request
00691       // accept the new source route before we do anything else
00692       // (we'll send off any packet's we have queued and waiting)
00693       acceptRouteReply(p);
00694     }
00695   
00696   if (srh->route_request())
00697     {
00698       if (dsragent_reply_only_to_first_rtreq  && ignoreRouteRequestp(p)) 
00699         { //we only respond to the first route request
00700           // we receive from a host 
00701           Packet::free(p.pkt);     // drop silently
00702           p.pkt = 0;
00703           return;
00704         }
00705       else
00706         { // we're going to process this request now, so record the req_num
00707           request_table.insert(p.src, p.src, srh->rtreq_seq());
00708           returnSrcRouteToRequestor(p);
00709         }
00710     }
00711 
00712   if (srh->route_error())
00713     { // register the dead route      
00714       processBrokenRouteError(p);
00715     }
00716 
00717   if (srh->flow_unknown())
00718     processUnknownFlowError(p, false);
00719 
00720   if (srh->flow_default_unknown())
00721     processUnknownFlowError(p, true);
00722 
00723   /* give the data in the packet to our higher layer (our port dmuxer, most 
00724    likely) */
00725   //handPktToDmux(p);
00726   assert(p.dest == net_id || p.dest == MAC_id);
00727   
00728 #if 0
00729   if (iph->dport() == 255) {
00730     int mask = Address::instance().portmask();
00731     int shift = Address::instance().portshift();  
00732     iph->daddr() = ((iph->dport() & mask) << shift) | ((~(mask) << shift) & iph->dst());
00733   }
00734 #endif
00735   
00736   cmh->size() -= srh->size();   // cut off the SR header 4/7/99 -dam
00737   srh->valid() = 0;
00738   cmh->size() -= IP_HDR_LEN;    // cut off IP header size 4/7/99 -dam
00739   target_->recv(p.pkt, (Handler*)0);
00740   p.pkt = 0;
00741 
00742 }

Here is the call graph for this function:

void DSRAgent::handlePktWithoutSR SRPacket p,
bool  retry
[private]
 

Definition at line 639 of file dsragent.cc.

References hdr_sr::access(), MobileNode::base_stn(), SRPacket::dest, diff_subnet(), Path::dump(), ID::dump(), RouteCache::findRoute(), getRouteForPacket(), handlePacketReceipt(), Scheduler::instance(), net_id, node_, SRPacket::pkt, SRPacket::route, route_cache, sendOutPacketWithRoute(), SRPacket::src, trace(), hdr_sr::valid(), and verbose.

Referenced by processBrokenRouteError(), processUnknownFlowError(), recv(), sendBufferCheck(), sendUnknownFlow(), and undeliverablePkt().

00642 {
00643   hdr_sr *srh =  hdr_sr::access(p.pkt);
00644   assert(srh->valid());
00645 
00646   if (p.dest == net_id)
00647     { // it doesn't need a source route, 'cause it's for us
00648       handlePacketReceipt(p);
00649       return;
00650     }
00651 
00652   // Extensions for wired cum wireless simulation mode
00653   //if pkt dst outside my subnet, route to base_stn
00654 
00655   ID dest;
00656   if (diff_subnet(p.dest,net_id)) {
00657   dest = ID(node_->base_stn(),::IP);
00658   p.dest = dest;
00659   }
00660 
00661   if (route_cache->findRoute(p.dest, p.route, 1))
00662     { // we've got a route...
00663       if (verbose)
00664         trace("S$hit %.5f _%s_ %s -> %s %s",
00665               Scheduler::instance().clock(), net_id.dump(),
00666               p.src.dump(), p.dest.dump(), p.route.dump());      
00667       sendOutPacketWithRoute(p, true);
00668       return;
00669     } // end if we have a route
00670   else
00671     { // we don't have a route...
00672       if (verbose) 
00673         trace("S$miss %.5f _%s_ %s -> %s", 
00674               Scheduler::instance().clock(), net_id.dump(), 
00675               net_id.dump(), p.dest.dump());
00676 
00677       getRouteForPacket(p, retry);
00678       return;
00679     } // end of we don't have a route
00680 }

Here is the call graph for this function:

void DSRAgent::handleRouteRequest SRPacket p  )  [private]
 

Definition at line 944 of file dsragent.cc.

References hdr_sr::access(), Path::appendToPath(), SRPacket::dest, dsragent_reply_from_cache_on_propagating, Path::dump(), ID::dump(), Packet::free(), Path::full(), HDR_MAC, Mac::hdr_src(), ifq, ignoreRouteRequestp(), RequestTable::insert(), Scheduler::instance(), Path::length(), mac_, hdr_sr::max_propagation(), net_id, SRPacket::pkt, CMUPriQueue::prq_length(), replyFromRouteCache(), request_table, SRPacket::route, hdr_sr::route_request(), hdr_sr::rtreq_seq(), sendOutPacketWithRoute(), SRPacket::src, trace(), and verbose_srr.

Referenced by recv().

00946 {
00947   hdr_sr *srh =  hdr_sr::access(p.pkt);
00948   assert (srh->route_request());
00949 
00950 #ifdef notdef
00951   {
00952           int src = mac_->hdr_src(HDR_MAC(p.pkt));
00953 
00954           if(mac_->is_neighbor(src) == 0) {
00955                   Packet::free(p.pkt);
00956                   p.pkt = 0;
00957                   return;
00958           }
00959   }
00960 #endif
00961 
00962   if (ignoreRouteRequestp(p)) 
00963     {
00964       if (verbose_srr) 
00965         trace("SRR %.5f _%s_ dropped %s #%d (ignored)",
00966               Scheduler::instance().clock(), net_id.dump(), p.src.dump(),
00967               srh->rtreq_seq());
00968       Packet::free(p.pkt);  // pkt is a route request we've already processed
00969       p.pkt = 0;
00970       return; // drop silently
00971     }
00972 
00973   // we're going to process this request now, so record the req_num
00974   request_table.insert(p.src, p.src, srh->rtreq_seq());
00975 
00976   /*  - if it's a Ring 0 search, check the rt$ for a reply and use it if
00977      possible.  There's not much point in doing Ring 0 search if you're 
00978      not going to check the cache.  See the comment about turning off all
00979      reply from cache behavior near the definition of d_r_f_c_o_p (if your 
00980      workload had really good spatial locality, it might still make 
00981      sense 'cause your target is probably sitting next to you)
00982       - if reply from cache is on, check the cache and reply if possible
00983       - otherwise, just propagate if possible. */
00984   if ((srh->max_propagation() == 0 || dsragent_reply_from_cache_on_propagating)
00985       && replyFromRouteCache(p))
00986           return;                       // all done
00987 
00988 #ifdef NEW_REQUEST_LOGIC
00989   /*
00990    * If we are congested, don't forward or answer the Route Reply
00991    */
00992   if(ifq->prq_length() > 10) {
00993           trace("SRR %.9f _%s_ discarding %s #%d (ifq length %d)",
00994                 Scheduler::instance().clock(),
00995                 net_id.dump(),
00996                 p.src.dump(),
00997                 srh->rtreq_seq(),
00998                 ifq->prq_length());
00999           Packet::free(p.pkt);
01000           p.pkt = 0;
01001           return;
01002   }
01003 
01004   /*
01005    *  If "free air time" < 15%, don't forward or answer the Route Reply
01006    */
01007   {
01008           double atime = mac_->air_time_free(10);
01009 
01010           if(atime > 0.0 && atime < 0.15) {
01011                   trace("SRR %.9f _%s_ discarding %s #%d (free air time %f)",
01012                         Scheduler::instance().clock(),
01013                         net_id.dump(),
01014                         p.src.dump(),
01015                         srh->rtreq_seq(),
01016                         atime);
01017                   Packet::free(p.pkt);
01018                   p.pkt = 0;
01019                   return;
01020           }
01021   }  
01022 #endif /* NEW_REQUEST_LOGIC */
01023 
01024   // does the orginator want us to propagate?
01025   if (p.route.length() > srh->max_propagation())
01026     {   // no propagation
01027       if (verbose_srr) 
01028         trace("SRR %.5f _%s_ dropped %s #%d (prop limit exceeded)",
01029               Scheduler::instance().clock(), net_id.dump(), p.src.dump(),
01030               srh->rtreq_seq());
01031       Packet::free(p.pkt); // pkt isn't for us, and isn't data carrying
01032       p.pkt = 0;
01033       return;           
01034     }
01035 
01036   // can we propagate?
01037   if (p.route.full())
01038     {   // no propagation
01039       trace("SRR %.5f _%s_ dropped %s #%d (SR full)",
01040             Scheduler::instance().clock(), net_id.dump(), p.src.dump(),
01041             srh->rtreq_seq());
01042       /* pkt is a rt req, even if data carrying, we don't want to log 
01043          the drop using drop() since many nodes could be dropping the 
01044          packet in this fashion */
01045       Packet::free(p.pkt);
01046       p.pkt = 0;
01047       return;           
01048     }
01049 
01050   // add ourselves to the source route
01051   p.route.appendToPath(net_id);
01052 
01053   if (verbose_srr)
01054     trace("SRR %.5f _%s_ rebroadcast %s #%d ->%s %s",
01055           Scheduler::instance().clock(), net_id.dump(), p.src.dump(),
01056           srh->rtreq_seq(), p.dest.dump(), p.route.dump());
01057 
01058   sendOutPacketWithRoute(p, false);
01059   return;      
01060 }

Here is the call graph for this function:

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

Definition at line 363 of file agent.cc.

References Agent::app_, and Application::resume().

Referenced by FullTcpAgent::foutput(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), UdpAgent::sendmsg(), SA_Agent::sendmsg(), and RTPAgent::sendmsg().

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

Here is the call graph for this function:

bool DSRAgent::ignoreRouteRequestp SRPacket p  )  [private]
 

Definition at line 1066 of file dsragent.cc.

References hdr_sr::access(), Path::full(), RequestTable::get(), MAC_id, Path::member(), net_id, SRPacket::pkt, request_table, SRPacket::route, hdr_sr::rtreq_seq(), and SRPacket::src.

Referenced by handlePacketReceipt(), and handleRouteRequest().

01068 {
01069   hdr_sr *srh =  hdr_sr::access(p.pkt);
01070 
01071   if (request_table.get(p.src) >= srh->rtreq_seq())
01072     { // we've already processed a copy of this reqest so
01073       // we should drop the request silently
01074       return true;
01075     }
01076   if (p.route.member(net_id,MAC_id))
01077     { // we're already on the route, drop silently
01078       return true;
01079     }
01080 
01081   if (p.route.full())
01082     { // there won't be room for us to put our address into
01083       // the route
01084       // so drop silently - sigh, so close, and yet so far...
01085       // Note that since we don't record the req_id of this message yet,
01086       // we'll process the request if it gets to us on a shorter path
01087       return true;
01088     }
01089   return false;
01090 }

Here is the call graph for this function:

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

Definition at line 446 of file agent.cc.

References hdr_nv::access(), hdr_flags::access(), hdr_ip::access(), hdr_cmn::access(), ns_addr_t::addr_, Scheduler::clock(), hdr_flags::cong_action_, hdr_ip::daddr(), Agent::defttl_, hdr_cmn::direction(), hdr_ip::dport(), Agent::dst_, hdr_flags::ecn_, hdr_flags::ecn_capable_, hdr_flags::ecn_to_echo_, hdr_flags::eln_, hdr_cmn::error(), Agent::fid_, hdr_ip::flowid(), hdr_flags::fs_, NixNode::GetNixVector(), NixNode::GetNodeObject(), hdr_nv::h_used, Agent::here_, hdr_cmn::iface(), Scheduler::instance(), hdr_flags::no_ts_, hdr_cmn::NONE, hdr_nv::nv(), hdr_ip::offset(), hdr_nv::offset(), ns_addr_t::port_, hdr_flags::pri_, hdr_ip::prio(), Agent::prio_, hdr_cmn::ptype(), NixVec::Reset(), hdr_ip::saddr(), hdr_cmn::size(), Agent::size_, hdr_ip::sport(), hdr_cmn::timestamp(), hdr_ip::ttl(), Agent::type_, hdr_cmn::uid(), and Agent::uidcnt_.

Referenced by Agent::allocpkt(), and PingResponder::recv().

00447 {
00448         hdr_cmn* ch = hdr_cmn::access(p);
00449         ch->uid() = uidcnt_++;
00450         ch->ptype() = type_;
00451         ch->size() = size_;
00452         ch->timestamp() = Scheduler::instance().clock();
00453         ch->iface() = UNKN_IFACE.value(); // from packet.h (agent is local)
00454         ch->direction() = hdr_cmn::NONE;
00455 
00456         ch->error() = 0;        /* pkt not corrupt to start with */
00457 
00458         hdr_ip* iph = hdr_ip::access(p);
00459         iph->saddr() = here_.addr_;
00460         iph->sport() = here_.port_;
00461         iph->daddr() = dst_.addr_;
00462         iph->dport() = dst_.port_;
00463         
00464         //DEBUG
00465         //if (dst_ != -1)
00466         //  printf("pl break\n");
00467         
00468         iph->flowid() = fid_;
00469         iph->prio() = prio_;
00470         iph->ttl() = defttl_;
00471 
00472         hdr_flags* hf = hdr_flags::access(p);
00473         hf->ecn_capable_ = 0;
00474         hf->ecn_ = 0;
00475         hf->eln_ = 0;
00476         hf->ecn_to_echo_ = 0;
00477         hf->fs_ = 0;
00478         hf->no_ts_ = 0;
00479         hf->pri_ = 0;
00480         hf->cong_action_ = 0;
00481 #ifdef HAVE_STL
00482 
00483         hdr_nv* nv = hdr_nv::access(p);
00484         if (0)
00485                 printf("Off hdr_nv %d, ip_hdr %d myaddr %ld\n",
00486                        hdr_nv::offset(), hdr_ip::offset(), here_.addr_);
00487         NixNode* pNixNode = NixNode::GetNodeObject(here_.addr_);
00488         if (0)
00489                 printf("Node Object %p\n", pNixNode);
00490         if (pNixNode) { 
00491                 // If we get non-null, indicates nixvector routing in use
00492                 // Delete any left over nv in the packet
00493                 // Get a nixvector to the target (may create new)
00494                 NixVec* pNv = pNixNode->GetNixVector(dst_.addr_);
00495                 pNv->Reset();
00496                 nv->nv() = pNv; // And set the nixvec in the packet
00497                 nv->h_used = 0; // And reset used portion to 0
00498         }
00499 #endif //HAVE_STL
00500 }

Here is the call graph for this function:

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

DSRAgent::LIST_ENTRY DSRAgent   ) 
 

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 }

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:

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

Definition at line 97 of file agent.h.

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

Referenced by LmsAgent::pkt2agent(), TcpAsymSink::recv(), MIPBSAgent::recv(), LmsAgent::recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), LmsReceiver::send_refresh(), IcmpAgent::sendredirect(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().

00097 { return here_.port_; }

void DSRAgent::processBrokenRouteError SRPacket p  )  [private]
 

Definition at line 1815 of file dsragent.cc.

References hdr_ip::access(), hdr_sr::access(), link_down::addr_type, Scheduler::clock(), Packet::copy(), Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_sr::down_links(), hdr_ip::dport(), ID::dump(), err_from, err_to, hdr_sr::flow_header(), flow_table, hdr_sr::flow_timeout(), link_down::from_addr, ID::getNSAddr_t(), handlePktWithoutSR(), Address::instance(), Scheduler::instance(), MAC_id, net_id, FlowTable::noticeDeadLink(), RouteCache::noticeDeadLink(), NS_AF_INET, hdr_sr::num_route_errors(), SRPacket::pkt, route_cache, hdr_sr::route_error(), route_error_data_time, route_error_held, RT_PORT, hdr_ip::saddr(), hdr_ip::sport(), SRPacket::src, link_down::tell_addr, link_down::to_addr, trace(), hdr_ip::ttl(), verbose, and verbose_srr.

Referenced by handlePacketReceipt(), recv(), and tap().

01819 {
01820   hdr_sr *srh = hdr_sr::access(p.pkt);
01821 
01822   if (!srh->route_error())
01823     return; // what happened??
01824   
01825   /* if we hear A->B is dead, should we also run the link B->A through the
01826      cache as being dead, since 802.11 requires bidirectional links 
01827       XXX -dam 4/23/98 */
01828 
01829   // since CPU time is cheaper than network time, we'll process
01830   // all the dead links in the error packet
01831   assert(srh->num_route_errors() > 0);
01832   for (int c = 0 ; c < srh->num_route_errors() ; c++)
01833     {
01834       assert(srh->down_links()[c].addr_type == NS_AF_INET);
01835       route_cache->noticeDeadLink(ID(srh->down_links()[c].from_addr,::IP),
01836                                  ID(srh->down_links()[c].to_addr,::IP),
01837                                  Scheduler::instance().clock());
01838       flow_table.noticeDeadLink(ID(srh->down_links()[c].from_addr,::IP),
01839                                  ID(srh->down_links()[c].to_addr,::IP));
01840       // I'll assume everything's of type NS_AF_INET for the printout... XXX
01841       if (verbose_srr)
01842         trace("SRR %.9f _%s_ dead-link tell %d  %d -> %d",
01843               Scheduler::instance().clock(), net_id.dump(),
01844               srh->down_links()[c].tell_addr,
01845               srh->down_links()[c].from_addr,
01846               srh->down_links()[c].to_addr);
01847     }
01848 
01849   ID who = ID(srh->down_links()[srh->num_route_errors()-1].tell_addr, ::IP);
01850   if (who != net_id && who != MAC_id)
01851     { // this error packet wasn't meant for us to deal with
01852       // since the outer entry doesn't list our name
01853       return;
01854     }
01855 
01856   // record this route error data for possible propagation on our next
01857   // route request
01858   route_error_held = true;
01859   err_from = ID(srh->down_links()[srh->num_route_errors()-1].from_addr,::IP);
01860   err_to = ID(srh->down_links()[srh->num_route_errors()-1].to_addr,::IP);
01861   route_error_data_time = Scheduler::instance().clock();
01862 
01863   if (1 == srh->num_route_errors())
01864     { // this error packet has done its job
01865       // it's either for us, in which case we've done what it sez
01866       // or it's not for us, in which case we still don't have to forward
01867       // it to whoever it is for
01868       return;
01869     }
01870 
01871   /* make a copy of the packet and send it to the next tell_addr on the
01872      error list.  the copy is needed in case there is other data in the
01873      packet (such as nested route errors) that need to be delivered */
01874   if (verbose) 
01875     trace("Sdebug %.5f _%s_ unwrapping nested route error",
01876           Scheduler::instance().clock(), net_id.dump());
01877   
01878   SRPacket p_copy = p;
01879   p_copy.pkt = p.pkt->copy();
01880 
01881   hdr_sr *new_srh = hdr_sr::access(p_copy.pkt);
01882   hdr_ip *new_iph = hdr_ip::access(p_copy.pkt);
01883   
01884   // remove us from the list of errors
01885   new_srh->num_route_errors() -= 1;
01886   
01887   // send the packet to the person listed in what's now the last entry
01888   p_copy.dest = ID(new_srh->down_links()[new_srh->num_route_errors()-1].tell_addr, ::IP);
01889   p_copy.src = net_id;
01890 
01891   //new_iph->daddr() = p_copy.dest.addr;
01892   new_iph->daddr() = Address::instance().create_ipaddr(p_copy.dest.getNSAddr_t(),RT_PORT);
01893   new_iph->dport() = RT_PORT;
01894   //new_iph->saddr() = p_copy.src.addr;
01895   new_iph->saddr() = Address::instance().create_ipaddr(p_copy.src.getNSAddr_t(),RT_PORT);
01896   new_iph->sport() = RT_PORT;
01897   new_iph->ttl() = 255;
01898 
01899   new_srh->flow_header() = 0;
01900   new_srh->flow_timeout() = 0;
01901       
01902   // an error packet is a first class citizen, so we'll
01903   // use handlePktWOSR to obtain a route if needed
01904   handlePktWithoutSR(p_copy, false);
01905 }

Here is the call graph for this function:

void DSRAgent::processFlowARS const Packet packet  )  [private]
 

Definition at line 1914 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), ars_table, hdr_ip::daddr(), FlowTable::defaultFlow(), FlowTable::find(), hdr_sr::flow_header(), hdr_sr::flow_id(), flow_table, hdr_sr::hopCount(), ARSTable::insert(), hdr_sr::num_addrs(), hdr_ip::saddr(), hdr_ip::ttl(), u_int16_t, and hdr_cmn::uid().

Referenced by tap().

01914                                              {
01915   
01916   hdr_sr *srh = hdr_sr::access(packet);
01917   hdr_ip *iph = hdr_ip::access(packet);
01918   hdr_cmn *cmh = hdr_cmn::access(packet);
01919   //hdr_sr  *srh = (hdr_sr*) ((Packet *)packet)->access(off_sr_);
01920   //hdr_ip  *iph = (hdr_ip*) ((Packet *)packet)->access(off_ip_);
01921   //hdr_cmn *cmh =  (hdr_cmn*)((Packet *)packet)->access(off_cmn_);
01922   u_int16_t flowid;
01923   int flowidx;
01924   int shortamt;
01925 
01926   assert(!srh->num_addrs());
01927 
01928   if (srh->flow_header()) {
01929     flowid = srh->flow_id();
01930 
01931     // do I know about this flow?
01932     if (-1 == (flowidx = flow_table.find(iph->saddr(), iph->daddr(), flowid)))
01933       return;
01934 
01935     shortamt = flow_table[flowidx].hopCount - srh->hopCount();
01936   } else {
01937     // do I know which flow is default?
01938     if (!flow_table.defaultFlow(iph->saddr(), iph->daddr(), flowid))
01939       return;
01940 
01941     // do I know about this flow?
01942     if (-1 == (flowidx = flow_table.find(iph->saddr(), iph->daddr(), flowid)))
01943       return;
01944 
01945     shortamt = iph->ttl() - flow_table[flowidx].expectedTTL;
01946   }
01947 
01948   // transmitter downstream from us
01949   if (shortamt <= 0)
01950     return;
01951 
01952   // this is a _MAJOR_ problem!!!
01953   if (flow_table[flowidx].sourceRoute.length() < shortamt)
01954     return;
01955 
01956   ars_table.insert(cmh->uid(), flowid, shortamt);
01957 }

Here is the call graph for this function:

void DSRAgent::processUnknownFlowError SRPacket p,
bool  asDefault
[private]
 

Definition at line 1749 of file dsragent.cc.

References hdr_ip::access(), hdr_sr::access(), ID::addr, Packet::copy(), Address::create_ipaddr(), hdr_ip::daddr(), FlowTable::defaultFlow(), SRPacket::dest, hdr_ip::dport(), ID::dump(), FlowTable::find(), hdr_sr::flow_default_unknown(), hdr_sr::flow_header(), flow_table, hdr_sr::flow_timeout(), hdr_sr::flow_unknown(), ID::getNSAddr_t(), handlePktWithoutSR(), Address::instance(), Scheduler::instance(), IP, net_id, hdr_sr::num_default_unknown(), hdr_sr::num_flow_unknown(), SRPacket::pkt, RT_PORT, hdr_ip::saddr(), hdr_ip::sport(), SRPacket::src, trace(), hdr_ip::ttl(), u_int16_t, hdr_sr::unknown_defaults(), and hdr_sr::unknown_flows().

Referenced by handlePacketReceipt().

01749                                                              {
01750   hdr_sr *srh = hdr_sr::access(p.pkt);
01751   int flowidx = -1;
01752   struct flow_error *fe;
01753   u_int16_t flowid;
01754 
01755   if (asDefault) {
01756     assert (srh->flow_default_unknown() && srh->num_default_unknown());
01757     fe = &srh->unknown_defaults()[srh->num_default_unknown()-1];
01758   } else {
01759     assert (srh->flow_unknown() && srh->num_flow_unknown());
01760     fe = &srh->unknown_flows()[srh->num_flow_unknown()-1];
01761     if (!flow_table.defaultFlow(fe->flow_src, fe->flow_dst, flowid))
01762       goto skip_proc;
01763   }
01764 
01765   /* not for us; hope it gets the right place... */
01766   if (fe->flow_src != (int) net_id.addr)
01767     return;
01768 
01769   if (-1 != (flowidx = flow_table.find(fe->flow_src, fe->flow_dst, 
01770                                        asDefault ? flowid : fe->flow_id)))
01771     flow_table[flowidx].count = 0;
01772 
01773 skip_proc:
01774   trace("SFEr %.9f _%s_ from %d re %d : %d [%d]",
01775         Scheduler::instance().clock(), net_id.dump(), p.src.addr, fe->flow_dst,
01776         asDefault ? -1 : fe->flow_id, 
01777         flowidx != -1 ? flow_table[flowidx].count : -1);
01778 
01779   if ((asDefault ? srh->num_default_unknown() : srh->num_flow_unknown()) == 1)
01780     return;
01781 
01782   SRPacket p_copy = p;
01783   p_copy.pkt = p.pkt->copy();
01784 
01785   hdr_sr *new_srh = hdr_sr::access(p_copy.pkt);
01786   hdr_ip *new_iph = hdr_ip::access(p_copy.pkt);
01787   
01788   // remove us from the list of errors
01789   if (asDefault)
01790     new_srh->num_default_unknown()--;
01791   else
01792     new_srh->num_flow_unknown()--;
01793   
01794   // send the packet to the person listed in what's now the last entry
01795   p_copy.dest = ID(fe[-1].flow_src, ::IP);
01796   p_copy.src = net_id;
01797 
01798   //new_iph->daddr() = p_copy.dest.addr;
01799   new_iph->daddr() = Address::instance().create_ipaddr(p_copy.dest.getNSAddr_t(),RT_PORT);
01800   new_iph->dport() = RT_PORT;
01801   //new_iph->saddr() = p_copy.src.addr;
01802   new_iph->saddr() = Address::instance().create_ipaddr(p_copy.src.getNSAddr_t(),RT_PORT);
01803   new_iph->sport() = RT_PORT;
01804   new_iph->ttl() = 255;
01805 
01806   new_srh->flow_header() = 0;
01807   new_srh->flow_timeout() = 0;
01808 
01809   // an error packet is a first class citizen, so we'll
01810   // use handlePktWOSR to obtain a route if needed
01811   handlePktWithoutSR(p_copy, false);
01812 }

Here is the call graph for this function:

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 DSRAgent::recv Packet ,
Handler callback = 0
[virtual]
 

Reimplemented from Agent.

Definition at line 540 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), hdr_ip::daddr(), SRPacket::dest, hdr_cmn::direction(), hdr_cmn::DOWN, dsragent_snoop_forwarded_errors, ID::dump(), Packet::free(), handleForwarding(), handlePacketReceipt(), handlePktWithoutSR(), handleRouteRequest(), hdr_sr::init(), Address::instance(), Scheduler::instance(), IP_broadcast, IP_BROADCAST, IP_HDR_LEN, logtarget, net_id, hdr_cmn::next_hop(), SRPacket::pkt, port_dmux_, processBrokenRouteError(), PT_GAF, hdr_cmn::ptype(), NsObject::recv(), hdr_sr::route_error(), hdr_sr::route_request(), hdr_ip::saddr(), Scheduler::schedule(), sendOutBCastPkt(), hdr_cmn::size(), SRPacket::src, Connector::target_, trace(), hdr_cmn::UP, hdr_sr::valid(), and verbose.

Referenced by sendOutPacketWithRoute().

00543 {
00544   hdr_sr *srh =  hdr_sr::access(packet);
00545   hdr_ip *iph =  hdr_ip::access(packet);
00546   hdr_cmn *cmh =  hdr_cmn::access(packet);
00547 
00548   // special process for GAF
00549   if (cmh->ptype() == PT_GAF) {
00550     if (iph->daddr() == (int)IP_BROADCAST) { 
00551       if(cmh->direction() == hdr_cmn::UP)
00552         cmh->direction() = hdr_cmn::DOWN;
00553       Scheduler::instance().schedule(ll,packet,0);
00554       return;
00555     } else {
00556       target_->recv(packet, (Handler*)0);
00557       return;     
00558     }
00559   }
00560 
00561   assert(cmh->size() >= 0);
00562 
00563   SRPacket p(packet, srh);
00564   //p.dest = ID(iph->dst(),::IP);
00565   //p.src = ID(iph->src(),::IP);
00566   p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
00567   p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
00568 
00569   assert(logtarget != 0);
00570 
00571   if (srh->valid() != 1) {
00572     unsigned int dst = cmh->next_hop();
00573     if (dst == IP_BROADCAST) {
00574       // extensions for mobileIP --Padma, 04/99.
00575       // Brdcast pkt - treat differently
00576       if (p.src == net_id)
00577         // I have originated this pkt
00578         sendOutBCastPkt(packet);
00579       else 
00580         //hand it over to port-dmux
00581         port_dmux_->recv(packet, (Handler*)0);
00582       
00583     } else {
00584       // this must be an outgoing packet, it doesn't have a SR header on it
00585       
00586       srh->init();               // give packet an SR header now
00587       cmh->size() += IP_HDR_LEN; // add on IP header size
00588       if (verbose)
00589         trace("S %.9f _%s_ originating %s -> %s",
00590               Scheduler::instance().clock(), net_id.dump(), p.src.dump(), 
00591               p.dest.dump());
00592       handlePktWithoutSR(p, false);
00593       goto done;
00594     }
00595   }
00596   else if (srh->valid() == 1) 
00597     {
00598       if (p.dest == net_id || p.dest == IP_broadcast)
00599         { // this packet is intended for us
00600           handlePacketReceipt(p);
00601           goto done;
00602         }
00603       
00604       // should we check to see if it's an error packet we're handling
00605       // and if so call processBrokenRouteError to snoop
00606       if (dsragent_snoop_forwarded_errors && srh->route_error())
00607         {
00608           processBrokenRouteError(p);
00609         }
00610 
00611       if (srh->route_request())
00612         { // propagate a route_request that's not for us
00613           handleRouteRequest(p);
00614         }
00615       else
00616         { // we're not the intended final recpt, but we're a hop
00617           handleForwarding(p);
00618         }
00619     }
00620   else {
00621     // some invalid pkt has reached here
00622     fprintf(stderr,"dsragent: Error-received Invalid pkt!\n");
00623     Packet::free(p.pkt);
00624     p.pkt =0; // drop silently
00625   }
00626 
00627  done:
00628   assert(p.pkt == 0);
00629   
00630   p.pkt = 0;
00631   return;
00632 }

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 DelAckSink::recv(), TcpSink::recv(), QSTcpSink::recv(), FullTcpAgent::recv(), and TcpAsymSink::recv().

00355 {
00356         if (app_)
00357                 app_->recv(nbytes);     
00358 }

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

bool DSRAgent::replyFromRouteCache SRPacket p  )  [private]
 

Definition at line 1094 of file dsragent.cc.

References hdr_ip::access(), hdr_sr::access(), hdr_cmn::access(), ID::addr, RouteCache::addRoute(), Agent::allocpkt(), Path::appendPath(), Path::appendToPath(), Scheduler::clock(), Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_sr::down_links(), hdr_ip::dport(), Path::dump(), ID::dump(), RouteCache::findRoute(), Packet::free(), GRAT_ROUTE_ERROR, Path::index(), hdr_sr::init(), Address::instance(), Scheduler::instance(), IP_HDR_LEN, Path::length(), MAC_id, MAX_SR_LEN, Path::member(), net_id, hdr_sr::num_route_errors(), SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), hdr_sr::reply_addrs(), Path::reverseInPlace(), SRPacket::route, route_cache, hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_reply_len(), hdr_sr::route_request(), RT_PORT, hdr_sr::rtreq_seq(), hdr_ip::saddr(), sendOutPacketWithRoute(), Path::setIterator(), hdr_cmn::size(), hdr_ip::sport(), SRPacket::src, trace(), hdr_ip::ttl(), verbose, and verbose_srr.

Referenced by handleRouteRequest().

01098 {
01099   Path rest_of_route;
01100   Path complete_route = p.route;
01101 
01102   /* we shouldn't yet be on on the pkt's current source route */
01103   assert(!p.route.member(net_id, MAC_id));
01104 
01105   // do we have a cached route the target?
01106   /* XXX what if we have more than 1?  (and one is legal for reply from
01107      cache and one isn't?) 1/28/97 -dam */
01108   if (!route_cache->findRoute(p.dest, rest_of_route, 0))
01109     { // no route => we're done
01110       return false;
01111     }
01112 
01113   /* but we should be on on the remainder of the route (and should be at
01114    the start of the route */
01115   assert(rest_of_route[0] == net_id || rest_of_route[0] == MAC_id);
01116 
01117   if (rest_of_route.length() + p.route.length() > MAX_SR_LEN)
01118     return false; // too long to work with...
01119 
01120   // add our suggested completion to the route so far
01121   complete_route.appendPath(rest_of_route);
01122 
01123   // call compressPath to remove any double backs
01124   ::compressPath(complete_route);
01125 
01126   if (!complete_route.member(net_id, MAC_id))
01127     { // we're not on the suggested route, so we can't return it
01128       return false;
01129     }
01130 
01131   // if there is any other information piggybacked into the
01132   // route request pkt, we need to forward it on to the dst
01133   hdr_cmn *cmh =  hdr_cmn::access(p.pkt);
01134   hdr_sr *srh =  hdr_sr::access(p.pkt);
01135   int request_seqnum = srh->rtreq_seq();
01136   
01137   if (PT_DSR != cmh->ptype()    // there's data
01138       || srh->route_reply()
01139       || (srh->route_error() && 
01140           srh->down_links()[srh->num_route_errors()-1].tell_addr 
01141           != GRAT_ROUTE_ERROR))
01142     { // must forward the packet on
01143       SRPacket p_copy = p;
01144       p.pkt = 0;
01145       srh->route_request() = 0;
01146 
01147       p_copy.route = complete_route;
01148       p_copy.route.setIterator(p.route.length());
01149 
01150       assert(p.route[p.route.index()] == net_id);
01151       
01152       if (verbose) trace("Sdebug %.9f _%s_ splitting %s to %s",
01153                          Scheduler::instance().clock(), net_id.dump(),
01154                          p.route.dump(), p_copy.route.dump());
01155 
01156       sendOutPacketWithRoute(p_copy,false);
01157     }
01158   else 
01159     {
01160       Packet::free(p.pkt);  // free the rcvd rt req before making rt reply
01161       p.pkt = 0;
01162     }
01163 
01164   // make up and send out a route reply
01165   p.route.appendToPath(net_id);
01166   p.route.reverseInPlace();
01167   route_cache->addRoute(p.route, Scheduler::instance().clock(), net_id);
01168   p.dest = p.src;
01169   p.src = net_id;
01170   p.pkt = allocpkt();
01171 
01172   hdr_ip *iph =  hdr_ip::access(p.pkt);
01173   iph->saddr() = Address::instance().create_ipaddr(p.src.addr, RT_PORT);
01174   iph->sport() = RT_PORT;
01175   iph->daddr() = Address::instance().create_ipaddr(p.dest.addr, RT_PORT);
01176   iph->dport() = RT_PORT;
01177   iph->ttl() = 255;
01178 
01179   srh = hdr_sr::access(p.pkt);
01180   srh->init();
01181   for (int i = 0 ; i < complete_route.length() ; i++)
01182     complete_route[i].fillSRAddr(srh->reply_addrs()[i]);
01183   srh->route_reply_len() = complete_route.length();
01184   srh->route_reply() = 1;
01185 
01186   // propagate the request sequence number in the reply for analysis purposes
01187   srh->rtreq_seq() = request_seqnum;
01188 
01189   hdr_cmn *cmnh =  hdr_cmn::access(p.pkt);
01190   cmnh->ptype() = PT_DSR;
01191   cmnh->size() = IP_HDR_LEN;
01192 
01193   if (verbose_srr)
01194     trace("SRR %.9f _%s_ cache-reply-sent %s -> %s #%d (len %d) %s",
01195           Scheduler::instance().clock(), net_id.dump(),
01196           p.src.dump(), p.dest.dump(), request_seqnum, complete_route.length(),
01197           complete_route.dump());
01198   sendOutPacketWithRoute(p, true);
01199   return true;
01200 }

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

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void DSRAgent::returnSrcRouteToRequestor SRPacket p  )  [private]
 

Definition at line 1572 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), RouteCache::addRoute(), Agent::allocpkt(), Path::appendToPath(), Scheduler::clock(), Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_ip::dport(), Path::dump(), ID::dump(), Path::fillSR(), Path::full(), ID::getNSAddr_t(), hdr_sr::init(), Scheduler::instance(), Address::instance(), IP_HDR_LEN, Path::length(), net_id, SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), hdr_sr::reply_addrs(), Path::resetIterator(), Path::reverseInPlace(), SRPacket::route, route_cache, hdr_sr::route_reply(), hdr_sr::route_reply_len(), RREQ_JITTER, RT_PORT, hdr_sr::rtreq_seq(), hdr_ip::saddr(), Scheduler::schedule(), hdr_sr::size(), hdr_cmn::size(), hdr_ip::sport(), SRPacket::src, trace(), hdr_ip::ttl(), Random::uniform(), and verbose_srr.

Referenced by handlePacketReceipt().

01576 {
01577   hdr_sr *old_srh = hdr_sr::access(p.pkt);
01578 
01579   if (p.route.full()) 
01580     return; // alas, the route would be to long once we add ourselves
01581 
01582   SRPacket p_copy = p;
01583   p_copy.pkt = allocpkt();
01584   p_copy.dest = p.src;
01585   p_copy.src = net_id;
01586 
01587   p_copy.route.appendToPath(net_id);
01588 
01589   hdr_ip *new_iph =  hdr_ip::access(p_copy.pkt);
01590   //new_iph->daddr() = p_copy.dest.addr;
01591   new_iph->daddr() = Address::instance().create_ipaddr(p_copy.dest.getNSAddr_t(),RT_PORT);
01592   new_iph->dport() = RT_PORT;
01593   //new_iph->saddr() = p_copy.src.addr;
01594   new_iph->saddr() =
01595     Address::instance().create_ipaddr(p_copy.src.getNSAddr_t(),RT_PORT); 
01596   new_iph->sport() = RT_PORT;
01597   new_iph->ttl() = 255;
01598 
01599   hdr_sr *new_srh =  hdr_sr::access(p_copy.pkt);
01600   new_srh->init();
01601   for (int i = 0 ; i < p_copy.route.length() ; i++)
01602     p_copy.route[i].fillSRAddr(new_srh->reply_addrs()[i]);
01603   new_srh->route_reply_len() = p_copy.route.length();
01604   new_srh->route_reply() = 1;
01605 
01606   // propagate the request sequence number in the reply for analysis purposes
01607   new_srh->rtreq_seq() = old_srh->rtreq_seq();
01608   
01609   hdr_cmn *new_cmnh =  hdr_cmn::access(p_copy.pkt);
01610   new_cmnh->ptype() = PT_DSR;
01611   new_cmnh->size() = IP_HDR_LEN;
01612 
01613   if (verbose_srr)
01614     trace("SRR %.9f _%s_ reply-sent %s -> %s #%d (len %d) %s",
01615           Scheduler::instance().clock(), net_id.dump(),
01616           p_copy.src.dump(), p_copy.dest.dump(), old_srh->rtreq_seq(),
01617           p_copy.route.length(), p_copy.route.dump());
01618 
01619   // flip the route around for the return to the requestor, and 
01620   // cache the route for future use
01621   p_copy.route.reverseInPlace();
01622   route_cache->addRoute(p_copy.route, Scheduler::instance().clock(), net_id);
01623 
01624   p_copy.route.resetIterator();
01625   p_copy.route.fillSR(new_srh);
01626   new_cmnh->size() += new_srh->size();
01627   
01628   /* we now want to jitter when we first originate route replies, since
01629      they are a transmission we make in response to a broadcast packet 
01630      -dam 4/23/98
01631      sendOutPacketWithRoute(p_copy, true); */
01632   {
01633           double d = Random::uniform(RREQ_JITTER);
01634 #if 0
01635           fprintf(stderr, "Random Delay: %f\n", d);
01636 #endif
01637           Scheduler::instance().schedule(this, p_copy.pkt, d);
01638   }
01639 }

Here is the call graph for this function:

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

Reimplemented in SRMAgent.

Definition at line 89 of file agent.h.

References Agent::sendmsg().

00089 { sendmsg(nbytes); }

Here is the call graph for this function:

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 TcpSink::ack(), QSTcpSink::ack(), SinkAgent::bcast_interest(), PingAgent::command(), MessageAgent::command(), mcastControlAgent::command(), LmsAgent::command(), LDPAgent::command(), SinkAgent::data_ready(), DSDV_Agent::forwardPacket(), FullTcpAgent::foutput(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), AbsTcpAgent::output(), AbsDelAckSink::recv(), AbsTcpSink::recv(), SRAgent::recv(), PingAgent::recv(), NatAgent::recv(), MIPBSAgent::recv(), Encapsulator::recv(), Decapsulator::recv(), MIPMHAgent::reg(), HttpInvalAgent::send(), GAFAgent::send_discovery(), RapAgent::SendAck(), SimpleTcpAgent::sendmsg(), PushbackAgent::sendMsg(), FullTcpAgent::sendpacket(), BayFullTcpAgent::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 DSRAgent::sendBufferCheck  )  [private]
 

Definition at line 244 of file dsragent.cc.

References Scheduler::clock(), SRPacket::dest, dropSendBuff(), ID::dump(), handlePktWithoutSR(), Scheduler::instance(), net_id, SendBufEntry::p, SRPacket::pkt, send_buf, SEND_BUF_SIZE, SEND_TIMEOUT, SendBufEntry::t, and trace().

Referenced by SendBufferTimer::expire().

00247 { // this is called about once a second.  run everybody through the
00248   // get route for pkt routine to see if it's time to do another 
00249   // route request or what not
00250   int c;
00251 
00252   for (c  = 0 ; c <SEND_BUF_SIZE ; c++) {
00253           if (send_buf[c].p.pkt == NULL)
00254                   continue;
00255           if (Scheduler::instance().clock() - send_buf[c].t > SEND_TIMEOUT) {
00256                   dropSendBuff(send_buf[c].p);
00257                   send_buf[c].p.pkt = 0;
00258                   continue;
00259           }
00260 #ifdef DEBUG
00261           trace("Sdebug %.5f _%s_ checking for route for dst %s",
00262                 Scheduler::instance().clock(), net_id.dump(), 
00263                 send_buf[c].p.dest.dump());
00264 #endif
00265 
00266           handlePktWithoutSR(send_buf[c].p, true);
00267 #ifdef DEBUG
00268           if (send_buf[c].p.pkt == NULL) 
00269                   trace("Sdebug %.5f _%s_ sendbuf pkt to %s liberated by handlePktWOSR",
00270                         Scheduler::instance().clock(), net_id.dump(), 
00271                         send_buf[c].p.dest.dump());
00272 #endif
00273   }
00274 }

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, LmsSender, SRMAgent, FullTcpAgent, TcpAgent, TfrcAgent, and SimpleTcpAgent.

Definition at line 415 of file agent.cc.

00416 {
00417 }

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

Reimplemented in UdpAgent.

Definition at line 400 of file agent.cc.

References abort().

Referenced by Agent::command(), Application::send(), Agent::send(), TrafficTrace::timeout(), TelnetApp::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout().

00401 {
00402         fprintf(stderr, 
00403         "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00404         abort();
00405 }

Here is the call graph for this function:

void DSRAgent::sendOutBCastPkt Packet p  ) 
 

Definition at line 528 of file dsragent.cc.

References hdr_cmn::access(), hdr_cmn::direction(), hdr_cmn::DOWN, Scheduler::instance(), Scheduler::schedule(), and hdr_cmn::UP.

Referenced by recv().

00529 {
00530   hdr_cmn *cmh =  hdr_cmn::access(p);
00531   if(cmh->direction() == hdr_cmn::UP)
00532     cmh->direction() = hdr_cmn::DOWN;
00533   // no jitter required
00534   Scheduler::instance().schedule(ll, p, 0.0);
00535 }

Here is the call graph for this function:

void DSRAgent::sendOutPacketWithRoute SRPacket p,
bool  fresh,
Time  delay = 0.0
[private]
 

Definition at line 1204 of file dsragent.cc.

References hdr_ip::access(), hdr_cmn::access(), hdr_sr::access(), ID::addr, hdr_cmn::addr_type(), MobileNode::base_stn(), FlowTable::cleanup(), Scheduler::clock(), FlowTable::createEntry(), hdr_sr::cur_addr(), default_flow_timeout, FlowTable::defaultFlow(), SRPacket::dest, diff_subnet(), hdr_cmn::direction(), hdr_cmn::DOWN, DROP_IFQ_QFULL, dsragent_always_reestablish, dsragent_enable_flowstate, dsragent_prefer_default_flow, dsragent_prefer_shorter_over_default, hdr_sr::dump(), Path::dump(), ID::dump(), END_TO_END_COUNT, Path::fillSR(), FlowTable::find(), hdr_sr::flow_header(), hdr_sr::flow_id(), flow_table, hdr_sr::flow_timeout(), hdr_sr::flow_timeout_time(), FlowTable::generateNextFlowId(), hdr_sr::get_next_addr(), hdr_sr::get_next_type(), hdr_sr::hopCount(), ifq, Scheduler::instance(), Path::length(), MAC_BROADCAST, min_adv_interval, p_info::name(), net_id, hdr_cmn::next_hop(), node_, NS_AF_ILINK, hdr_sr::num_addrs(), packet_info, SRPacket::pkt, CMUPriQueue::prq_isfull(), CMUPriQueue::prq_length(), hdr_cmn::ptype(), recv(), Path::resetIterator(), SRPacket::route, hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_request(), RREQ_JITTER, Scheduler::schedule(), hdr_sr::size(), hdr_cmn::size(), SRPacket::src, trace(), hdr_ip::ttl(), u_int16_t, hdr_cmn::uid(), Random::uniform(), hdr_sr::valid(), verbose, hdr_cmn::xmit_failure_, hdr_cmn::xmit_failure_data_, xmitFailed(), XmitFailureCallback, and XmitFlowFailureCallback.

Referenced by acceptRouteReply(), handleForwarding(), handlePktWithoutSR(), handleRouteRequest(), replyFromRouteCache(), sendOutRtReq(), sendRouteShortening(), undeliverablePkt(), and xmitFailed().

01210 {
01211   hdr_sr *srh =  hdr_sr::access(p.pkt);
01212   hdr_cmn *cmnh = hdr_cmn::access(p.pkt);
01213 
01214   assert(srh->valid());
01215   assert(cmnh->size() > 0);
01216 
01217   ID dest;
01218   if (diff_subnet(p.dest,net_id)) {
01219   dest = ID(node_->base_stn(),::IP);
01220   p.dest = dest;
01221   }
01222 
01223   if (p.dest == net_id)
01224     { // it doesn't need to go on the wire, 'cause it's for us
01225       recv(p.pkt, (Handler *) 0);
01226       p.pkt = 0;
01227       return;
01228     }
01229 
01230   if (fresh)
01231     {
01232       p.route.resetIterator();
01233       if (verbose && !srh->route_request())
01234         {
01235           trace("SO %.9f _%s_ originating %s %s", 
01236                 Scheduler::instance().clock(), 
01237                 net_id.dump(), packet_info.name(cmnh->ptype()), p.route.dump());
01238         }
01239     }
01240 
01241   p.route.fillSR(srh);
01242 
01243   // set direction of pkt to DOWN , i.e downward
01244   cmnh->direction() = hdr_cmn::DOWN;
01245 
01246   // let's see if we can snag this packet for flow state... ych 5/2/01
01247   if (dsragent_enable_flowstate &&
01248       p.src == net_id && !srh->route_request() && !srh->cur_addr() &&
01249       // can't yet decode flow errors and route errors/replies together
01250       // so don't tempt the system... ych 5/7/01
01251       !srh->route_error() && !srh->route_reply()) {
01252     hdr_ip *iph =  hdr_ip::access(p.pkt);
01253     int flowidx;
01254     u_int16_t flowid, default_flowid;
01255     double now = Scheduler::instance().clock();
01256 
01257     // hmmm, let's see if we can save us some overhead...
01258     if (dsragent_prefer_default_flow &&
01259         flow_table.defaultFlow(p.src.addr, p.dest.addr, flowid) &&
01260         -1 != (flowidx = flow_table.find(p.src.addr, p.dest.addr, flowid)) &&
01261         flow_table[flowidx].timeout >= now &&
01262         (!dsragent_prefer_shorter_over_default || 
01263           flow_table[flowidx].sourceRoute.length() <= p.route.length()) &&
01264         !(p.route == flow_table[flowidx].sourceRoute)) {
01265 
01266       p.route = flow_table[flowidx].sourceRoute;
01267       p.route.fillSR(srh);
01268     }
01269 
01270     flowidx = flow_table.find(p.src.addr, p.dest.addr, p.route);
01271 
01272     if (flowidx == -1 || flow_table[flowidx].timeout < now) {
01273       // I guess we don't know about this flow; allocate it.
01274       flow_table.cleanup();
01275       flowid = flow_table.generateNextFlowId(p.dest.addr, true);
01276       flowidx = flow_table.createEntry(p.src.addr, p.dest.addr, flowid);
01277       assert(flowidx != -1);
01278 
01279       // fill out the table
01280       flow_table[flowidx].count = 1;
01281       flow_table[flowidx].lastAdvRt = Scheduler::instance().clock();
01282       flow_table[flowidx].timeout = now + default_flow_timeout;
01283       flow_table[flowidx].hopCount = 0;
01284       flow_table[flowidx].expectedTTL = iph->ttl();
01285       flow_table[flowidx].allowDefault = true;
01286       flow_table[flowidx].sourceRoute = p.route;
01287       flow_table[flowidx].nextHop = srh->get_next_addr();
01288       assert(srh->get_next_type() == ::IP);
01289 
01290       // fix up the srh for the timeout
01291       srh->flow_timeout() = 1;
01292       srh->flow_timeout_time() = default_flow_timeout;
01293       srh->cur_addr() = srh->cur_addr() + 1;
01294     } else if (flow_table[flowidx].count <= END_TO_END_COUNT ||
01295                 flow_table[flowidx].lastAdvRt < 
01296                    (Scheduler::instance().clock() - min_adv_interval)) {
01297       // I've got it, but maybe someone else doesn't
01298       if (flow_table[flowidx].expectedTTL != iph->ttl())
01299         flow_table[flowidx].allowDefault = false;
01300 
01301       flow_table[flowidx].count++;
01302       flow_table[flowidx].lastAdvRt = Scheduler::instance().clock();
01303 
01304       srh->flow_timeout() = 1;
01305       if (dsragent_always_reestablish)
01306         srh->flow_timeout_time() = default_flow_timeout;
01307       else
01308         srh->flow_timeout_time() = (int)(flow_table[flowidx].timeout - now);
01309       srh->cur_addr() = srh->cur_addr() + 1;
01310     } else {
01311       // flow is established end to end
01312       assert (flow_table[flowidx].sourceRoute == p.route);
01313       srh->flow_timeout() = srh->cur_addr() = srh->num_addrs() = 0;
01314     }
01315 
01316     if (dsragent_always_reestablish) {
01317       // XXX see major problems detailed above (search for dsragent_always_re..)
01318       flow_table[flowidx].timeout = now + default_flow_timeout;
01319     }
01320 
01321     cmnh->next_hop() = flow_table[flowidx].nextHop;
01322     cmnh->addr_type() = ::IP;
01323 
01324     if (flow_table.defaultFlow(p.src.addr, p.dest.addr, default_flowid) &&
01325         flow_table[flowidx].flowId == default_flowid &&
01326         !srh->num_addrs() && iph->ttl() == flow_table[flowidx].expectedTTL &&
01327         flow_table[flowidx].allowDefault) {
01328       // we can go without anything... woo hoo!
01329       assert(!srh->flow_header());
01330     } else {
01331       srh->flow_header() = 1;
01332       srh->flow_id() = flow_table[flowidx].flowId;
01333       srh->hopCount() = 1;
01334     }
01335 
01336     trace("SF%ss %.9f _%s_ %d [%s -> %s] %d(%d) to %d %s", 
01337         srh->num_addrs() ? "EST" : "",
01338         Scheduler::instance().clock(), net_id.dump(), cmnh->uid(),
01339         p.src.dump(), p.dest.dump(), flow_table[flowidx].flowId,
01340         srh->flow_header(), flow_table[flowidx].nextHop,
01341         srh->num_addrs() ? srh->dump() : "");
01342 
01343     cmnh->size() += srh->size();
01344     cmnh->xmit_failure_ = srh->num_addrs() ? XmitFailureCallback : 
01345                                              XmitFlowFailureCallback;
01346     cmnh->xmit_failure_data_ = (void *) this;
01347 
01348     assert(!srh->num_addrs() || srh->flow_timeout());
01349   } else {
01350     // old non-flowstate stuff...
01351     assert(p.src != net_id || !srh->flow_header());
01352     cmnh->size() += srh->size();
01353 
01354     if (srh->route_request())
01355       { // broadcast forward
01356         cmnh->xmit_failure_ = 0;
01357         cmnh->next_hop() = MAC_BROADCAST;
01358         cmnh->addr_type() = NS_AF_ILINK;
01359       }
01360     else
01361       { // forward according to source route
01362         cmnh->xmit_failure_ = XmitFailureCallback;
01363         cmnh->xmit_failure_data_ = (void *) this;
01364 
01365         cmnh->next_hop() = srh->get_next_addr();
01366         cmnh->addr_type() = srh->get_next_type();
01367         srh->cur_addr() = srh->cur_addr() + 1;
01368       } /* route_request() */
01369   } /* can snag for path state */
01370 
01371   /* put route errors at the head of the ifq somehow? -dam 4/13/98 */
01372 
01373   // make sure we aren't cycling packets
01374   
01375 #ifdef notdef
01376   if (ifq->prq_length() > 25)
01377           trace("SIFQ %.5f _%s_ len %d",
01378                 Scheduler::instance().clock(),
01379                 net_id.dump(), ifq->prq_length());
01380 #endif
01381 #ifdef NEW_IFQ_LOGIC
01382   /*
01383    *  If the interface queue is full, there's no sense in sending
01384    *  the packet.  Drop it and generate a Route Error?
01385    */
01386   /* question for the author: this seems rife with congestion/infinite loop
01387    * possibilities. you're responding to an ifq full by sending a rt err.
01388    * sounds like the source quench problem. ych 5/5/01
01389    */
01390   if(ifq->prq_isfull(p.pkt)) {
01391           xmitFailed(p.pkt, DROP_IFQ_QFULL);
01392           p.pkt = 0;
01393           return;
01394   }
01395 #endif /* NEW_IFQ_LOGIC */
01396 
01397   // ych debugging
01398   assert(!srh->flow_header() || !srh->num_addrs() || srh->flow_timeout());
01399 
01400   // off it goes!
01401   if (srh->route_request())
01402     { // route requests need to be jittered a bit
01403       Scheduler::instance().schedule(ll, p.pkt, 
01404                                      Random::uniform(RREQ_JITTER) + delay);
01405     }
01406   else
01407     { // no jitter required 
01408       Scheduler::instance().schedule(ll, p.pkt, delay);
01409     }
01410   p.pkt = NULL; /* packet sent off */
01411 }

Here is the call graph for this function:

void DSRAgent::sendOutRtReq SRPacket p,
int  max_prop = MAX_SR_LEN
[private]
 

Definition at line 1533 of file dsragent.cc.

References hdr_sr::access(), link_down::addr_type, Path::appendToPath(), Scheduler::clock(), SRPacket::dest, hdr_sr::down_links(), dsragent_propagate_last_error, ID::dump(), err_from, err_to, link_down::from_addr, ID::getNSAddr_t(), GRAT_ROUTE_ERROR, Scheduler::instance(), max_err_hold, hdr_sr::max_propagation(), MAX_ROUTE_ERRORS, net_id, NS_AF_INET, hdr_sr::num_route_errors(), SRPacket::pkt, Path::reset(), SRPacket::route, hdr_sr::route_error(), route_error_data_time, route_error_held, hdr_sr::route_request(), route_request_num, hdr_sr::rtreq_seq(), sendOutPacketWithRoute(), SRPacket::src, link_down::tell_addr, link_down::to_addr, trace(), hdr_sr::valid(), and verbose_srr.

Referenced by getRouteForPacket().

01537 {
01538   hdr_sr *srh =  hdr_sr::access(p.pkt);
01539   assert(srh->valid());
01540 
01541   srh->route_request() = 1;
01542   srh->rtreq_seq() = route_request_num++;
01543   srh->max_propagation() = max_prop;
01544   p.route.reset();
01545   p.route.appendToPath(net_id);
01546 
01547   if (dsragent_propagate_last_error && route_error_held 
01548       && Scheduler::instance().clock() - route_error_data_time  < max_err_hold)
01549     {
01550       assert(srh->num_route_errors() < MAX_ROUTE_ERRORS);
01551       srh->route_error() = 1;
01552       link_down *deadlink = &(srh->down_links()[srh->num_route_errors()]);
01553       deadlink->addr_type = NS_AF_INET;
01554       deadlink->from_addr = err_from.getNSAddr_t();
01555       deadlink->to_addr = err_to.getNSAddr_t();
01556       deadlink->tell_addr = GRAT_ROUTE_ERROR;
01557       srh->num_route_errors() += 1;
01558       /*
01559        * Make sure that the Route Error gets on a propagating request.
01560        */
01561       if(max_prop > 0) route_error_held = false;
01562     }
01563 
01564   if (verbose_srr)
01565     trace("SRR %.5f _%s_ new-request %d %s #%d -> %s", 
01566           Scheduler::instance().clock(), net_id.dump(), 
01567           max_prop, p.src.dump(), srh->rtreq_seq(), p.dest.dump());
01568   sendOutPacketWithRoute(p, false);
01569 }

Here is the call graph for this function:

void DSRAgent::sendRouteShortening SRPacket p,
int  heard_at,
int  xmit_at
[private]
 

Definition at line 2116 of file dsragent.cc.

References hdr_cmn::access(), hdr_sr::access(), hdr_ip::access(), RouteCache::addRoute(), Agent::allocpkt(), Scheduler::clock(), Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_ip::dport(), dsragent_send_grat_replies, Path::dump(), ID::dump(), FindGratHoldDown(), ID::getNSAddr_t(), grat_hold, grat_hold_down_time, grat_hold_victim, Path::index(), hdr_sr::init(), Address::instance(), Scheduler::instance(), IP_HDR_LEN, Path::length(), net_id, SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), Path::removeSection(), hdr_sr::reply_addrs(), Path::reverseInPlace(), SRPacket::route, route_cache, hdr_sr::route_reply(), hdr_sr::route_reply_len(), RT_PORT, RTREP_HOLDOFF_SIZE, hdr_sr::rtreq_seq(), hdr_ip::saddr(), sendOutPacketWithRoute(), hdr_cmn::size(), hdr_ip::sport(), SRPacket::src, GratReplyHoldDown::t, trace(), hdr_ip::ttl(), verbose, and verbose_srr.

Referenced by handleFlowForwarding(), and tap().

02121 {
02122   // this shares code with returnSrcRouteToRequestor - factor them -dam */
02123 
02124   if (!dsragent_send_grat_replies) return;
02125 
02126   if (verbose)
02127     trace("Sdebug %s consider grat arp for %s", net_id.dump(), p.route.dump());
02128   GratReplyHoldDown *g = FindGratHoldDown(grat_hold, RTREP_HOLDOFF_SIZE, 
02129                                           p.route);
02130   if (!g)
02131     { 
02132       grat_hold[grat_hold_victim].p = p.route;
02133       grat_hold_victim = (grat_hold_victim + 1) % RTREP_HOLDOFF_SIZE;
02134       g = &grat_hold[grat_hold_victim];      
02135     }
02136   else if (Scheduler::instance().clock() - g->t < grat_hold_down_time) return;
02137   g->t = Scheduler::instance().clock();
02138 
02139   SRPacket p_copy = p;
02140   p_copy.pkt = allocpkt();
02141   p_copy.dest = p.route[0];   // tell the originator of this long source route
02142   p_copy.src = net_id;
02143 
02144   // reverse the route to get the packet back
02145   p_copy.route[p_copy.route.index()] = net_id;
02146   p_copy.route.reverseInPlace();
02147   p_copy.route.removeSection(0,p_copy.route.index());
02148 
02149   hdr_ip *new_iph =  hdr_ip::access(p_copy.pkt);
02150   //new_iph->daddr() = p_copy.dest.addr;
02151   new_iph->daddr() = Address::instance().create_ipaddr(p_copy.dest.getNSAddr_t(),RT_PORT);
02152   new_iph->dport() = RT_PORT;
02153   //new_iph->saddr() = p_copy.src.addr;
02154   new_iph->saddr() = Address::instance().create_ipaddr(p_copy.src.getNSAddr_t(),RT_PORT);
02155   new_iph->sport() = RT_PORT;
02156   new_iph->ttl() = 255;
02157 
02158   // shorten's p's route
02159   p.route.removeSection(heard_at, xmit_at);
02160   hdr_sr *new_srh =  hdr_sr::access(p_copy.pkt);
02161   new_srh->init();
02162   for (int i = 0 ; i < p.route.length() ; i++)
02163     p.route[i].fillSRAddr(new_srh->reply_addrs()[i]);
02164   new_srh->route_reply_len() = p.route.length();
02165   new_srh->route_reply() = 1;
02166   // grat replies will have a 0 seq num (it's only for trace analysis anyway)
02167   new_srh->rtreq_seq() = 0;
02168 
02169   hdr_cmn *new_cmnh =  hdr_cmn::access(p_copy.pkt);
02170   new_cmnh->ptype() = PT_DSR;
02171   new_cmnh->size() += IP_HDR_LEN;
02172 
02173   if (verbose_srr)
02174     trace("SRR %.9f _%s_ gratuitous-reply-sent %s -> %s (len %d) %s",
02175           Scheduler::instance().clock(), net_id.dump(),
02176           p_copy.src.dump(), p_copy.dest.dump(), p.route.length(), 
02177           p.route.dump());
02178 
02179   // cache the route for future use (we learned the route from p)
02180   route_cache->addRoute(p_copy.route, Scheduler::instance().clock(), p.src);
02181   sendOutPacketWithRoute(p_copy, true);
02182 }

Here is the call graph for this function:

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

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

Definition at line 407 of file agent.cc.

References abort().

Referenced by Agent::command().

00409 {
00410         fprintf(stderr, 
00411         "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00412         abort();
00413 }

Here is the call graph for this function:

void DSRAgent::sendUnknownFlow SRPacket p,
bool  asDefault,
u_int16_t  flowid = 0
[private]
 

Definition at line 2404 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), ID::addr, Address::create_ipaddr(), hdr_ip::daddr(), SRPacket::dest, hdr_ip::dport(), ID::dump(), hdr_sr::flow_default_unknown(), hdr_sr::flow_header(), hdr_sr::flow_timeout(), hdr_sr::flow_unknown(), Packet::free(), ID::getNSAddr_t(), handlePktWithoutSR(), Address::instance(), Scheduler::instance(), IP_HDR_LEN, MAX_ROUTE_ERRORS, net_id, hdr_sr::num_addrs(), hdr_sr::num_default_unknown(), hdr_sr::num_flow_unknown(), hdr_cmn::num_forwards(), SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), hdr_sr::route_reply(), hdr_sr::route_request(), RT_PORT, hdr_ip::saddr(), hdr_cmn::size(), hdr_ip::sport(), SRPacket::src, trace(), hdr_ip::ttl(), hdr_cmn::uid(), Agent::uidcnt_, undeliverablePkt(), hdr_sr::unknown_defaults(), and hdr_sr::unknown_flows().

Referenced by handleDefaultForwarding(), handleFlowForwarding(), and xmitFlowFailed().

02404                                                                        {
02405   hdr_sr *srh = hdr_sr::access(p.pkt);
02406   hdr_ip *iph = hdr_ip::access(p.pkt);
02407   hdr_cmn *cmh = hdr_cmn::access(p.pkt);
02408   struct flow_error *fe;
02409 
02410   assert(!srh->num_addrs()); // flow forwarding basis only.
02411 #if 0
02412   // this doesn't always hold true; if an xmit fails, we'll dump the
02413   // thing from our flow table, possibly before we even get here (though how
02414   // we found out, other than from this packet, is anyone's guess, considering
02415   // that underliverablePkt() should have been called in any other circumstance,
02416   // so we shouldn't go through the failed stuff.
02417   assert(p.src != net_id); // how'd it get here if it were?
02418 
02419   // this doesn't always hold true; I may be sending it default, fail,
02420   // the flow times out, but I still know the flowid (whacked paths through
02421   // the code, I know... ych 5/7/01
02422   assert(srh->flow_header() ^ asDefault); // one or the other, not both
02423 #endif
02424 
02425   if (p.src == net_id) {
02426     Packet::free(p.pkt);
02427     p.pkt = 0;
02428     return; // gimme a break, we already know!
02429   }
02430 
02431   undeliverablePkt(p.pkt, false); // salvage, but don't molest.
02432  
02433   /* warp into an error... */
02434   if (asDefault) {
02435     if (!srh->flow_default_unknown()) {
02436       srh->num_default_unknown() = 1;
02437       srh->flow_default_unknown() = 1;
02438       fe = srh->unknown_defaults();
02439     } else if (srh->num_default_unknown() < MAX_ROUTE_ERRORS) {
02440       fe = srh->unknown_defaults() + srh->num_default_unknown();
02441       srh->num_default_unknown()++;
02442     } else {
02443       trace("SYFU  %.5f _%s_ dumping maximally nested Flow error %d -> %d",
02444       Scheduler::instance().clock(), net_id.dump(), p.src.addr, p.dest.addr);
02445 
02446       Packet::free(p.pkt);        // no drop needed
02447       p.pkt = 0;
02448       return;
02449     }
02450   } else {
02451     if (!srh->flow_unknown()) {
02452       srh->num_flow_unknown() = 1;
02453       srh->flow_unknown() = 1;
02454       fe = srh->unknown_flows();
02455     } else if (srh->num_default_unknown() < MAX_ROUTE_ERRORS) {
02456       fe = srh->unknown_flows() + srh->num_flow_unknown();
02457       srh->num_flow_unknown()++;
02458     } else {
02459       trace("SYFU  %.5f _%s_ dumping maximally nested Flow error %d -> %d",
02460       Scheduler::instance().clock(), net_id.dump(), p.src.addr, p.dest.addr);
02461 
02462       Packet::free(p.pkt);        // no drop needed
02463       p.pkt = 0;
02464       return;
02465     }
02466   }
02467 
02468   trace("SFErr %.5f _%s_ %d -> %d : %d",
02469         Scheduler::instance().clock(), net_id.dump(), p.src.addr, p.dest.addr,
02470         flowid);
02471 
02472   srh->route_reply() = 0;
02473   srh->route_request() = 0;
02474   srh->flow_header() = 0;
02475   srh->flow_timeout() = 0;
02476 
02477   //iph->daddr() = p.src.addr;
02478   iph->daddr() = Address::instance().create_ipaddr(p.src.getNSAddr_t(),RT_PORT);
02479   iph->dport() = RT_PORT;
02480   //iph->saddr() = net_id.addr;
02481   iph->saddr() = Address::instance().create_ipaddr(net_id.getNSAddr_t(),RT_PORT);
02482   iph->sport() = RT_PORT;
02483   iph->ttl() = 255;
02484 
02485   //fe->flow_src = p.src.addr;
02486   fe->flow_src = p.src.getNSAddr_t();
02487   //fe->flow_dst = p.dest.addr;
02488   fe->flow_dst = p.dest.getNSAddr_t();
02489   fe->flow_id  = flowid;
02490 
02491   //p.src = ID(iph->src(), ::IP);
02492   //p.dest = ID(iph->dst(), ::IP);
02493   p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
02494   p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
02495 
02496 
02497   cmh->ptype() = PT_DSR;                // cut off data
02498   cmh->size() = IP_HDR_LEN;
02499   cmh->num_forwards() = 0;
02500   // assign this packet a new uid, since we're sending it
02501   cmh->uid() = uidcnt_++;
02502 
02503   handlePktWithoutSR(p, false);
02504   assert(p.pkt == 0);
02505 }

Here is the call graph for this function:

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

Definition at line 100 of file agent.h.

References Agent::type_.

Referenced by Agent::command(), HttpUInvalClass::create(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), and CBR_PP_Traffic::init().

00100 { type_ = pkttype; }

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

Reimplemented in FullTcpAgent.

Definition at line 95 of file agent.h.

References Agent::size_.

Referenced by rtProtoDV::command(), RLM_Sender::command(), imepAgent::getResponseListSize(), LandmarkAgent::makeUpdate(), Agent::recv(), SSMSRMAgent::send_glb_sess(), SSMSRMAgent::send_loc_sess(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), and TelnetApp::timeout().

00095 { return size_; }

void DSRAgent::stickPacketInSendBuffer SRPacket p  )  [private]
 

Definition at line 213 of file dsragent.cc.

References Scheduler::clock(), SRPacket::dest, dropSendBuff(), ID::dump(), Scheduler::instance(), min, net_id, SendBufEntry::p, SRPacket::pkt, send_buf, SEND_BUF_SIZE, SRPacket::src, SendBufEntry::t, Time, trace(), and verbose.

Referenced by getRouteForPacket(), and undeliverablePkt().

00214 {
00215   Time min = DBL_MAX;
00216   int min_index = 0;
00217   int c;
00218 
00219   if (verbose)
00220     trace("Sdebug %.5f _%s_ stuck into send buff %s -> %s",
00221           Scheduler::instance().clock(), 
00222           net_id.dump(), p.src.dump(), p.dest.dump());
00223 
00224   for (c = 0 ; c < SEND_BUF_SIZE ; c ++)
00225     if (send_buf[c].p.pkt == NULL)
00226       {
00227         send_buf[c].t = Scheduler::instance().clock();
00228         send_buf[c].p = p;
00229         return;
00230       }
00231     else if (send_buf[c].t < min)
00232       {
00233         min = send_buf[c].t;
00234         min_index = c;
00235       }
00236   
00237   // kill somebody
00238   dropSendBuff(send_buf[min_index].p);
00239   send_buf[min_index].t = Scheduler::instance().clock();
00240   send_buf[min_index].p = p;
00241 }

Here is the call graph for this function:

void DSRAgent::tap const Packet p  )  [virtual]
 

Implements Tap.

Definition at line 1960 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), hdr_sr::addrs(), Scheduler::clock(), hdr_sr::cur_addr(), hdr_ip::daddr(), SRPacket::dest, dsr_tap, dsr_tap_skip, dsragent_snoop_source_routes, dsragent_use_tap, Path::dump(), ID::dump(), Path::index(), Scheduler::instance(), Address::instance(), Path::length(), MAC_id, net_id, RouteCache::noticeRouteUsed(), hdr_sr::num_addrs(), processBrokenRouteError(), processFlowARS(), PT_DSR, hdr_cmn::ptype(), hdr_sr::reply_addrs(), SRPacket::route, route_cache, hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_reply_len(), hdr_sr::route_request(), hdr_ip::saddr(), sendRouteShortening(), SRPacket::src, TAP_BITMASK, tap_uid_cache, trace(), hdr_cmn::uid(), hdr_sr::valid(), and verbose.

01963 {
01964   hdr_sr *srh = hdr_sr::access(packet);
01965   hdr_ip *iph = hdr_ip::access(packet);
01966   hdr_cmn *cmh =  hdr_cmn::access(packet);
01967   
01968   if (!dsragent_use_tap) return;
01969 
01970   if (!srh->valid()) return;    // can't do anything with it
01971 
01972   if (!srh->num_addrs()) {
01973     processFlowARS(packet);
01974     return;
01975   }
01976 
01977   // don't trouble me with packets I'm about to receive anyway
01978   /* this change added 5/13/98 -dam */
01979   ID next_hop(srh->addrs()[srh->cur_addr()]);
01980   if (next_hop == net_id || next_hop == MAC_id) return;
01981 
01982   SRPacket p((Packet *) packet, srh);
01983   //p.dest = ID(iph->dst(),::IP);
01984   //p.src = ID(iph->src(),::IP);
01985   p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
01986   p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
01987 
01988   // don't trouble me with my own packets
01989   if (p.src == net_id) return; 
01990 
01991 #ifdef DSR_FILTER_TAP
01992   /* 
01993    * Don't process packets more than once.  In real implementations
01994    * this can be done with the (IP Source, IP ID) pair, but it is
01995    * simpler to implement it with the global "uid" in simulation.
01996    */
01997   {
01998           int uid = cmh->uid();
01999           if(tap_uid_cache[(uid & TAP_BITMASK)] == uid) {
02000                   dsr_tap_skip++;
02001                   return;
02002           }
02003           dsr_tap++;
02004           tap_uid_cache[(uid & TAP_BITMASK)] = uid;
02005   }
02006 #endif
02007 
02008   /* snoop on the SR data */
02009   if (srh->route_error())
02010     {
02011       if (verbose)
02012         trace("Sdebug _%s_ tap saw error %d",  net_id.dump(), cmh->uid());
02013       processBrokenRouteError(p);
02014     }
02015 
02016   if (srh->route_reply())
02017     {
02018       Path reply_path(srh->reply_addrs(), srh->route_reply_len());
02019       if(verbose)
02020         trace("Sdebug _%s_ tap saw route reply %d  %s",
02021                net_id.dump(), cmh->uid(), reply_path.dump());
02022       route_cache->noticeRouteUsed(reply_path, Scheduler::instance().clock(), 
02023                                    p.src);
02024     }
02025 
02026   /* we can't decide whether we should snoop on the src routes in 
02027      route requests.  We've seen cases where we hear a route req from a
02028      node, but can't complete an arp with that node (and so can't actually
02029      deliver packets through it if called on to do so) -dam 4/16/98 */
02030 
02031   if (srh->route_request()) return; // don't path shorten route requests
02032   // the logic is wrong for shortening rtreq's anyway, cur_addr always = 0
02033 
02034   if (dsragent_snoop_source_routes)
02035     {
02036       if (verbose)
02037         trace("Sdebug _%s_ tap saw route use %d %s", net_id.dump(), 
02038               cmh->uid(), p.route.dump());
02039       route_cache->noticeRouteUsed(p.route, Scheduler::instance().clock(), 
02040                                    net_id);
02041     }
02042 
02043   if (PT_DSR == cmh->ptype()) return; //  no route shortening on any
02044   // DSR packet
02045 
02046   /* I think we ended up sending grat route replies for source routes on 
02047      route replies for route requests that were answered by someone else's
02048      cache, resulting in the wrong node receiving the route.  For now, I 
02049      outlaw it.
02050 
02051      The root of the problem is that when we salvage a pkt from a failed
02052      link using a route from our cache, we break what had been an invariant
02053      that the IP src of a packet was also the first machine listed on the
02054      source route.  Here's the route of the problem that results in the 
02055      simulator crashing at 8.56135 when 44 recieves a route reply that
02056      has 24 listed as the first node in the route.
02057 
02058 SSendFailure 8.52432 24 [10 |24 46 45 1 40 ]
02059 S$hit 8.52432 salvaging 10 -> 40 with [(24) 44 50 9 40 ]
02060 S$hit 8.52432 salvaging 44 -> 40 with [(24) 44 50 9 40 ]
02061 D 8.52432 [20 42 2e 18 800] 24 DSR 156 -- 10->40 6 [0] [1 9 39] [0 0 0->0]
02062 s 8.52438 [1b 45e 2c 18 0] 24 MAC 20
02063 r 8.52446 [1b 45e 2c 18 0] 44 MAC 20
02064 s 8.52454 [101b 27e 23 1b 0] 27 MAC 20
02065 s 8.52564 [101b 27e 23 1b 0] 27 MAC 20
02066 s 8.52580 [101b 45e 2c 18 0] 24 MAC 20
02067 r 8.52588 [101b 45e 2c 18 0] 44 MAC 20
02068 s 8.52589 [1c 41c 18 0 0] 44 MAC 14
02069 r 8.52595 [1c 41c 18 0 0] 24 MAC 14
02070 s 8.52600 [20 42 2c 18 800] 24 DSR 244 -- 10->40 5 [0] [1 9 39] [0 0 24->46]
02071 r 8.52698 [20 42 2c 18 800] 44 DSR 216 -- 10->40 5 [0] [1 9 39] [0 0 24->46]
02072 
02073 s 8.53947 [20 42 2c 18 800] 24 DSR 204 -- 44->40 5 [0] [1 8 39] [0 0 0->0]
02074 r 8.54029 [20 42 2c 18 800] 44 DSR 176 -- 44->40 5 [0] [1 8 39] [0 0 0->0]
02075 Sdebug 50 consider grat arp for [24 (44) 50 9 40 ]
02076 SRR 8.54029 50 gratuitous-reply-sent 50 -> 44 [24 (50) 9 40 ]
02077 SF 8.54029 44 [44 -> 40] via 0x3200 [24 |44 50 9 40 ]
02078 s 8.54030 [1d 0 18 0 0] 44 MAC 14
02079 r 8.54036 [1d 0 18 0 0] 24 MAC 14
02080 s 8.54044 [101b 54f 32 2c 0] 44 MAC 20
02081 r 8.54053 [101b 54f 32 2c 0] 50 MAC 20
02082 s 8.54054 [1c 50d 2c 0 0] 50 MAC 14
02083 r 8.54059 [1c 50d 2c 0 0] 44 MAC 14
02084 s 8.54064 [20 42 32 2c 800] 44 DSR 304 -- 10->40 5 [0] [1 9 39] [0 0 24->46]
02085 r 8.54186 [20 42 32 2c 800] 50 DSR 276 -- 10->40 5 [0] [1 9 39] [0 0 24->46]
02086 SF 8.54186 50 [10 -> 40] via 0x900 [24 44 |50 9 40 ]
02087 
02088 s 8.56101 [20 42 2c 18 800] 24 DSR 84 -- 50->44 2 [0] [1 4 40] [0 0 0->0]
02089 r 8.56135 [20 42 2c 18 800] 44 DSR 56 -- 50->44 2 [0] [1 4 40] [0 0 0->0]
02090 
02091 */
02092 
02093 
02094   /* check to see if we can shorten the route being used */
02095   if (p.route[p.route.index()] != net_id
02096       && p.route[p.route.index()] != MAC_id)
02097     { // it's not immeadiately to us
02098       for (int i = p.route.index() + 1; i < p.route.length(); i++)
02099         if (p.route[i] == net_id || p.route[i] == MAC_id)
02100           { // but it'll get here eventually...
02101             sendRouteShortening(p, p.route.index(), i);
02102           }
02103     }
02104 }

Here is the call graph for this function:

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

Definition at line 48 of file connector.h.

References Connector::target_.

Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().

00048 { return target_; }

void DSRAgent::Terminate void   ) 
 

Definition at line 359 of file dsragent.cc.

References Connector::drop(), DROP_END_OF_SIMULATION, SendBufEntry::p, SRPacket::pkt, send_buf, and SEND_BUF_SIZE.

Referenced by command().

00360 {
00361         int c;
00362         for (c  = 0 ; c < SEND_BUF_SIZE ; c++) {
00363                 if (send_buf[c].p.pkt) {
00364                         drop(send_buf[c].p.pkt, DROP_END_OF_SIMULATION);
00365                         send_buf[c].p.pkt = 0;
00366                 }
00367         }
00368 }

Here is the call graph for this function:

void DSRAgent::testinit  )  [private]
 

Definition at line 371 of file dsragent.cc.

References RouteCache::addRoute(), hdr_sr::addrs(), hdr_sr::append_addr(), hdr_sr::init(), IP, net_id, NS_AF_INET, hdr_sr::num_addrs(), and route_cache.

Referenced by command().

00372 {
00373   struct hdr_sr hsr;
00374   
00375   if (net_id == ID(1,::IP))
00376     {
00377       printf("adding route to 1\n");
00378       hsr.init();
00379       hsr.append_addr( 1, NS_AF_INET );
00380       hsr.append_addr( 2, NS_AF_INET );
00381       hsr.append_addr( 3, NS_AF_INET );
00382       hsr.append_addr( 4, NS_AF_INET );
00383       
00384       route_cache->addRoute(Path(hsr.addrs(),
00385                                  hsr.num_addrs()), 0.0, ID(1,::IP));
00386     }
00387   
00388   if (net_id == ID(3,::IP))
00389     {
00390       printf("adding route to 3\n");
00391       hsr.init();
00392       hsr.append_addr( 3, NS_AF_INET );
00393       hsr.append_addr( 2, NS_AF_INET );
00394       hsr.append_addr( 1, NS_AF_INET );
00395       
00396       route_cache->addRoute(Path(hsr.addrs(),
00397                                  hsr.num_addrs()), 0.0, ID(3,::IP));
00398     }
00399 }

Here is the call graph for this function:

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

void DSRAgent::trace char *  fmt,
... 
[private]
 

Definition at line 2188 of file dsragent.cc.

References BaseTrace::buffer(), BaseTrace::dump(), logtarget, and Trace::pt_.

Referenced by acceptRouteReply(), command(), dropSendBuff(), getRouteForPacket(), handleFlowForwarding(), handleForwarding(), handlePktWithoutSR(), handleRouteRequest(), processBrokenRouteError(), processUnknownFlowError(), recv(), replyFromRouteCache(), returnSrcRouteToRequestor(), sendBufferCheck(), sendOutPacketWithRoute(), sendOutRtReq(), sendRouteShortening(), sendUnknownFlow(), stickPacketInSendBuffer(), tap(), undeliverablePkt(), and xmitFailed().

02189 {
02190   va_list ap;
02191   
02192   if (!logtarget) return;
02193 
02194   va_start(ap, fmt);
02195   vsprintf(logtarget->pt_->buffer(), fmt, ap);
02196   logtarget->pt_->dump();
02197   va_end(ap);
02198 }

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 146 of file agent.h.

00146 {}

void DSRAgent::undeliverablePkt Packet p,
int  mine
[private]
 

Definition at line 2228 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), hdr_sr::addrs(), Path::appendPath(), Packet::copy(), hdr_sr::cur_addr(), hdr_ip::daddr(), SRPacket::dest, Connector::drop(), DROP_RTR_MAC_CALLBACK, DROP_RTR_NO_ROUTE, DROP_RTR_SALVAGE, dsr_salvage_max_attempts, dsr_salvage_max_requests, dsragent_dont_salvage_bad_replies, dsragent_require_bi_routes, dsragent_salvage_with_cache, Path::dump(), ID::dump(), RouteCache::findRoute(), hdr_sr::flow_header(), hdr_sr::flow_timeout(), handlePktWithoutSR(), ID_Type, Path::index(), Scheduler::instance(), Address::instance(), net_id, SRPacket::pkt, PT_DSR, hdr_cmn::ptype(), hdr_sr::reply_addrs(), Path::resetIterator(), SRPacket::route, route_cache, hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_reply_len(), hdr_sr::route_request(), hdr_ip::saddr(), hdr_sr::salvaged(), sendOutPacketWithRoute(), Path::setIterator(), Path::setLength(), hdr_sr::size(), hdr_cmn::size(), SRPacket::src, stickPacketInSendBuffer(), trace(), hdr_cmn::uid(), verbose_srr, and verbose_ssalv.

Referenced by sendUnknownFlow(), and xmitFailed().

02231 {
02232   hdr_sr *srh = hdr_sr::access(pkt);
02233   hdr_ip *iph = hdr_ip::access(pkt);
02234   hdr_cmn *cmh;
02235 
02236   SRPacket p(pkt,srh);
02237   //p.dest = ID(iph->dst(),::IP);
02238   //p.src = ID(iph->src(),::IP);
02239   p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
02240   p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
02241   p.pkt = mine ? pkt : pkt->copy();
02242 
02243   srh = hdr_sr::access(p.pkt);
02244   iph = hdr_ip::access(p.pkt);
02245   cmh = hdr_cmn::access(p.pkt);
02246 
02247   // we're about to salvage. flowstate rules say we must strip all flow
02248   // state info out of this packet. ych 5/5/01
02249   cmh->size() -= srh->size(); // changes affect size of header...
02250   srh->flow_timeout() = 0;
02251   srh->flow_header() = 0;
02252   cmh->size() += srh->size(); // done fixing flow state headers
02253 
02254   if (ID((Address::instance().get_nodeaddr(iph->saddr())),::IP) == net_id) {
02255     // it's our packet we couldn't send
02256     cmh->size() -= srh->size(); // remove size of SR header
02257     assert(cmh->size() >= 0);
02258     
02259     handlePktWithoutSR(p, false);
02260     
02261     return;
02262   }
02263 
02264   /*
02265    * Am I allowed to salvage?
02266    */
02267   if(dsragent_salvage_with_cache == 0) {
02268           assert(mine);
02269           drop(pkt, DROP_RTR_NO_ROUTE);  
02270           return;
02271   }
02272 
02273 #ifdef NEW_SALVAGE_LOGIC
02274   if(srh->salvaged() >= dsr_salvage_max_attempts) {
02275           assert(mine);
02276           drop(pkt, DROP_RTR_SALVAGE);
02277           return;
02278   }
02279 #endif /* NEW_SALVAGE_LOGIC */
02280 
02281   // it's a packet we're forwarding for someone, save it if we can...
02282   Path salvage_route;
02283       
02284   if (route_cache->findRoute(p.dest, salvage_route, 0)) {
02285           // be nice and send the packet out
02286 #if 0
02287           /* we'd like to create a ``proper'' source route with the
02288              IP src of the packet as the first node, but we can't actually 
02289              just append the salvage route onto the route used so far, 
02290              since the append creates routes with loops in them 
02291              like  1 2 3 4 3 5 
02292              If we were to squish the route to remove the loop, then we'd be
02293              removing ourselves from the route, which is verboten.
02294              If we did remove ourselves, and our salvage route contained
02295              a stale link, we might never hear the route error.
02296              -dam 5/13/98
02297 
02298              Could we perhaps allow SRs with loops in them on the air?
02299              Since it's still a finite length SR, the pkt can't loop
02300              forever... -dam 8/5/98 */
02301 
02302           // truncate the route at the bad link and append good bit
02303           int our_index = p.route.index();
02304 
02305           p.route.setLength(our_index);
02306           // yes this cuts us off the route,
02307 
02308           p.route.appendPath(salvage_route);
02309           // but we're at the front of s_r
02310           p.route.setIterator(our_index);
02311 #else
02312           p.route = salvage_route;
02313           p.route.resetIterator();
02314 #endif
02315 
02316           if (dsragent_dont_salvage_bad_replies && srh->route_reply()) {
02317                   // check to see if we'd be salvaging a packet
02318                   // with the dead link in it
02319 
02320                   ID to_id(srh->addrs()[srh->cur_addr()+1].addr,
02321                            (ID_Type) srh->addrs()[srh->cur_addr()].addr_type);
02322                   bool bad_reply = false;
02323 
02324                   for (int i = 0 ; i < srh->route_reply_len()-1; i++) {
02325 
02326                           if (net_id == ID(srh->reply_addrs()[i]) &&
02327                               to_id == ID(srh->reply_addrs()[i+1]) ||
02328                               (dsragent_require_bi_routes &&
02329                                to_id == ID(srh->reply_addrs()[i]) &&
02330                                net_id == ID(srh->reply_addrs()[i+1]))) {
02331                                           
02332                                   bad_reply = true;
02333                                   break;
02334                           }
02335                   }
02336                   if (bad_reply) {
02337                           // think about killing this packet
02338                           srh->route_reply() = 0;
02339                           if (PT_DSR == cmh->ptype() &&
02340                               ! srh->route_request() &&
02341                               ! srh->route_error()) {
02342                                   // this packet has no reason to live
02343                                   if (verbose_srr)
02344                                           trace("SRR %.5f _%s_ --- %d dropping bad-reply %s -> %s", 
02345                                                 Scheduler::instance().clock(), net_id.dump(), 
02346                                                 cmh->uid(), p.src.dump(), p.dest.dump());
02347                                   if (mine)
02348                                           drop(pkt, DROP_RTR_MAC_CALLBACK);
02349                                   return;
02350                           }
02351                   }
02352           }
02353 
02354           if (verbose_ssalv) 
02355                   trace("Ssalv %.5f _%s_ salvaging %s -> %s --- %d with %s",
02356                         Scheduler::instance().clock(), net_id.dump(),
02357                         p.src.dump(), p.dest.dump(),
02358                         cmh->uid(), p.route.dump());
02359 
02360           // remove size of SR header, added back in sendOutPacketWithRoute
02361           cmh->size() -= srh->size(); 
02362           assert(cmh->size() >= 0);
02363 #ifdef NEW_SALVAGE_LOGIC
02364           srh->salvaged() += 1;
02365 #endif
02366           sendOutPacketWithRoute(p, false);
02367   }
02368 #ifdef NEW_SALVAGE_LOGIC
02369   else if(dsr_salvage_max_requests > 0) {
02370           /*
02371            * Allow the node to perform route discovery for an
02372            * intermediate hop.
02373            */
02374           if (verbose_ssalv) 
02375                   trace("Ssalv %.5f _%s_ adding to SB --- %d %s -> %s [%d]", 
02376                         Scheduler::instance().clock(), 
02377                         net_id.dump(),
02378                         cmh->uid(),
02379                         p.src.dump(), p.dest.dump(),
02380                         srh->salvaged());
02381           stickPacketInSendBuffer(p);
02382   }
02383 #endif
02384   else {
02385           // we don't have a route, and it's not worth us doing a
02386           // route request to try to help the originator out, since
02387           // it might be counter productive
02388           if (verbose_ssalv) 
02389                   trace("Ssalv %.5f _%s_ dropping --- %d %s -> %s [%d]", 
02390                         Scheduler::instance().clock(), 
02391                         net_id.dump(), cmh->uid(),
02392                         p.src.dump(), p.dest.dump(),
02393                         srh->salvaged());
02394           if (mine)
02395                   drop(pkt, DROP_RTR_NO_ROUTE);
02396   }
02397 }

Here is the call graph for this function:

void DSRAgent::xmitFailed Packet pkt,
const char *  reason = "DROP_RTR_MAC_CALLBACK"
[private]
 

Definition at line 2560 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), ID::addr, sr_addr::addr, link_down::addr_type, hdr_sr::addrs(), Packet::copy(), Address::create_ipaddr(), hdr_sr::cur_addr(), hdr_ip::daddr(), SRPacket::dest, hdr_cmn::direction(), hdr_cmn::DOWN, hdr_sr::down_links(), hdr_ip::dport(), hdr_sr::dump(), ID::dump(), hdr_sr::flow_header(), flow_table, hdr_sr::flow_timeout(), Packet::free(), link_down::from_addr, ID::getNSAddr_t(), God::hops(), ID_Type, ifq, Path::index(), Address::instance(), God::instance(), Scheduler::instance(), IP_HDR_LEN, MAC_id, MAX_ROUTE_ERRORS, net_id, Packet::next_, FlowTable::noticeDeadLink(), RouteCache::noticeDeadLink(), hdr_sr::num_addrs(), hdr_cmn::num_forwards(), hdr_sr::num_route_errors(), CMUPriQueue::prq_get_nexthop(), PT_DSR, hdr_cmn::ptype(), Path::reverseInPlace(), SRPacket::route, route_cache, hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_request(), RT_PORT, hdr_ip::saddr(), sendOutPacketWithRoute(), Path::setLength(), hdr_cmn::size(), hdr_ip::sport(), SRPacket::src, link_down::tell_addr, link_down::to_addr, trace(), hdr_ip::ttl(), hdr_cmn::uid(), Agent::uidcnt_, undeliverablePkt(), and verbose.

Referenced by sendOutPacketWithRoute(), and xmitFlowFailed().

02565 {
02566   hdr_sr *srh = hdr_sr::access(pkt);
02567   hdr_ip *iph = hdr_ip::access(pkt);
02568   hdr_cmn *cmh = hdr_cmn::access(pkt);
02569 
02570   assert(cmh->size() >= 0);
02571 
02572   srh->cur_addr() -= 1;         // correct for inc already done on sending
02573   
02574   if (srh->cur_addr() >= srh->num_addrs() - 1)
02575     {
02576       trace("SDFU: route error beyond end of source route????");
02577       fprintf(stderr,"SDFU: route error beyond end of source route????\n");
02578       Packet::free(pkt);
02579       return;
02580     }
02581 
02582   if (srh->route_request())
02583     {
02584       trace("SDFU: route error forwarding route request????");
02585       fprintf(stderr,"SDFU: route error forwarding route request????\n");
02586       Packet::free(pkt);
02587       return;
02588     }
02589 
02590 
02591   ID tell_id(srh->addrs()[0].addr,
02592              (ID_Type) srh->addrs()[srh->cur_addr()].addr_type);
02593   ID from_id(srh->addrs()[srh->cur_addr()].addr,
02594              (ID_Type) srh->addrs()[srh->cur_addr()].addr_type);
02595   ID to_id(srh->addrs()[srh->cur_addr()+1].addr,
02596              (ID_Type) srh->addrs()[srh->cur_addr()].addr_type);
02597   assert(from_id == net_id || from_id == MAC_id);
02598 
02599   trace("SSendFailure %.9f _%s_ %d %d %d:%d %d:%d %s->%s %d %d %d %d %s",
02600         Scheduler::instance().clock(), net_id.dump(), 
02601         cmh->uid(), cmh->ptype(),
02602         iph->saddr(), iph->sport(),
02603         iph->daddr(), iph->dport(),
02604         from_id.dump(),to_id.dump(),
02605         God::instance()->hops(from_id.getNSAddr_t(), to_id.getNSAddr_t()),
02606         God::instance()->hops(iph->saddr(),iph->daddr()),
02607         God::instance()->hops(from_id.getNSAddr_t(), iph->daddr()),
02608         srh->num_addrs(), srh->dump());
02609 
02610 #ifdef USE_GOD_FEEDBACK
02611   if (God::instance()->hops(from_id.getNSAddr_t(), to_id.getNSAddr_t()) == 1)
02612     { /* god thinks this link is still valid */
02613       linkerr_is_wrong++;
02614       trace("SxmitFailed %.5f _%s_  %d->%d god okays #%d",
02615             Scheduler::instance().clock(), net_id.dump(),
02616             from_id.getNSAddr_t(), to_id.getNSAddr_t(), linkerr_is_wrong);
02617       fprintf(stderr,
02618               "xmitFailed on link %d->%d god okays - ignoring & recycling #%d\n",
02619               from_id.getNSAddr_t(), to_id.getNSAddr_t(), linkerr_is_wrong);
02620       /* put packet back on end of ifq for xmission */
02621       srh->cur_addr() += 1;     // correct for decrement earlier in proc 
02622       // make sure we aren't cycling packets
02623       // also change direction in pkt hdr
02624       cmh->direction() = hdr_cmn::DOWN;
02625       ll->recv(pkt, (Handler*) 0);
02626       return;
02627     }
02628 #endif
02629 
02630   if(strcmp(reason, "DROP_IFQ_QFULL") != 0) {
02631           assert(strcmp(reason, "DROP_RTR_MAC_CALLBACK") == 0);
02632 
02633           /* kill any routes we have using this link */
02634           route_cache->noticeDeadLink(from_id, to_id,
02635                                       Scheduler::instance().clock());
02636           flow_table.noticeDeadLink(from_id, to_id);
02637 
02638           /* give ourselves a chance to save the packet */
02639           undeliverablePkt(pkt->copy(), 1);
02640 
02641           /* now kill all the other packets in the output queue that would
02642              use the same next hop.  This is reasonable, since 802.11 has
02643              already retried the xmission multiple times => a persistent
02644              failure. */
02645 
02646           /* XXX YCH 5/4/01 shouldn't each of these packets get Route Errors
02647            * if one hasn't already been sent? ie if two different routes
02648            * are using this link?
02649            */
02650           {
02651             Packet *r, *nr, *queue1 = 0, *queue2 = 0;
02652             // pkts to be recycled
02653             
02654             while((r = ifq->prq_get_nexthop(to_id.getNSAddr_t()))) {
02655               r->next_ = queue1;
02656               queue1 = r; 
02657             }
02658 
02659             // the packets are now in the reverse order of how they
02660             // appeared in the IFQ so reverse them again
02661             for(r = queue1; r; r = nr) {
02662               nr = r->next_;
02663               r->next_ = queue2;
02664               queue2 = r;
02665             }
02666 
02667             // now process them in order
02668             for(r = queue2; r; r = nr) {
02669               nr = r->next_;
02670               undeliverablePkt(r, 1);
02671             }
02672           }
02673   }
02674   
02675   /* warp pkt into a route error message */
02676   if (tell_id == net_id || tell_id == MAC_id)
02677     { // no need to send the route error if it's for us
02678       if (verbose) 
02679         trace("Sdebug _%s_ not bothering to send route error to ourselves", 
02680               tell_id.dump());
02681       Packet::free(pkt);        // no drop needed
02682       pkt = 0;
02683       return;
02684     }
02685 
02686   if (srh->num_route_errors() >= MAX_ROUTE_ERRORS)
02687     { // no more room in the error packet to nest an additional error.
02688       // this pkt's been bouncing around so much, let's just drop and let
02689       // the originator retry
02690       // Another possibility is to just strip off the outer error, and
02691       // launch a Route discovey for the inner error XXX -dam 6/5/98
02692       trace("SDFU  %.5f _%s_ dumping maximally nested error %s  %d -> %d",
02693             Scheduler::instance().clock(), net_id.dump(),
02694             tell_id.dump(),
02695             from_id.dump(),
02696             to_id.dump());
02697       Packet::free(pkt);        // no drop needed
02698       pkt = 0;
02699       return;
02700     }
02701 
02702   link_down *deadlink = &(srh->down_links()[srh->num_route_errors()]);
02703   deadlink->addr_type = srh->addrs()[srh->cur_addr()].addr_type;
02704   deadlink->from_addr = srh->addrs()[srh->cur_addr()].addr;
02705   deadlink->to_addr = srh->addrs()[srh->cur_addr()+1].addr;
02706   deadlink->tell_addr = srh->addrs()[0].addr;
02707   srh->num_route_errors() += 1;
02708 
02709   if (verbose)
02710     trace("Sdebug %.5f _%s_ sending into dead-link (nest %d) tell %d  %d -> %d",
02711           Scheduler::instance().clock(), net_id.dump(),
02712           srh->num_route_errors(),
02713           deadlink->tell_addr,
02714           deadlink->from_addr,
02715           deadlink->to_addr);
02716 
02717   srh->route_error() = 1;
02718   srh->route_reply() = 0;
02719   srh->route_request() = 0;
02720   srh->flow_header() = 0;
02721   srh->flow_timeout() = 0;
02722 
02723   //iph->daddr() = deadlink->tell_addr;
02724   iph->daddr() = Address::instance().create_ipaddr(deadlink->tell_addr,RT_PORT);
02725   iph->dport() = RT_PORT;
02726   //iph->saddr() = net_id.addr;
02727   iph->saddr() = Address::instance().create_ipaddr(net_id.addr,RT_PORT);
02728   iph->sport() = RT_PORT;
02729   iph->ttl() = 255;
02730 
02731   cmh->ptype() = PT_DSR;                // cut off data
02732   cmh->size() = IP_HDR_LEN;
02733   cmh->num_forwards() = 0;
02734   // assign this packet a new uid, since we're sending it
02735   cmh->uid() = uidcnt_++;
02736 
02737   SRPacket p(pkt, srh);
02738   p.route.setLength(p.route.index()+1);
02739   p.route.reverseInPlace();
02740   p.dest = tell_id;
02741   p.src = net_id;
02742 
02743   /* send out the Route Error message */
02744   sendOutPacketWithRoute(p, true);
02745 }

Here is the call graph for this function:

void DSRAgent::xmitFlowFailed Packet pkt,
const char *  reason = "DROP_RTR_MAC_CALLBACK"
[private]
 

Definition at line 2508 of file dsragent.cc.

References hdr_cmn::access(), hdr_ip::access(), hdr_sr::access(), ID::addr, hdr_sr::addrs(), Scheduler::clock(), hdr_sr::cur_addr(), hdr_ip::daddr(), FlowTable::defaultFlow(), SRPacket::dest, FlowTable::find(), hdr_sr::flow_header(), hdr_sr::flow_id(), flow_table, Scheduler::instance(), Address::instance(), net_id, nsaddr_t, hdr_sr::num_addrs(), hdr_ip::saddr(), sendUnknownFlow(), hdr_sr::size(), hdr_cmn::size(), SRPacket::src, u_int16_t, and xmitFailed().

02509 {
02510   hdr_sr *srh = hdr_sr::access(pkt);
02511   hdr_ip *iph = hdr_ip::access(pkt);
02512   hdr_cmn *cmh = hdr_cmn::access(pkt);
02513   int flowidx = flow_table.find(iph->saddr(), iph->daddr(), srh->flow_id());
02514   u_int16_t default_flow;
02515 
02516   assert(!srh->num_addrs());
02517 
02518   if (!srh->flow_header()) {
02519     if (!flow_table.defaultFlow(iph->saddr(), iph->daddr(), default_flow)) {
02520       SRPacket p(pkt, srh);
02521       //p.src = ID(iph->src(), ::IP);
02522       //p.dest = ID(iph->dst(), ::IP);
02523       p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
02524       p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
02525 
02526 
02527       sendUnknownFlow(p, true);
02528       return;
02529     }
02530     flowidx = flow_table.find(iph->saddr(), iph->daddr(), default_flow);
02531   }
02532 
02533   if (flowidx == -1 || 
02534       flow_table[flowidx].timeout < Scheduler::instance().clock()) {
02535     // blah, the flow has expired, or been forgotten.
02536     SRPacket p(pkt, srh);
02537     //p.src = ID(iph->src(), ::IP);
02538     //p.dest = ID(iph->dst(), ::IP);
02539     p.dest = ID((Address::instance().get_nodeaddr(iph->daddr())),::IP);
02540     p.src = ID((Address::instance().get_nodeaddr(iph->saddr())),::IP);
02541 
02542 
02543     return;
02544   }
02545 
02546   cmh->size() -= srh->size(); // gonna change the source route size
02547   assert(cmh->size() >= 0);
02548   
02549   flow_table[flowidx].sourceRoute.fillSR(srh);
02550   srh->cur_addr() = flow_table[flowidx].hopCount;
02551   assert(srh->addrs()[srh->cur_addr()].addr == (nsaddr_t) net_id.addr);
02552   cmh->size() += srh->size();
02553 
02554   // xmitFailed is going to assume this was incr'ed for send
02555   srh->cur_addr()++;
02556   xmitFailed(pkt, reason);
02557 }

Here is the call graph for this function:


Friends And Related Function Documentation

int FilterFailure Packet p,
void *  data
[friend]
 

friend class SendBufferTimer [friend]
 

Definition at line 246 of file dsragent.h.

void XmitFailureCallback Packet pkt,
void *  data
[friend]
 

Definition at line 2748 of file dsragent.cc.

Referenced by sendOutPacketWithRoute().

02749 {
02750   DSRAgent *agent = (DSRAgent *)data; // cast of trust
02751   agent->xmitFailed(pkt);
02752 }

void XmitFlowFailureCallback Packet pkt,
void *  data
[friend]
 

Definition at line 2755 of file dsragent.cc.

Referenced by handleFlowForwarding(), and sendOutPacketWithRoute().

02756 {
02757   DSRAgent *agent = (DSRAgent *)data;
02758   agent->xmitFlowFailed(pkt);
02759 }


Member Data Documentation

DSRAgent_List DSRAgent::agthead = { 0 } [static]
 

Definition at line 98 of file dsragent.cc.

Referenced by DSRAgent().

Application* Agent::app_ [protected, inherited]
 

Reimplemented in BayFullTcpAgent.

Definition at line 134 of file agent.h.

Referenced by Agent::attachApp(), Agent::idle(), RapAgent::IpgTimeout(), UdpAgent::recv(), SimpleTcpAgent::recv(), RapAgent::recv(), HttpInvalAgent::recv(), Agent::recv(), and Agent::recvBytes().

ARSTable DSRAgent::ars_table [private]
 

Definition at line 151 of file dsragent.h.

Referenced by handleFlowForwarding(), and processFlowARS().

Tcl_Channel Agent::channel_ [protected, inherited]
 

Definition at line 130 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::command(), Agent::flushAVar(), Agent::monitorAgentTrace(), TcpAsymSink::recv(), Agent::trace(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

int Agent::defttl_ [protected, inherited]
 

Definition at line 121 of file agent.h.

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

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

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

ns_addr_t Agent::dst_ [protected, inherited]
 

Reimplemented in AckRecons.

Definition at line 115 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::daddr(), Agent::delay_bind_dispatch(), Agent::deleteAgentTrace(), Agent::dport(), DSRProto::DSRProto(), Agent::flushAVar(), Agent::initpkt(), SRMAgent::recv(), SSMSRMAgent::recv(), NatAgent::recv(), SRMAgent::sendmsg(), PushbackAgent::sendMsg(), and Agent::trace().

ID DSRAgent::err_from [private]
 

Definition at line 154 of file dsragent.h.

Referenced by processBrokenRouteError(), and sendOutRtReq().

ID DSRAgent::err_to [private]
 

Definition at line 154 of file dsragent.h.

Referenced by processBrokenRouteError(), and sendOutRtReq().

EventTrace* Agent::et_ [protected, inherited]
 

Definition at line 145 of file agent.h.

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

int Agent::fid_ [protected, inherited]
 

Definition at line 118 of file agent.h.

Referenced by Agent::delay_bind_dispatch(), AbsTcpAgent::flowid(), Agent::initpkt(), FullTcpAgent::recv(), CtrMcastEncap::recv(), AbsTcpAgent::send_batch(), Sack1TcpAgent::timeout(), and TcpAgent::trace_event().

int Agent::flags_ [protected, inherited]
 

Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent.

Definition at line 120 of file agent.h.

Referenced by Agent::delay_bind_dispatch().

FlowTable DSRAgent::flow_table [private]
 

Definition at line 150 of file dsragent.h.

Referenced by command(), handleDefaultForwarding(), handleFlowForwarding(), processBrokenRouteError(), processFlowARS(), processUnknownFlowError(), sendOutPacketWithRoute(), xmitFailed(), and xmitFlowFailed().

GratReplyHoldDown DSRAgent::grat_hold[RTREP_HOLDOFF_SIZE] [private]
 

Definition at line 146 of file dsragent.h.

Referenced by DSRAgent(), and sendRouteShortening().

int DSRAgent::grat_hold_victim [private]
 

Definition at line 147 of file dsragent.h.

Referenced by DSRAgent(), and sendRouteShortening().

ns_addr_t Agent::here_ [protected, inherited]
 

Definition at line 114 of file agent.h.

Referenced by Agent::addAgentTrace(), Agent::addr(), SinkAgent::bcast_interest(), SinkAgent::data_ready(), OmniMcastAgent::DataForSink(), FloodingAgent::DataForSink(), DiffusionAgent::DataForSink(), Agent::delay_bind_dispatch(), Agent::deleteAgentTrace(), 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(), DumbAgent::recv(), SinkAgent::sendpkt(), SinkAgent::set_addr(), SinkAgent::Terminate(), and Agent::trace().

CMUPriQueue* DSRAgent::ifq [private]
 

Definition at line 118 of file dsragent.h.

Referenced by command(), DSRAgent(), handleRouteRequest(), sendOutPacketWithRoute(), and xmitFailed().

NsObject* DSRAgent::ll [private]
 

Definition at line 117 of file dsragent.h.

Trace* DSRAgent::logtarget [private]
 

Definition at line 108 of file dsragent.h.

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

Mac* DSRAgent::mac_ [private]
 

Definition at line 119 of file dsragent.h.

Referenced by command(), DSRAgent(), and handleRouteRequest().

ID DSRAgent::MAC_id [private]
 

Definition at line 116 of file dsragent.h.

Referenced by command(), handleForwarding(), handlePacketReceipt(), ignoreRouteRequestp(), processBrokenRouteError(), replyFromRouteCache(), tap(), and xmitFailed().

ID DSRAgent::net_id [private]
 

Definition at line 116 of file dsragent.h.

Referenced by acceptRouteReply(), command(), dropSendBuff(), getRouteForPacket(), handleFlowForwarding(), handleForwarding(), handlePacketReceipt(), handlePktWithoutSR(), handleRouteRequest(), ignoreRouteRequestp(), processBrokenRouteError(), processUnknownFlowError(), recv(), replyFromRouteCache(), returnSrcRouteToRequestor(), sendBufferCheck(), sendOutPacketWithRoute(), sendOutRtReq(), sendRouteShortening(), sendUnknownFlow(), stickPacketInSendBuffer(), tap(), testinit(), undeliverablePkt(), xmitFailed(), and xmitFlowFailed().

MobileNode* DSRAgent::node_ [private]
 

Definition at line 122 of file dsragent.h.

Referenced by acceptRouteReply(), command(), handlePktWithoutSR(), and sendOutPacketWithRoute().

int DSRAgent::num_heldoff_rt_replies [private]
 

Definition at line 144 of file dsragent.h.

Referenced by DSRAgent().

int DSRAgent::off_ip_ [private]
 

Definition at line 111 of file dsragent.h.

int DSRAgent::off_ll_ [private]
 

Definition at line 110 of file dsragent.h.

int DSRAgent::off_mac_ [private]
 

Definition at line 109 of file dsragent.h.

int DSRAgent::off_sr_ [private]
 

Definition at line 112 of file dsragent.h.

OldValue* Agent::oldValueList_ [protected, inherited]
 

Definition at line 132 of file agent.h.

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

NsObject* DSRAgent::port_dmux_ [private]
 

Definition at line 126 of file dsragent.h.

Referenced by command(), and recv().

int Agent::prio_ [protected, inherited]
 

Definition at line 119 of file agent.h.

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

RequestTable DSRAgent::request_table [private]
 

Definition at line 139 of file dsragent.h.

Referenced by acceptRouteReply(), getRouteForPacket(), handlePacketReceipt(), handleRouteRequest(), and ignoreRouteRequestp().

RouteCache* DSRAgent::route_cache [private]
 

Definition at line 140 of file dsragent.h.

Referenced by acceptRouteReply(), command(), DSRAgent(), handleForwarding(), handlePktWithoutSR(), processBrokenRouteError(), replyFromRouteCache(), returnSrcRouteToRequestor(), sendRouteShortening(), tap(), testinit(), undeliverablePkt(), and xmitFailed().

Time DSRAgent::route_error_data_time [private]
 

Definition at line 155 of file dsragent.h.

Referenced by processBrokenRouteError(), and sendOutRtReq().

bool DSRAgent::route_error_held [private]
 

Definition at line 153 of file dsragent.h.

Referenced by DSRAgent(), processBrokenRouteError(), and sendOutRtReq().

int DSRAgent::route_request_num [private]
 

Definition at line 143 of file dsragent.h.

Referenced by DSRAgent(), and sendOutRtReq().

RtRepHoldoff DSRAgent::rtrep_holdoff[RTREP_HOLDOFF_SIZE] [private]
 

Definition at line 145 of file dsragent.h.

Referenced by DSRAgent().

SendBufEntry DSRAgent::send_buf[SEND_BUF_SIZE] [private]
 

Definition at line 141 of file dsragent.h.

Referenced by acceptRouteReply(), sendBufferCheck(), stickPacketInSendBuffer(), and Terminate().

SendBufferTimer DSRAgent::send_buf_timer [private]
 

Definition at line 142 of file dsragent.h.

Referenced by command().

int Agent::size_ [protected, inherited]
 

Reimplemented in SA_Agent, and AckRecons.

Definition at line 116 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(), IntTcpAgent::createTcpSession(), TfrcAgent::decrease_rate(), TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), FullTcpAgent::foutput(), getRouteForPacket(), TfrcAgent::increase_rate(), TcpAgent::initial_window(), Agent::initpkt(), RapAgent::IpgTimeout(), IvsReceiver::IvsReceiver(), LmsAgent::LmsAgent(), LmsReceiver::LmsReceiver(), mcastControlAgent::mcastControlAgent(), MessageAgent::MessageAgent(), MIPBSAgent::MIPBSAgent(), MIPMHAgent::MIPMHAgent(), TfrcAgent::nextpkt(), IntTcpAgent::opencwnd(), PingAgent::PingAgent(), RapAgent::RapAgent(), TfrcAgent::recv(), TcpSessionAgent::recv(), NewRenoTcpAgent::recv(), TfrcAgent::reduce_rate_on_no_feedback(), 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(), UdpAgent::sendmsg(), TfrcAgent::sendmsg(), TcpAgent::sendmsg(), SRMAgent::sendmsg(), RTPAgent::sendmsg(), RapAgent::SendPacket(), TfrcAgent::sendpkt(), rtProtoDV::sendpkt(), SinkAgent::sendpkt(), SinkAgent::SinkAgent(), Agent::size(), TfrcAgent::slowstart(), TfrcAgent::start(), TfrcAgent::TfrcAgent(), TfrcSinkAgent::TfrcSinkAgent(), RTPAgent::timeout(), RTCPAgent::timeout(), and UdpAgent::UdpAgent().

int DSRAgent::tap_uid_cache[TAP_CACHE_SIZE] [private]
 

Definition at line 135 of file dsragent.h.

Referenced by DSRAgent(), and tap().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 of file connector.h.

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

char* Agent::traceName_ [protected, inherited]
 

Definition at line 131 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 117 of file agent.h.

Referenced by Agent::get_pkttype(), Agent::initpkt(), FullTcpAgent::listen(), BayFullTcpAgent::listen(), RapAgent::SendAck(), SRMAgent::sendmsg(), RapAgent::SendPacket(), and Agent::set_pkttype().

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

Definition at line 68 of file agent.cc.

Referenced by imepAgent::handlerControlTimer(), imepAgent::handlerReXmitTimer(), Agent::initpkt(), imepAgent::sendAck(), imepAgent::sendBeacon(), toraAgent::sendCLR(), imepAgent::sendHello(), toraAgent::sendQRY(), sendUnknownFlow(), toraAgent::sendUPD(), and xmitFailed().


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