FloodAgent Class Reference

#include <flood-agent.h>

Inheritance diagram for FloodAgent:

Agent Connector NsObject TclObject Handler Collaboration diagram for FloodAgent:

Collaboration graph
[legend]

Detailed Description

Definition at line 39 of file flood-agent.h.

Public Member Functions

nsaddr_taddr ()
virtual void attachApp (Application *app)
virtual void close ()
virtual int command (int argc, const char *const *argv)
virtual void connect (nsaddr_t dst)
nsaddr_tdaddr ()
virtual void debug (const char *fmt,...)
nsaddr_tdport ()
virtual void drop (Packet *p)
 FloodAgent ()
packet_t get_pkttype ()
int isdebug () const
virtual void listen ()
nsaddr_tport ()
virtual void recv (Packet *p, const char *s)
void recvOnly (Packet *)
virtual void send (int nbytes)
virtual void send (int sz, AppData *data)
void send (Packet *p, Handler *h)
virtual void sendmsg (int nbytes, const char *flags=0)
virtual void sendmsg (int sz, AppData *, const char *flags=0)
virtual void sendto (int nbytes, const char *flags, ns_addr_t dst)
virtual void sendto (int nbytes, const char *flags, nsaddr_t dst)
virtual void sendto (int sz, AppData *, const char *flags, ns_addr_t dst)
virtual void sendto (int sz, AppData *, const char *flags, nsaddr_t dst)
void set_pkttype (packet_t pkttype)
void setDropTarget (NsObject *dt)
virtual int & size ()
void target (NsObject *target)
NsObjecttarget ()
virtual void timeout (int tno)

Protected Member Functions

void addAgentTrace (const char *name)
Packetallocpkt (int) const
Packetallocpkt () const
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
virtual void delay_bind_init_all ()
void deleteAgentTrace ()
virtual void drop (Packet *p, const char *s)
void dumpTracedVars ()
nsaddr_t get_next_hop (nsaddr_t src, int obj_name, int origin_time)
void handle (Event *)
virtual void idle ()
void initpkt (Packet *) const
void insertOldValue (TracedVar *v, const char *value)
OldValuelookupOldValue (TracedVar *v)
void monitorAgentTrace ()
void periodic_callback (Event *e, int level)
void recv (Packet *p, Handler *)
virtual void recvBytes (int bytes)
virtual void reset ()
int search_queries_list (nsaddr_t src, int obj_name, int origin_time, int num_hops, nsaddr_t last_hop_id)
void startUp ()
virtual void trace (TracedVar *v)
void trace (char *fmt,...)
virtual void trace_event (char *eventtype)

Protected Attributes

Applicationapp_
int cache_
Tcl_Channel channel_
int debug_
int defttl_
NsObjectdrop_
ns_addr_t dst_
EventTraceet_
int fid_
int flags_
ns_addr_t here_
PriQueuell_queue
int myaddr_
MobileNodenode_
int num_cached_items_
OldValueoldValueList_
int prio_
QueryListquery_list_
int seqno_
int size_
TagCachetag_cache_
tags_databasetag_dbase_
compr_taglisttag_list_
NsObjecttarget_
char * traceName_
Tracetracetarget_
packet_t type_

Static Protected Attributes

static int uidcnt_


Constructor & Destructor Documentation

FloodAgent::FloodAgent  ) 
 

Definition at line 86 of file flood-agent.cc.

References cache_, MAX_CACHE_ITEMS, node_, num_cached_items_, query_list_, tag_cache_, and tag_list_.

00086                        : Agent(PT_MESSAGE)
00087 {
00088   node_ = NULL;
00089   tag_list_ = NULL;
00090   query_list_ = NULL;
00091 
00092   cache_ = 0; // Disable caching by default
00093   tag_cache_ = new TagCache[MAX_CACHE_ITEMS];
00094   num_cached_items_ = 0;
00095 }


Member Function Documentation

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

Definition at line 326 of file agent.cc.

References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::dst_, Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_.

Referenced by Agent::command().

