#include <srm-ssm.h>
Inheritance diagram for SSMSRMAgent:


Public Member Functions | |
| SSMSRMAgent () | |
| int | command (int argc, const char *const *argv) |
| void | recv (Packet *p, Handler *h) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | sendmsg (int nbytes, const char *flags=0) |
| virtual void | sendmsg (int sz, AppData *, const char *flags=0) |
| virtual void | send (int nbytes) |
| void | send (Packet *p, Handler *h) |
| virtual void | send (int sz, AppData *data) |
| void | recvOnly (Packet *) |
| virtual void | timeout (int tno) |
| virtual void | sendto (int sz, AppData *, const char *flags, nsaddr_t dst) |
| virtual void | sendto (int nbytes, const char *flags, nsaddr_t dst) |
| virtual void | connect (nsaddr_t dst) |
| virtual void | close () |
| virtual void | listen () |
| virtual void | attachApp (Application *app) |
| virtual int & | size () |
| nsaddr_t & | addr () |
| nsaddr_t & | port () |
| nsaddr_t & | daddr () |
| nsaddr_t & | dport () |
| void | set_pkttype (packet_t pkttype) |
| packet_t | get_pkttype () |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| virtual void | start () |
| SRMinfo * | get_state (int sender) |
| virtual void | cleanup () |
| virtual void | addExtendedHeaders (Packet *) |
| virtual void | parseExtendedHeaders (Packet *) |
| virtual int | request (SRMinfo *sp, int hi) |
| virtual void | recv_data (int sender, int msgid, u_char *data) |
| virtual void | recv_repr (int round, int sender, int msgid, u_char *data) |
| virtual void | recv_rqst (int requestr, int round, int sender, int msgid) |
| virtual void | recv_sess (Packet *, int sessCtr, int *data) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | recvBytes (int bytes) |
| virtual void | idle () |
| Packet * | allocpkt () const |
| Packet * | allocpkt (int) const |
| void | initpkt (Packet *) const |
| virtual void | trace (TracedVar *v) |
| void | deleteAgentTrace () |
| void | addAgentTrace (const char *name) |
| void | monitorAgentTrace () |
| OldValue * | lookupOldValue (TracedVar *v) |
| void | insertOldValue (TracedVar *v, const char *value) |
| void | dumpTracedVars () |
| virtual void | trace_event (char *eventtype) |
| virtual void | drop (Packet *p, const char *s) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| int | dataCtr_ |
| int | sessCtr_ |
| int | packetSize_ |
| SRMinfo * | sip_ |
| Tcl_HashTable * | siphash_ |
| int | groupSize_ |
| int | seqno_ |
| int | app_fid_ |
| packet_t | app_type_ |
| 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_ |
Private Member Functions | |
| void | recv_data (int sender, int id, int repid, u_char *data) |
| void | recv_rqst (int requestor, int round, int sender, int repid, int msgid) |
| void | recv_sess (int sessCtr, int *data, Packet *p) |
| void | recv_glb_sess (int sessCtr, int *data, Packet *p) |
| void | recv_loc_sess (int sessCtr, int *data, Packet *p) |
| void | recv_rep_sess (int sessCtr, int *data, Packet *p) |
| void | send_ctrl (int type, int round, int sender, int msgid, int size) |
| void | send_sess () |
| void | send_glb_sess () |
| void | send_loc_sess () |
| void | send_rep_sess () |
| void | timeout_info () |
| int | is_active (SRMinfo *sp) |
Private Attributes | |
| int | glb_sessCtr_ |
| int | loc_sessCtr_ |
| int | rep_sessCtr_ |
| int | scopeFlag_ |
| int | groupScope_ |
| int | localScope_ |
| int | senderFlag_ |
| int | repid_ |
|
|
Definition at line 68 of file srm-ssm.cc. References groupScope_, localScope_, repid_, and scopeFlag_.
00069 : SRMAgent(), glb_sessCtr_(-1), loc_sessCtr_(-1), rep_sessCtr_(-1) 00070 { 00071 bind("group_scope_",&groupScope_); 00072 bind("local_scope_",&localScope_); 00073 bind("scope_flag_",&scopeFlag_); 00074 bind("rep_id_", &repid_); 00075 } |
|
|
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:

