30.4.1.0.4 Agent/rtProto../ns-2/route-proto.tcl

This class is the base class from which all routing protocol agents are derived. Each protocol agent must define the procedure[]init-all to initialize the complete protocol, and possibly instance procedures []init, []compute-routes, and []send-updates. In addition, if the topology is dynamic, and the protocol supports route computation to react to changes in the topology, then the protocol should define the procedure []compute-all, and possibly the instance procedure []intf-changed. In this section, we will briefly describe the interface for the basic procedures. We will defer the description of []compute-all and []intf-changed to the section on network dynamics. We also defer the description of the details of each of the protocols to their separate section at the end of the chapter.
--
The procedure []init-all../ns-2/route-proto.tclAgent/rtProto::init-all is a global initialization procedure for the class. It may be given a list of the nodes as an argument. This the list of nodes that should run this routing protocol. However, centralized routing protocols such as static and session routing will ignore this argument; detailed dynamic routing protocols such as DV will use this argument list to instantiate protocols agents at each of the nodes specified.

Note that derived classes in OTcl do not inherit the procedures defined in the base class. Therefore, every derived routing protocol class must define its own procedures explicitly.

--
The instance procedure []init../ns-2/route-proto.tclAgent/rtProto::init is the constructor for protocol agents that are created. The base class constructor initializes the default preference for objects in this class, identifies the interfaces incident on the node and their current status. The interfaces are indexed by the neighbor handle and stored in the instance variable array, ifs_; the corresponding status instance variable array is ifstat_.

Centralized routing protocols such as static and session routing do not create separate agents per node, and therefore do not access any of these instance procedures.

--
The instance procedure []compute-routes../ns-2/route-proto.tclAgent/rtProto::compute-routes computes the actual routes for the protocol. The computation is based on the routes learned by the protocol, and varies from protocol to protocol.

This routine is invoked by the rtObject whenever the topology changes. It is also invoked when the node receives an update for the protocol.

If the routine computes new routes, []rtObject::compute-routes needs to be invoked to recompute and possibly install new routes at the node. The actual invoking of the rtObject is done by the procedure that invoked this routine in the first place.

--
The instance procedure []send-updates../ns-2/route-proto.tclAgent/rtProto::send-updates is invoked by the rtObject whenever the node routing tables have changed, and fresh updates have to be sent to all peers. The rtObject passes as argument the number of changes that were done. This procedure may also be invoked when there are no changes to the routes, but the topology incident on the node changes state. The number of changes is used to determine the list of peers to which a route update must be sent.
Other procedures relate to responding to topology changes and are described laterSectionsec:rtglibAPI.

Tom Henderson 2011-11-05