ManualRoutingModule Class Reference

#include <rtmodule.h>

Inheritance diagram for ManualRoutingModule:

RoutingModule TclObject Collaboration diagram for ManualRoutingModule:

Collaboration graph
[legend]

Detailed Description

Definition at line 133 of file rtmodule.h.

Public Member Functions

void add_route (char *dst, NsObject *target)
virtual int attach (Node *n)
virtual int command (int argc, const char *const *argv)
virtual void delete_route (char *dst, NsObject *nullagent)
 ManualRoutingModule ()
virtual const char * module_name () const
Nodenode ()
void route_notify (RoutingModule *rtm)
void set_table_size (int level, int csize)
void set_table_size (int nn)
void unreg_route_notify (RoutingModule *rtm)

Data Fields

RoutingModulenext_rtm_

Protected Attributes

DestHashClassifierclassifier_
Noden_


Constructor & Destructor Documentation

ManualRoutingModule::ManualRoutingModule  )  [inline]
 

Definition at line 135 of file rtmodule.h.

00135 : RoutingModule() {}


Member Function Documentation

void ManualRoutingModule::add_route char *  dst,
NsObject target
[virtual]
 

Reimplemented from RoutingModule.

Definition at line 498 of file rtmodule.cc.

References RoutingModule::add_route(), classifier_, HashClassifier::do_set_hash(), Classifier::install_next(), AddrParamsClass::instance(), RoutingModule::next_rtm_, and HashClassifier::set_default().

00498                                                                {
00499     int slot = classifier_->install_next(target);
00500     if (strcmp(dst, "default") == 0) {
00501         classifier_->set_default(slot);
00502     } else {
00503         int encoded_dst_address = 
00504             (atoi(dst)) << (AddrParamsClass::instance().node_shift(1));
00505         if (0 > (classifier_->do_set_hash(0, encoded_dst_address, 0, slot))) {
00506             fprintf(stderr, "HashClassifier::set_hash() return value less than 0\n"); }
00507     }
00508     if (next_rtm_ != NULL)
00509         next_rtm_->add_route(dst, target); 
00510 }

Here is the call graph for this function:

virtual int RoutingModule::attach Node n  )  [inline, virtual, inherited]
 

Definition at line 88 of file rtmodule.h.

References RoutingModule::n_.

00088 { n_ = n; return TCL_OK; }

int ManualRoutingModule::command int  argc,
const char *const *  argv
[virtual]
 

Reimplemented from RoutingModule.

Definition at line 356 of file rtmodule.cc.

References RoutingModule::command(), RoutingModule::n_, RoutingModule::node(), Node::route_notify(), and Node::unreg_route_notify().

00356                                                                  {
00357     Tcl& tcl = Tcl::instance();
00358     if (argc == 3) {
00359         if (strcmp(argv[1] , "route-notify") == 0) {
00360             Node *node = (Node *)(TclObject::lookup(argv[2]));
00361             if (node == NULL) {
00362                 tcl.add_errorf("Invalid node object %s", argv[2]);
00363                 return TCL_ERROR;
00364             }
00365             if (node != n_) {
00366                 tcl.add_errorf("Node object %s different from node_", argv[2]);
00367                 return TCL_ERROR;
00368             }
00369             n_->route_notify(this);
00370             return TCL_OK;
00371         }
00372         if (strcmp(argv[1] , "unreg-route-notify") == 0) {
00373             Node *node = (Node *)(TclObject::lookup(argv[2]));
00374             if (node == NULL) {
00375                 tcl.add_errorf("Invalid node object %s", argv[2]);
00376                 return TCL_ERROR;
00377             }
00378             if (node != n_) {
00379                 tcl.add_errorf("Node object %s different from n_", argv[2]);
00380                 return TCL_ERROR;
00381             }
00382             n_->unreg_route_notify(this);
00383             return TCL_OK;
00384         }
00385     }
00386     return (RoutingModule::command(argc, argv));
00387 }

Here is the call graph for this function:

void RoutingModule::delete_route char *  dst,
NsObject nullagent
[virtual, inherited]
 

Definition at line 453 of file rtmodule.cc.

References RoutingModule::add_route(), RoutingModule::classifier_, Classifier::do_install(), and RoutingModule::next_rtm_.

