The method is used by the class Simulator, and unicast and multicast routing.
The instance procedure init-routing is invoked by the rtObject at the node. It stores a pointer to the rtObject, in its instance variable rtObject_, for later manipulation or retrieval. It also checks its class variable to see if it should use multiPath routing, and sets up an instance variable to that effect. If multiPath routing could be used, the instance variable array routes_ stores a count of the number of paths installed for each destination. This is the only array in unicast routing that is indexed by the node id, rather than the node handle.
The instance procedure rtObject? returns the rtObject handle for that node.
The instance procedure add-routes takes a node id, and a list of links. It will add the list of links as the routes to reach the destination identified by the node id. The realization of multiPath routing is done by using a separate Classifier/multiPath. For any given destination id , if this node has multiple paths to , then the main classifier points to this multipath classifier instead of the link to reach the destination. Each of the multiple paths identified by the interfaces being used is installed in the multipath classifier. The multipath classifier will use each of the links installed in it for succeeding packets forwarded to it.
The instance procedure delete-routes takes a node id, a list of interfaces, and a nullAgent. It removes each of the interfaces in the list from the installed list of interfaces. If the entry did not previously use a multipath classifier, then it must have had only one route, and the route entry is set to point to the nullAgent specified.
Q: WHY DOES IT NOT POINT TO NULLAGENT IF THE ENTRIES IN THE MPATHCLASSIFIER GOES TO ZERO?
Note that cost takes the cost as argument. It is preferable to use the simulator method to set the cost variable, similar to the simulator instance procedures to set the queue or delay on a link.
The instance procedure install../ns-2/route-proto.tclClassifier::install overloads the existing instproc-like of the same name. The procedure stores the entry being installed in the instance variable array, elements_, and then invokes the instproc-like.
The instance procedure installNext../ns-2/route-proto.tclClassifier::installNext also overloads the existing instproc-like of the same name. This instproc-like simply installs the entry into the next available slot.
The instance procedure adjacents../ns-2/route-proto.tclClassifier::adjacents returns a list of key, value pairs of all elements installed in the classifier.
Tom Henderson 2011-11-05