6.1.0.0.2 SimpleLink Procedures

The Otcl SimpleLink../ns-2/ns-link.tcl implements a simple point-to-point link with an associated queue and delay6.1. It is derived from the base Otcl class Link as follows:
        Class SimpleLink -superclass Link
        SimpleLink instproc init { src dst bw delay q { lltype "DelayLink" } } {
                $self next $src $dst
                $self instvar link_ queue_ head_ toNode_ ttl_
                ...
                set queue_ $q
                set link_ [new Delay/Link]
                $link_ set bandwidth_ $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 and/or monitor
                # fabric
                #
                set ttl_ [new TTLChecker]
                $ttl_ target [$link_ target]
                $link_ target $ttl_
        }
Notice that when a SimpleLink object is created, new Delay/Link and TTLChecker objects are also created. Note also that, the Queue object must have already been created.

There are two additional methods implemented (in OTcl) as part of the SimpleLink class: trace and init-monitor. These functions are described in further detail in the section on tracingChapterchap:trace.



Tom Henderson 2011-11-05