#include <classifier-qs.h>
Inheritance diagram for QSClassifier:


Public Types | |
| enum | classify_ret { ONCE = -2, TWICE = -1 } |
Public Member Functions | |
| int | maxslot () const |
| NsObject * | slot (int slot) |
| int | mshift (int val) |
| void | set_default_target (NsObject *obj) |
| virtual void | recv (Packet *p, Handler *h) |
| virtual void | recv (Packet *p, const char *s) |
| virtual int | classify (Packet *) |
| virtual void | clear (int slot) |
| virtual void | do_install (char *dst, NsObject *target) |
| int | install_next (NsObject *node) |
| virtual void | install (int slot, NsObject *) |
| void | set_table_size (int nn) |
| virtual void | set_table_size (int level, int nn) |
| virtual void | recvOnly (Packet *) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| NsObject * | find (Packet *) |
| virtual int | getnxt (NsObject *) |
| virtual int | command (int argc, const char *const *argv) |
| void | alloc (int) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| NsObject ** | slot_ |
| int | nslot_ |
| int | maxslot_ |
| int | offset_ |
| int | shift_ |
| int | mask_ |
| NsObject * | default_target_ |
| int | nsize_ |
| int | debug_ |
|
|
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 }
|
|
|
Reimplemented in AddressClassifier, ReserveAddressClassifier, MCastBSTClassifier, HashClassifier, DestHashClassifier, MCastClassifier, MultiPathForwarder, PortClassifier, 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().
|
|
||||||||||||
|
Reimplemented from NsObject. Reimplemented in ReserveAddressClassifier, BcastAddressClassifier, HashClassifier, DestHashClassifier, HierClassifier, MCastClassifier, ReservePortClassifier, VirtualClassifier, Replicator, MPLSAddressClassifier, and NixClassifier. Definition at line 184 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 Replicator::command(), ReservePortClassifier::command(), MCastClassifier::command(), HierClassifier::command(), HashClassifier::command(), BcastAddressClassifier::command(), ReserveAddressClassifier::command(), and MPLSAddressClassifier::command().
00185 {
00186 Tcl& tcl = Tcl::instance();
00187 if(argc == 2) {
00188 if (strcmp(argv[1], "defaulttarget") == 0) {
00189 if (default_target_ != 0)
00190 tcl.result(default_target_->name());
00191 return (TCL_OK);
00192 }
00193 } else if (argc == 3) {
00194 /*
00195 * $classifier alloc-port nullagent
00196 */
00197 if (strcmp(argv[1],"alloc-port") == 0) {
00198 int slot;
00199 NsObject* nullagent =
00200 (NsObject*)TclObject::lookup(argv[2]);
00201 slot = getnxt(nullagent);
00202 tcl.resultf("%u",slot);
00203 return(TCL_OK);
00204 }
00205 /*
00206 * $classifier clear $slot
00207 */
00208 if (strcmp(argv[1], "clear") == 0) {
00209 int slot = atoi(argv[2]);
00210 clear(slot);
00211 return (TCL_OK);
00212 }
00213 /*
00214 * $classifier installNext $node
00215 */
00216 if (strcmp(argv[1], "installNext") == 0) {
00217 //int slot = maxslot_ + 1;
00218 NsObject* node = (NsObject*)TclObject::lookup(argv[2]);
00219 if (node == NULL) {
00220 tcl.resultf("Classifier::installNext attempt "
00221 "to install non-object %s into classifier", argv[2]);
00222 return TCL_ERROR;
00223 };
00224 int slot = install_next(node);
00225 tcl.resultf("%u", slot);
00226 return TCL_OK;
00227 }
00228 /*
00229 * $classifier slot snum
00230 * returns the name of the object in slot # snum
00231 */
00232 if (strcmp(argv[1], "slot") == 0) {
00233 int slot = atoi(argv[2]);
00234 if (slot >= 0 && slot < nslot_ && slot_[slot] != NULL) {
00235 tcl.resultf("%s", slot_[slot]->name());
00236 return TCL_OK;
00237 }
00238 tcl.resultf("Classifier: no object at slot %d", slot);
00239 return (TCL_ERROR);
00240 }
00241 /*
00242 * $classifier findslot $node
00243 * finds the slot containing $node
00244 */
00245 if (strcmp(argv[1], "findslot") == 0) {
00246 int slot = 0;
00247 NsObject* node = (NsObject*)TclObject::lookup(argv[2]);
00248 if (node == NULL) {
00249 return (TCL_ERROR);
00250 }
00251 while (slot < nslot_) {
00252 // check if the slot is empty (xuanc, 1/14/02)
00253 // fix contributed by Frank A. Zdarsky
00254 // <frank.zdarsky@kom.tu-darmstadt.de>
00255 if (slot_[slot] &&
00256 strcmp(slot_[slot]->name(), argv[2]) == 0){
00257 tcl.resultf("%u", slot);
00258 return (TCL_OK);
00259 }
00260 slot++;
00261 }
00262 tcl.result("-1");
00263 return (TCL_OK);
00264 }
00265 if (strcmp(argv[1], "defaulttarget") == 0) {
00266 default_target_=(NsObject*)TclObject::lookup(argv[2]);
00267 if (default_target_ == 0)
00268 return TCL_ERROR;
00269 return TCL_OK;
00270 }
00271 } else if (argc == 4) {
00272 /*
00273 * $classifier install $slot $node
00274 */
00275 if (strcmp(argv[1], "install") == 0) {
00276 int slot = atoi(argv[2]);
00277 NsObject* node = (NsObject*)TclObject::lookup(argv[3]);
00278 install(slot, node);
00279 return (TCL_OK);
00280 }
00281 }
00282 return (NsObject::command(argc, argv));
00283 }
|
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, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. 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, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
00058 {
00059 delay_bind_init_one("debug_");
00060 }
|
|
||||||||||||
|
Reimplemented in DestHashClassifier, HierClassifier, and VirtualClassifier. Definition at line 66 of file classifier.h. References Classifier::install(). 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. |
|
|
Reimplemented in ReserveAddressClassifier, and ReservePortClassifier. Definition at line 120 of file classifier.cc. References Classifier::alloc(), Classifier::nslot_, and Classifier::slot_. Referenced by Classifier::command(), and DestHashClassifier::do_install().
|
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().
|
Here is the call graph for this function:

|
|
Definition at line 178 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 135 of file classifier.cc. References Classifier::find(), Packet::free(), and NsObject::recv(). Referenced by QSAgent::recv(), ErrorModule::recv(), DumbAgent::recv(), and HierClassifier::recv().
00136 {
00137 NsObject* node = find(p);
00138 if (node == NULL) {
00139 /*
00140 * XXX this should be "dropped" somehow. Right now,
00141 * these events aren't traced.
00142 */
00143 Packet::free(p);
00144 return;
00145 }
00146 node->recv(p,h);
00147 }
|
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().
00056 {};
|
|
|
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 }
|
|
|
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.
00075 {}
|
|
|
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(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset(). |
|
|
Definition at line 87 of file classifier.h. Referenced by Classifier::Classifier(), Classifier::command(), Classifier::find(), BcastAddressClassifier::find(), and Classifier::set_default_target(). |
|
|
Definition at line 86 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::mshift(). |
|
|
|
Definition at line 88 of file classifier.h. Referenced by Classifier::alloc(), and Classifier::set_table_size(). |
|
|
|
Definition at line 84 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::classify(). |
|
|
Definition at line 85 of file classifier.h. Referenced by Classifier::Classifier(), and Classifier::mshift(). |
|
1.3.3