00327 {
00328     char wrk[256];
00329     int n;
00330     double curTime = (&Scheduler::instance() == NULL ? 0 : 
00331               Scheduler::instance().clock());
00332     
00333     sprintf(wrk, "a -t "TIME_FORMAT" -s %d -d %d -n %s",
00334         curTime, here_.addr_, dst_.addr_, name);
00335     n = strlen(wrk);
00336     wrk[n] = '\n';
00337     wrk[n+1] = 0;
00338     if (channel_)
00339         (void)Tcl_Write(channel_, wrk, n+1);
00340     // keep agent trace name
00341     if (traceName_ != NULL)
00342         delete[] traceName_;
00343     traceName_ = new char[strlen(name)+1];
00344     strcpy(traceName_, name);
00345 }

Here is the call graph for this function:

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

Definition at line 99 of file agent.h.

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

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

00099 { return here_.addr_; }

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

Definition at line 528 of file agent.cc.

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

00529 {
00530         Packet* p = allocpkt();
00531 
00532     if (n > 0)
00533             p->allocdata(n);
00534 
00535     return(p);
00536 }

Here is the call graph for this function:

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

Definition at line 517 of file agent.cc.

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

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

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

Here is the call graph for this function:

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

Definition at line 372 of file agent.cc.

References Agent::app_.

Referenced by WormApp::command(), HttpMInvalCache::command(), Application::command(), TcpApp::TcpApp(), and TcpApp::~TcpApp().

00373 {
00374     app_ = app;
00375 }

void Agent::close  )  [virtual, inherited]
 

Reimplemented in FullTcpAgent.

Definition at line 377 of file agent.cc.

Referenced by Agent::command().

00378 {
00379 }

int FloodAgent::command int  argc,
const char *const *  argv
[virtual]
 

Reimplemented from Agent.

Definition at line 101 of file flood-agent.cc.

References cache_, Agent::command(), Address::instance(), ll_queue, myaddr_, node_, startUp(), Address::str2addr(), tag_dbase_, and tracetarget_.

00102 {
00103   if (argc == 2)
00104     {
00105       if (strcmp (argv[1], "start-floodagent") == 0)
00106         {
00107           startUp();
00108           return (TCL_OK);
00109         }
00110       if (strcmp (argv[1], "enable-caching") == 0)
00111         {
00112           cache_ = 1;
00113           return (TCL_OK);
00114         }
00115       else if (strcasecmp (argv[1], "ll-queue") == 0)
00116         {
00117       if (!(ll_queue = (PriQueue *) TclObject::lookup (argv[2])))
00118             {
00119               fprintf (stderr, "Flood_Agent: ll-queue lookup of %s failed\n", argv[2]);
00120               return TCL_ERROR;
00121             }
00122       return TCL_OK;
00123         }
00124     }
00125   else if (argc == 3)
00126     {
00127       if (strcasecmp (argv[1], "tracetarget") == 0)
00128         {
00129           TclObject *obj;
00130       if ((obj = TclObject::lookup (argv[2])) == 0)
00131             {
00132               fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1],
00133                        argv[2]);
00134               return TCL_ERROR;
00135             }
00136           tracetarget_ = (Trace *) obj;
00137           return TCL_OK;
00138         }
00139       else if (strcasecmp (argv[1], "addr") == 0) {
00140         int temp;
00141         temp = Address::instance().str2addr(argv[2]);
00142         myaddr_ = temp;
00143         return TCL_OK;
00144       }
00145       else if (strcasecmp (argv[1], "attach-tag-dbase") == 0)
00146         {
00147           TclObject *obj;
00148       if ((obj = TclObject::lookup (argv[2])) == 0)
00149             {
00150               fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1],
00151                        argv[2]);
00152               return TCL_ERROR;
00153             }
00154           tag_dbase_ = (tags_database *) obj;
00155           return TCL_OK;
00156         }
00157       else if (strcasecmp (argv[1], "node") == 0)
00158         {
00159           assert(node_ == NULL);
00160           TclObject *obj;
00161       if ((obj = TclObject::lookup (argv[2])) == 0)
00162             {
00163               fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1],
00164                        argv[2]);
00165               return TCL_ERROR;
00166             }
00167           node_ = (MobileNode *) obj;
00168           return TCL_OK;
00169         }
00170     }
00171   
00172   return (Agent::command (argc, argv));
00173 }

Here is the call graph for this function:

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

Definition at line 389 of file agent.cc.

Referenced by Agent::command().

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

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

Definition at line 101 of file agent.h.

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

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

00101 { return dst_.addr_; }

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

Definition at line 102 of file object.cc.

References NsObject::debug_.

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

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

Reimplemented from NsObject.

Reimplemented in BayFullTcpAgent, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

