#include <flooding.h>
Inheritance diagram for FloodingAgent:


Public Member Functions | |
| FloodingAgent () | |
| int | command (int argc, const char *const *argv) |
| void | recv (Packet *, Handler *) |
| virtual void | recv (Packet *p, const char *s) |
| void | recvOnly (Packet *) |
| void | send (Packet *p, Handler *h) |
| virtual void | send (int sz, AppData *data) |
| virtual void | send (int nbytes) |
| virtual void | timeout (int tno) |
| virtual void | sendmsg (int sz, AppData *, const char *flags=0) |
| virtual void | sendmsg (int nbytes, const char *flags=0) |
| virtual void | sendto (int sz, AppData *, const char *flags, nsaddr_t dst) |
| virtual void | sendto (int nbytes, const char *flags, nsaddr_t dst) |
| virtual void | connect (nsaddr_t dst) |
| virtual void | close () |
| virtual void | listen () |
| virtual void | attachApp (Application *app) |
| virtual int & | size () |
| nsaddr_t & | addr () |
| nsaddr_t & | port () |
| nsaddr_t & | daddr () |
| nsaddr_t & | dport () |
| void | set_pkttype (packet_t pkttype) |
| packet_t | get_pkttype () |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Public Attributes | |
| Flooding_Entry | routing_table [MAX_DATA_TYPE] |
Protected Member Functions | |
| void | send_to_dmux (Packet *pkt, Handler *h) |
| void | Terminate () |
| void | reset () |
| void | ConsiderNew (Packet *pkt) |
| Packet * | create_packet () |
| Packet * | prepare_message (unsigned int dtype, ns_addr_t to_addr, int msg_type) |
| void | DataForSink (Packet *pkt) |
| void | StopSource () |
| void | MACprepare (Packet *pkt) |
| void | MACsend (Packet *pkt, Time delay=0) |
| void | trace (char *fmt,...) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | recvBytes (int bytes) |
| virtual void | idle () |
| Packet * | allocpkt () const |
| Packet * | allocpkt (int) const |
| void | initpkt (Packet *) const |
| virtual void | trace (TracedVar *v) |
| void | deleteAgentTrace () |
| void | addAgentTrace (const char *name) |
| void | monitorAgentTrace () |
| OldValue * | lookupOldValue (TracedVar *v) |
| void | insertOldValue (TracedVar *v, const char *value) |
| void | dumpTracedVars () |
| virtual void | trace_event (char *eventtype) |
| virtual void | drop (Packet *p, const char *s) |
| void | handle (Event *) |
Protected Attributes | |
| int | pk_count |
| Pkt_Hash_Table | PktTable |
| Node * | node |
| Trace * | tracetarget |
| NsObject * | ll |
| NsObject * | port_dmux |
| ns_addr_t | here_ |
| ns_addr_t | dst_ |
| int | size_ |
| packet_t | type_ |
| int | fid_ |
| int | prio_ |
| int | flags_ |
| int | defttl_ |
| Tcl_Channel | channel_ |
| char * | traceName_ |
| OldValue * | oldValueList_ |
| Application * | app_ |
| EventTrace * | et_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Static Protected Attributes | |
| int | uidcnt_ |
|
|
Definition at line 72 of file flooding.cc. References node, pk_count, PT_DIFF, Connector::target_, and tracetarget.
00072 : Agent(PT_DIFF) 00073 { 00074 // Initialize variables. 00075 00076 pk_count = 0; 00077 target_ = 0; 00078 node = NULL; 00079 tracetarget = NULL; 00080 } |
|
|
Definition at line 326 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::dst_, Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_. Referenced by Agent::command().
00327 {
00328 char wrk[256];
00329 int n;
00330 double curTime = (&Scheduler::instance() == NULL ? 0 :
00331 Scheduler::instance().clock());
00332
00333 sprintf(wrk, "a -t "TIME_FORMAT" -s %d -d %d -n %s",
00334 curTime, here_.addr_, dst_.addr_, name);
00335 n = strlen(wrk);
00336 wrk[n] = '\n';
00337 wrk[n+1] = 0;
00338 if (channel_)
00339 (void)Tcl_Write(channel_, wrk, n+1);
00340 // keep agent trace name
00341 if (traceName_ != NULL)
00342 delete[] traceName_;
00343 traceName_ = new char[strlen(name)+1];
00344 strcpy(traceName_, name);
00345 }
|
Here is the call graph for this function:

|
|
|
Definition at line 517 of file agent.cc. References Packet::allocdata(), and Agent::allocpkt().
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Definition at line 372 of file agent.cc. References Agent::app_. Referenced by HttpMInvalCache::command(), Application::command(), TcpApp::TcpApp(), and TcpApp::~TcpApp().
00373 {
00374 app_ = app;
00375 }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 377 of file agent.cc. Referenced by Agent::command().
00378 {
00379 }
|
|
||||||||||||
|
Reimplemented from Agent. Definition at line 344 of file flooding.cc. References Agent::command(), node, port_dmux, reset(), StopSource(), Terminate(), THIS_NODE, and tracetarget.
00345 {
00346 Tcl& tcl = Tcl::instance();
00347
00348 if (argc == 2) {
00349
00350 if (strcasecmp(argv[1], "reset-state")==0) {
00351
00352 reset();
00353 return TCL_OK;
00354 }
00355
00356 if (strcasecmp(argv[1], "reset")==0) {
00357
00358 return Agent::command(argc, argv);
00359 }
00360
00361 if (strcasecmp(argv[1], "start")==0) {
00362 return TCL_OK;
00363 }
00364
00365 if (strcasecmp(argv[1], "stop")==0) {
00366 return TCL_OK;
00367 }
00368
00369 if (strcasecmp(argv[1], "terminate")==0) {
00370 Terminate();
00371 return TCL_OK;
00372 }
00373
00374 if (strcasecmp(argv[1], "stop-source")==0) {
00375 StopSource();
00376 return TCL_OK;
00377 }
00378
00379 } else if (argc == 3) {
00380
00381 if (strcasecmp(argv[1], "on-node")==0) {
00382 node = (Node *)tcl.lookup(argv[2]);
00383 return TCL_OK;
00384 }
00385
00386 if (strcasecmp(argv[1], "add-ll") == 0) {
00387
00388 TclObject *obj;
00389
00390 if ( (obj = TclObject::lookup(argv[2])) == 0) {
00391 fprintf(stderr, "Flooding Node: %d lookup of %s failed\n", THIS_NODE,
00392 argv[2]);
00393 return TCL_ERROR;
00394 }
00395 ll = (NsObject *) obj;
00396
00397 return TCL_OK;
00398 }
00399
00400 if (strcasecmp (argv[1], "tracetarget") == 0) {
00401 TclObject *obj;
00402 if ((obj = TclObject::lookup (argv[2])) == 0) {
00403 fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1],
00404 argv[2]);
00405 return TCL_ERROR;
00406 }
00407
00408 tracetarget = (Trace *) obj;
00409 return TCL_OK;
00410 }
00411
00412 if (strcasecmp(argv[1], "port-dmux") == 0) {
00413
00414 TclObject *obj;
00415
00416 if ( (obj = TclObject::lookup(argv[2])) == 0) {
00417 fprintf(stderr, "Flooding Node: %d lookup of %s failed\n", THIS_NODE,
00418 argv[2]);
00419 return TCL_ERROR;
00420 }
00421 port_dmux = (NsObject *) obj;
00422 return TCL_OK;
00423 }
00424
00425 }
00426
00427 return Agent::command(argc, argv);
00428 }
|
Here is the call graph for this function:

