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.

a LanIface object is cre<strong>at</strong>ed. LanIface contai<strong>ns</strong> all other objects th<strong>at</strong> are needed on the per–node basis: a Queue, a linklayer (LL), Mac, etc. It should be emphasized th<strong>at</strong> LanNode is a node only for routing algorithms: Node <strong>and</strong> LanNodehave very little in common. One of few things th<strong>at</strong> they share is an identifier taken from the Node ID–space. If hierarchicalrouting is used, LanNode has to be assigned a hierarchical address just like any other node. From the point of view of <strong>ns</strong>(st<strong>at</strong>ic) routing, LanNode is just another node connected to every node on the LAN. Links connecting the LanNode withn1n2n1n2LANLANn3n4n3n4Figure 14.2: Actual LAN configur<strong>at</strong>ion (left) <strong>and</strong> as seen by <strong>ns</strong> routing (right)the nodes on the LAN are also “virtual” (Vlink). <strong>The</strong> default routing cost of such a link is 1/2, so the cost of traversing twoVlinks (e.g. n1 → LAN → n2) is counted as just one hop.Most important method of Vlink is the one th<strong>at</strong> gives the head of the link:Vlink i<strong>ns</strong>tproc head {} {$self i<strong>ns</strong>tvar lan_ dst_ src_if {$src_ == [$lan_ set id_]} {# if this is a link FROM the lan vnode,# it doesn’t m<strong>at</strong>ter wh<strong>at</strong> we return, because# it’s only used by $lan add-route (empty)return ""} else {# if this is a link TO the lan vnode,# return the entry to the lanIface objectset src_lif [$lan_ set lanIface_($src_)]return [$src_lif entry]}}This method is used by st<strong>at</strong>ic (default) routing to i<strong>ns</strong>tall correct routes <strong>at</strong> a node (see Simul<strong>at</strong>or methodscompute-fl<strong>at</strong>-routes <strong>and</strong> compute-hier-routes in tcl/lib/<strong>ns</strong>-route.tcl, as well as Node methodsadd-route <strong>and</strong> add-hroute in tcl/lib/<strong>ns</strong>-node.tcl).From the code fragment above it can be seen th<strong>at</strong> it retur<strong>ns</strong> LAN interface of the node as a head of the link to be i<strong>ns</strong>talled inthe appropri<strong>at</strong>e classifier.Thus, Vlink does not impose any delay on the packet <strong>and</strong> serves the only purpose to i<strong>ns</strong>tall LAN interfaces i<strong>ns</strong>tead of normallinks <strong>at</strong> nodes’ classifiers.Note, th<strong>at</strong> this design allows to have nodes connected by parallel LANs, while in the current implement<strong>at</strong>ion it is impossibleto have nodes connected by parallel simple links <strong>and</strong> use them both (the array Simul<strong>at</strong>or i<strong>ns</strong>tvar link_ holds thelink object for each connected pair of source <strong>and</strong> destin<strong>at</strong>ion, <strong>and</strong> it can be only one object per source/destin<strong>at</strong>ion pair).139

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

Saved successfully!

Ooh no, something went wrong!