Definition at line 93 of file agent.cc.

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

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

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

Here is the call graph for this function:

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

Reimplemented from NsObject.

Reimplemented in BayFullTcpAgent, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

Definition at line 78 of file agent.cc.

References NsObject::delay_bind_init_all().

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

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

Here is the call graph for this function:

void Agent::deleteAgentTrace  )  [protected, inherited]
 

Definition at line 222 of file agent.cc.

References ns_addr_t::addr_, Agent::dst_, Agent::flushAVar(), Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_.

Referenced by Agent::command().

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

Here is the call graph for this function:

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

Definition at line 102 of file agent.h.

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

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

00102 { return dst_.port_; }

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

Definition at line 114 of file connector.cc.

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

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

Here is the call graph for this function:

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

Reimplemented in XCPQueue.

Definition at line 106 of file connector.cc.

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

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

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

Here is the call graph for this function:

void Agent::dumpTracedVars  )  [protected, inherited]
 

nsaddr_t FloodAgent::get_next_hop nsaddr_t  src,
int  obj_name,
int  origin_time
[protected]
 

Definition at line 485 of file flood-agent.cc.

References QueryList::last_hop_id_, QueryList::next_, NO_NEXT_HOP, QueryList::obj_name_, QueryList::origin_time_, query_list_, and QueryList::src_.

00486 {
00487  QueryList *ql;
00488 
00489  ql = query_list_;
00490 
00491  while(ql) {
00492    if(ql->src_ == src && ql->obj_name_ == obj_name && ql->origin_time_ == origin_time) {
00493      return(ql->last_hop_id_);
00494    }
00495    ql = ql->next_;
00496  }
00497  
00498  return(NO_NEXT_HOP);
00499 }

packet_t Agent::get_pkttype  )  [inline, inherited]
 

Definition at line 104 of file agent.h.

References Agent::type_.

00104 { return type_; }

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

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

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

Here is the call graph for this function:

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

Definition at line 363 of file agent.cc.

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

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

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

Here is the call graph for this function:

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

Definition at line 456 of file agent.cc.

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

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

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

Here is the call graph for this function:

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

Definition at line 250 of file agent.cc.

References min, OldValue::next_, Agent::oldValueList_, TRACEVAR_MAXVALUELENGTH, OldValue::val_, and OldValue::var_.

Referenced by Agent::trace().

00251 {
00252     OldValue *p = new OldValue;
00253     assert(p != NULL);
00254     strncpy(p->val_, value, min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00255     p->var_ = v;
00256     p->next_ = NULL;
00257     if (oldValueList_ == NULL) 
00258         oldValueList_ = p;
00259     else {
00260         p->next_ = oldValueList_;
00261         oldValueList_ = p;
00262     }
00263 }

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

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

void Agent::listen  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent.

Definition at line 381 of file agent.cc.

Referenced by Agent::command().

00382 {
00383 }

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

Definition at line 242 of file agent.cc.

References OldValue::next_, Agent::oldValueList_, and OldValue::var_.

Referenced by Agent::trace().

00243 {
00244     OldValue *p = oldValueList_;
00245     while ((p != NULL) && (p->var_ != v))
00246         p = p->next_;
00247     return p;
00248 }

void Agent::monitorAgentTrace  )  [protected, inherited]
 

Definition at line 310 of file agent.cc.

References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_.

Referenced by Agent::command().

00311 {
00312     char wrk[256];
00313     int n;
00314     double curTime = (&Scheduler::instance() == NULL ? 0 : 
00315               Scheduler::instance().clock());
00316     
00317     sprintf(wrk, "v -t "TIME_FORMAT" -e monitor_agent %d %s",
00318         curTime, here_.addr_, traceName_);
00319     n = strlen(wrk);
00320     wrk[n] = '\n';
00321     wrk[n+1] = 0;
00322     if (channel_)
00323         (void)Tcl_Write(channel_, wrk, n+1);
00324 }

Here is the call graph for this function:

void FloodAgent::periodic_callback Event e,
int  level
[protected]
 

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

Definition at line 100 of file agent.h.

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

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

00100 { return here_.port_; }

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

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

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

Here is the call graph for this function:

void FloodAgent::recv Packet p,
Handler
[protected, virtual]
 

Reimplemented from Agent.

Definition at line 210 of file flood-agent.cc.

