#include <classifier-sr.h>
Inheritance diagram for SRClassifier:


Definition at line 45 of file classifier-sr.h.
Public Types | |
| enum | classify_ret { ONCE = -2, TWICE = -1 } |
Public Member Functions | |
| int | allocPort (NsObject *) |
| virtual int | classify (Packet *) |
| virtual void | clear (int slot) |
| 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 () |
| virtual void | do_install (char *dst, NsObject *target) |
| virtual void | install (int slot, NsObject *) |
| int | install_next (NsObject *node) |
| int | isdebug () const |
| int | maxslot () const |
| int | mshift (int val) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | recv (Packet *p, Handler *h) |
| virtual void | recvOnly (Packet *) |
| void | set_default_target (NsObject *obj) |
| virtual void | set_table_size (int level, int nn) |
| void | set_table_size (int nn) |
| NsObject * | slot (int slot) |
Protected Member Functions | |
| void | alloc (int) |
| virtual int | command (int argc, const char *const *argv) |
| NsObject * | find (Packet *) |
| virtual int | getnxt (NsObject *) |
| void | handle (Event *) |
| virtual void | reset () |
Protected Attributes | |
| int | debug_ |
| NsObject * | default_target_ |
| int | mask_ |
| int | maxslot_ |
| int | nsize_ |
| int | nslot_ |
| int | offset_ |
| int | shift_ |
| NsObject ** | slot_ |
|
|
Definition at line 64 of file classifier.h.
|
|
|
Definition at line 79 of file classifier.cc. References Classifier::nsize_, Classifier::nslot_, and Classifier::slot_. Referenced by ReservePortClassifier::command(), ReserveAddressClassifier::command(), Classifier::getnxt(), ReservePortClassifier::getnxt(), ReserveAddressClassifier::getnxt(), and Classifier::install(). 00080 { 00081 NsObject** old = slot_; 00082 int n = nslot_; 00083 if (old == 0) 00084 if (nsize_ != 0) { 00085 //printf("classifier %x set to %d....%dth visit\n", this, nsize_, i++); 00086 nslot_ = nsize_; 00087 } 00088 else { 00089 //printf("classifier %x set to 32....%dth visit\n", this, j++); 00090 nslot_ = 32; 00091 } 00092 while (nslot_ <= slot) 00093 nslot_ <<= 1; 00094 slot_ = new NsObject*[nslot_]; 00095 memset(slot_, 0, nslot_ * sizeof(NsObject*)); 00096 for (int i = 0; i < n; ++i) 00097 slot_[i] = old[i]; 00098 delete [] old; 00099 }
|
|
|
Definition at line 120 of file classifier.cc. References Classifier::getnxt(). 00121 { 00122 return getnxt (nullagent); 00123 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented in AddressClassifier, ReserveAddressClassifier, MCastBSTClassifier, HashClassifier, DestHashClassifier, MCastClassifier, MultiPathForwarder, PortClassifier, VirtualClassifier, LmsClassifier, Replicator, and MPLSAddressClassifier. Definition at line 64 of file classifier.cc. References Packet::access(), Classifier::mshift(), and Classifier::offset_. Referenced by Classifier::find(), and LanRouter::next_hop().
Here is the call graph for this function: ![]() |
|
|
Reimplemented in ReserveAddressClassifier, and ReservePortClassifier. Definition at line 111 of file classifier.cc. References Classifier::maxslot_, and Classifier::slot_. Referenced by Classifier::command(), and HierClassifier::command(). 00112 { 00113 slot_[slot] = 0; 00114 if (slot == maxslot_) { 00115 while (--maxslot_ >= 0 && slot_[maxslot_] == 0) 00116 ; 00117 } 00118 }
|
|
||||||||||||
|
Reimplemented from NsObject. Reimplemented in ReserveAddressClassifier, BcastAddressClassifier, HashClassifier, DestHashClassifier, HierClassifier, MCastClassifier, ReservePortClassifier, VirtualClassifier, Replicator, MPLSAddressClassifier, and NixClassifier. Definition at line 189 of file classifier.cc. References Classifier::clear(), NsObject::command(), Classifier::default_target_, Classifier::getnxt(), Classifier::install(), Classifier::install_next(), Classifier::nslot_, Classifier::slot(), and Classifier::slot_. Referenced by ReservePortClassifier::command(), MCastClassifier::command(), HierClassifier::command(), HashClassifier::command(), BcastAddressClassifier::command(), and ReserveAddressClassifier::command(). 00190 { 00191 Tcl& tcl = Tcl::instance(); 00192 if(argc == 2) { 00193 if (strcmp(argv[1], "defaulttarget") == 0) { 00194 if (default_target_ != 0) 00195 tcl.result(default_target_->name()); 00196 return (TCL_OK); 00197 } 00198 } else if (argc == 3) { 00199 /* 00200 * $classifier alloc-port nullagent 00201 */ 00202 if (strcmp(argv[1],"alloc-port") == 0) { 00203 int slot; 00204 NsObject* nullagent = 00205 (NsObject*)TclObject::lookup(argv[2]); 00206 slot = getnxt(nullagent); 00207 tcl.resultf("%u",slot); 00208 return(TCL_OK); 00209 } 00210 /* 00211 * $classifier clear $slot 00212 */ 00213 if (strcmp(argv[1], "clear") == 0) { 00214 int slot = atoi(argv[2]); 00215 clear(slot); 00216 return (TCL_OK); 00217 } 00218 /* 00219 * $classifier installNext $node 00220 */ 00221 if (strcmp(argv[1], "installNext") == 0) { 00222 //int slot = maxslot_ + 1; 00223 NsObject* node = (NsObject*)TclObject::lookup(argv[2]); 00224 if (node == NULL) { 00225 tcl.resultf("Classifier::installNext attempt " 00226 "to install non-object %s into classifier", argv[2]); 00227 return TCL_ERROR; 00228 }; 00229 int slot = install_next(node); 00230 tcl.resultf("%u", slot); 00231 return TCL_OK; 00232 } 00233 /* 00234 * $classifier slot snum 00235 * returns the name of the object in slot # snum 00236 */ 00237 if (strcmp(argv[1], "slot") == 0) { 00238 int slot = atoi(argv[2]); 00239 if (slot >= 0 && slot < nslot_ && slot_[slot] != NULL) { 00240 tcl.resultf("%s", slot_[slot]->name()); 00241 return TCL_OK; 00242 } 00243 tcl.resultf("Classifier: no object at slot %d", slot); 00244 return (TCL_ERROR); 00245 } 00246 /* 00247 * $classifier findslot $node 00248 * finds the slot containing $node 00249 */ 00250 if (strcmp(argv[1], "findslot") == 0) { 00251 int slot = 0; 00252 NsObject* node = (NsObject*)TclObject::lookup(argv[2]); 00253 if (node == NULL) { 00254 return (TCL_ERROR); 00255 } 00256 while (slot < nslot_) { 00257 // check if the slot is empty (xuanc, 1/14/02) 00258 // fix contributed by Frank A. Zdarsky 00259 // <frank.zdarsky@kom.tu-darmstadt.de> 00260 if (slot_[slot] && 00261 strcmp(slot_[slot]->name(), argv[2]) == 0){ 00262 tcl.resultf("%u", slot); 00263 return (TCL_OK); 00264 } 00265 slot++; 00266 } 00267 tcl.result("-1"); 00268 return (TCL_OK); 00269 } 00270 if (strcmp(argv[1], "defaulttarget") == 0) { 00271 default_target_=(NsObject*)TclObject::lookup(argv[2]); 00272 if (default_target_ == 0) 00273 return TCL_ERROR; 00274 return TCL_OK; 00275 } 00276 } else if (argc == 4) { 00277 /* 00278 * $classifier install $slot $node 00279 */ 00280 if (strcmp(argv[1], "install") == 0) { 00281 int slot = atoi(argv[2]); 00282 NsObject* node = (NsObject*)TclObject::lookup(argv[3]); 00283 install(slot, node); 00284 return (TCL_OK); 00285 } 00286 } 00287 return (NsObject::command(argc, argv)); 00288 }
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().
|
|
||||||||||||
|
Reimplemented in DestHashClassifier, HierClassifier, and VirtualClassifier. Definition at line 66 of file classifier.h. References Classifier::install(), and Classifier::slot(). Referenced by RoutingModule::add_route(), BroadcastNode::add_route(), RoutingModule::delete_route(), and BroadcastNode::delete_route().
Here is the call graph for this function: ![]() |
|
|
Reimplemented from Classifier. Definition at line 54 of file classifier-sr.cc. References hdr_cmn::access(), Classifier::slot_, and hdr_cmn::src_rt_valid. 00054 { 00055 hdr_cmn *cmh = hdr_cmn::access(p); 00056 00057 if (cmh->src_rt_valid) 00058 // source routing packet forwarded to the agent 00059 { 00060 //cout << "forwarded to my agent" << endl; 00061 return slot_[0]; 00062 } 00063 else 00064 { 00065 //cout << "forwarded to normal place : " << endl; 00066 return slot_[1]; 00067 } 00068 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented in ReserveAddressClassifier, and ReservePortClassifier. Definition at line 125 of file classifier.cc. References Classifier::alloc(), Classifier::nslot_, and Classifier::slot_. Referenced by Classifier::allocPort(), Classifier::command(), and DestHashClassifier::do_install(). 00126 { 00127 int i; 00128 for (i=0; i < nslot_; i++) 00129 if (slot_[i]==0 || slot_[i]==nullagent) 00130 return i; 00131 i=nslot_; 00132 alloc(nslot_); 00133 return i; 00134 }
Here is the call graph for this function: ![]() |
|
|
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: ![]() |
|
||||||||||||
|
Reimplemented in MPLSAddressClassifier. Definition at line 102 of file classifier.cc. References Classifier::alloc(), Classifier::maxslot_, Classifier::nslot_, and Classifier::slot_. Referenced by Classifier::command(), Classifier::do_install(), HierClassifier::do_install(), DestHashClassifier::do_install(), MPLSAddressClassifier::install(), and Classifier::install_next(). 00103 { 00104 if (slot >= nslot_) 00105 alloc(slot); 00106 slot_[slot] = p; 00107 if (slot >= maxslot_) 00108 maxslot_ = slot; 00109 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 183 of file classifier.cc. References Classifier::install(), Classifier::maxslot_, and Classifier::slot(). Referenced by ManualRoutingModule::add_route(), and Classifier::command().
Here is the call graph for this function: ![]() |
|
|
Definition at line 61 of file object.h. References NsObject::debug_. 00061 { return debug_; }
|
|
|
Definition at line 49 of file classifier.h. References Classifier::maxslot_. Referenced by FlowMon::dumpflows(), Tagger::dumpflows(), FlowMon::flow_list(), and Tagger::flow_list(). 00049 { return maxslot_; }
|
|
|
Definition at line 55 of file classifier.h. References Classifier::mask_, and Classifier::shift_. Referenced by Classifier::classify(), VirtualClassifier::classify(), AddressClassifier::classify(), DestHashClassifier::hashkey(), SrcDestHashClassifier::hashkey(), SrcDestFidHashClassifier::hashkey(), and HashClassifier::lookup().
|
|
||||||||||||
|
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. Reimplemented in MCastBSTClassifier, HierClassifier, MacClassifier, VirtualClassifier, Replicator, and MIPDecapsulator. Definition at line 140 of file classifier.cc. References Classifier::find(), Packet::free(), and NsObject::recv(). Referenced by AODV::forward(), ErrorModule::recv(), DumbAgent::recv(), and HierClassifier::recv(). 00141 { 00142 NsObject* node = find(p); 00143 if (node == NULL) { 00144 /* 00145 * XXX this should be "dropped" somehow. Right now, 00146 * these events aren't traced. 00147 */ 00148 Packet::free(p); 00149 return; 00150 } 00151 node->recv(p,h); 00152 }
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().
|
|
|
Definition at line 56 of file classifier.h. References Classifier::default_target_. Referenced by HierClassifier::command(). 00056 { 00057 default_target_ = obj; 00058 }
|
|
||||||||||||
|
Reimplemented in HierClassifier. Definition at line 75 of file classifier.h.
|
|
|
Reimplemented in HashClassifier. Definition at line 74 of file classifier.cc. References Classifier::nsize_. Referenced by RoutingModule::set_table_size(), and HierClassifier::set_table_size(). 00075 { 00076 nsize_ = nn; 00077 }
|
|
|
|
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 88 of file classifier.h. Referenced by Classifier::Classifier(), Classifier::command(), Classifier::find(), BcastAddressClassifier::find(), and Classifier::set_default_target(). |
|
|
Definition at line 87 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::mshift(). |
|
|
|
Definition at line 89 of file classifier.h. Referenced by Classifier::alloc(), and Classifier::set_table_size(). |
|
|
|
Definition at line 85 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::classify(). |
|
|
Definition at line 86 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::mshift(). |
|
1.4.6