Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

rtmodule.h

Go to the documentation of this file.
00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- 
00002  *
00003  * Copyright (C) 2000 by USC/ISI
00004  * All rights reserved.                                            
00005  *                                                                
00006  * Redistribution and use in source and binary forms are permitted
00007  * provided that the above copyright notice and this paragraph are
00008  * duplicated in all such forms and that any documentation, advertising
00009  * materials, and other materials related to such distribution and use
00010  * acknowledge that the software was developed by the University of
00011  * Southern California, Information Sciences Institute.  The name of the
00012  * University may not be used to endorse or promote products derived from
00013  * this software without specific prior written permission.
00014  * 
00015  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
00016  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00017  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018  *
00019  * $Header: /nfs/jade/vint/CVSROOT/ns-2/routing/rtmodule.h,v 1.14 2002/12/18 03:36:37 sundarra Exp $
00020  *
00021  * Definition of RoutingModule, base class for all extensions to routing 
00022  * functionality in a Node. These modules are meant to be "plugin", and 
00023  * should be configured via node-config{} interface in tcl/lib/ns-lib.tcl.
00024  */
00025 
00026 #ifndef ns_rtmodule_h
00027 #define ns_rtmodule_h
00028 
00029 #include <tclcl.h>
00030 #include "addr-params.h"
00031 #include "classifier.h"
00032 #include "classifier-hash.h"
00033 #include "classifier-hier.h"
00034 
00035 
00036 
00037 class NsObject;
00038 class Node;
00039 class VirtualClassifier;
00040 class DestHashClassifier;
00041 
00042 
00043 class RoutingModule : public TclObject {
00044 public:
00045         RoutingModule(); 
00046         /*
00047          * Returns the node to which this module is attached.
00048          */ 
00049         inline Node* node() { return n_; }
00050         /*
00051          * Node-related module-specific initialization can be done here.
00052          * However: (1) RoutingModule::attach() must be called from derived
00053          * class so the value of n_ is setup, (2) module-specific 
00054          * initialization that does not require knowledge of Node should 
00055          * always stay in the module constructor.
00056          *
00057          * Return TCL_ERROR if initialization fails.
00058          */
00059         virtual int attach(Node *n) { n_ = n; return TCL_OK; }
00060         virtual int command(int argc, const char*const* argv);
00061         virtual const char* module_name() const { return NULL; }
00062 
00063         /* support for populating rtg table */
00064         void route_notify(RoutingModule *rtm);
00065         void unreg_route_notify(RoutingModule *rtm);
00066         virtual void add_route(char *dst, NsObject *target); 
00067         virtual void delete_route(char *dst, NsObject *nullagent);
00068         void set_table_size(int nn);
00069         void set_table_size(int level, int csize);
00070         RoutingModule *next_rtm_;
00071         
00072 protected:
00073         Node *n_;
00074         Classifier *classifier_;
00075 };
00076 
00077 class BaseRoutingModule : public RoutingModule {
00078 public:
00079         BaseRoutingModule() : RoutingModule() {}
00080         virtual const char* module_name() const { return "Base"; }
00081         virtual int command(int argc, const char*const* argv);
00082 protected:
00083         DestHashClassifier *classifier_;
00084 };
00085 
00086 class McastRoutingModule : public RoutingModule {
00087 public:
00088         McastRoutingModule() : RoutingModule() {}
00089         virtual const char* module_name() const { return "Mcast"; }
00090         virtual int command(int argc, const char*const* argv);
00091 protected:
00092         DestHashClassifier *classifier_;        
00093 };
00094 
00095 class HierRoutingModule : public RoutingModule {
00096 public:
00097         HierRoutingModule() : RoutingModule() {}
00098         virtual const char* module_name() const { return "Hier"; }
00099         virtual int command(int argc, const char*const* argv);
00100 protected:
00101         HierClassifier *classifier_;
00102 };
00103 
00104 class ManualRoutingModule : public RoutingModule {
00105 public:
00106         ManualRoutingModule() : RoutingModule() {}
00107         virtual const char* module_name() const { return "Manual"; }
00108         virtual int command(int argc, const char*const* argv);
00109         void add_route(char *dst, NsObject *target);
00110 protected:
00111         DestHashClassifier *classifier_;
00112 };
00113 
00114 class SourceRoutingModule : public RoutingModule {
00115 public:
00116         SourceRoutingModule() : RoutingModule() {}
00117         virtual const char* module_name() const { return "Source"; }
00118         virtual int command(int argc, const char*const* argv);
00119 };
00120 
00121 class QSRoutingModule : public RoutingModule {
00122 public:
00123         QSRoutingModule() : RoutingModule() {}
00124         virtual const char* module_name() const { return "QS"; }
00125                 virtual int command(int argc, const char*const* argv);
00126 };
00127 
00128 class VcRoutingModule : public RoutingModule {
00129 public:
00130         VcRoutingModule() : RoutingModule() {}
00131         virtual const char* module_name() const { return "VC"; }
00132         virtual int command(int argc, const char*const* argv);
00133         virtual void add_route(char *, NsObject *);
00134 };
00135 
00136 
00137 
00138 class PgmRoutingModule : public RoutingModule {
00139 public:
00140         PgmRoutingModule() : RoutingModule() {}
00141         virtual const char* module_name() const { return "PGM"; }
00142 };
00143 
00144 class LmsRoutingModule : public RoutingModule {
00145 public:
00146         LmsRoutingModule() : RoutingModule() {}
00147         virtual const char* module_name() const { return "LMS"; }
00148         // virtual int command(int argc, const char*const* argv);
00149         virtual void add_route(char *dst, NsObject *target){}
00150 };
00151 
00152 #endif //  ns_rtmodule_h

Generated on Tue Apr 20 12:14:30 2004 for NS2.26SourcesOriginal by doxygen 1.3.3