References Packet::accessdata(), Scheduler::clock(), FALSE, HDR_CMN, HDR_IP, Scheduler::instance(), myaddr_, QUERY_PKT, hdr_ip::saddr(), hdr_cmn::size_, and hdr_ip::sport().

00211 {
00212   hdr_ip *iph = HDR_IP(p);
00213   hdr_cmn *cmh = HDR_CMN(p);
00214   unsigned char *walk, *X_ptr, *Y_ptr;
00215   compr_taglist *tag_ptr;
00216   int found = FALSE, action, X, Y, obj_name, origin_time, next_hop_level;
00217   int cached = FALSE, cache_index = -1;
00218   int num_src_hops;
00219   double local_x, local_y, local_z;
00220   nsaddr_t last_hop_id;
00221   Scheduler &s = Scheduler::instance();
00222   double now = s.clock();
00223 
00224   walk = p->accessdata();
00225 
00226   // Type of advertisement
00227   action = *walk++;
00228 
00229   X_ptr = walk;
00230   X = *walk++;
00231   X = (X << 8) | *walk++;
00232 
00233   Y_ptr = walk;
00234   Y = *walk++;
00235   Y = (Y << 8) | *walk++;
00236 
00237   // Used in LM
00238   next_hop_level = *walk++;
00239 
00240   obj_name = *walk++;
00241   obj_name = (obj_name << 8) | *walk++;
00242   obj_name = (obj_name << 8) | *walk++;
00243   obj_name = (obj_name << 8) | *walk++;
00244 
00245     // origin time of advertisement
00246   origin_time = *walk++;
00247   origin_time = (origin_time << 8) | *walk++;
00248   origin_time = (origin_time << 8) | *walk++;
00249   origin_time = (origin_time << 8) | *walk++;
00250 
00251   num_src_hops = *walk++;
00252   num_src_hops = (num_src_hops << 8) | *walk++;
00253 
00254   // Query from an agent at our node
00255   if(iph->saddr() == myaddr_ && iph->sport() == 0 && action == QUERY_PKT) {
00256     // Increase the number of source hops to 1
00257     // Add IP header length
00258     cmh->size_ += 20;
00259   }
00260   else {
00261     ++num_src_hops;
00262     walk = walk - 2;
00263     (*walk++) = (num_src_hops >> 8) & 0xFF;
00264     (*walk++) = (num_src_hops) & 0XFF;
00265   }
00266     
00267   if(num_src_hops) {
00268     last_hop_id = *walk++;
00269     last_hop_id = (last_hop_id << 8) | *walk++;
00270   }
00271   else {
00272     last_hop_id = myaddr_;
00273     walk = walk + 2;
00274   }
00275 
00276   if(action == QUERY_PKT) {
00277     walk = walk - 2;
00278     *walk++ = (myaddr_ >> 8) & 0xFF;
00279     *walk++ = myaddr_ & 0xFF;
00280   }
00281 
00282   // Packet will be send down the stack
00283   cmh->direction() = hdr_cmn::DOWN;
00284 
00285 
00286   // Query pkt if X and Y are 65000
00287   if(X == 65000 && Y == 65000) {
00288 
00289     // Method returns 1 if query seen before. Otherwise returns 0
00290     // and adds query info to the list
00291     int query_type = search_queries_list(iph->saddr(),obj_name,origin_time,num_src_hops,last_hop_id);
00292     if(query_type == OLD_QRY_ENTRY) {
00293       Packet::free(p);
00294       return;
00295     }
00296 
00297     // Check if info is in cache if caching is enabled
00298     if(cache_) {
00299             // If this is a query pkt; check if we have the relevant information 
00300       // cached. TTL = 600 seconds for the cache entries
00301       cached = FALSE;
00302       for(int i = 0; i < num_cached_items_; ++i) {
00303         if(tag_cache_[i].obj_name_ == obj_name && tag_cache_[i].origin_time_ > origin_time - 600) {
00304           cached = TRUE;
00305           cache_index = i;
00306           break;
00307         }
00308       }
00309     }
00310 
00311 
00312     // check if our node has the requested information
00313     tag_ptr = tag_list_;
00314     while(tag_ptr) {
00315       if(tag_ptr->obj_name_ == obj_name) {
00316     found = TRUE;
00317     break;
00318       }
00319       tag_ptr = tag_ptr->next_;
00320     }
00321     
00322     if(query_type == OLD_SHORTER_ENTRY && found) {
00323       trace("Node %d: Query received along shorter path",myaddr_);
00324       Packet::free(p);
00325       return;
00326     }
00327     
00328     if(found || cached) {
00329       // generate response
00330       //      trace("Node %d: Generating response",myaddr_);
00331       if(cached) {
00332           (*X_ptr++) = ((int)tag_cache_[cache_index].X_ >> 8) & 0xFF;
00333           (*X_ptr) = ((int)tag_cache_[cache_index].X_) & 0xFF;
00334           (*Y_ptr++) = ((int)tag_cache_[cache_index].Y_ >> 8) & 0xFF;
00335           (*Y_ptr) = ((int)tag_cache_[cache_index].Y_) & 0xFF;
00336       }
00337       else {
00338     node_->getLoc(&local_x, &local_y, &local_z);
00339     (*X_ptr++) = ((int)local_x >> 8) & 0xFF;
00340     (*X_ptr) = ((int)local_x) & 0xFF;
00341     (*Y_ptr++) = ((int)local_y >> 8) & 0xFF;
00342     (*Y_ptr) = ((int)local_y) & 0xFF;
00343       }
00344 
00345       iph->ttl_ = 1000;
00346       iph->daddr() = iph->saddr();
00347       iph->dport() = QUERY_PORT;
00348       cmh->next_hop() = last_hop_id;
00349       cmh->addr_type_ = NS_AF_INET;
00350       // Add 50 bytes to response 
00351       cmh->size() += 50;
00352 
00353       if(last_hop_id == myaddr_) {
00354     // TEMPORARY HACK! Cant forward from routing agent to some other
00355     // agent on our node!
00356     Packet::free(p);
00357     trace("FloodAgent Found object %d.%d.%d at (%d,%d) at time %f", (obj_name >> 24) & 0xFF, (obj_name >> 16) & 0xFF, obj_name & 0xFFFF,X,Y,now);
00358     return;
00359       }
00360 
00361       s.schedule(target_,p,0);
00362     }
00363     else {
00364       // flood pkt 
00365       //      trace("Node %d: Flooding packet; query type %d",myaddr_,query_type);
00366       if(--iph->ttl_ == 0) {
00367     drop(p, DROP_RTR_TTL);
00368     return;
00369       }
00370 
00371       cmh->next_hop_ = IP_BROADCAST; // need to broadcast packet
00372       cmh->addr_type_ = NS_AF_INET;
00373       iph->daddr() = IP_BROADCAST;  // packet needs to be broadcast
00374       iph->dport() = ROUTER_PORT;
00375 
00376       s.schedule(target_,p,0);
00377     }
00378   }
00379   else {
00380     // Forward response
00381     //    trace("Node %d: Forwarding response",myaddr_);
00382     if(--iph->ttl_ == 0) {
00383       drop(p, DROP_RTR_TTL);
00384       return;
00385     }
00386     
00387     if(cache_) {
00388       if(num_cached_items_ < MAX_CACHE_ITEMS) {
00389     
00390     int replace_index = num_cached_items_;
00391     // If object already exists in cache, update info if necessary
00392     for(int i = 0; i < num_cached_items_; ++i) {
00393       if(tag_cache_[i].obj_name_ == obj_name && tag_cache_[i].origin_time_ < origin_time) {
00394         replace_index = i;
00395         break;
00396       }
00397     }
00398     
00399     tag_cache_[replace_index].obj_name_ = obj_name;
00400     tag_cache_[replace_index].origin_time_ = origin_time;
00401     tag_cache_[replace_index].X_ = X;
00402     tag_cache_[replace_index].Y_ = Y;
00403     ++num_cached_items_;
00404       }
00405       else {
00406     // Use LRU cache replacement
00407     int replace_index = 0;
00408     int least_time = tag_cache_[replace_index].origin_time_;
00409     for(int i = 0; i < MAX_CACHE_ITEMS; ++i) {
00410       if(tag_cache_[i].origin_time_ < least_time)
00411         replace_index = i;
00412     }
00413     tag_cache_[replace_index].obj_name_ = obj_name;
00414     tag_cache_[replace_index].origin_time_ = origin_time;
00415     tag_cache_[replace_index].X_ = X;
00416     tag_cache_[replace_index].Y_ = Y;
00417       }
00418     }
00419     
00420     cmh->next_hop_ = get_next_hop(iph->saddr(),obj_name,origin_time);
00421     assert(cmh->next_hop_ != NO_NEXT_HOP);
00422     s.schedule(target_,p,0);
00423   }
00424 }

