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> first argument is the time <strong>at</strong> which this oper<strong>at</strong>ion will execute. i<strong>ns</strong>q{} takes the exact time as argument;i<strong>ns</strong>q-i{} takes the interval as argument, <strong>and</strong> schedules the oper<strong>at</strong>ion interval seconds after the current time.<strong>The</strong> following arguments specify the object, $obj, the i<strong>ns</strong>tance procedure of th<strong>at</strong> object, $iproc, <strong>and</strong> the argumentsto th<strong>at</strong> procedure, $args.<strong>The</strong>se arguments are placed into the route queue for execution <strong>at</strong> the appropri<strong>at</strong>e time.<strong>The</strong> i<strong>ns</strong>tance procedure runq{} executes eval $obj $iproc $args <strong>at</strong> the appropri<strong>at</strong>e i<strong>ns</strong>tant. After all the events forth<strong>at</strong> i<strong>ns</strong>tance are executed, runq{} will notify{} each object about the execution.Finally, the i<strong>ns</strong>tance procedure delq{} can remove a queued action with the time <strong>and</strong> the name of the object.31.3 Interaction with Unicast RoutingIn an earlier section, we had described how unicast routing reacts (Section 29.4.2) to changes to the topology. This sectiondetails the steps by which the network dynamics code will notify the nodes <strong>and</strong> routing about the changes to the topology.1. rtQueue::runq{} will invoke the procedures specified by each of the route model i<strong>ns</strong>tances. After all of the actio<strong>ns</strong>are completed, runq{} will notify each of the models.2. notify{} will then invoke i<strong>ns</strong>tance procedures <strong>at</strong> all of the nodes th<strong>at</strong> were incident to the affected links. Each routemodel stores the list of nodes in its i<strong>ns</strong>tance variable array, nodes_.It will then notify the RouteLogic i<strong>ns</strong>tance of topology changes.3. <strong>The</strong> rtModel object invokes the class Node i<strong>ns</strong>tance procedure intf-changed{} for each of the affected nodes.4. Node::intf-changed{} will notify any rtObject <strong>at</strong> the node of the possible changes to the topology.Recall th<strong>at</strong> these route objects are cre<strong>at</strong>ed when the simul<strong>at</strong>ion uses detailed dynamic unicast routing.31.3.1 Exte<strong>ns</strong>io<strong>ns</strong> to Other Classes<strong>The</strong> existing classes assume th<strong>at</strong> the topology is st<strong>at</strong>ic by default. In this section, we document the necessary changes to theseclasses to support dynamic topologies.We have already described the i<strong>ns</strong>tance procedures in the class Simul<strong>at</strong>or to cre<strong>at</strong>e or manipul<strong>at</strong>e route models, i.e.,rtmodel{}, rtmodel-<strong>at</strong>{}, rtmodel-delete{}, <strong>and</strong> rtmodel-configure{} in earlier sectio<strong>ns</strong> (Section 31.2.1).Similarly, the class Node contai<strong>ns</strong> the i<strong>ns</strong>tance procedure intf-changed{} th<strong>at</strong> we described in the previous section(Section 31.3).<strong>The</strong> network dynamics code oper<strong>at</strong>es on individual links. Each model currently tra<strong>ns</strong>l<strong>at</strong>es its specific<strong>at</strong>ion into oper<strong>at</strong>io<strong>ns</strong> onthe appropri<strong>at</strong>e links. <strong>The</strong> following paragraphs describe the class Link <strong>and</strong> rel<strong>at</strong>ed classes.class DynamicLink This class is the only TclObject in the network dynamics code. <strong>The</strong> shadow class is called classDynaLink. <strong>The</strong> class supports one bound variable, st<strong>at</strong>us_. st<strong>at</strong>us_ is 1 when the link is up, <strong>and</strong> 0 when the link isdown. <strong>The</strong> shadow object’s recv() method checks the st<strong>at</strong>us_ variable, to decide whether or not a packet should beforwarded.278

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

Saved successfully!

Ooh no, something went wrong!