12.07.2015 Views

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 ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> routine send-periodic-upd<strong>at</strong>e{} invokes send-upd<strong>at</strong>es{} to send the actual upd<strong>at</strong>es. It then reschedulessending the next periodic upd<strong>at</strong>e after advertInterval jittered slightly to avoid possible synchroniz<strong>at</strong>ion effects.send-upd<strong>at</strong>es{} will send upd<strong>at</strong>es to a select set of peers. If any of the routes <strong>at</strong> th<strong>at</strong> node have changed, or for periodicupd<strong>at</strong>es, the procedure will send upd<strong>at</strong>es to all peers. Otherwise, if some incident links have just recovered, the procedurewill send upd<strong>at</strong>es to the adjacent peers on those incident links only.send-upd<strong>at</strong>es{} uses the procedure send-to-peer{} to send the actual upd<strong>at</strong>es. This procedure packages the upd<strong>at</strong>e,taking the split-horizon <strong>and</strong> poison reverse mechanisms into account. It invokes the i<strong>ns</strong>tproc-like, send-upd<strong>at</strong>e{} (Notethe singular case) to send the actual upd<strong>at</strong>e. <strong>The</strong> actual route upd<strong>at</strong>e is stored in the class variable msg_ indexed by a nondecreasinginteger as index. <strong>The</strong> i<strong>ns</strong>tproc-like only sends the index to msg_ to the remote peer. This elimin<strong>at</strong>es the need toconvert from OTcl strings to altern<strong>at</strong>e form<strong>at</strong>s <strong>and</strong> back.When a peer receives a route upd<strong>at</strong>e it first checks to determine if the upd<strong>at</strong>e from differs from the previous ones. <strong>The</strong> agentwill compute new routes if the upd<strong>at</strong>e contai<strong>ns</strong> new inform<strong>at</strong>ion.29.6 Unicast routing objectsRoutelogic <strong>and</strong> rtObject are two objects th<strong>at</strong> are significant to unicast routing in <strong>ns</strong>. Routelogic, essentially, represents therouting table th<strong>at</strong> is cre<strong>at</strong>ed <strong>and</strong> maintained centrally for every unicast simul<strong>at</strong>ion. rtObject is the object th<strong>at</strong> every nodetaking part in dynamic unicast routing, has an i<strong>ns</strong>tance of. Note th<strong>at</strong> nodes will not have an i<strong>ns</strong>tance of this object if Sessionrouting is done as a detailed routing protocol is not being simul<strong>at</strong>ed in this case. <strong>The</strong> methods for RouteLogic <strong>and</strong> rtObjectare described in the next section.29.7 Comm<strong>and</strong>s <strong>at</strong> a glanceFollowing is a list of unicast routing rel<strong>at</strong>ed comm<strong>and</strong>s used in simul<strong>at</strong>ion scripts:$<strong>ns</strong>_ rtproto where defines the type of routing protocol to be used, like St<strong>at</strong>ic, <strong>Manual</strong>, Session , DV etc. args may definethe list of nodes on which the protocol is to be run. <strong>The</strong> node list defaults to all nodes in the topology.Internal methods:$<strong>ns</strong>_ compute-routesThis comm<strong>and</strong> computes next_hop inform<strong>at</strong>ion for all nodes in the topology using the topology connectivity. Thisnext_hop info is then used to popul<strong>at</strong>e the node classifiers or the routing tables. compute-routes calls compute-fl<strong>at</strong>-routesor compute-hier-routes depending on the type of addressing being used for the simul<strong>at</strong>ion.$<strong>ns</strong>_ get-routelogicThis retur<strong>ns</strong> a h<strong>and</strong>le to the RouteLogic object (the routing table), if one has been cre<strong>at</strong>ed. Otherwise a new routing tableobject is cre<strong>at</strong>ed.$<strong>ns</strong>_ dump-routelogic-nh259

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

Saved successfully!

Ooh no, something went wrong!