Here is the call graph for this function:

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

Definition at line 354 of file agent.cc.

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

Referenced by TcpAsymSink::recv().

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

Here is the call graph for this function:

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

Reimplemented from NsObject.

Definition at line 78 of file agent.h.

00078 {};

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

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

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

int FloodAgent::search_queries_list nsaddr_t  src,
int  obj_name,
int  origin_time,
int  num_hops,
nsaddr_t  last_hop_id
[protected]
 

Definition at line 430 of file flood-agent.cc.

References QueryList::last_hop_id_, NEW_QRY_ENTRY, QueryList::next_, QueryList::num_hops_, QueryList::obj_name_, OLD_QRY_ENTRY, OLD_SHORTER_ENTRY, QueryList::origin_time_, query_list_, and QueryList::src_.

00431 {
00432   QueryList *ql, *newql = NULL, *replql = NULL;
00433 
00434   ql = query_list_;
00435 
00436   while(ql) {
00437     if(ql->src_ == src && ql->obj_name_ == obj_name && ql->origin_time_ == origin_time) {
00438       if(ql->num_hops_ > num_hops) {
00439     ql->num_hops_ = num_hops;
00440     ql->last_hop_id_ = last_hop_id;
00441       return(OLD_SHORTER_ENTRY);
00442       }
00443       return(OLD_QRY_ENTRY);
00444     }
00445     // Replace very old entries
00446     if(ql->origin_time_ + 100 < origin_time && !replql)
00447       replql = ql;
00448     else if(!replql)
00449       newql = ql;
00450     ql = ql->next_;
00451   }    
00452 
00453   if(!query_list_) {
00454     query_list_ = new QueryList;
00455     query_list_->src_ = src;
00456     query_list_->obj_name_ = obj_name;
00457     query_list_->origin_time_ = origin_time;
00458     query_list_->num_hops_ = num_hops;
00459     query_list_->last_hop_id_ = last_hop_id;
00460     return(NEW_QRY_ENTRY);
00461   }
00462 
00463   if(replql) {
00464     replql->src_ = src;
00465     replql->obj_name_ = obj_name;
00466     replql->origin_time_ = origin_time;
00467     replql->num_hops_ = num_hops;
00468     replql->last_hop_id_ = last_hop_id;
00469   }
00470   else {
00471     newql->next_ = new QueryList;
00472     newql = newql->next_;
00473     newql->src_ = src;
00474     newql->obj_name_ = obj_name;
00475     newql->origin_time_ = origin_time;
00476     newql->num_hops_ = num_hops;
00477     newql->last_hop_id_ = last_hop_id;
00478   }
00479   return(NEW_QRY_ENTRY);
00480 }

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