Referenced by Node::delete_route().

00454 {
00455     if (classifier_) 
00456         classifier_->do_install(dst, nullagent); 
00457     if (next_rtm_)
00458         next_rtm_->add_route(dst, nullagent); 
00459 }

Here is the call graph for this function:

virtual const char* ManualRoutingModule::module_name  )  const [inline, virtual]
 

Reimplemented from RoutingModule.

Definition at line 136 of file rtmodule.h.

00136 { return "Manual"; }

Node* RoutingModule::node void   )  [inline, inherited]
 

Definition at line 78 of file rtmodule.h.

References RoutingModule::n_.

Referenced by VcRoutingModule::command(), command(), HierRoutingModule::command(), McastRoutingModule::command(), QSRoutingModule::command(), SourceRoutingModule::command(), BaseRoutingModule::command(), and MPLSModule::command().

00078 { return n_; }

void RoutingModule::route_notify RoutingModule rtm  )  [inherited]
 

Definition at line 425 of file rtmodule.cc.

References RoutingModule::next_rtm_, and RoutingModule::route_notify().

Referenced by RoutingModule::route_notify(), and Node::route_notify().

00425                                                    {
00426     if (next_rtm_ != NULL)
00427         next_rtm_->route_notify(rtm);
00428     else
00429         next_rtm_ = rtm;
00430 }

Here is the call graph for this function:

void RoutingModule::set_table_size int  level,
int  csize
[inherited]
 

Definition at line 469 of file rtmodule.cc.

References RoutingModule::classifier_, RoutingModule::next_rtm_, RoutingModule::set_table_size(), and Classifier::set_table_size().

00470 {
00471     if (classifier_)
00472         classifier_->set_table_size(level, size);
00473     if (next_rtm_)
00474         next_rtm_->set_table_size(level, size);
00475 }

Here is the call graph for this function:

void RoutingModule::set_table_size int  nn  )  [inherited]
 

Definition at line 461 of file rtmodule.cc.

References RoutingModule::classifier_, RoutingModule::next_rtm_, RoutingModule::set_table_size(), and Classifier::set_table_size().

Referenced by RoutingModule::set_table_size(), and Node::set_table_size().

00462 {
00463     if (classifier_)
00464         classifier_->set_table_size(nn);
00465     if (next_rtm_)
00466         next_rtm_->set_table_size(nn);
00467 }

Here is the call graph for this function:

void RoutingModule::unreg_route_notify RoutingModule rtm  )  [inherited]
 

Definition at line 432 of file rtmodule.cc.

References RoutingModule::next_rtm_, and RoutingModule::unreg_route_notify().

Referenced by RoutingModule::unreg_route_notify(), and Node::unreg_route_notify().

00432                                                          {
00433     if (next_rtm_) {
00434         if (next_rtm_ == rtm) {
00435             //RoutingModule *tmp = next_rtm_;
00436             next_rtm_ = next_rtm_->next_rtm_;
00437             //free (tmp);
00438         }
00439         else {
00440             next_rtm_->unreg_route_notify(rtm);
00441         }
00442     }
00443 }

Here is the call graph for this function:


Field Documentation

DestHashClassifier* ManualRoutingModule::classifier_ [protected]
 

Reimplemented from RoutingModule.

Definition at line 140 of file rtmodule.h.

Referenced by add_route().

Node* RoutingModule::n_ [protected, inherited]
 

Definition at line 102 of file rtmodule.h.

Referenced by RoutingModule::attach(), VcRoutingModule::command(), command(), HierRoutingModule::command(), McastRoutingModule::command(), QSRoutingModule::command(), SourceRoutingModule::command(), BaseRoutingModule::command(), RoutingModule::command(), MPLSModule::command(), and RoutingModule::node().

RoutingModule* RoutingModule::next_rtm_ [inherited]
 

Definition at line 99 of file rtmodule.h.

Referenced by add_route(), RoutingModule::add_route(), MPLSModule::add_route(), RoutingModule::delete_route(), RoutingModule::route_notify(), RoutingModule::set_table_size(), RoutingModule::unreg_route_notify(), and Node::unreg_route_notify().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:19:47 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6