00001 // -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- 00002 // 00003 // Time-stamp: <2000-09-15 12:52:53 haoboy> 00004 // 00005 // Copyright (c) 2000 by the University of Southern California 00006 // All rights reserved. 00007 // 00008 // Permission to use, copy, modify, and distribute this software and its 00009 // documentation in source and binary forms for non-commercial purposes 00010 // and without fee is hereby granted, provided that the above copyright 00011 // notice appear in all copies and that both the copyright notice and 00012 // this permission notice appear in supporting documentation. and that 00013 // any documentation, advertising materials, and other materials related 00014 // to such distribution and use acknowledge that the software was 00015 // developed by the University of Southern California, Information 00016 // Sciences Institute. The name of the University may not be used to 00017 // endorse or promote products derived from this software without 00018 // specific prior written permission. 00019 // 00020 // THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about 00021 // the suitability of this software for any purpose. THIS SOFTWARE IS 00022 // PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, 00023 // INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 00024 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00025 // 00026 // Other copyrights might apply to parts of this software and are so 00027 // noted when applicable. 00028 // 00029 // Hierarchical classifier: a wrapper for hierarchical routing 00030 // 00031 // $Header: /nfs/jade/vint/CVSROOT/ns-2/classifier/classifier-hier.h,v 1.5 2002/01/25 20:22:16 haldar Exp $ 00032 00033 #include <assert.h> 00034 #include "classifier.h" 00035 #include "addr-params.h" 00036 #include "route.h" 00037 00038 class HierClassifier : public Classifier { 00039 public: 00040 HierClassifier() : Classifier() { 00041 clsfr_ = new Classifier*[AddrParamsClass::instance().hlevel()]; 00042 } 00043 virtual ~HierClassifier() { 00044 // Deletion of contents (classifiers) is done in otcl 00045 delete []clsfr_; 00046 } 00047 inline virtual void recv(Packet *p, Handler *h) { 00048 clsfr_[0]->recv(p, h); 00049 } 00050 virtual int command(int argc, const char*const* argv); 00051 virtual void do_install(char *dst, NsObject *target); 00052 void set_table_size(int level, int csize); 00053 private: 00054 Classifier **clsfr_; 00055 }; 00056
1.3.3