Reimplemented in SRMAgent.

Definition at line 91 of file agent.h.

References Agent::sendmsg().

00091 { sendmsg(nbytes); }

Here is the call graph for this function:

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

Reimplemented in HttpInvalAgent.

Definition at line 84 of file agent.h.

References Agent::sendmsg().

00084 { sendmsg(sz, data, 0); }

Here is the call graph for this function:

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

Reimplemented from Connector.

Definition at line 80 of file agent.h.

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

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

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

Here is the call graph for this function:

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

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

Definition at line 407 of file agent.cc.

00408 {
00409 }

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

Reimplemented in UdpAgent, and MessagePassingAgent.

Definition at line 400 of file agent.cc.

References abort().

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

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

Here is the call graph for this function:

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

Reimplemented in MessagePassingAgent.

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

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

Reimplemented in MessagePassingAgent.

Definition at line 420 of file agent.cc.

00422 {
00423 }

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

Definition at line 411 of file agent.cc.

References abort().

Referenced by Agent::command(), AnWormApp::probe(), and DnhWormApp::send_probe().

00413 {
00414     fprintf(stderr, 
00415     "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00416     abort();
00417 }

Here is the call graph for this function:

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

Definition at line 103 of file agent.h.

References Agent::type_.

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

00103 { type_ = pkttype; }

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

Definition at line 51 of file connector.h.

References Connector::drop_.

Referenced by XCPWrapQ::command().

00051 {drop_ = dt; } 

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

Reimplemented in FullTcpAgent.

Definition at line 98 of file agent.h.

References Agent::size_.

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

00098 { return size_; }

void FloodAgent::startUp  )  [protected]
 

