Next: 23.4.1.0.3 The rtPeer../ns-2/route-proto.tcl
Up: 23.4.1 The classes
Previous: 23.4.1.0.1 RouteLogic../ns-2/route-proto.tcl
is used in simulations that use dynamic routing.
Each node has a rtObject associated with it, that
acts as a co-ordinator for the different routing protocols that
operate at a node.
At any node, the rtObject at that node
tracks each of the protocols operating at that node;
it computes and installs the nest route to each destination
available via each of the protocols.
In the event that the routing tables change, or the topology changes,
the rtObject will alert the protocols to take the appropriate action.
The class defines the procedure
[]init-all../ns-2/route-proto.tclrtObject::init-all;
this procedure takes a list of nodes as arguments,
and creates a rtObject at each of the nodes in its argument list.
It subsequently invokes its compute-routes.
The assumption is that the constructor for each of the new objects
will instantiate the ``Direct'' route protocol at each of these nodes.
This route protocol is responsible for computing the routes to
immediately adjacent neighbors.
When []compute-routes is run by the []init-all
procedure, these direct routes are installed in the node by the
appropriate route object.
The other instance procedures in this class are:
- []init../ns-2/route-proto.tclrtObject::init
The constructor sets up pointers from itself to the node,
in its instance variable node_, and from the node to itself,
through the Node instance procedure
[]init-routing and the Node instance variable rtObject_.
It then initializes an array of
nextHop_, rtpref_, metric_, rtVia_.
The index of each of these arrays is the handle of the destination node.
The nextHop_ contains the link that will be used to reach the
particular destination;
rtpref_ and metric_ are
the preference and metric for the route installed in the node;
rtVia_ is the name of the agent whose route is installed in the node.
The constructor also creates the instance of the Direct route protocol,
and invokes []compute-routes for that protocol.
-
[]add-proto../ns-2/route-proto.tclrtObject::add-proto
creates an instance of the protocol, stores a reference to it
in its array of protocols, rtProtos_.
The index of the array is the name of the protocol.
It also attaches the protocol object to the node,
and returns the handle of the protocol object.
- []lookup../ns-2/route-proto.tclrtObject::lookup
takes a destination node handle, and returns the id of the neighbor node
that is used to reach the destination.
If multiple paths are in use, then it returns a list of the
neighbor nodes that will be used.
If the node does not have a route to the destination,
the procedure will return -1.
-
[]compute-routes../ns-2/route-proto.tclrtObject::compute-routes
is the core procedure in this class.
It first checks to see if any of the routing protocols
at the node have computed any new routes.
If they have,
it will determine the best route to each destination
from among all the protocols.
If any routes have changed,
the procedure will notify each of the protocols of the number of
such changes, in case any of these protocols wants to send a fresh update.
Finally, it will also notify any multicast protocol that new unicast route
tables have been computed.
The routine checks the protocol agent's instance variable,
rtsChanged_ to see if any of the routes in that protocol
have changed since the protocol was last examined.
It then uses the protocol's instance variable arrays,
nextHop_, rtpref_, and metric_
to compute its own arrays.
The rtObject will install or modify any of the routes as the changes are found.
If any of the routes at the node have changed,
the rtObject will invoke the protocol agent's instance procedures,
[]send-updates with the number of changes as argument.
It will then invoke the multicast route object, if it exists.
The next set of routines are used to query the rtObject for various state
information.
Next: 23.4.1.0.3 The rtPeer../ns-2/route-proto.tcl
Up: 23.4.1 The classes
Previous: 23.4.1.0.1 RouteLogic../ns-2/route-proto.tcl
2000-08-24