#include <mpls-module.h>
Inheritance diagram for MPLSModule:


Definition at line 62 of file mpls-module.h.
Public Member Functions | |
| virtual 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) |
| virtual const char * | module_name () const |
| MPLSModule () | |
| Node * | node () |
| 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) |
| virtual | ~MPLSModule () |
Data Fields | |
| RoutingModule * | next_rtm_ |
Protected Member Functions | |
| void | attach_ldp (LDPAgent *a) |
| void | detach_ldp (LDPAgent *a) |
| LDPAgent * | exist_ldp (int nbr) |
| LIST_HEAD (LDPList, LDPListElem) | |
Protected Attributes | |
| Classifier * | classifier_ |
| int | last_inlabel_ |
| int | last_outlabel_ |
| LDPList | ldplist_ |
| Node * | n_ |
Data Structures | |
| struct | LDPListElem |
|
|
Definition at line 64 of file mpls-module.h. References ldplist_, and LIST_INIT. 00064 : RoutingModule(), last_inlabel_(0), last_outlabel_(1000) { 00065 LIST_INIT(&ldplist_); 00066 }
|
|
|
Definition at line 68 of file mpls-module.cc. References ldplist_. 00069 { 00070 // Delete LDP agent list 00071 LDPListElem *e; 00072 for (LDPListElem *p = ldplist_.lh_first; p != NULL; ) { 00073 e = p; 00074 p = p->link.le_next; 00075 delete e; 00076 } 00077 }
|
|
||||||||||||
|
Reimplemented from RoutingModule. Definition at line 194 of file mpls-module.cc. References RoutingModule::add_route(), RoutingModule::classifier_, and RoutingModule::next_rtm_. 00194 { 00195 if (classifier_) 00196 ((MPLSAddressClassifier *)classifier_)->do_install(dst, target); 00197 if (next_rtm_ != NULL) 00198 next_rtm_->add_route(dst, target); 00199 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 88 of file rtmodule.h. References RoutingModule::n_. 00088 { n_ = n; return TCL_OK; }
|
|
|
Definition at line 74 of file mpls-module.h. References a, ldplist_, and LIST_INSERT_HEAD. Referenced by command(). 00074 { 00075 LDPListElem *e = new LDPListElem(a); 00076 LIST_INSERT_HEAD(&ldplist_, e, link); 00077 }
|
|
||||||||||||
|
Reimplemented from RoutingModule. Definition at line 99 of file mpls-module.cc. References a, attach_ldp(), RoutingModule::classifier_, RoutingModule::command(), detach_ldp(), exist_ldp(), last_inlabel_, last_outlabel_, ldplist_, RoutingModule::n_, RoutingModule::node(), Node::route_notify(), and Node::unreg_route_notify(). 00100 { 00101 Tcl& tcl = Tcl::instance(); 00102 if (argc == 2) { 00103 if (strcmp(argv[1], "new-incoming-label") == 0) { 00104 tcl.resultf("%d", ++last_inlabel_); 00105 return (TCL_OK); 00106 } else if (strcmp(argv[1], "new-outgoing-label") == 0) { 00107 tcl.resultf("%d", --last_outlabel_); 00108 return (TCL_OK); 00109 } else if (strcmp(argv[1], "get-ldp-agents") == 0) { 00110 for (LDPListElem *e = ldplist_.lh_first; e != NULL; 00111 e = e->link.le_next) 00112 tcl.resultf("%s %s", tcl.result(), 00113 e->agt_->name()); 00114 return (TCL_OK); 00115 } else if (strcmp(argv[1], "trace-ldp") == 0) { 00116 for (LDPListElem *e = ldplist_.lh_first; e != NULL; 00117 e = e->link.le_next) 00118 e->agt_->turn_on_trace(); 00119 return (TCL_OK); 00120 } else if (strcmp(argv[1], "trace-msgtbl") == 0) { 00121 printf("%d : message-table\n", node()->nodeid()); 00122 for (LDPListElem *e = ldplist_.lh_first; e != NULL; 00123 e = e->link.le_next) 00124 e->agt_->MSGTdump(); 00125 return (TCL_OK); 00126 } 00127 } else if (argc == 3) { 00128 if (strcmp(argv[1], "attach-ldp") == 0) { 00129 LDPAgent *a = (LDPAgent*)TclObject::lookup(argv[2]); 00130 if (a == NULL) { 00131 fprintf(stderr,"Wrong object name %s",argv[2]); 00132 return (TCL_ERROR); 00133 } 00134 attach_ldp(a); 00135 return (TCL_OK); 00136 } else if (strcmp(argv[1], "detach-ldp") == 0) { 00137 LDPAgent *a = (LDPAgent*)TclObject::lookup(argv[2]); 00138 if (a == NULL) { 00139 fprintf(stderr,"Wrong object name %s",argv[2]); 00140 return (TCL_ERROR); 00141 } 00142 detach_ldp(a); 00143 return (TCL_OK); 00144 } else if (strcmp(argv[1], "exist-ldp-agent") == 0) { 00145 tcl.resultf("%d", 00146 exist_ldp(atoi(argv[2])) == NULL ? 0 : 1 ); 00147 return (TCL_OK); 00148 } else if (strcmp(argv[1], "get-ldp-agent") == 0) { 00149 LDPAgent *a = exist_ldp(atoi(argv[2])); 00150 if (a == NULL) 00151 tcl.result(""); 00152 else 00153 tcl.resultf("%s", a->name()); 00154 return (TCL_OK); 00155 } 00156 else if (strcmp(argv[1] , "route-notify") == 0) { 00157 Node *node = (Node *)(TclObject::lookup(argv[2])); 00158 if (node == NULL) { 00159 tcl.add_errorf("Invalid node object %s", argv[2]); 00160 return TCL_ERROR; 00161 } 00162 if (node != n_) { 00163 tcl.add_errorf("Node object %s different from n_", argv[2]); 00164 return TCL_ERROR; 00165 } 00166 n_->route_notify(this); 00167 return TCL_OK; 00168 } 00169 if (strcmp(argv[1] , "unreg-route-notify") == 0) { 00170 Node *node = (Node *)(TclObject::lookup(argv[2])); 00171 if (node == NULL) { 00172 tcl.add_errorf("Invalid node object %s", argv[2]); 00173 return TCL_ERROR; 00174 } 00175 if (node != n_) { 00176 tcl.add_errorf("Node object %s different from n_", argv[2]); 00177 return TCL_ERROR; 00178 } 00179 n_->unreg_route_notify(this); 00180 return TCL_OK; 00181 } 00182 else if (strcmp(argv[1], "attach-classifier") == 0) { 00183 classifier_ = (MPLSAddressClassifier*)(TclObject::lookup(argv[2])); 00184 if (classifier_ == NULL) { 00185 tcl.add_errorf("Wrong object name %s",argv[2]); 00186 return TCL_ERROR; 00187 } 00188 return TCL_OK; 00189 } 00190 } 00191 return RoutingModule::command(argc, argv); 00192 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
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: ![]() |
|
|
Definition at line 79 of file mpls-module.cc. References a, ldplist_, and LIST_REMOVE. Referenced by command(). 00080 { 00081 for (LDPListElem *p = ldplist_.lh_first; p != NULL; 00082 p = p->link.le_next) 00083 if (p->agt_ == a) { 00084 LIST_REMOVE(p, link); 00085 delete p; 00086 break; 00087 } 00088 }
|
|
|
Definition at line 90 of file mpls-module.cc. References ldplist_. Referenced by command(). 00091 { 00092 for (LDPListElem *p = ldplist_.lh_first; p != NULL; 00093 p = p->link.le_next) 00094 if (p->agt_->peer() == nbr) 00095 return p->agt_; 00096 return NULL; 00097 }
|
|
||||||||||||
|
|
|
|
Reimplemented from RoutingModule. Definition at line 68 of file mpls-module.h.
|
|
|
Definition at line 78 of file rtmodule.h. References RoutingModule::n_. Referenced by VcRoutingModule::command(), ManualRoutingModule::command(), HierRoutingModule::command(), McastRoutingModule::command(), QSRoutingModule::command(), SourceRoutingModule::command(), BaseRoutingModule::command(), and command(). 00078 { return n_; }
|
|
|
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: ![]() |
|
||||||||||||
|
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: ![]() |
|
|
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: ![]() |
|
|
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: ![]() |
|
|
Reimplemented in BaseRoutingModule, McastRoutingModule, HierRoutingModule, and ManualRoutingModule. Definition at line 103 of file rtmodule.h. Referenced by RoutingModule::add_route(), add_route(), command(), RoutingModule::delete_route(), RoutingModule::RoutingModule(), and RoutingModule::set_table_size(). |
|
|
Definition at line 80 of file mpls-module.h. Referenced by command(). |
|
|
Definition at line 81 of file mpls-module.h. Referenced by command(). |
|
|
Definition at line 91 of file mpls-module.h. Referenced by attach_ldp(), command(), detach_ldp(), exist_ldp(), MPLSModule(), and ~MPLSModule(). |
|
|
|
Definition at line 99 of file rtmodule.h. Referenced by ManualRoutingModule::add_route(), RoutingModule::add_route(), add_route(), RoutingModule::delete_route(), RoutingModule::route_notify(), RoutingModule::set_table_size(), RoutingModule::unreg_route_notify(), and Node::unreg_route_notify(). |
1.4.6