Definition at line 180 of file flood-agent.cc.

References MobileNode::getLoc(), tags_database::Gettags(), myaddr_, compr_taglist::next_, node_, compr_taglist::obj_name_, tag_dbase_, tag_list_, and trace().

Referenced by command().

00181 {
00182   compr_taglist *local_tags0, *t_ptr;
00183   int ntags = 0;
00184   double x,y,z;
00185 
00186   node_->getLoc(&x,&y,&z);
00187   //  printf("Node %d position: (%f,%f,%f)\n",myaddr_,x,y,z);
00188 
00189   // Detection range smaller than transmission range. This is because, if 
00190   // the tags are passive, they may not have sufficient energy to re-radiate
00191   // information to the sensor
00192   double r = 60;
00193 
00194   local_tags0 = tag_dbase_->Gettags(x,y,r);
00195   trace("Node %d's at (%f,%f,%f) senses tags:",myaddr_,x,y,z);
00196   t_ptr = local_tags0;
00197   ntags = 0;
00198   while(t_ptr) {
00199     trace("tag name: %d.%d.%d",(t_ptr->obj_name_ >> 24) & 0xFF,(t_ptr->obj_name_ >> 16) & 0xFF,(t_ptr->obj_name_) & 0xFFFF);
00200     ++ntags;
00201     t_ptr = t_ptr->next_;
00202   }
00203   trace("Number of tags: %d",ntags);
00204 
00205   tag_list_ = local_tags0;
00206 
00207 }

Here is the call graph for this function:

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

Definition at line 49 of file connector.h.

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

00049 { target_ = target; }

Here is the call graph for this function:

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

Definition at line 48 of file connector.h.

References Connector::target_.

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

00048 { return target_; }

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

Reimplemented in SA_Agent, RTPAgent, FtpClientAgent, BayFullTcpAgent, SinkAgent, RLM_Sender, MIPBSAgent, MIPMHAgent, RapAgent, RTCPAgent, TcpAsymSink, FackTcpAgent, FullTcpAgent, QSNewRenoTcpAgent, RBPVegasTcpAgent, RBPRenoTcpAgent, SackRHTcpAgent, Sack1TcpAgent, TcpSessionAgent, DelAckSink, TcpAgent, RenoTcpAgent, VegasTcpAgent, and SimpleTcpAgent.

Definition at line 347 of file agent.cc.

Referenced by SimpleTimer::expire().

00348 {
00349 }

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

Reimplemented in SctpAgent, and TcpAgent.

Definition at line 266 of file agent.cc.

References ns_addr_t::addr_, Agent::channel_, Agent::dst_, Agent::here_, Agent::insertOldValue(), Scheduler::instance(), Agent::lookupOldValue(), min, TIME_FORMAT, Agent::traceName_, TRACEVAR_MAXVALUELENGTH, and OldValue::val_.

Referenced by TcpAgent::trace().