|
|
Reimplemented in ASRMAgent. Definition at line 91 of file srm.h. Referenced by ASRMAgent::addExtendedHeaders(), SRMAgent::recv(), SRMAgent::send_ctrl(), SRMAgent::send_sess(), and SRMAgent::sendmsg().
00091 {}
|
|
|
|
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 }
|
|
|
Definition at line 87 of file srm.h. References SRMAgent::siphash_. Referenced by SRMAgent::~SRMAgent().
00087 {
00088 Tcl_DeleteHashTable(siphash_);
00089 }
|
|
|
Reimplemented in FullTcpAgent. Definition at line 377 of file agent.cc. Referenced by Agent::command().
00378 {
00379 }
|
|
||||||||||||
|
Reimplemented from SRMAgent. Definition at line 77 of file srm-ssm.cc. References Agent::addr(), SRMAgent::command(), SRMinfo::distance_, SRMAgent::get_state(), groupScope_, SRMAgent::packetSize_, REP_DISTANCE, repid_, SRMinfo::repid_, rsp, SRMinfo::scopeFlag_, scopeFlag_, SELF_DISTANCE, send_ctrl(), send_sess(), SRMinfo::sender_, senderFlag_, SRMAgent::sip_, sp, SRM_GLOBAL, SRM_LOCAL, SRM_REPR, and SRM_RQST.
00078 {
00079 Tcl& tcl = Tcl::instance();
00080
00081 if (strcmp(argv[1], "send") == 0) {
00082 if (strcmp(argv[2], "session") == 0) {
00083 send_sess();
00084 return TCL_OK;
00085 }
00086 if (strcmp(argv[2], "request") == 0) {
00087 int round = atoi(argv[3]);
00088 int sender = atoi(argv[4]);
00089 int msgid = atoi(argv[5]);
00090 send_ctrl(SRM_RQST, round, sender, msgid, 0);
00091 return TCL_OK;
00092 }
00093 if (strcmp(argv[2], "repair") == 0) {
00094 int round = atoi(argv[3]);
00095 int sender = atoi(argv[4]);
00096 int msgid = atoi(argv[5]);
00097 send_ctrl(SRM_REPR, round, sender, msgid, packetSize_);
00098 return TCL_OK;
00099 }
00100 tcl.resultf("%s: invalid send request %s", name_, argv[2]);
00101 return TCL_ERROR;
00102 /*
00103 #if 0
00104 fprintf(stdout,"%s: send request %s passed to srm_agent",
00105 name_, argv[2]);
00106 #endif
00107 return SRMAgent::command(argc, argv);
00108 */
00109 }
00110
00111 if (argc == 2) {
00112 if (strcmp(argv[1], "start") == 0) {
00113 sip_->sender_ = addr();
00114 sip_->distance_ = 0.0;
00115 /* sip_->repid_ = addr_;
00116 sip_->scopeFlag_ = SRM_GLOBAL;
00117 repid_ = addr_;
00118 scopeFlag_ = SRM_GLOBAL;
00119 */
00120 groupScope_ = 32;
00121 senderFlag_ = 0;
00122 printf("%s is %d and rep-status %d\n", name_, addr(), scopeFlag_);
00123 return TCL_OK;
00124 }
00125 if (strcmp(argv[1], "ch-rep") == 0) {
00126 if(scopeFlag_ == SRM_GLOBAL) {
00127 sip_->repid_ = repid_ = addr();
00128 sip_->scopeFlag_ = SRM_GLOBAL;
00129 } else {
00130 sip_->repid_ = repid_;
00131 sip_->scopeFlag_ = SRM_LOCAL;
00132 }
00133 return TCL_OK;
00134 }
00135 if (strcmp(argv[1], "distances?") == 0) {
00136 if (sip_->sender_ < 0) { // i.e. this agent is not
00137 tcl.result(""); // yet active.
00138 return TCL_OK;
00139 }
00140 for (SRMinfo* sp = sip_; sp; sp = sp->next_) {
00141 if((sp->distanceFlag_ == REP_DISTANCE) ||
00142 (sp->distanceFlag_ == SELF_DISTANCE)) {
00143
00144 tcl.resultf("%s %d %f", tcl.result(),
00145 sp->sender_, sp->distance_);
00146 } else { /* Return reps distance */
00147 SRMinfo* rsp = get_state(sp->repid_);
00148 tcl.resultf("%s %d %f", tcl.result(),
00149 sp->sender_, rsp->distance_);
00150 }
00151 }
00152 return TCL_OK;
00153 }
00154
00155 }
00156 if (argc == 3) {
00157 if (strcmp(argv[1], "distance?") == 0) {
00158 int sender = atoi(argv[2]);
00159 SRMinfo* sp = get_state(sender);
00160 if((sp->distanceFlag_ == REP_DISTANCE) ||
00161 (sp->distanceFlag_ == SELF_DISTANCE)) {
00162 tcl.resultf("%f", sp->distance_);
00163 } else { /* Return reps distance */
00164 SRMinfo* rsp = get_state(sp->repid_);
00165 tcl.resultf("%f", rsp->distance_);
00166 }
00167 return TCL_OK;
00168 }
00169 }
00170 return SRMAgent::command(argc, argv);
00171 }
|
Here is the call graph for this function:

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

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

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

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

|
Here is the call graph for this function:

|
|
|
|
|
Definition at line 101 of file agent.h. References packet_t, and Agent::type_. Referenced by CBR_Traffic::init().
00101 { return type_; }
|
|
|
Definition at line 71 of file srm.h. References SRMAgent::groupSize_, SRMinfo::next_, SRMAgent::sip_, and SRMAgent::siphash_. Referenced by ASRMAgent::addExtendedHeaders(), SRMAgent::command(), command(), SRMAgent::recv_data(), recv_data(), recv_glb_sess(), recv_loc_sess(), recv_rep_sess(), SRMAgent::recv_repr(), SRMAgent::recv_rqst(), recv_rqst(), and SRMAgent::recv_sess().
00071 {
00072 assert(siphash_);
00073
00074 int new_entry = 0;
00075 Tcl_HashEntry* he = Tcl_CreateHashEntry(siphash_,
00076 (char*) sender,
00077 &new_entry);
00078 if (new_entry) {
00079 groupSize_++;
00080 SRMinfo* tmp = new SRMinfo(sender);
00081 tmp->next_ = sip_->next_;
00082 sip_->next_ = tmp;
00083 Tcl_SetHashValue(he, (ClientData*)tmp);
00084 }
00085 return (SRMinfo*)Tcl_GetHashValue(he);
00086 }
|
|
|
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 736 of file srm-ssm.cc. References Agent::addr(), Scheduler::clock(), Scheduler::instance(), sessionDelay, and sp. Referenced by recv_rep_sess(), send_glb_sess(), and send_loc_sess().
00737 {
00738 int now;
00739 now = (int) (Scheduler::instance().clock() * 1000);
00740 if ((sp->sender_ != addr()) && ((now - sp->recvTime_) >= 3*sessionDelay)) {
00741 return 0;
00742 } else {
00743 return 1;
00744 }
00745 }
|
Here is the call graph for this function:

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

