#include <sr_forwarder.h>
Inheritance diagram for SRForwarder:


Definition at line 73 of file sr_forwarder.h.
Public Member Functions | |
| virtual void | debug (const char *fmt,...) |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | delay_bind_init_all () |
| int | isdebug () const |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | recvOnly (Packet *) |
| SRForwarder () | |
Protected Member Functions | |
| virtual int | command (int argc, const char *const *argv) |
| void | handle (Event *) |
| virtual void | recv (Packet *, Handler *callback=0) |
| virtual void | reset () |
Protected Attributes | |
| int | debug_ |
| DSRProto * | route_agent_ |
| RouteCache * | routecache_ |
| NsObject * | target_ |
Private Member Functions | |
| void | handlePktWithoutSR (Packet *p) |
Private Attributes | |
| int | off_ip_ |
| int | off_ll_ |
| int | off_mac_ |
| int | off_sr_ |
| Trace * | tracetarget |
|
|
Definition at line 84 of file sr_forwarder.cc. References off_ip_, off_ll_, off_mac_, off_sr_, route_agent_, target_, and tracetarget. 00085 { 00086 target_ = 0; 00087 route_agent_ = 0; 00088 tracetarget = 0; 00089 00090 bind("off_sr_", &off_sr_); 00091 bind("off_ll_", &off_ll_); 00092 bind("off_mac_", &off_mac_); 00093 bind("off_ip_", &off_ip_); 00094 00095 }
|
|
||||||||||||
|
Reimplemented from NsObject. Definition at line 98 of file sr_forwarder.cc. References NsObject::command(), route_agent_, routecache_, target_, and tracetarget. 00099 { 00100 Tcl& tcl = Tcl::instance(); 00101 00102 if (argc == 2) 00103 { 00104 if (strcmp(argv[1], "target") == 0) { 00105 if (target_ != 0) 00106 tcl.result(target_->name()); 00107 return (TCL_OK); 00108 } 00109 if (strcmp(argv[1], "routeagent") == 0) { 00110 if (route_agent_ != 0) 00111 tcl.result(route_agent_->name()); 00112 return (TCL_OK); 00113 } 00114 } 00115 else if(argc == 3) 00116 { 00117 TclObject *obj; 00118 00119 if( (obj = TclObject::lookup(argv[2])) == 0) { 00120 fprintf(stderr, "SRForwarder: %s lookup of %s failed\n", argv[1], 00121 argv[2]); 00122 return TCL_ERROR; 00123 } 00124 00125 if (strcasecmp(argv[1], "tracetarget") == 0) 00126 { 00127 tracetarget = (Trace*) obj; 00128 return TCL_OK; 00129 } 00130 else if (strcasecmp(argv[1], "routecache") == 0) 00131 { 00132 routecache_ = (RouteCache*) obj; 00133 return TCL_OK; 00134 } 00135 else if (strcasecmp(argv[1], "target") == 0) 00136 { 00137 target_ = (NsObject*) obj; 00138 return TCL_OK; 00139 } 00140 else if (strcasecmp(argv[1], "routeagent") == 0) 00141 { 00142 route_agent_ = (DSRProto*) obj; 00143 return TCL_OK; 00144 } 00145 } 00146 00147 return NsObject::command(argc, argv); 00148 }
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 in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. Definition at line 63 of file object.cc. References NsObject::debug_. Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch(). 00064 { 00065 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 00066 return TCL_OK; 00067 return TclObject::delay_bind_dispatch(varName, localName, tracer); 00068 }
|
|
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
|
|
|
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 151 of file sr_forwarder.cc. References hdr_ip::access(), hdr_sr::access(), BaseTrace::buffer(), Scheduler::clock(), hdr_ip::daddr(), BaseTrace::dump(), hdr_sr::dump(), Path::fillSR(), RouteCache::findRoute(), hdr_sr::init(), Scheduler::instance(), IP, Trace::pt_, recv(), routecache_, hdr_ip::saddr(), and tracetarget. Referenced by recv(). 00152 { 00153 hdr_sr *srh = hdr_sr::access(p); 00154 hdr_ip *iph = hdr_ip::access(p); 00155 //hdr_cmn *cmh = hdr_cmn::access(p); 00156 Path path; 00157 00158 /* check route cache for source route for this packet */ 00159 //if (routecache_->findRoute(ID(iph->daddr()>>8,::IP),path)) 00160 if (routecache_->findRoute(ID(iph->daddr(),::IP),path,0)) 00161 { 00162 srh->init(); 00163 path.fillSR(srh); 00164 sprintf(tracetarget->pt_->buffer(), 00165 "$hit %g originating 0x%x -> 0x%x %s", 00166 Scheduler::instance().clock(), 00167 iph->saddr(), iph->daddr(), srh->dump()); 00168 tracetarget->pt_->dump(); 00169 this->recv(p,0); // send back to forwarder to send this out 00170 return; 00171 } 00172 00173 /* if not found, give packet to routing protocol */ 00174 sprintf(tracetarget->pt_->buffer(), 00175 "dfu %g srforwarder: %s no route to 0x%x", 00176 Scheduler::instance().clock(), 00177 routecache_->net_id.dump(), iph->daddr()); 00178 tracetarget->pt_->dump(); 00179 00180 route_agent_->noRouteForPacket(p); 00181 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 61 of file object.h. References NsObject::debug_. 00061 { return debug_; }
|
|
||||||||||||
|
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: ![]() |
|
||||||||||||
|
Implements NsObject. Definition at line 184 of file sr_forwarder.cc. References Packet::access(), handlePktWithoutSR(), off_sr_, tracetarget, and hdr_sr::valid(). Referenced by handlePktWithoutSR(). 00185 { 00186 hdr_sr *srh = (hdr_sr*)p->access(off_sr_); 00187 00188 assert(tracetarget != 0); 00189 00190 if (!srh->valid()) 00191 { 00192 handlePktWithoutSR(p); 00193 return; 00194 } 00195 00196 /* forward as per source route */ 00197 hdr_ip *iph = hdr_ip::access(p); 00198 hdr_cmn *cmnh = hdr_cmn::access(p); 00199 00200 if (srh->route_request()) 00201 { /* just broadcast */ 00202 cmnh->next_hop() = MAC_BROADCAST; 00203 cmnh->addr_type() = NS_AF_ILINK; 00204 target_->recv(p, (Handler*)0); 00205 return; 00206 } 00207 00208 /* it must be a normal data packet with a source route */ 00209 if (tracetarget) 00210 { 00211 sprintf(tracetarget->pt_->buffer(), 00212 "F %g 0x%x -> 0x%x via 0x%x %s", 00213 Scheduler::instance().clock(), 00214 iph->saddr(), iph->daddr(), srh->get_next_addr(), srh->dump()); 00215 tracetarget->pt_->dump(); 00216 } 00217 00218 cmnh->next_hop() = srh->get_next_addr(); 00219 cmnh->addr_type() = NS_AF_INET; 00220 srh->cur_addr() = srh->cur_addr() + 1; 00221 target_->recv(p, (Handler*)0); 00222 return; 00223 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
|
|
|
Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, Queue< T >, and XcpSink. Definition at line 70 of file object.cc. Referenced by NsObject::command().
|
|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send(). |
|
|
Definition at line 90 of file sr_forwarder.h. Referenced by SRForwarder(). |
|
|
Definition at line 89 of file sr_forwarder.h. Referenced by SRForwarder(). |
|
|
Definition at line 88 of file sr_forwarder.h. Referenced by SRForwarder(). |
|
|
Definition at line 91 of file sr_forwarder.h. Referenced by recv(), and SRForwarder(). |
|
|
Definition at line 82 of file sr_forwarder.h. Referenced by command(), and SRForwarder(). |
|
|
Definition at line 83 of file sr_forwarder.h. Referenced by command(), and handlePktWithoutSR(). |
|
|
Definition at line 81 of file sr_forwarder.h. Referenced by command(), and SRForwarder(). |
|
|
Definition at line 87 of file sr_forwarder.h. Referenced by command(), handlePktWithoutSR(), recv(), and SRForwarder(). |
1.4.6