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.

head{}queue{}link{}up{}down{}up?{}all-connectors{}cost{}cost?{}retur<strong>ns</strong> the h<strong>and</strong>le for head_.retur<strong>ns</strong> the h<strong>and</strong>le for queue_.retur<strong>ns</strong> the h<strong>and</strong>le for the delay element, link_.set link st<strong>at</strong>us to “up” in the dynamics_ element. Also, writes out a trace line to each filespecified through the procedure trace-dynamics{}.As with up{}, set link st<strong>at</strong>us to “down” in the dynamics_ element. Also, writes out a traceline to each file specified through the procedure trace-dynamics{}.retur<strong>ns</strong> st<strong>at</strong>us of the link. St<strong>at</strong>us is “up” or “down”; st<strong>at</strong>us is “up” if link dynamics is not enabled.Apply specified oper<strong>at</strong>ion to all connectors on the link.p An example of such usage is linkall-connectors reset.set link cost to value specified.retur<strong>ns</strong> the cost of the link. Default cost of link is 1, if no cost has been specified earlier.SimpleLink Procedures <strong>The</strong> Otcl class SimpleLink implements a simple point-to-point link with an associ<strong>at</strong>edqueue <strong>and</strong> delay 1 . It is derived from the base Otcl class Link as follows:Class SimpleLink -superclass LinkSimpleLink i<strong>ns</strong>tproc init { src dst bw delay q { lltype "DelayLink" } } {$self next $src $dst$self i<strong>ns</strong>tvar link_ queue_ head_ toNode_ ttl_...set queue_ $qset link_ [new Delay/Link]$link_ set b<strong>and</strong>width_ $bw$link_ set delay_ $delay$queue_ target $link_$link_ target [$toNode_ entry]}...# XXX# put the ttl checker after the delay# so we don’t have to worry about accounting# for ttl-drops within the trace <strong>and</strong>/or monitor# fabric#set ttl_ [new TTLChecker]$ttl_ target [$link_ target]$link_ target $ttl_Notice th<strong>at</strong> when a SimpleLink object is cre<strong>at</strong>ed, new Delay/Link <strong>and</strong> TTLChecker objects are also cre<strong>at</strong>ed. Notealso th<strong>at</strong>, the Queue object must have already been cre<strong>at</strong>ed.<strong>The</strong>re are two additional methods implemented (in OTcl) as part of the SimpleLink class: trace <strong>and</strong> init-monitor.<strong>The</strong>se functio<strong>ns</strong> are described in further detail in the section on tracing (Chapter 26).1 <strong>The</strong> current version also includes an object to examine the network layer “ttl” field <strong>and</strong> discard packets if the field reaches zero.65

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

Saved successfully!

Ooh no, something went wrong!