|
|
Definition at line 389 of file agent.cc. Referenced by Agent::command().
00390 {
00391 /*
00392 dst_ = dst;
00393 */
00394 }
|
|
|
Definition at line 108 of file flooding.cc. References God::AddSink(), God::AddSource(), AGT_ADDR, PrvCurPtr::cur, DATA, DATA_READY, DATA_REQUEST, hdr_cdiff::data_type, DataForSink(), hdr_cdiff::forward_agent_id, Packet::free(), Pkt_Hash_Table::GetHash(), HDR_CDIFF, God::instance(), INTEREST, INTF_FIND, INTF_INSERT, JITTER, MACprepare(), MACsend(), hdr_cdiff::mess_type, Agent_List::next, nsaddr_t, ORIGINAL, hdr_cdiff::pk_num, PktTable, prepare_message(), hdr_cdiff::report_rate, routing_table, send_to_dmux(), hdr_cdiff::sender_id, Flooding_Entry::source, THIS_NODE, and Random::uniform(). Referenced by recv().
00109 {
00110 hdr_cdiff* dfh = HDR_CDIFF(pkt);
00111 unsigned char msg_type = dfh->mess_type;
00112 unsigned int dtype = dfh->data_type;
00113
00114 Pkt_Hash_Entry *hashPtr;
00115 Agent_List *agentPtr;
00116 PrvCurPtr RetVal;
00117 nsaddr_t from_nodeID, forward_nodeID;
00118
00119 Packet *gen_pkt;
00120 hdr_cdiff *gen_dfh;
00121
00122 switch (msg_type) {
00123 case INTEREST :
00124
00125 hashPtr = PktTable.GetHash(dfh->sender_id, dfh->pk_num);
00126
00127 // Check if it comes from sink agent of this node
00128 // If so we have to keep it in sink list
00129
00130 from_nodeID = (dfh->sender_id).addr_;
00131 forward_nodeID = (dfh->forward_agent_id).addr_;
00132
00133
00134 if (THIS_NODE == from_nodeID) {
00135
00136 // It's from a sink on this node.
00137 // Is it already in list ?
00138
00139 RetVal = INTF_FIND(routing_table[dtype].sink, dfh->sender_id);
00140 if (RetVal.cur == NULL) {
00141 // No, it's not.
00142 agentPtr = new Agent_List;
00143 AGT_ADDR(agentPtr) = dfh->sender_id;
00144 INTF_INSERT(routing_table[dtype].sink, agentPtr);
00145
00146 God::instance()->AddSink(dtype, THIS_NODE);
00147 }
00148 }
00149
00150 Packet::free(pkt);
00151 return;
00152
00153
00154 case DATA_READY :
00155
00156 // put source_agent in source list of routing table
00157
00158 agentPtr = new Agent_List;
00159 AGT_ADDR(agentPtr) = dfh->sender_id;
00160 agentPtr->next = routing_table[dtype].source;
00161 routing_table[dtype].source = agentPtr;
00162
00163 God::instance()->AddSource(dtype, (dfh->sender_id).addr_);
00164
00165 gen_pkt = prepare_message(dtype, dfh->sender_id, DATA_REQUEST);
00166 gen_dfh = HDR_CDIFF(gen_pkt);
00167 gen_dfh->report_rate = ORIGINAL;
00168 send_to_dmux(gen_pkt, 0);
00169 Packet::free(pkt);
00170 return;
00171
00172
00173 case DATA :
00174
00175 DataForSink(pkt);
00176
00177 MACprepare(pkt);
00178 MACsend(pkt, JITTER*Random::uniform(1.0));
00179 return;
00180
00181
00182 default :
00183
00184 Packet::free(pkt);
00185 break;
00186 }
00187 }
|
Here is the call graph for this function:

