Following is a list of common link commands used in simulation scripts:
$ns_ simplex-link node1 node2 bw delay qtype args
This command creates an unidirectional link between node1 and node2 with
specified bandwidth (BW) and delay characteristics. The link uses a queue
type of <qtype> and depending on the queue type different arguments are
passed through <args>.
$ns_ duplex-link node1 node2 bw delay qtype args
This creates a bi-directional link between node1 and node2. This procedure
essentially creates a duplex-link from two simplex links, one from node1
to node2 and the other from node2 to node1. The syntax for duplex-link is
same as that of simplex-link described above.
$ns_ duplex-intserv-link n1 n2 bw dly sched signal adc args
This creates a duplex-link between n1 and n2 with queue type of intserv, with
specified BW and delay. This type of queue implements a scheduler with two
level services priority. The type of intserv queue is given by <sched>, with
admission control unit type of <adc> and signal module of type <signal>.
$ns_ simplex-link-op n1 n2 op args
This is used to set attributes for a simplex link. The attributes may be
the orientation, color or queue-position.
$ns_ duplex-link-op n1 n2 op args
This command is used to set link attributes (like orientation of the links,
color or queue-position) for duplex links.
$ns_ link-lossmodel lossobj from to
This function generates losses (using the loss model <lossobj> inserted in
the link between <from> node and <to> node) in the link that can be
visualized by nam.
$ns_ lossmodel lossobj from to
This is used to insert a loss module in regular links.
Following is a list of internal link-related procedures:
$ns_ register-nam-linkconfig link
This is an internal procedure used by "$link orient" to
register/update the order in which links should be created in nam.
$ns_ remove-nam-linkconfig id1 id2
This procedure is used to remove any duplicate links (duplicate links may be
created by GT-ITM topology generator).
$link head
Returns the instance variable head_ for the link. The head_ is
the entry pont to the link and it points to the first object in the link.
$link add-to-head connector
This allows the <connector> object to be now pointed by the head_
element in the link, i.e, <connector> now becomes the first object in the
link.
$link link
Returns the instance variable link_. The link_ is the element
in the link that actually models the link in terms of delay and bandwidth
characteristics of the link.
$link queue
Returns the instance variable queue_. queue_ is queue element
in the link. There may be one or more queue elements in a particular link.
$link cost c
This sets a link cost of <c>.
$link cost?
Returns the cost value for the link. Default cost of link is set to 1.
$link if-label?
Returns the network interfaces associated with the link (for multicast routing).
$link up
This sets the link status to "up". This command is a part of network
dynamics support in .
$link down
Similar to up, this command marks the link status as "down".
$link up?
Returns the link status. The status is always "up" as default, if link
dynamics is not enabled.
$link all-connectors op
This command applies the specified operation <op> to all connectors in the
link. Like, $link all-connectors reset or
$link all-connectors isDynamic.
$link install-error errmodel
This installs an error module after the link_ element.
In addition to the Link and link-related commands listed above, there are other procedures to support the specific requirements of different types of links derived from the base class "Link" like simple-link (SimpleLink), integrated service (IntServLink), class-based queue (CBQLink), fair queue (FQLink) and procedures to support multicast routing, sessionsim, nam etc. These and the above procedures may be found in /tcl/lib(ns-lib.tcl, ns-link.tcl, ns-intserv.tcl, ns-namsupp.tcl, ns-queue.tcl), /tcl/mcast/(McastMonitor.tcl, ns-mcast.tcl), /tcl/session/session.tcl.