00267 {
00268     if (channel_ == 0)
00269         return;
00270     char wrk[256], value[128];
00271     int n;
00272 
00273     // XXX we need to keep track of old values. What's the best way?
00274     v->value(value, 128);
00275 
00276     // XXX hack: how do I know ns has not started yet?
00277     // if there's nothing in value, return
00278     static int started = 0;
00279     if (!started) {
00280         Tcl::instance().evalc("[Simulator instance] is-started");
00281         if (Tcl::instance().result()[0] == '0')
00282             // Simulator not started, do nothing
00283             return;
00284         // remember for next time (so we don't always have to call to tcl)
00285         started = 1;
00286     };
00287 
00288     OldValue *ov = lookupOldValue(v);
00289     if (ov != NULL) {
00290         sprintf(wrk, 
00291             "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -o %s -T v",
00292             Scheduler::instance().clock(), here_.addr_,
00293             dst_.addr_, v->name(), traceName_, value, ov->val_);
00294         strncpy(ov->val_, 
00295             value,
00296             min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00297     } else {
00298         // if there is value, insert it into old value list
00299         sprintf(wrk, "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -T v",
00300             Scheduler::instance().clock(), here_.addr_,
00301             dst_.addr_, v->name(), traceName_, value);
00302         insertOldValue(v, value);
00303     }
00304     n = strlen(wrk);
00305     wrk[n] = '\n';
00306     wrk[n+1] = 0;
00307     (void)Tcl_Write(channel_, wrk, n+1);
00308 }

Here is the call graph for this function:

void FloodAgent::trace char *  fmt,
  ...
[protected]
 

Definition at line 54 of file flood-agent.cc.

References tracetarget_.

Referenced by startUp().

00055 {
00056   va_list ap; // Define a variable ap that will refer to each argument in turn
00057 
00058   if (!tracetarget_)
00059     return;
00060 
00061   // Initializes ap to first argument
00062   va_start (ap, fmt); 
00063   // Prints the elements in turn
00064   vsprintf (tracetarget_->buffer (), fmt, ap); 
00065   tracetarget_->dump ();
00066   // Does the necessary clean-up before returning
00067   va_end (ap); 
00068 }

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

Reimplemented in TcpAgent.

Definition at line 149 of file agent.h.

00149 {}


Field Documentation

Application* Agent::app_ [protected, inherited]
 

Reimplemented in BayFullTcpAgent.

Definition at line 137 of file agent.h.

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

int FloodAgent::cache_ [protected]
 

Definition at line 82 of file flood-agent.h.

Referenced by command(), and FloodAgent().

Tcl_Channel Agent::channel_ [protected, inherited]
 

Definition at line 133 of file agent.h.

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

int FloodAgent::debug_ [protected]
 

Reimplemented from NsObject.

Definition at line 79 of file flood-agent.h.

int Agent::defttl_ [protected, inherited]
 

Definition at line 124 of file agent.h.

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

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 59 of file connector.h.

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

ns_addr_t Agent::dst_ [protected, inherited]
 

Reimplemented in AckRecons.

Definition at line 118 of file agent.h.

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

EventTrace* Agent::et_ [protected, inherited]
 

Definition at line 148 of file agent.h.

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

int Agent::fid_ [protected, inherited]
 

Definition at line 121 of file agent.h.

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

int Agent::flags_ [protected, inherited]
 

Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent.

Definition at line 123 of file agent.h.

Referenced by Agent::delay_bind_dispatch().

ns_addr_t Agent::here_ [protected, inherited]
 

Definition at line 117 of file agent.h.

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

PriQueue* FloodAgent::ll_queue [protected]
 

Definition at line 55 of file flood-agent.h.

Referenced by command().

int FloodAgent::myaddr_ [protected]
 

Definition at line 49 of file flood-agent.h.

Referenced by command(), recv(), and startUp().

MobileNode* FloodAgent::node_ [protected]
 

Definition at line 76 of file flood-agent.h.

Referenced by command(), FloodAgent(), and startUp().

int FloodAgent::num_cached_items_ [protected]
 

Definition at line 84 of file flood-agent.h.

Referenced by FloodAgent().

OldValue* Agent::oldValueList_ [protected, inherited]
 

Definition at line 135 of file agent.h.

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

int Agent::prio_ [protected, inherited]
 

Definition at line 122 of file agent.h.

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

QueryList* FloodAgent::query_list_ [protected]
 

Definition at line 70 of file flood-agent.h.

Referenced by FloodAgent(), get_next_hop(), and search_queries_list().

int FloodAgent::seqno_ [protected]
 

Definition at line 48 of file flood-agent.h.

int Agent::size_ [protected, inherited]
 

Reimplemented in SA_Agent, and AckRecons.

Definition at line 119 of file agent.h.

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

TagCache* FloodAgent::tag_cache_ [protected]
 

Definition at line 83 of file flood-agent.h.

Referenced by FloodAgent().

tags_database* FloodAgent::tag_dbase_ [protected]
 

Definition at line 64 of file flood-agent.h.

Referenced by command(), and startUp().

compr_taglist* FloodAgent::tag_list_ [protected]
 

Definition at line 66 of file flood-agent.h.

Referenced by FloodAgent(), and startUp().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 58 of file connector.h.

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

char* Agent::traceName_ [protected, inherited]
 

Definition at line 134 of file agent.h.

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

Trace* FloodAgent::tracetarget_ [protected]
 

Definition at line 61 of file flood-agent.h.

Referenced by command(), and trace().

packet_t Agent::type_ [protected, inherited]
 

Definition at line 120 of file agent.h.

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

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

Definition at line 131 of file agent.h.

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


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