|
|
Definition at line 222 of file flooding.cc. References Agent::allocpkt(), HDR_CDIFF, HDR_CMN, NOW, hdr_cmn::size(), and hdr_cdiff::ts_. Referenced by prepare_message().
|
Here is the call graph for this function:

|
|
|
Definition at line 302 of file flooding.cc. References AGENT_NEXT, AGT_ADDR, Packet::copy(), hdr_cdiff::data_type, hdr_ip::dst_, hdr_cdiff::forward_agent_id, HDR_CDIFF, HDR_IP, Agent::here_, hdr_cdiff::next_nodes, NODE_ADDR, hdr_cdiff::num_next, routing_table, and send_to_dmux(). Referenced by ConsiderNew().
00303 {
00304 hdr_cdiff *dfh = HDR_CDIFF(pkt);
00305 unsigned int dtype = dfh->data_type;
00306 Agent_List *cur_agent;
00307 Packet *cur_pkt;
00308 hdr_cdiff *cur_dfh;
00309 hdr_ip *cur_iph;
00310
00311
00312 for (cur_agent= (routing_table[dtype]).sink; cur_agent != NULL;
00313 cur_agent= AGENT_NEXT(cur_agent) ) {
00314
00315 cur_pkt = pkt->copy();
00316 cur_iph = HDR_IP(cur_pkt);
00317 cur_iph->dst_ = AGT_ADDR(cur_agent);
00318
00319 cur_dfh = HDR_CDIFF(cur_pkt);
00320 cur_dfh->forward_agent_id = here_;
00321 cur_dfh->num_next = 1;
00322 cur_dfh->next_nodes[0] = NODE_ADDR(cur_agent);
00323
00324 send_to_dmux(cur_pkt, 0);
00325 }
00326 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 102 of file object.cc. References NsObject::debug_.
00103 {
00104 if (!debug_)
00105 return;
00106 va_list ap;
00107 va_start(ap, fmt);
00108 vprintf(fmt, ap);
00109 }
|
|
||||||||||||||||
|
Reimplemented from NsObject. Reimplemented in BayFullTcpAgent, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 93 of file agent.cc. References ns_addr_t::addr_, Agent::defttl_, NsObject::delay_bind_dispatch(), Agent::dst_, Agent::fid_, Agent::flags_, Agent::here_, ns_addr_t::port_, and Agent::prio_. Referenced by TcpAgent::delay_bind_dispatch(), TcpSink::delay_bind_dispatch(), and LDPAgent::delay_bind_dispatch().
00094 {
00095 if (delay_bind(varName, localName, "agent_addr_", (int*)&(here_.addr_), tracer)) return TCL_OK;
00096 if (delay_bind(varName, localName, "agent_port_", (int*)&(here_.port_), tracer)) return TCL_OK;
00097 if (delay_bind(varName, localName, "dst_addr_", (int*)&(dst_.addr_), tracer)) return TCL_OK;
00098 if (delay_bind(varName, localName, "dst_port_", (int*)&(dst_.port_), tracer)) return TCL_OK;
00099 if (delay_bind(varName, localName, "fid_", (int*)&fid_, tracer)) return TCL_OK;
00100 if (delay_bind(varName, localName, "prio_", (int*)&prio_, tracer)) return TCL_OK;
00101 if (delay_bind(varName, localName, "flags_", (int*)&flags_, tracer)) return TCL_OK;
00102 if (delay_bind(varName, localName, "ttl_", &defttl_, tracer)) return TCL_OK;
00103 if (delay_bind(varName, localName, "class_", (int*)&fid_, tracer)) return TCL_OK;
00104 return Connector::delay_bind_dispatch(varName, localName, tracer);
00105 }
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Reimplemented in BayFullTcpAgent, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 78 of file agent.cc. References NsObject::delay_bind_init_all(). Referenced by TcpAgent::delay_bind_init_all(), TcpSink::delay_bind_init_all(), and LDPAgent::delay_bind_init_all().
00079 {
00080 delay_bind_init_one("agent_addr_");
00081 delay_bind_init_one("agent_port_");
00082 delay_bind_init_one("dst_addr_");
00083 delay_bind_init_one("dst_port_");
00084 delay_bind_init_one("fid_");
00085 delay_bind_init_one("prio_");
00086 delay_bind_init_one("flags_");
00087 delay_bind_init_one("ttl_");
00088 delay_bind_init_one("class_");
00089 Connector::delay_bind_init_all();
00090 }
|
Here is the call graph for this function:

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

|
|
Definition at line 99 of file agent.h. References Agent::dst_, nsaddr_t, and ns_addr_t::port_. Referenced by DSDV_Agent::lost_link(), TcpAsymSink::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), rtProtoDV::sendpkt(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().
|
|
||||||||||||
|
Definition at line 114 of file connector.cc. References Connector::drop_, Packet::free(), and NsObject::recv().
00115 {
00116 if (drop_ != 0)
00117 drop_->recv(p, s);
00118 else
00119 Packet::free(p);
00120 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
|
|
|
Definition at line 101 of file agent.h. References packet_t, and Agent::type_. Referenced by CBR_Traffic::init().
00101 { return type_; }
|
|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
|
Here is the call graph for this function:

|
|
Definition at line 363 of file agent.cc. References Agent::app_, and Application::resume(). Referenced by FullTcpAgent::foutput(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), BayFullTcpAgent::output(), UdpAgent::sendmsg(), SA_Agent::sendmsg(), and RTPAgent::sendmsg().
|
Here is the call graph for this function:

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

|
||||||||||||
|
Definition at line 250 of file agent.cc. References min, OldValue::next_, Agent::oldValueList_, TRACEVAR_MAXVALUELENGTH, OldValue::val_, and OldValue::var_. Referenced by Agent::trace().
00251 {
00252 OldValue *p = new OldValue;
00253 assert(p != NULL);
00254 strncpy(p->val_, value, min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00255 p->var_ = v;
00256 p->next_ = NULL;
00257 if (oldValueList_ == NULL)
00258 oldValueList_ = p;
00259 else {
00260 p->next_ = oldValueList_;
00261 oldValueList_ = p;
00262 }
00263 }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent. Definition at line 381 of file agent.cc. Referenced by Agent::command().
00382 {
00383 }
|
|
|
Definition at line 242 of file agent.cc. References OldValue::next_, Agent::oldValueList_, and OldValue::var_. Referenced by Agent::trace().
00243 {
00244 OldValue *p = oldValueList_;
00245 while ((p != NULL) && (p->var_ != v))
00246 p = p->next_;
00247 return p;
00248 }
|
|
|
Definition at line 266 of file flooding.cc. References ns_addr_t::addr_, hdr_cmn::addr_type(), hdr_cmn::direction(), hdr_cmn::DOWN, hdr_ip::dst_, hdr_cdiff::forward_agent_id, HDR_CDIFF, HDR_CMN, HDR_IP, Agent::here_, MAC_BROADCAST, hdr_cmn::next_hop(), hdr_cdiff::next_nodes, NS_AF_ILINK, hdr_cdiff::num_next, ns_addr_t::port_, ROUTING_PORT, hdr_ip::src_, and hdr_cmn::xmit_failure_. Referenced by ConsiderNew().
00267 {
00268 hdr_cdiff* dfh = HDR_CDIFF(pkt);
00269 hdr_cmn* cmh = HDR_CMN(pkt);
00270 hdr_ip* iph = HDR_IP(pkt);
00271
00272 dfh->forward_agent_id = here_;
00273
00274 cmh->xmit_failure_ = 0;
00275 cmh->next_hop() = MAC_BROADCAST;
00276 cmh->addr_type() = NS_AF_ILINK;
00277 cmh->direction() = hdr_cmn::DOWN;
00278
00279 iph->src_ = here_;
00280 iph->dst_.addr_ = MAC_BROADCAST;
00281 iph->dst_.port_ = ROUTING_PORT;
00282
00283 dfh->num_next = 1;
00284 dfh->next_nodes[0] = MAC_BROADCAST;
00285 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 288 of file flooding.cc. References DATA, God::data_pkt_size, HDR_CDIFF, HDR_CMN, Scheduler::instance(), God::instance(), hdr_cdiff::mess_type, hdr_cdiff::num_next, Scheduler::schedule(), and hdr_cmn::size(). Referenced by ConsiderNew().
00289 {
00290 hdr_cmn* cmh = HDR_CMN(pkt);
00291 hdr_cdiff* dfh = HDR_CDIFF(pkt);
00292
00293 if (dfh->mess_type == DATA)
00294 cmh->size() = (God::instance()->data_pkt_size) + 4*(dfh->num_next - 1);
00295 else
00296 cmh->size() = 36 + 4*(dfh->num_next -1);
00297
00298 Scheduler::instance().schedule(ll, pkt, delay);
00299 }
|
Here is the call graph for this function:

|
|
Definition at line 310 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Scheduler::clock(), Agent::here_, Scheduler::instance(), TIME_FORMAT, and Agent::traceName_. Referenced by Agent::command().
00311 {
00312 char wrk[256];
00313 int n;
00314 double curTime = (&Scheduler::instance() == NULL ? 0 :
00315 Scheduler::instance().clock());
00316
00317 sprintf(wrk, "v -t "TIME_FORMAT" -e monitor_agent %d %s",
00318 curTime, here_.addr_, traceName_);
00319 n = strlen(wrk);
00320 wrk[n] = '\n';
00321 wrk[n+1] = 0;
00322 if (channel_)
00323 (void)Tcl_Write(channel_, wrk, n+1);
00324 }
|
Here is the call graph for this function:

|
|
Definition at line 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().
|
|
||||||||||||||||
|
Definition at line 237 of file flooding.cc. References ns_addr_t::addr_, create_packet(), hdr_cdiff::data_type, hdr_ip::dst_, hdr_cdiff::forward_agent_id, HDR_CDIFF, HDR_IP, Agent::here_, hdr_cdiff::mess_type, hdr_cdiff::next_nodes, NOW, hdr_cdiff::num_next, pk_count, hdr_cdiff::pk_num, hdr_cdiff::sender_id, hdr_ip::src_, and hdr_cdiff::ts_. Referenced by ConsiderNew().
00239 {
00240 Packet *pkt;
00241 hdr_cdiff *dfh;
00242 hdr_ip *iph;
00243
00244 pkt = create_packet();
00245 dfh = HDR_CDIFF(pkt);
00246 iph = HDR_IP(pkt);
00247
00248 dfh->mess_type = msg_type;
00249 dfh->pk_num = pk_count;
00250 pk_count++;
00251 dfh->sender_id = here_;
00252 dfh->data_type = dtype;
00253 dfh->forward_agent_id = here_;
00254
00255 dfh->ts_ = NOW;
00256 dfh->num_next = 1;
00257 dfh->next_nodes[0] = to_addr.addr_;
00258
00259 iph->src_ = here_;
00260 iph->dst_ = to_addr;
00261
00262 return pkt;
00263 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free().
00097 {
00098 Packet::free(p);
00099 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Agent. Definition at line 83 of file flooding.cc. References ConsiderNew(), Packet::free(), Pkt_Hash_Table::GetHash(), HDR_CDIFF, hdr_cdiff::pk_num, PktTable, Pkt_Hash_Table::put_in_hash(), and hdr_cdiff::sender_id.
00084 {
00085 hdr_cdiff* dfh = HDR_CDIFF(packet);
00086
00087 // Packet Hash Table is used to keep info about experienced pkts.
00088
00089 Pkt_Hash_Entry *hashPtr= PktTable.GetHash(dfh->sender_id, dfh->pk_num);
00090
00091 // Received this packet before ?
00092
00093 if (hashPtr != NULL) {
00094 Packet::free(packet);
00095 return;
00096 }
00097
00098 // Never receive it before ? Put in hash table.
00099
00100 PktTable.put_in_hash(dfh);
00101
00102 // Take action for a new pkt.
00103
00104 ConsiderNew(packet);
00105 }
|
Here is the call graph for this function:

|
|
Definition at line 354 of file agent.cc. References Agent::app_, and Application::recv(). Referenced by DelAckSink::recv(), TcpSink::recv(), QSTcpSink::recv(), FullTcpAgent::recv(), and TcpAsymSink::recv().
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Definition at line 78 of file agent.h.
00078 {};
|
|
|
Reimplemented from NsObject. Definition at line 190 of file flooding.cc. References MAX_DATA_TYPE, PktTable, Flooding_Entry::reset(), Pkt_Hash_Table::reset(), and routing_table. Referenced by command().
00191 {
00192 PktTable.reset();
00193
00194 for (int i=0; i<MAX_DATA_TYPE; i++) {
00195 routing_table[i].reset();
00196 }
00197 }
|
Here is the call graph for this function:

|
|
Reimplemented in SRMAgent. Definition at line 89 of file agent.h. References Agent::sendmsg().
00089 { sendmsg(nbytes); }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in HttpInvalAgent. Definition at line 84 of file agent.h. References Agent::sendmsg().
00084 { sendmsg(sz, data, 0); }
|
Here is the call graph for this function:

|
||||||||||||
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 106 of file flooding.h. References port_dmux, and NsObject::recv(). Referenced by ConsiderNew(), and DataForSink().
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in SA_Agent, RTPAgent, UdpAgent, LmsSender, SRMAgent, FullTcpAgent, TcpAgent, TfrcAgent, and SimpleTcpAgent. Definition at line 415 of file agent.cc.
00416 {
00417 }
|
|
||||||||||||||||
|
Reimplemented in UdpAgent. Definition at line 400 of file agent.cc. References abort(). Referenced by Agent::command(), Application::send(), Agent::send(), TrafficTrace::timeout(), TelnetApp::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout().
00401 {
00402 fprintf(stderr,
00403 "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00404 abort();
00405 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 407 of file agent.cc. References abort(). Referenced by Agent::command().
00409 {
00410 fprintf(stderr,
00411 "Agent::sendmsg(int, AppData*, const char*) not implemented\n");
00412 abort();
00413 }
|
Here is the call graph for this function:

|
|
Definition at line 100 of file agent.h. References Agent::type_. Referenced by Agent::command(), HttpUInvalClass::create(), RA_Traffic::init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), and CBR_PP_Traffic::init().
00100 { type_ = pkttype; }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 95 of file agent.h. References Agent::size_. Referenced by rtProtoDV::command(), RLM_Sender::command(), imepAgent::getResponseListSize(), LandmarkAgent::makeUpdate(), Agent::recv(), SSMSRMAgent::send_glb_sess(), SSMSRMAgent::send_loc_sess(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), and TelnetApp::timeout().
00095 { return size_; }
|
|
|
Definition at line 210 of file flooding.cc. References AGENT_NEXT, AGT_ADDR, DATA_STOP, MAX_DATA_TYPE, routing_table, SEND_MESSAGE, and Flooding_Entry::source. Referenced by command().
00211 {
00212 Agent_List *cur;
00213
00214 for (int i=0; i<MAX_DATA_TYPE; i++) {
00215 for (cur=routing_table[i].source; cur!=NULL; cur=AGENT_NEXT(cur) ) {
00216 SEND_MESSAGE(i, AGT_ADDR(cur), DATA_STOP);
00217 }
00218 }
00219 }
|
|
|
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_; }
|
|
|
Definition at line 200 of file flooding.cc. References EnergyModel::energy(), Node::energy_model(), EnergyModel::initialenergy(), node, and THIS_NODE. Referenced by command().
00201 {
00202 #ifdef DEBUG_OUTPUT
00203 printf("node %d: remaining energy %f, initial energy %f\n", THIS_NODE,
00204 node->energy_model()->energy(),
00205 node->energy_model()->initialenergy() );
00206 #endif
00207 }
|
Here is the call graph for this function:

|
|
Reimplemented in SA_Agent, RTPAgent, FtpClientAgent, BayFullTcpAgent, SinkAgent, RLM_Sender, MIPBSAgent, MIPMHAgent, RapAgent, RTCPAgent, TcpAsymSink, FackTcpAgent, FullTcpAgent, QSNewRenoTcpAgent, RBPVegasTcpAgent, RBPRenoTcpAgent, SackRHTcpAgent, Sack1TcpAgent, TcpSessionAgent, DelAckSink, TcpAgent, RenoTcpAgent, VegasTcpAgent, and SimpleTcpAgent. Definition at line 347 of file agent.cc. Referenced by SimpleTimer::expire().
00348 {
00349 }
|
|
|
Reimplemented in TcpAgent. Definition at line 266 of file agent.cc. References ns_addr_t::addr_, Agent::channel_, Agent::dst_, Agent::here_, Agent::insertOldValue(), Scheduler::instance(), Agent::lookupOldValue(), min, TIME_FORMAT, Agent::traceName_, TRACEVAR_MAXVALUELENGTH, and OldValue::val_. Referenced by TcpAgent::trace().
00267 {
00268 if (channel_ == 0)
00269 return;
00270 char wrk[256], value[128];
00271 int n;
00272
00273 // XXX we need to keep track of old values. What's the best way?
00274 v->value(value, 128);
00275
00276 // XXX hack: how do I know ns has not started yet?
00277 // if there's nothing in value, return
00278 static int started = 0;
00279 if (!started) {
00280 Tcl::instance().evalc("[Simulator instance] is-started");
00281 if (Tcl::instance().result()[0] == '0')
00282 // Simulator not started, do nothing
00283 return;
00284 // remember for next time (so we don't always have to call to tcl)
00285 started = 1;
00286 };
00287
00288 OldValue *ov = lookupOldValue(v);
00289 if (ov != NULL) {
00290 sprintf(wrk,
00291 "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -o %s -T v",
00292 Scheduler::instance().clock(), here_.addr_,
00293 dst_.addr_, v->name(), traceName_, value, ov->val_);
00294 strncpy(ov->val_,
00295 value,
00296 min(strlen(value)+1, TRACEVAR_MAXVALUELENGTH));
00297 } else {
00298 // if there is value, insert it into old value list
00299 sprintf(wrk, "f -t "TIME_FORMAT" -s %d -d %d -n %s -a %s -v %s -T v",
00300 Scheduler::instance().clock(), here_.addr_,
00301 dst_.addr_, v->name(), traceName_, value);
00302 insertOldValue(v, value);
00303 }
00304 n = strlen(wrk);
00305 wrk[n] = '\n';
00306 wrk[n+1] = 0;
00307 (void)Tcl_Write(channel_, wrk, n+1);
00308 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 329 of file flooding.cc. References BaseTrace::buffer(), BaseTrace::dump(), Trace::pt_, and tracetarget.
00330 {
00331 va_list ap;
00332
00333 if (!tracetarget)
00334 return;
00335
00336 va_start (ap, fmt);
00337 vsprintf (tracetarget->pt_->buffer(), fmt, ap);
00338 tracetarget->pt_->dump ();
00339 va_end (ap);
00340 }
|
Here is the call graph for this function:

|
|
Reimplemented in TcpAgent. Definition at line 146 of file agent.h.
00146 {}
|
|
|
Reimplemented in BayFullTcpAgent. Definition at line 134 of file agent.h. Referenced by Agent::attachApp(), Agent::idle(), RapAgent::IpgTimeout(), UdpAgent::recv(), SimpleTcpAgent::recv(), RapAgent::recv(), HttpInvalAgent::recv(), Agent::recv(), and Agent::recvBytes(). |
|
|
Definition at line 130 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::flushAVar(), Agent::monitorAgentTrace(), TcpAsymSink::recv(), Agent::trace(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar(). |
|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset(). |
|
|
Definition at line 121 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Reimplemented in AckRecons. Definition at line 115 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::daddr(), Agent::delay_bind_dispatch(), Agent::deleteAgentTrace(), Agent::dport(), DSRProto::DSRProto(), Agent::flushAVar(), Agent::initpkt(), SRMAgent::recv(), SSMSRMAgent::recv(), NatAgent::recv(), SRMAgent::sendmsg(), PushbackAgent::sendMsg(), and Agent::trace(). |
|
|
Definition at line 145 of file agent.h. Referenced by TcpAgent::command(), and TcpAgent::trace_event(). |
|
|
Definition at line 118 of file agent.h. Referenced by Agent::delay_bind_dispatch(), AbsTcpAgent::flowid(), Agent::initpkt(), FullTcpAgent::recv(), CtrMcastEncap::recv(), AbsTcpAgent::send_batch(), Sack1TcpAgent::timeout(), and TcpAgent::trace_event(). |
|
|
Reimplemented in BayFullTcpAgent, RapAgent, and FullTcpAgent. Definition at line 120 of file agent.h. Referenced by Agent::delay_bind_dispatch(). |
|
|
|
Definition at line 103 of file flooding.h. |
|
|
Definition at line 101 of file flooding.h. Referenced by command(), FloodingAgent(), and Terminate(). |
|
|
Definition at line 132 of file agent.h. Referenced by Agent::insertOldValue(), Agent::lookupOldValue(), and Agent::~Agent(). |
|
|
Definition at line 98 of file flooding.h. Referenced by FloodingAgent(), and prepare_message(). |
|
|
Definition at line 99 of file flooding.h. Referenced by ConsiderNew(), recv(), and reset(). |
|
|
Definition at line 104 of file flooding.h. Referenced by command(), and send_to_dmux(). |
|
|
Definition at line 119 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 95 of file flooding.h. Referenced by ConsiderNew(), DataForSink(), reset(), and StopSource(). |
|
|
|
|
Definition at line 131 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::deleteAgentTrace(), Agent::flushAVar(), Agent::monitorAgentTrace(), and Agent::trace(). |
|
|
Definition at line 102 of file flooding.h. Referenced by command(), FloodingAgent(), and trace(). |
|
|
Definition at line 117 of file agent.h. Referenced by Agent::get_pkttype(), Agent::initpkt(), FullTcpAgent::listen(), BayFullTcpAgent::listen(), RapAgent::SendAck(), SRMAgent::sendmsg(), RapAgent::SendPacket(), and Agent::set_pkttype(). |
|
|
Definition at line 68 of file agent.cc. Referenced by imepAgent::handlerControlTimer(), imepAgent::handlerReXmitTimer(), Agent::initpkt(), imepAgent::sendAck(), imepAgent::sendBeacon(), toraAgent::sendCLR(), imepAgent::sendHello(), toraAgent::sendQRY(), DSRAgent::sendUnknownFlow(), toraAgent::sendUPD(), and DSRAgent::xmitFailed(). |
1.3.3