next up previous contents index
Next: 13.10 Commands at a Up: 13. Local Area Networks Previous: 13.8 Other Components

   
13.9 LANs and routing

When a LAN is created using either make-lan or newLan, a ``virtual LAN node'' LanNode is created. LanNode keeps together all shared objects on the LAN: Channel, Classifier/Mac, and LanRouter. Then for each node on the LAN, a LanIface object is created. LanIface contains all other objects that are needed on the per-node basis: a Queue, a link layer (LL), Mac, etc. It should be emphasized that LanNode is a node only for routing algorithms: Node and LanNode have very little in common. One of few things that they share is an identifier taken from the Node ID-space. If hierarchical routing is used, LanNode has to be assigned a hierarchical address just like any other node. From the point of view of (static) routing, LanNode is just another node connected to every node on the LAN.

  
Figure: Actual LAN configuration (left) and as seen by routing (right)
lan2

Links connecting the LanNode with the nodes on the LAN are also ``virtual'' (Vlink). The default routing cost of such a link is 1/2, so the cost of traversing two Vlinks (e.g. n1 LAN n2) is counted as just one hop.

Most important method of Vlink is the one that gives the head of the link:

Vlink instproc head {} {
    $self instvar lan_ dst_ src_
    if {$src_ == [$lan_ set id_]} {
        # if this is a link FROM the lan vnode, 
        # it doesn't matter what 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 object
        set src_lif [$lan_ set lanIface_($src_)]
        return [$src_lif entry]
    }
}
This method is used by static (default) routing to install correct routes at a node (see Simulator methods
compute-flat-routes and compute-hier-routes in tcl/lib/ns-route.tcl, as well as Node methods add-route and add-hroute in tcl/lib/ns-node.tcl).

From the code fragment above it can be seen that it returns LAN interface of the node as a head of the link to be installed in the appropriate classifier.

Thus, Vlink does not impose any delay on the packet and serves the only purpose to install LAN interfaces instead of normal links at nodes' classifiers.

Note, that this design allows to have nodes connected by parallel LANs, while in the current implementation it is impossible to have nodes connected by parallel simple links and use them both (the array Simulator instvar link_ holds the link object for each connected pair of source and destination, and it can be only one object per source/destination pair).


next up previous contents index
Next: 13.10 Commands at a Up: 13. Local Area Networks Previous: 13.8 Other Components

2000-08-24