The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ... The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

The routine send-periodic-update{} invokes send-updates{} to send the actual updates. It then reschedulessending the next periodic update after advertInterval jittered slightly to avoid possible synchronization effects.send-updates{} will send updates to a select set of peers. If any of the routes at that node have changed, or for periodicupdates, the procedure will send updates to all peers. Otherwise, if some incident links have just recovered, the procedurewill send updates to the adjacent peers on those incident links only.send-updates{} uses the procedure send-to-peer{} to send the actual updates. This procedure packages the update,taking the split-horizon and poison reverse mechanisms into account. It invokes the instproc-like, send-update{} (Notethe singular case) to send the actual update. The actual route update is stored in the class variable msg_ indexed by a nondecreasinginteger as index. The instproc-like only sends the index to msg_ to the remote peer. This eliminates the need toconvert from OTcl strings to alternate formats and back.When a peer receives a route update it first checks to determine if the update from differs from the previous ones. The agentwill compute new routes if the update contains new information.29.6 Unicast routing objectsRoutelogic and rtObject are two objects that are significant to unicast routing in ns. Routelogic, essentially, represents therouting table that is created and maintained centrally for every unicast simulation. rtObject is the object that every nodetaking part in dynamic unicast routing, has an instance of. Note that nodes will not have an instance of this object if Sessionrouting is done as a detailed routing protocol is not being simulated in this case. The methods for RouteLogic and rtObjectare described in the next section.29.7 Commands at a glanceFollowing is a list of unicast routing related commands used in simulation scripts:$ns_ rtproto where defines the type of routing protocol to be used, like Static, Manual, Session , DV etc. args may definethe list of nodes on which the protocol is to be run. The node list defaults to all nodes in the topology.Internal methods:$ns_ compute-routesThis command computes next_hop information for all nodes in the topology using the topology connectivity. Thisnext_hop info is then used to populate the node classifiers or the routing tables. compute-routes calls compute-flat-routesor compute-hier-routes depending on the type of addressing being used for the simulation.$ns_ get-routelogicThis returns a handle to the RouteLogic object (the routing table), if one has been created. Otherwise a new routing tableobject is created.$ns_ dump-routelogic-nh259

This dumps next hop information in the routing table.$ns_ dump-routelogic-distanceThis dumps the distance information in the routing table.$node add-route This is a method used to add routing entries (nexthop information) in the node’s routing table. The nexthop to fromthis node is the object and this info is added to the node’s classifier.$routelogic lookup Returns the id of the node that is the next hop from the node with id srcid to the node with id destid.$routelogic dump Dump the routing tables of all nodes whose id is less than nodeid. Node ids are typically assigned to nodes in ascendingfashion starting from 0 by their order of creation.rtobject dump-routes Dump the routing table to the output channel specified by fileID. fileID must be a file handle returned by the Tcl opencommand and it must have been opened for writing.$rtobject rtProto?Returns a handle to the routing protocol agent specified by proto if it exists at that node. Returns an empty string otherwise.$rtobject nextHop?Returns the id of the node that is the next hop to the destination specified by the node id, .$rtobject rtpref?destIDReturns the preference for the route to destination node given by destid.$rtobject metric?destIDReturns metric for the route to destid.260

This dumps next hop inform<strong>at</strong>ion in the routing table.$<strong>ns</strong>_ dump-routelogic-distanceThis dumps the distance inform<strong>at</strong>ion in the routing table.$node add-route This is a method used to add routing entries (nexthop inform<strong>at</strong>ion) in the node’s routing table. <strong>The</strong> nexthop to fromthis node is the object <strong>and</strong> this info is added to the node’s classifier.$routelogic lookup Retur<strong>ns</strong> the id of the node th<strong>at</strong> is the next hop from the node with id srcid to the node with id destid.$routelogic dump Dump the routing tables of all nodes whose id is less than nodeid. Node ids are typically assigned to nodes in ascendingfashion starting from 0 by their order of cre<strong>at</strong>ion.rtobject dump-routes Dump the routing table to the output channel specified by fileID. fileID must be a file h<strong>and</strong>le returned by the Tcl opencomm<strong>and</strong> <strong>and</strong> it must have been opened for writing.$rtobject rtProto?Retur<strong>ns</strong> a h<strong>and</strong>le to the routing protocol agent specified by proto if it exists <strong>at</strong> th<strong>at</strong> node. Retur<strong>ns</strong> an empty string otherwise.$rtobject nextHop?Retur<strong>ns</strong> the id of the node th<strong>at</strong> is the next hop to the destin<strong>at</strong>ion specified by the node id, .$rtobject rtpref?destIDRetur<strong>ns</strong> the preference for the route to destin<strong>at</strong>ion node given by destid.$rtobject metric?destIDRetur<strong>ns</strong> metric for the route to destid.260

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!