|
|
Reimplemented in ASRMAgent. Definition at line 92 of file srm.h. Referenced by ASRMAgent::parseExtendedHeaders(), and SRMAgent::recv().
00092 {}
|
|
|
Definition at line 97 of file agent.h. References Agent::here_, nsaddr_t, and ns_addr_t::port_. Referenced by LmsAgent::pkt2agent(), TcpAsymSink::recv(), MIPBSAgent::recv(), LmsAgent::recv(), HttpInvalAgent::recv(), CtrMcastEncap::recv(), IntTcpAgent::rxmit_last(), IntTcpAgent::send_one(), LmsReceiver::send_refresh(), IcmpAgent::sendredirect(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), and TcpAsymAgent::traceVar().
|
|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free().
00097 {
00098 Packet::free(p);
00099 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from SRMAgent. Definition at line 173 of file srm-ssm.cc. References hdr_srm_ext::access(), hdr_srm::access(), hdr_ip::access(), Packet::accessdata(), Agent::addr(), hdr_ip::daddr(), SRMAgent::dataCtr_, hdr_ip::dst(), Agent::dst_, Packet::free(), Agent::here_, Scheduler::instance(), NsObject::recv(), recv_data(), SRMAgent::recv_repr(), recv_rqst(), recv_sess(), hdr_srm_ext::repid(), repid_, hdr_ip::saddr(), sh, hdr_ip::src(), SRM_DATA, SRM_REPR, SRM_RQST, SRM_SESS, and Connector::target_.
00174 {
00175 hdr_ip* ih = hdr_ip::access(p);
00176 hdr_srm* sh = hdr_srm::access(p);
00177 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00178
00179 if (ih->daddr() == 0) {
00180 // Packet from local agent. Add srm headers, set dst, and fwd
00181 sh->type() = SRM_DATA;
00182 sh->sender() = addr();
00183 sh->seqnum() = ++dataCtr_;
00184 seh->repid() = repid_;
00185 ih->dst() = dst_;
00186 ih->src() = here_;
00187 target_->recv(p, h);
00188 } else {
00189
00190 #if 0
00191 static char *foo[] = {"NONE", "DATA", "SESS", "RQST", "REPR"};
00192 fprintf(stdout, "%7.4f %s %d recvd SRM_%s <%d, %d> from %d\n",
00193 Scheduler::instance().clock(), name_, addr_, foo[sh->type()],
00194 sh->sender(), sh->seqnum(), ih->src());
00195 fflush(stdout);
00196 #endif
00197
00198 switch (sh->type()) {
00199 case SRM_DATA:
00200 recv_data(sh->sender(), sh->seqnum(), seh->repid(), p->accessdata());
00201 Packet::free(p);
00202 break;
00203 case SRM_RQST:
00204 recv_rqst(ih->saddr(), sh->round(), sh->sender(), sh->seqnum(),
00205 seh->repid());
00206 Packet::free(p);
00207 break;
00208 case SRM_REPR:
00209 recv_repr(sh->round(), sh->sender(), sh->seqnum(), p->accessdata());
00210 Packet::free(p);
00211 break;
00212 case SRM_SESS:
00213 // This seqnum() is the session sequence number,
00214 // not the data packet sequence numbers seen before.
00215 // Send the whole pkt for ttl etc..
00216 recv_sess(sh->seqnum(), (int*) p->accessdata(), p);
00217 break;
00218 }
00219 }
00220 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 255 of file srm.cc. References SRMAgent::get_state(), SRMAgent::request(), and sp. Referenced by SRMAgent::recv(), and recv_data().
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 223 of file srm-ssm.cc. References SRMAgent::get_state(), SRMAgent::recv_data(), and sp. Referenced by recv().
00224 {
00225 SRMinfo* sp = get_state(sender);
00226 /* Just store the repid and call srmagent recv_data */
00227 sp->repid_ = repid;
00228 SRMAgent::recv_data(sender,id,data);
00229 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 475 of file srm-ssm.cc. References hdr_srm_ext::access(), hdr_ip::access(), Agent::addr(), Scheduler::clock(), GET_SESSION_INFO, SRMAgent::get_state(), Scheduler::instance(), hdr_srm_ext::ottl(), hdr_srm_ext::repid(), SELF_DISTANCE, sp, SRM_GLOBAL, and hdr_ip::ttl(). Referenced by recv_sess().
00476 {
00477 Tcl& tcl = Tcl::instance();
00478 SRMinfo* sp;
00479 int ttl;
00480
00481 hdr_ip* ih = hdr_ip::access(p);
00482 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00483 ttl = seh->ottl() - ih->ttl();
00484
00485 int sender, dataCnt, rtime, stime,repid;
00486 int now, sentAt, sentBy;
00487 int cnt = *data++;
00488 //int type = *data++;
00489 int i;
00490
00491 // data = data + SESS_CONST;
00492 /* As as included type of session message also */
00493 /* The first block contains the sender's own state */
00494 GET_SESSION_INFO;
00495 if (sender == addr())
00496 // sender's own session message
00497 return;
00498 if (seh->repid() != repid) {
00499 fprintf(stdout,"%f Recvd a glb-sess with diff header(%d) != inside(%d)\n",
00500 Scheduler::instance().clock(),seh->repid(),repid);
00501 /* abort(); */
00502 return;
00503 }
00504 if (sender != repid) {
00505 fprintf(stdout,"%f Recvd a glb-sess with repid(%d) != address(%d)\n",
00506 Scheduler::instance().clock(),repid,sender);
00507 /* abort(); */
00508 return;
00509 }
00510
00511 sp = get_state(sender);
00512 if (sp->lglbsess_ > sessCtr) // older session message recd.
00513 return;
00514 #if 0
00515 fprintf(stdout,"%s recv-gsess from %d\n",name_,sender);
00516 #endif
00517 tcl.evalf("%s recv-gsess %d %d", name_, sender, ttl);
00518
00519 if (sp->scopeFlag_ != SRM_GLOBAL) {
00520 sp->scopeFlag_ = SRM_GLOBAL;
00521 }
00522 sp->repid_ = repid;
00523
00524 now = (int) (Scheduler::instance().clock() * 1000);
00525 sentBy = sender; // to later compute rtt
00526 sentAt = stime;
00527
00528 sp->lglbsess_ = sessCtr;
00529 sp->recvTime_ = now;
00530 sp->sendTime_ = stime;
00531 for (i = sp->ldata_ + 1; i <= dataCnt; i++)
00532 if (! sp->ifReceived(i))
00533 tcl.evalf("%s request %d %d", name_, sender, i, sp->repid_);
00534 if (sp->ldata_ < dataCnt)
00535 sp->ldata_ = dataCnt;
00536
00537 for (i = 1; i < cnt; i++) {
00538 GET_SESSION_INFO;
00539 if (sender == addr() && now) {
00540 int rtt = (now - sentAt) + (rtime - stime);
00541 sp = get_state(sentBy);
00542 sp->distance_ = (double) rtt / 2 / 1000;
00543 sp->distanceFlag_ = SELF_DISTANCE;
00544 #if 0
00545 fprintf(stderr,
00546 "%7.4f %s compute distance to %d: %f\n",
00547 Scheduler::instance().clock(), name_,
00548 sentBy, sp->distance_);
00549 #endif
00550 continue;
00551 }
00552 sp = get_state(sender);
00553 for (int j = sp->ldata_ + 1; j <= dataCnt; j++)
00554 if (! sp->ifReceived(j))
00555 tcl.evalf("%s request %d %d", name_, sender, j, sp->repid_);
00556 if (sp->ldata_ < dataCnt)
00557 sp->ldata_ = dataCnt;
00558 }
00559 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 562 of file srm-ssm.cc. References hdr_srm_ext::access(), hdr_ip::access(), Agent::addr(), Scheduler::clock(), GET_SESSION_INFO, SRMAgent::get_state(), Scheduler::instance(), hdr_srm_ext::ottl(), SELF_DISTANCE, sp, SRM_LOCAL, and hdr_ip::ttl(). Referenced by recv_sess().
00563 {
00564 Tcl& tcl = Tcl::instance();
00565 SRMinfo* sp;
00566 int ttl;
00567
00568 hdr_ip* ih = hdr_ip::access(p);
00569 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00570 ttl = seh->ottl() - ih->ttl();
00571
00572 int sender, dataCnt, rtime, stime,repid;
00573 int now, sentAt, sentBy;
00574 int cnt = *data++;
00575 /*int type = * */data++;
00576 int i;
00577
00578 // data = data + SESS_CONST;
00579 /* As as included type of session message also */
00580
00581 /* The first block contains the sender's own state */
00582 GET_SESSION_INFO;
00583 if (sender == addr()) // sender's own session message
00584 return;
00585
00586 sp = get_state(sender);
00587 if (sp->llocsess_ > sessCtr) // older session message recd.
00588 return;
00589 if (sp->scopeFlag_ != SRM_LOCAL) {
00590 sp->scopeFlag_ = SRM_LOCAL;
00591 // Also put a check if this is my child
00592 }
00593 sp->repid_ = repid;
00594
00595 #if 0
00596 fprintf(stdout,"%s recv-lsess from %d\n",name_,sender);
00597 #endif
00598 tcl.evalf("%s recv-lsess %d %d %d", name_, sender, repid, ttl);
00599
00600 now = (int) (Scheduler::instance().clock() * 1000);
00601 sentBy = sender; // to later compute rtt
00602 sentAt = stime;
00603
00604 sp->llocsess_ = sessCtr;
00605 sp->recvTime_ = now;
00606 sp->sendTime_ = stime;
00607 for (i = sp->ldata_ + 1; i <= dataCnt; i++)
00608 if (! sp->ifReceived(i))
00609 tcl.evalf("%s request %d %d", name_, sender, i, sp->repid_);
00610 if (sp->ldata_ < dataCnt)
00611 sp->ldata_ = dataCnt;
00612
00613 for (i = 1; i < cnt; i++) {
00614 GET_SESSION_INFO;
00615 if (sender == addr() && now) {
00616 int rtt = (now - sentAt) + (rtime - stime);
00617 sp = get_state(sentBy);
00618 sp->distance_ = (double) rtt / 2 / 1000;
00619 sp->distanceFlag_ = SELF_DISTANCE;
00620 #if 0
00621 fprintf(stderr,
00622 "%7.4f %s compute distance to %d: %f\n",
00623 Scheduler::instance().clock(), name_,
00624 sentBy, sp->distance_);
00625 #endif
00626 continue;
00627 }
00628 sp = get_state(sender);
00629 for (int j = sp->ldata_ + 1; j <= dataCnt; j++)
00630 if (! sp->ifReceived(j))
00631 tcl.evalf("%s request %d %d", name_, sender, j, sp->repid_);
00632 if (sp->ldata_ < dataCnt)
00633 sp->ldata_ = dataCnt;
00634 }
00635 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 641 of file srm-ssm.cc. References abort(), Agent::addr(), Scheduler::clock(), GET_SESSION_INFO, SRMAgent::get_state(), Scheduler::instance(), is_active(), REP_DISTANCE, repid_, SELF_DISTANCE, sp, and SRM_GLOBAL. Referenced by recv_sess().
00642 {
00643 Tcl& tcl = Tcl::instance();
00644 SRMinfo* sp;
00645
00646 int sender, dataCnt, rtime, stime,repid;
00647 int now, sentAt, sentBy;
00648 int cnt = *data++;
00649 /*int type = **/data++;
00650 int i;
00651
00652 //data = data + SESS_CONST;
00653 /* As as included type of session message also */
00654
00655 /* The first block contains the sender's own state */
00656 GET_SESSION_INFO;
00657 if (sender == addr()) // sender's own session message
00658 return;
00659 if (sender != repid_) // not from my rep
00660 return;
00661 if (sender != repid) {
00662 fprintf(stdout,"Recvd a rep-sess with repid(%d) != address(%d)\n",
00663 repid,sender);
00664 abort();
00665 }
00666 sp = get_state(sender);
00667 if (sp->lrepsess_ > sessCtr) // older session message recd.
00668 return;
00669 if (sp->scopeFlag_ != SRM_GLOBAL) // Should I change the repid also??
00670 sp->scopeFlag_ = SRM_GLOBAL;
00671
00672 now = (int) (Scheduler::instance().clock() * 1000);
00673 sentBy = sender; // to later compute rtt
00674 sentAt = stime;
00675
00676 sp->lrepsess_ = sessCtr;
00677 sp->recvTime_ = now;
00678 sp->sendTime_ = stime;
00679 for (i = sp->ldata_ + 1; i <= dataCnt; i++)
00680 if (! sp->ifReceived(i))
00681 tcl.evalf("%s request %d %d", name_, sender, i, sp->repid_);
00682 if (sp->ldata_ < dataCnt)
00683 sp->ldata_ = dataCnt;
00684
00685 for (i = 1; i < cnt; i++) {
00686 GET_SESSION_INFO;
00687 if (sender == addr() && now) {
00688 int rtt = (now - sentAt) + (rtime - stime);
00689 sp = get_state(sentBy);
00690 sp->distance_ = (double) rtt / 2 / 1000;
00691 sp->distanceFlag_ = SELF_DISTANCE;
00692 #if 0
00693 fprintf(stderr,
00694 "%7.4f %s compute distance to %d: %f\n",
00695 Scheduler::instance().clock(), name_,
00696 sentBy, sp->distance_);
00697 #endif
00698 continue;
00699 }
00700 if ((sender == repid) && (sender != sentBy)) {
00701 sp = get_state(sender);
00702 if (!(is_active(sp) && (sp->distanceFlag_ == SELF_DISTANCE))) {
00703 sp->distance_ = (double) rtime/1000;
00704 /* As for global members this is distance */
00705 sp->distanceFlag_ = REP_DISTANCE;
00706 /* ?? What if I am hearing from this guy already */
00707 }
00708 }
00709 sp = get_state(sender);
00710 for (int j = sp->ldata_ + 1; j <= dataCnt; j++)
00711 if (! sp->ifReceived(j))
00712 tcl.evalf("%s request %d %d", name_, sender, j, sp->repid_);
00713 if (sp->ldata_ < dataCnt)
00714 sp->ldata_ = dataCnt;
00715 }
00716 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 281 of file srm.cc. References SRMAgent::get_state(), SRMAgent::request(), and sp. Referenced by SRMAgent::recv(), and recv().
00282 {
00283 Tcl& tcl = Tcl::instance();
00284 SRMinfo* sp = get_state(sender);
00285 if (msgid > sp->ldata_) {
00286 (void) request(sp, msgid - 1); // request upto msgid - 1
00287 sp->setReceived(msgid);
00288 sp->ldata_ = msgid;
00289 } else {
00290 tcl.evalf("%s recv repair %d %d %d", name_,
00291 round, sender, msgid);
00292 }
00293 // Notice that we currently make no provisions for a listener
00294 // agent to receive the data.
00295 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 268 of file srm.cc. References SRMAgent::get_state(), SRMAgent::request(), and sp. Referenced by SRMAgent::recv(), and recv_rqst().
00269 {
00270 Tcl& tcl = Tcl::instance();
00271 SRMinfo* sp = get_state(sender);
00272 if (msgid > sp->ldata_) {
00273 (void) request(sp, msgid); // request upto msgid
00274 sp->ldata_ = msgid;
00275 } else {
00276 tcl.evalf("%s recv request %d %d %d %d", name_,
00277 requestor, round, sender, msgid);
00278 }
00279 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 247 of file srm-ssm.cc. References SRMAgent::get_state(), SRMAgent::recv_rqst(), and rsp. Referenced by recv().
00249 {
00250 //Tcl& tcl = Tcl::instance();
00251 SRMinfo* rsp = get_state(requestor);
00252 rsp->repid_ = repid;
00253 SRMAgent::recv_rqst(requestor,round, sender,msgid);
00254 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 330 of file srm.cc. References Agent::addr(), Scheduler::clock(), GET_SESSION_INFO, SRMAgent::get_state(), Scheduler::instance(), SRMAgent::request(), and sp. Referenced by SRMAgent::recv().
00331 {
00332 SRMinfo* sp;
00333
00334 int sender, dataCnt, rtime, stime;
00335 int now, sentAt, sentBy;
00336 int cnt = *data++;
00337 int i;
00338
00339 /* The first block contains the sender's own state */
00340 GET_SESSION_INFO;
00341 if (sender == addr()) // sender's own session message
00342 return;
00343
00344 sp = get_state(sender);
00345 if (sp->lsess_ > sessCtr) // older session message recd.
00346 return;
00347
00348 now = (int) (Scheduler::instance().clock() * 1000);
00349 sentBy = sender; // to later compute rtt
00350 sentAt = stime;
00351
00352 sp->lsess_ = sessCtr;
00353 sp->recvTime_ = now;
00354 sp->sendTime_ = stime;
00355 (void) request(sp, dataCnt);
00356 if (sp->ldata_ < dataCnt)
00357 sp->ldata_ = dataCnt;
00358
00359 for (i = 1; i < cnt; i++) {
00360 GET_SESSION_INFO;
00361 if (sender == addr() && now) {
00362 //
00363 // This session message from sender sentBy:
00364 // vvvvv
00365 // now <=======+ sentAt
00366 // | |
00367 // stime +=======> rtime
00368 // ^^^^^
00369 // Earlier session message sent by ``this'' agent
00370 //
00371 int rtt = (now - sentAt) + (rtime - stime);
00372 sp = get_state(sentBy);
00373 sp->distance_ = (double) rtt / 2 / 1000;
00374 #if 0
00375 fprintf(stderr,
00376 "%7.4f %s compute distance to %d: %f\n",
00377 Scheduler::instance().clock(), name_,
00378 sentBy, sp->distance_);
00379 #endif
00380 continue;
00381 }
00382 sp = get_state(sender);
00383 (void) request(sp, dataCnt);
00384 if (sp->ldata_ < dataCnt)
00385 sp->ldata_ = dataCnt;
00386 }
00387 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 456 of file srm-ssm.cc. References Packet::free(), recv_glb_sess(), recv_loc_sess(), recv_rep_sess(), scopeFlag_, SRM_GLOBAL, SRM_LOCAL, and SRM_RINFO. Referenced by recv().
00457 {
00458 int type = data[1];
00459
00460 switch (type) {
00461 case SRM_GLOBAL :
00462 recv_glb_sess(sessCtr,data,p);
00463 break;
00464 case SRM_LOCAL :
00465 recv_loc_sess(sessCtr,data,p);
00466 break;
00467 case SRM_RINFO :
00468 if (scopeFlag_ == SRM_GLOBAL) return;
00469 recv_rep_sess(sessCtr,data,p);
00470 break;
00471 }
00472 Packet::free(p);
00473 }
|
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 {};
|
|
||||||||||||
|
Definition at line 93 of file srm.h. References sp. Referenced by SRMAgent::recv_data(), SRMAgent::recv_repr(), SRMAgent::recv_rqst(), and SRMAgent::recv_sess().
00093 {
00094 int miss = 0;
00095 if (sp->ldata_ >= hi)
00096 return miss;
00097
00098 int maxsize = ((int)log10(hi + 1) + 2) * (hi - sp->ldata_);
00099 // 1 + log10(msgid) bytes for the msgid
00100 // msgid could be 0, if first pkt is lost.
00101 // 1 byte per msg separator
00102 // hi - sp->ldata_ msgs max missing
00103 char* msgids = new char[maxsize + 1];
00104 *msgids = '\0';
00105 for (int i = sp->ldata_ + 1; i <= hi; i++)
00106 if (! sp->ifReceived(i)) {
00107 (void) sprintf(msgids, "%s %d", msgids, i);
00108 miss++;
00109 }
00110 assert(miss);
00111 Tcl::instance().evalf("%s request %d %s", name_,
00112 sp->sender_, msgids);
00113 delete[] msgids;
00114 return miss;
00115 }
|
|
|
Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >. Definition at line 70 of file object.cc. Referenced by NsObject::command().
00071 {
00072 }
|
|
||||||||||||
|
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:

|
|
Reimplemented from Agent. Definition at line 130 of file srm.h. References SRMAgent::sendmsg().
00130 { sendmsg(nbytes); }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Reimplemented from SRMAgent. Definition at line 231 of file srm-ssm.cc. References hdr_cmn::access(), hdr_srm_ext::access(), hdr_srm::access(), Agent::allocpkt(), NsObject::recv(), hdr_srm_ext::repid(), repid_, sh, hdr_cmn::size(), and Connector::target_. Referenced by command().
00232 {
00233 Packet* p = Agent::allocpkt();
00234 hdr_srm* sh = hdr_srm::access(p);
00235 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00236 sh->type() = type;
00237 sh->sender() = sender;
00238 sh->seqnum() = msgid;
00239 sh->round() = round;
00240 seh->repid() = repid_; /* For ctrl messages this is your own repid */
00241
00242 hdr_cmn* ch = hdr_cmn::access(p);
00243 ch->size() = sizeof(hdr_srm) + size;
00244 target_->recv(p, (Handler*)NULL);
00245 }
|
Here is the call graph for this function:

|
|
Definition at line 276 of file srm-ssm.cc. References hdr_ip::access(), hdr_cmn::access(), hdr_srm_ext::access(), hdr_srm::access(), Packet::accessdata(), Agent::addr(), Agent::allocpkt(), Scheduler::clock(), hdr_ip::flowid(), glb_sessCtr_, groupScope_, SRMAgent::groupSize_, Scheduler::instance(), is_active(), hdr_srm_ext::ottl(), NsObject::recv(), hdr_srm_ext::repid(), repid_, SESS_CONST, SESSINFO_SIZE, sh, SRMAgent::sip_, hdr_cmn::size(), Agent::size(), sp, SRM_GLOBAL, SRM_SESS, Connector::target_, and hdr_ip::ttl(). Referenced by send_sess().
00277 {
00278 int size = (SESS_CONST + groupSize_ * SESSINFO_SIZE) * sizeof(int);
00279 /* Currently do extra allocation, later change */
00280 int num_entries;
00281 Packet* p = Agent::allocpkt(size);
00282 hdr_srm* sh = hdr_srm::access(p);
00283 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00284
00285 #if 0
00286 printf("sending global session message\n");
00287 #endif
00288 sh->type() = SRM_SESS;
00289 sh->sender() = addr();
00290 sh->seqnum() = ++glb_sessCtr_;
00291 seh->repid() = repid_;
00292
00293 int* data = (int*) p->accessdata();
00294 *data++ = groupSize_;
00295 *data++ = SRM_GLOBAL;
00296 num_entries = 0;
00297 for (SRMinfo* sp = sip_; sp; sp = sp->next_) {
00298 /* Global Session Message has information about Senders/reps */
00299 if ((sp->senderFlag_ ||
00300 (sp->scopeFlag_ == SRM_GLOBAL) ||
00301 (sp->sender_ == addr()))
00302 && (is_active(sp))) {
00303 *data++ = sp->sender_;
00304 *data++ = sp->ldata_;
00305 *data++ = sp->recvTime_;
00306 *data++ = sp->sendTime_;
00307 *data++ = sp->repid_;
00308 num_entries++;
00309 }
00310 }
00311 data = (int*) p->accessdata();
00312 data[0] = num_entries;
00313 data[1] = SRM_GLOBAL;
00314 size = (SESS_CONST + num_entries * SESSINFO_SIZE) * sizeof(int);
00315 data[5] = (int) (Scheduler::instance().clock()*1000);
00316
00317 hdr_cmn* ch = hdr_cmn::access(p);
00318 ch->size() += size+ sizeof(hdr_srm); /* Add size of srm_hdr_ext */
00319 hdr_ip* ih = hdr_ip::access(p);
00320 ih->ttl() = groupScope_;
00321 // Currently put this to distinguish various session messages
00322 ih->flowid() = SRM_GLOBAL;
00323 seh->ottl() = groupScope_;
00324 target_->recv(p, (Handler*)NULL);
00325 }
|
Here is the call graph for this function:

|
|
Definition at line 328 of file srm-ssm.cc. References hdr_ip::access(), hdr_cmn::access(), hdr_srm_ext::access(), hdr_srm::access(), Packet::accessdata(), Agent::addr(), Agent::allocpkt(), Scheduler::clock(), hdr_ip::flowid(), SRMAgent::groupSize_, Scheduler::instance(), is_active(), loc_sessCtr_, localScope_, hdr_srm_ext::ottl(), NsObject::recv(), hdr_srm_ext::repid(), repid_, SELF_DISTANCE, SESS_CONST, SESSINFO_SIZE, sh, SRMAgent::sip_, hdr_cmn::size(), Agent::size(), sp, SRM_LOCAL, SRM_SESS, Connector::target_, and hdr_ip::ttl(). Referenced by send_sess().
00329 {
00330 int size = (SESS_CONST + groupSize_ * SESSINFO_SIZE) * sizeof(int);
00331 /* Currently do extra allocation, later change */
00332 int num_entries;
00333 Packet* p = Agent::allocpkt(size);
00334 hdr_srm* sh = hdr_srm::access(p);
00335 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00336 sh->type() = SRM_SESS;
00337 sh->sender() = addr();
00338 sh->seqnum() = ++loc_sessCtr_;
00339 seh->repid() = repid_;
00340 #if 0
00341 printf("sending local session message\n");
00342 #endif
00343 int* data = (int*) p->accessdata();
00344 //int* tmp_data = (int*) p->accessdata();
00345 *data++ = groupSize_;
00346 *data++ = SRM_LOCAL;
00347 num_entries = 0;
00348 for (SRMinfo* sp = sip_; sp; sp = sp->next_) {
00349 /* Local Session Message has information
00350 about Senders/other locals */
00351 if ((sp->senderFlag_ ||
00352 (sp->scopeFlag_ == SRM_LOCAL) ||
00353 (sp->distanceFlag_ = SELF_DISTANCE) ||
00354 /* For the reps that I am hearing from */
00355 (sp->sender_ == addr()) ||
00356 // just in case, I have not set the flags properly,
00357 // one entry has to be there
00358 (repid_ == sp->sender_))
00359 && (is_active(sp))) {
00360 *data++ = sp->sender_;
00361 *data++ = sp->ldata_;
00362 *data++ = sp->recvTime_;
00363 *data++ = sp->sendTime_;
00364 *data++ = sp->repid_;
00365 num_entries++;
00366 }
00367 }
00368 data = (int*) p->accessdata();
00369 data[0] = num_entries;
00370 data[1] = SRM_LOCAL;
00371 size = (SESS_CONST + num_entries * SESSINFO_SIZE) * sizeof(int);
00372 data[5] = (int) (Scheduler::instance().clock()*1000);
00373
00374 hdr_cmn* ch = hdr_cmn::access(p);
00375 ch->size() += size+ sizeof(hdr_srm);
00376 hdr_ip* ih = hdr_ip::access(p);
00377 ih->ttl() = localScope_;
00378 // Currently put this to distinguish various session messages
00379 ih->flowid() = SRM_LOCAL;
00380 seh->ottl() = localScope_;
00381 target_->recv(p, (Handler*)NULL);
00382 }
|
Here is the call graph for this function:

|
|
Definition at line 385 of file srm-ssm.cc. References hdr_ip::access(), hdr_cmn::access(), hdr_srm_ext::access(), hdr_srm::access(), Packet::accessdata(), ACTIVE, Agent::addr(), Agent::allocpkt(), Scheduler::clock(), hdr_ip::flowid(), Packet::free(), SRMAgent::groupSize_, Scheduler::instance(), localScope_, hdr_srm_ext::ottl(), NsObject::recv(), rep_sessCtr_, hdr_srm_ext::repid(), repid_, SESS_CONST, SESSINFO_SIZE, sh, SRMAgent::sip_, hdr_cmn::size(), Agent::size(), sp, SRM_GLOBAL, SRM_RINFO, SRM_SESS, Connector::target_, and hdr_ip::ttl(). Referenced by send_sess().
00386 {
00387 int size = (SESS_CONST + groupSize_ * SESSINFO_SIZE) * sizeof(int);
00388 /* Currently do extra allocation, later change */
00389 int num_entries, num_local_members;
00390 Packet* p = Agent::allocpkt(size);
00391 hdr_srm* sh = hdr_srm::access(p);
00392 hdr_srm_ext* seh = hdr_srm_ext::access(p);
00393 sh->type() = SRM_SESS;
00394 sh->sender() = addr();
00395 sh->seqnum() = ++rep_sessCtr_;
00396 seh->repid() = repid_;
00397 #if 0
00398 printf("sending rep_info session message\n");
00399 #endif
00400 int* data = (int*) p->accessdata();
00401 *data++ = groupSize_;
00402 *data++ = SRM_RINFO;
00403 num_entries = 0;
00404 num_local_members = 0;
00405 for (SRMinfo* sp = sip_; sp; sp = sp->next_) {
00406 if (sp->activeFlag_ == ACTIVE) {
00407 /* Rep info has distance to others reps and
00408 timestamps for everyone */
00409 *data++ = sp->sender_;
00410 *data++ = sp->ldata_;
00411 if (sp->scopeFlag_ == SRM_GLOBAL) {
00412 *data++ = (int) (sp->distance_*1000);
00413 data++;
00414 } else {
00415 // Put a check here for only people I have heard from.??
00416 *data++ = sp->recvTime_;
00417 *data++ = sp->sendTime_;
00418 num_local_members++;
00419 }
00420 *data++ = sp->repid_;
00421 num_entries++;
00422 }
00423 }
00424 if (num_local_members <= 0) {
00425 Packet::free(p);
00426 return;
00427 }
00428 data = (int*) p->accessdata();
00429 data[0] = num_entries;
00430 data[1] = SRM_RINFO;
00431 size = (SESS_CONST + num_entries * SESSINFO_SIZE) * sizeof(int);
00432 data[5] = (int) (Scheduler::instance().clock()*1000);
00433
00434 hdr_cmn* ch = hdr_cmn::access(p);
00435 ch->size() += size+ sizeof(hdr_srm);
00436 hdr_ip* ih = hdr_ip::access(p);
00437 ih->ttl() = localScope_;
00438 // Currently put this to distinguish various session messages
00439 ih->flowid() = SRM_RINFO;
00440 seh->ottl() = localScope_;
00441 target_->recv(p, (Handler*)NULL);
00442 }
|
Here is the call graph for this function:

|
|
Reimplemented from SRMAgent. Definition at line 262 of file srm-ssm.cc. References scopeFlag_, send_glb_sess(), send_loc_sess(), send_rep_sess(), and SRM_GLOBAL. Referenced by command().
00263 {
00264 if (scopeFlag_ == SRM_GLOBAL) {
00265 send_glb_sess();
00266 send_rep_sess();
00267 } else {
00268 send_loc_sess();
00269 }
00270 // timeout_info();
00271 }
|
Here is the call graph for this function:

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

|
||||||||||||
|
Reimplemented from Agent. Definition at line 203 of file srm.cc. References hdr_cmn::access(), hdr_rtp::access(), hdr_srm::access(), hdr_ip::access(), SRMAgent::addExtendedHeaders(), Agent::addr(), Agent::allocpkt(), SRMAgent::app_fid_, SRMAgent::app_type_, SRMAgent::dataCtr_, hdr_ip::dst(), Agent::dst_, hdr_ip::flowid(), PT_SRM, hdr_cmn::ptype(), NsObject::recv(), hdr_rtp::seqno(), SRMAgent::seqno_, sh, hdr_cmn::size(), Agent::size_, SRM_DATA, Connector::target_, and Agent::type_. Referenced by SRMAgent::send().
00204 {
00205 if (nbytes == -1) {
00206 printf("Error: sendmsg() for SRM should not be -1\n");
00207 return;
00208 }
00209 // The traffic generator may have reset our payload type when it
00210 // initialized. If so, save the current payload type as app_type_,
00211 // and set type_ to PT_SRM. Use app_type_ for all app. packets
00212 //
00213 if (type_ != PT_SRM) {
00214 app_type_ = type_;
00215 type_ = PT_SRM;
00216 }
00217 size_ = nbytes;
00218 Packet *p;
00219 p = allocpkt();
00220 hdr_ip* ih = hdr_ip::access(p);
00221 hdr_srm* sh = hdr_srm::access(p);
00222 hdr_rtp* rh = hdr_rtp::access(p);
00223 hdr_cmn* ch = hdr_cmn::access(p);
00224 //hdr_cmn* ch = hdr_cmn::access(p);
00225
00226 ch->ptype() = app_type_;
00227 ch->size() = size_;
00228 ih->flowid() = app_fid_;
00229 rh->seqno() = ++seqno_;
00230 // Add srm headers, set dst, and fwd
00231 sh->type() = SRM_DATA;
00232 sh->sender() = addr();
00233 sh->seqnum() = ++dataCtr_;
00234 addExtendedHeaders(p);
00235 ih->dst() = dst_;
00236 target_->recv(p);
00237 }
|
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(), send_glb_sess(), send_loc_sess(), send_rep_sess(), SRMAgent::send_sess(), and TelnetApp::timeout().
00095 { return size_; }
|
|
|
Definition at line 56 of file srm.h. References Agent::addr(), SRMinfo::distance_, SRMAgent::groupSize_, SRMinfo::next_, SRMinfo::sender_, SRMAgent::sip_, and SRMAgent::siphash_. Referenced by SRMAgent::command().
00056 {
00057 int new_entry = 0;
00058
00059 sip_->sender_ /* is itself */ = addr();
00060 sip_->distance_ /* to itself */ = 0.0;
00061 sip_->next_ = NULL;
00062
00063 siphash_ = new Tcl_HashTable;
00064 Tcl_InitHashTable(siphash_, TCL_ONE_WORD_KEYS);
00065 Tcl_HashEntry* he = Tcl_CreateHashEntry(siphash_,
00066 (char*) addr(),
00067 &new_entry);
00068 Tcl_SetHashValue(he, (ClientData*)sip_);
00069 groupSize_++;
00070 }
|
Here is the call graph for this function:

|
|
Definition at line 48 of file connector.h. References Connector::target_. Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().
00048 { return target_; }
|
|
|
Reimplemented in SA_Agent, RTPAgent, FtpClientAgent, BayFullTcpAgent, SinkAgent, RLM_Sender, MIPBSAgent, MIPMHAgent, RapAgent, RTCPAgent, TcpAsymSink, FackTcpAgent, FullTcpAgent, QSNewRenoTcpAgent, RBPVegasTcpAgent, RBPRenoTcpAgent, SackRHTcpAgent, Sack1TcpAgent, TcpSessionAgent, DelAckSink, TcpAgent, RenoTcpAgent, VegasTcpAgent, and SimpleTcpAgent. Definition at line 347 of file agent.cc. Referenced by SimpleTimer::expire().
00348 {
00349 }
|
|
|
Definition at line 723 of file srm-ssm.cc. References Scheduler::clock(), SRMAgent::groupSize_, INACTIVE, Scheduler::instance(), SRMinfo::next_, sessionDelay, SRMAgent::sip_, and sp.
00724 {
00725 int now;
00726 now = (int) (Scheduler::instance().clock() * 1000);
00727 for (SRMinfo* sp = sip_->next_; sp; sp = sp->next_) {
00728 if ((now - sp->recvTime_) >= 3*sessionDelay) {
00729 sp->activeFlag_ = INACTIVE;
00730 groupSize_--;
00731 }
00732
00733 }
00734 }
|
Here is the call graph for this function:

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

|
|
Reimplemented in TcpAgent. Definition at line 146 of file agent.h.
00146 {}
|
|
|
Reimplemented in BayFullTcpAgent. Definition at line 134 of file agent.h. Referenced by Agent::attachApp(), Agent::idle(), RapAgent::IpgTimeout(), UdpAgent::recv(), SimpleTcpAgent::recv(), RapAgent::recv(), HttpInvalAgent::recv(), Agent::recv(), and Agent::recvBytes(). |
|
|
Definition at line 53 of file srm.h. Referenced by SRMAgent::sendmsg(), and SRMAgent::SRMAgent(). |
|
|
Definition at line 54 of file srm.h. Referenced by SRMAgent::sendmsg(). |
|
|
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(). |
|
|
Definition at line 46 of file srm.h. Referenced by SRMAgent::recv(), recv(), and SRMAgent::sendmsg(). |
|
|
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(), 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 57 of file srm-ssm.h. Referenced by send_glb_sess(). |
|
|
Definition at line 61 of file srm-ssm.h. Referenced by command(), send_glb_sess(), and SSMSRMAgent(). |
|
|
Definition at line 51 of file srm.h. Referenced by SRMAgent::get_state(), send_glb_sess(), send_loc_sess(), send_rep_sess(), SRMAgent::send_sess(), SRMAgent::SRMAgent(), SRMAgent::start(), and timeout_info(). |
|
|
|
Definition at line 58 of file srm-ssm.h. Referenced by send_loc_sess(). |
|
|
Definition at line 62 of file srm-ssm.h. Referenced by send_loc_sess(), send_rep_sess(), and SSMSRMAgent(). |
|
|
Definition at line 132 of file agent.h. Referenced by Agent::insertOldValue(), Agent::lookupOldValue(), and Agent::~Agent(). |
|
|
Definition at line 48 of file srm.h. Referenced by SRMAgent::command(), command(), and SRMAgent::SRMAgent(). |
|
|
Definition at line 119 of file agent.h. Referenced by Agent::delay_bind_dispatch(), and Agent::initpkt(). |
|
|
Definition at line 59 of file srm-ssm.h. Referenced by send_rep_sess(). |
|
|
Definition at line 64 of file srm-ssm.h. Referenced by command(), recv(), recv_rep_sess(), send_ctrl(), send_glb_sess(), send_loc_sess(), send_rep_sess(), and SSMSRMAgent(). |
|
|
Definition at line 60 of file srm-ssm.h. Referenced by command(), recv_sess(), send_sess(), and SSMSRMAgent(). |
|
|
Definition at line 63 of file srm-ssm.h. Referenced by command(). |
|
|
Definition at line 52 of file srm.h. Referenced by SRMAgent::sendmsg(). |
|
|
Definition at line 47 of file srm.h. Referenced by SRMAgent::send_sess(). |
|
|
Definition at line 49 of file srm.h. Referenced by SRMAgent::command(), command(), SRMAgent::get_state(), send_glb_sess(), send_loc_sess(), send_rep_sess(), SRMAgent::send_sess(), SRMAgent::SRMAgent(), SRMAgent::start(), and timeout_info(). |
|
|
Definition at line 50 of file srm.h. Referenced by SRMAgent::cleanup(), SRMAgent::get_state(), and SRMAgent::start(). |
|
|
|
|
Definition at line 131 of file agent.h. Referenced by Agent::addAgentTrace(), Agent::command(), Agent::deleteAgentTrace(), Agent::flushAVar(), Agent::monitorAgentTrace(), and Agent::trace(). |
|
|
Definition at line 117 of file agent.h. Referenced by Agent::get_pkttype(), Agent::initpkt(), FullTcpAgent::listen(), BayFullTcpAgent::listen(), RapAgent::SendAck(), SRMAgent::sendmsg(), RapAgent::SendPacket(), and Agent::set_pkttype(). |
|
|
Definition at line 68 of file agent.cc. Referenced by imepAgent::handlerControlTimer(), imepAgent::handlerReXmitTimer(), Agent::initpkt(), imepAgent::sendAck(), imepAgent::sendBeacon(), toraAgent::sendCLR(), imepAgent::sendHello(), toraAgent::sendQRY(), DSRAgent::sendUnknownFlow(), toraAgent::sendUPD(), and DSRAgent::xmitFailed(). |
1.3.3