-
Notifications
You must be signed in to change notification settings - Fork 1
/
ns.1
2922 lines (2788 loc) · 89.7 KB
/
ns.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\"
.\" Copyright (c) 1994-1995 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgment:
.\" This product includes software developed by the Computer Systems
.\" Engineering Group at Lawrence Berkeley Laboratory.
.\" 4. Neither the name of the University nor of the Laboratory may be used
.\" to endorse or promote products derived from this software without
.\" specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.TH NS 1 "25 July 1997"
.de HD
.sp 1.5
.B
..
.SH NAME
ns \- network simulator (version 2)
.SH SYNOPSIS
.na
.B ns
[
.I file
[
.I arg arg ...
]
]
.ad
.SH DESCRIPTION
.I ns
is an event-driven network simulator.
An extensible simulation engine
is implemented in C++
that uses MIT's Object Tool Command Language, OTcl
(an object oriented version of Tcl)
as the command and configuration interface.
A previous version of the simulator
i.e. ns version 1 used
the Tool Command Language, Tcl
as the configuration language.
The current version still supports
simulation scripts written in Tcl
meant for the ns version 1 simulator.
.LP
This manual page documents some of the interfaces
for ns. For much more complete documentation, please
see "ns Notes and Documentation" [13], available in the distribution
and on the web.
.LP
The simulator is invoked via the
.I ns
interpreter, an extension of the vanilla
.I otclsh
command shell.
A simulation is defined by a OTcl script.
The scripts use the Simulator Class
as the principal interface
to the simulation engine.
Using the methods defined in this class,
a network topology is defined,
traffic sources and sinks are configured,
the simulation is invoked,
and the statistics are collected.
By building upon a fully functional language, arbitrary actions
can be programmed into the configuration.
.LP
The first step in the simulation
is to acquire
an instance of the Simulator class.
Instances of objects in classes
are created and destroyed in ns using the
.I new
and
.I delete
methods.
For example,
an instance of the Simulator object is
created by the following command:
.nf
e.g. set ns [new Simulator]
.fi
A network topology is realized
using three primitive building blocks:
nodes, links, and agents.
The Simulator class has methods to create/
configure each of these building blocks.
Nodes are created with the
.I node
Simulator method
that automatically assigns
an unique address to each node.
Links are created between nodes
to form a network topology with the
.I simplex-link
and
.I duplex-link
methods that set up
unidirectional and bidirectional links respectively.
Agents are the objects that
actively drive the simulation.
.I Agents
can be thought of as the
processes and/or transport entities that
run on
.I nodes
that may be end hosts or routers.
Traffic sources
and sinks, dynamic routing modules
and the various protocol modules
are all examples of agents.
Agents are created by
instantiating objects
in the subclass of class Agent i.e.,
.I Agent/type
where type specifies
the nature of the agent.
For example, a TCP agent
is created using the command:
.br
.nf
set tcp [new Agent/TCP]
.fi
.LP
Once the agents are created,
they are
attached to nodes
with the
.I attach-agent
Simulator method.
Each agent is automatically assigned a port number unique across
all agents on a given node (analogous to a tcp or udp port).
Some types of agents may
have sources attached to them
while others may generate their own data.
For example,
you can attach ``ftp'' and ``telnet'' sources
to ``tcp'' agents
but ``constant bit-rate'' agents generate their own data.
Applications are attached to agents
using the
.I attach-app
method.
.LP
Each object has
some configuration parameters associated with it
that can be modified.
Configuration parameters are
instance variables of the object.
These parameters are initialized
during startup to default values
that can simply be read from the
instance variables of the object.
For example,
.I $tcp set window_
returns the default window size for the tcp object.
The default values for that object
can be explicitly overridden by simple assignment
either before a simulation begins,
or dynamically, while the simulation is in progress.
For example the window-size for a particular TCP session
can be changed in the
following manner.
.br
.nf
$tcp set window_ 25
.fi
The default values for the
configuration parameters
of all the class objects
subsequently created
can also be changed by simple assignment.
For example, we can say
.br
.nf
Agent/TCP set window_ 30
.fi
to make all future tcp agent creations default to a window size of 30.
.LP
Events are scheduled in ns
using the
.I at
Simulator method
that allows OTcl procedures to be invoked
at arbitrary points in simulation time.
These OTcl callbacks provide a flexible simulation
mechanism -- they can be used to start or stop
sources, dump statistics, instantiate link failures,
reconfigure the network topology etc.
The simulation is started via the
.I run
method and continues until there are no more
events to be processed.
At this time,
the original invocation of the
.I run
command returns
and the Tcl script can exit or invoke another
simulation run after possible reconfiguration.
Alternatively, the simulation can be prematurely halted
by invoking the
.I stop
command or by exiting the script with Tcl's standard
.I exit
command.
.LP
Packets are forwarded along the shortest path route from
a source to a destination, where the distance metric is
the sum of costs of the links traversed from
the source to the destination.
The cost of a link is 1 by default;
the distance metric is
simply the hop count
in this case.
The cost of a link can be changed with the
.I cost
Simulator method.
A static topology model
is used as the default in ns
in which
the states of nodes/links
do not change during the course of a simulation.
Network Dynamics could be specified
using methods described in NETWORK DYNAMICS METHODS section.
Also static unicast routing is the default
in which the routes are pre-computed over the
entire topology once prior to
starting the simulation.
Methods to enable and configure
dynamic unicast and multicast routing
are described in the
UNICAST ROUTING METHODS and
MULTICAST ROUTING METHODS sections respectively.
.SH "NS COMMANDS"
This section describes the basic commands
to create the building blocks
of the simulation
(i.e. the node, link and agent objects)
and to run the simulation.
.LP
The first step in running a simulation
as stated before
is to acquire an instance of the
Simulator class that has
methods to configure and run the simulation.
Throughout this section
the object variable name $ns
is used to imply a
Simulator object.
.IP "\fB$ns node\fP"
Create a new node object and return a handle to it.
.IP "\fB$ns all-nodes-list\fP"
Returns a list of all the node objects defined in the simulation.
.IP "\fB$ns simplex-link\fI node1 node2 bw delay type\fP"
Create a new unidirectional link between
.I node1
and
.I node2
with bandwidth
.I bw
in bits per second
and link propagation delay
.I delay
in seconds.
.I node1
and
.I node2
must have already been created with the
.I node
method.
.I bw
and
.I delay
default to
1.5 Mbits/sec and 100 ms respectively.
The defaults can be changed by modifying
the relevant configuration parameters of the
DelayLink Object (see DELAYLINK OBJECTS section).
.I node1
and
.I node2
must have already been created with the
.I node
method.
The queuing discipline of the link is specified by
.I type,
which may be
.B DropTail,
.B FQ,
.B SFQ,
.B DRR,
.B RED,
.B CBQ,
or
.B CBQ/WRR.
A DropTail link is a simple FIFO queue which drops the last packet
in the queue when the queue overflows.
A FQ link is for Fair Queuing (for details see [?]).
A SFQ link is for Stochastic Fair Queuing (for details see [?]).
A DRR link is for deficit round robin scheduling (for details see [9]).
A RED link is a random-early drop queue (for details see [2]).
A CBQ link is for class-based queuing using a packet-by-packet round-robin
scheduler (for details see [3]).
A CBQ/WRR link is for class-based queuing with a weighted round robin scheduler.
If multicast routing is used
links with interface labels are required.
Such links are created by
setting Simulator NumberInterfaces_ variable to 1.
All the subsequently created links will have interface labels.
To disable creation of interfaces simply reset NumberInterfaces_ to 0
(this is the default).
.IP "\fB$ns duplex-link\fI node1 node2 bw delay type\fP"
Create a new bidirectional link between
.I node1
and
.I node2
with bandwidth
.I bw
in bits per second
and link propagation delay
.I delay
in seconds.
.I node1
and
.I node2
must have already been created with the
.I node
method.
.I bw
and
.I delay
default to
1.5 Mbits/sec and 100 ms respectively.
The defaults can be changed by modifying
the relevant configuration parameters of the
DelayLink Object (see DELAYLINK OBJECTS section).
The queuing discipline of the link is specified by
.I type,
which may be
.B DropTail,
.B FQ
.B SFQ,
.B DRR,
.B RED,
.B CBQ,
or
.B CBQ/WRR.
A DropTail link is a simple FIFO queue which drops the last packet
in the queue when the queue overflows.
A FQ link is for Fair Queuing (for details see [?]).
A SFQ link is for Stochastic Fair Queuing (for details see [?]).
A DRR link is for deficit round robin scheduling (for details see [9]).
A RED link is a random-early drop queue (for details see [2]).
A CBQ link is for class-based queuing using a packet-by-packet round-robin
scheduler (for details see [3]).
A CBQ/WRR link is for class-based queuing with a weighted round robin scheduler.
If multicast routing is used
links with interface labels are required.
Such links are created by
setting Simulator NumberInterfaces_ variable to 1.
All the subsequently created links will have interface labels.
To disable creation of interfaces simply reset NumberInterfaces_ to 0
(this is the default).
.IP "\fB$ns link\fI node1 node2\fP"
Returns a reference to the link connecting nodes
.I node1
and
.I node2.
This is useful for
setting link configuration parameters
and to invoke tracing methods (see LINK OBJECTS section).
.IP "\fB$ns queue-limit\fI node1 node2 queue-limit\fP"
Set the maximum number of packets
that can be queued on the link
in the direction from
.I node1
to
.I node2
to
.I queue-limit.
The link between node1 and node2
should have already been created.
.IP "\fB$ns delay\fI node1 node2 time-interval\fP"
Set the latency of the link
in the direction from
.I node1
to
.I node2
to
.I time-interval
seconds.
The link between node1 and node2
should have already been created.
.IP "\fB$ns cost \fI node1 node2 cost-val\fP"
Assign the cost
.I cost-val
to the link between nodes
.I node1
and
.I node2.
The costs assigned to links
are used in unicast route computations.
All the links default
to a cost of 1.
.IP "\fB$ns multi-link\fI node-list bw delay type\fP"
Connects the nodes specified in
.I node-list
by a mesh of duplex links
(to simulate a broadcast LAN)
with bandwidth
.I bw
in bits per second
and link propagation delay
.I delay
in seconds.
.I node-list
is a list of node object handles
that have already been created with the
.I node
method.
.I bw
and
.I delay
default to
1.5 Mbits/sec and 100 ms respectively.
The defaults can be changed by modifying
the relevant configuration parameters of the
DelayLink Object (see DELAYLINK OBJECTS section).
The queuing discipline of the link is specified by
.I type,
which may be
.B DropTail,
.B FQ
.B SFQ,
.B DRR,
.B RED,
.B CBQ,
or
.B CBQ/WRR.
A DropTail link is a simple FIFO queue which drops the last packet
in the queue when the queue overflows.
A FQ link is for Fair Queuing (for details see [?]).
A SFQ link is for Stochastic Fair Queuing (for details see [?]).
A DRR link is for deficit round robin scheduling (for details see [9]).
A RED link is a random-early drop queue (for details see [2]).
A CBQ link is for class-based queuing using a packet-by-packet round-robin
scheduler (for details see [3]).
A CBQ/WRR link is for class-based queuing with a weighted round robin scheduler.
.IP "\fB$ns multi-link-of-interfaces\fI node-list bw delay type\fP"
Connects the nodes specified in
.I node-list
by a mesh of duplex links with interfaces
(to simulate a broadcast LAN)
with bandwidth
.I bw
in bits per second
and link propagation delay
.I delay
in seconds.
.I node-list
is a list of node object handles
that have already been created with the
.I node
method.
.I bw
and
.I delay
default to
1.5 Mbits/sec and 100 ms respectively.
The defaults can be changed by modifying
the relevant configuration parameters of the
DelayLink Object (see DELAYLINK OBJECTS section).
The queuing discipline of the link is specified by
.I type,
which may be
.B DropTail,
.B FQ
.B SFQ,
.B DRR,
.B RED,
.B CBQ,
or
.B CBQ/WRR.
A DropTail link is a simple FIFO queue which drops the last packet
in the queue when the queue overflows.
A FQ link is for Fair Queuing (for details see [?]).
A SFQ link is for Stochastic Fair Queuing (for details see [?]).
A DRR link is for deficit round robin scheduling (for details see [9]).
A RED link is a random-early drop queue (for details see [2]).
A CBQ link is for class-based queuing using a packet-by-packet round-robin
scheduler (for details see [3]).
A CBQ/WRR link is for class-based queuing with a weighted round robin scheduler.
.IP "\fBnew Agent/\fItype\fP"
Create an Agent
of type
.I type
which may be:
.nf
Null - Traffic Sink
LossMonitor - Traffic Sink that monitors loss parameters
TCP - BSD Tahoe TCP
TCP/FullTcp - Full Reno TCP with two-way connections [11]
TCP/Reno - BSD Reno TCP
TCP/Newreno - a modified version of BSD Reno TCP
TCP/Vegas - Vegas TCP (from U. Arizonia via USC)
TCP/Sack1 - BSD Reno TCP with selective ACKs
TCP/Fack - BSD Reno TCP with forward ACKs
TCPSink - standard TCP sink
TCPSink/DelAck - TCP sink that generates delayed ACKs
TCPSink/Sack1 - TCP sink that generates selective ACKs
TCPSink/Sack1/DelAck - delayed-ack TCP sink with selective ACKs
UDP - UDP Transport
RTP - RTP agent
Session/RTP -
RTCP - RTCP agent
IVS/Source -
IVS/Receiver -
SRM -
.fi
The methods, configuration parameters
and the relevant state variables
associated with these objects
are discussed in detail in later sections.
Note that some agents e.g. TCP or SRM
do not generate their own data.
Such agents need sources attached to them
to generate data
(see attach-source and attach-traffic methods
in AGENT OBJECTS section).
.IP "\fB$ns attach-agent \fInode agent\fP"
Attach the agent object
.I agent
to
.I node.
The
.I agent
and
.I node
objects should have already been created.
.IP "\fB$ns detach-agent \fInode agent\fP"
Detach the agent object
.I agent
from
.I node.
.IP "\fB$ns connect \fIsrc dst\fP"
Establish a two-way connection between the agent
.I src
and the agent
.I dst.
Returns the handle to
.I src
agent.
A helper method
has been defined to
facilitate creating and attaching an agent
to each of two nodes
and establishing a two-way connection between them.
(see BUILTINS section).
.IP "\fB$ns use-scheduler \fItype\fP"
Use an event scheduler of type
.I type
in the simulations.
.I type
is one of List, Heap, Calendar, RealTime.
The List scheduler is the default.
A Heap scheduler uses a heap for event queueing.
A Calendar scheduler uses a calendar queue to keep track of events.
RealTime scheduler is used in emulation mode when the simulator
interacts with an external agent.
.IP "\fB$ns at\fI time procedure\fP"
Evaluate
.I procedure
at simulation time
.I time.
The procedure could be a globally accessible function (proc) or an object
method (instproc).
This command can be used
to start and stop sources,
dynamically reconfigure the simulator,
dump statistics at specified intervals, etc.
Returns an event id.
.IP "\fB$ns cancel \fIeid\fP"
Remove the event specified by the event id
.I eid
from the event queue.
.IP "\fB$ns now\fP"
Return the current simulation time.
.IP "\fB$ns gen-map\fP"
Walks through the simulation topology
and lists all the objects
that have been created
and the way they are hooked up to each other.
This is useful to debug simulation scripts.
.IP "\fBns-version\fP"
Return a string identifying the version of ns currently running.
This method is executed in
the global context
by the interpreter.
.IP "\fBns-random\fI [ seed ]\fP"
If
.I seed
is not present,
return a pseudo-random integer between 0 and 2^31-1.
Otherwise, seed the pseudo-random number generator with
.I seed
and return the seed used.
If
.I seed
is 0, choose an initial seed heuristically (which varies
on successive invocations).
This method is executed in
the global context
by the interpreter.
.LP
Ns has other facilities for random number generation;
please see documentation for details [13].
.SH "OBJECT HIERARCHY"
A brief description of
the object hierarchy in
.I ns
is presented in this section.
This description is
not intended to be complete.
It has been provided to depict
how the methods and configuration parameters
associated with the various objects
are inherited.
For more complete information
see "ns notes & documentation"
and the automatically generated class library information
on the ns web page.
.LP
Objects are associated with
configuration parameters that can be
dynamically set and queried,
and state variables that can be queried
(usually modified only when the state variables need to be reset for
another simulation run).
.LP
Configuration parameters represent simulation parameters
that are usually fixed during the entire simulation (like a
link bandwidth), but can be changed dynamically if desired.
State variables represent values that are specific to a
given object and that object's implementation.
.LP
The following diagram depicts a portion the object hierarchy:
.nf
Simulator
MultiSim
Node
Link
SimpleLink
CBQLink
DummyLink
DelayLink
Queue
DropTail
FQ
SFQ
DRR
RED
CBQ
CBQ/WRR
QueueMonitor
ED
Flowmon
Flow
rtObject
RouteLogic
Agent
rtProto
Static
Session
DV
Direct
Null
LossMonitor
TCP
FullTcp
Reno
Newreno
Sack1
Fack
TCPSink
DelAck
Sack1
DelAck
UDP
RTP
RTCP
IVS
Source
Receiver
SRM
Session
RTP [how is this diff from Agent/CBR/RTP]
Appplication
FTP
Telnet
Traffic
Expoo
Pareto
CBR
Trace
Integrator
Samples
.fi
.LP
For a complete, automatically generated, object hierarchy,
see the link "class hierarchy" (which points to
http://www-sop.inria.fr/rodeo/personnel/Antoine.Clerget/ns/)
on the ns web pages. (Thanks to Antoine Clerget for maintaining
this!)
.LP
For example, any method that is supported by a
.I TCP
agent is also supported by a
.I Reno
or a
.I Sack1
agent.
Default configuration parameters are also inherited.
For example,
.I $tcp set window_ 20
where $tcp is a TCP agent
defines the default TCP window size for both
.I TCP
and
.I Reno
objects.
.SH "OBJECT METHODS"
The following sections document the methods, configuration parameters
and state variables associated with the various objects
as well as those to enable
Network dynamics, Unicast routing, Multicast routing and
Trace and Monitoring support.
The object class is specified implicitly by the object
variable name in the description.
For example,
.B $tcp
implies the tcp object class and all of its child classes.
.SH "NODE OBJECTS"
[NOTE: This section has not been verified to be up-to-date with the release.]
.IP "\fB$node id\fP"
Returns the node id.
.IP "\fB$node neighbors\fP"
Returns a list of the neighbour node objects.
.IP "\fB$node attach \fIagent\fP"
Attach an agent of type
.I agent
to this node.
.IP "\fB$node detach \fIagent\fP"
Detach an agent of type
.I agent
from this node.
.IP "\fB$node agent \fIport\fP"
Return a handle to the agent attached to port
.I port
on this node. Returns an empty string if the port is not in use.
.IP "\fB$node reset"
Reset all agents attached to this node.
This would re-initialize the state variables
associated with the various agents
at this node.
.IP "\fB$node rtObject?\fP"
Returns a handle to rtObject
if there exists an instance
of the object at that node.
Only nodes that take part in
a dynamic unicast routing protocol
will have this object
(see UNICAST ROUTING METHODS and RTOBJECT OBJECTS section).
.IP "\fB$node join-group \fIagent group\fP"
Add the agent specified by the object handle
.I agent
to the multicast host group identified by the address
.I group.
This causes the group membership protocol to arrange for the appropriate
multicast traffic to reach this agent.
Multicast group address should be
in the range 0x8000 - 0xFFFF.
.IP "\fB$node allocaddr\fP"
Returns multicast group address
in ascending order
on each invocation
starting from 0x8000
and ending at 0xFFFF.
.\"
.IP "\fB$node shape \fIshape\fP"
Set the shape of the node to "\fIshape\fP". When called before the
simulator starts to run, it changes the default shape of
the node in the nam trace file. The default shape of a node is """circle"""
.\"
.IP "\fB$node color \fIcolor\fP"
Set the color of the node to \fIcolor\fP. It can be called anytime to change
the current color of the node in nam trace file, if there is one.
.\"
.IP "\fB$node get-attribute \fIname\fP"
Get the specified attribute \fIname\fP of the node. Currently a Node object
has two attributes: \fICOLOR\fP and \fISHAPE\fP. Note: these letters must be
capital.
.IP "\fB$node add-mark \fIname color shape\fP"
Add a mark (in nam trace file) with \fIcolor\fP and \fIshape\fP around
the node. The shape can be """circle""", """hexagon""" and """square""" (case
sensitive). The added mark will be identified by \fIname\fP.
.IP "\fB$node delete-mark \fIname\fP"
Delete the mark with \fIname\fP in the given node.
.LP
There are no state variables or configuration parameters
specific to the node class.
.SH "LINK OBJECTS"
[NOTE: This section has not been verified to be up-to-date with the release.]
.IP "\fB$link trace-dynamics \fIns fileID\fP"
Trace the dynamics of this link
and write the output to
.I fileID
filehandle.
.I ns
is an instance of the Simulator or MultiSim object
that was created to invoke the simulation
(see TRACE AND MONITORING METHODS section
for the output trace format).
.\"
.IP "\fB$link trace-callback \fIns cmd\fP"
Trace all packets on the link with the callback \fIcmd\fP.
Cmd is invoked for each trace event (enqueue, dequeue, drop)
with the text that would be logged as parameters.
(See the description of the log file for this information.)
A demo of trace callbacks is in
the program tcl/ex/callback_demo.tcl
in the distribution.
.\"
.IP "\fB$link color \fIcolor\fP"
Set the color of the Link object. It can be called anytime to change
the current color of the link in nam trace file, if there is one.
.\"
.IP "\fB$link get-attribute \fIname\fP"
Get the specified attribute \fIname\fP of the Link. Currently a Link object
has three attributes: \fICOLOR\fP, \fIORIENTATION\fP, and \fIQUEUE_POS\fP.
.\"
.LP
Currently the following two functions should not be directly called. Use
\fB$ns duplex-link-op\fP instead. Refer to the corresponding section in this
man page.
.\"
.IP "\fB$link orient \fIori\fP"
Set the orientation of the link to \fIori\fP. When called before the simulator
starts to run, it changes the default orientation of the link in nam trace
file, if there is one. If orientation is unspecified for any link(s), nam will
use automatic layout. The default orientation of a Link object is unspecified.
.\"
.IP "\fB$link queuePos \fIpos\fP"
Set the queue position of the link to \fIpos\fP. When called before the
simulator starts to run, it changes the default queue placement of the simplex
link in nam trace file, if there is one. \fIpos\fP specifies the angle between
the horizontal line and the line along which queued packets will be displayed.
.LP
.SH "SIMPLELINK OBJECTS"
[NOTE: This section has not been verified to be up-to-date with the release.]
.IP "\fB$link cost \fIcost-val\fP"
Make
.I cost-val
the cost of this link.
.IP "\fB$link cost?\fP"
Return the cost of this link.
.LP
Any configuration parameters or state variables?
.SH "DELAYLINK OBJECTS"
[NOTE: This section has not been verified to be up-to-date with the release.]
The DelayLink Objects determine
the amount of time required for a packet to
traverse a link.
This is defined to be
size/bw + delay
where
size is the packet size,
bw is the link bandwidth and
delay is the link propagation delay.
There are no methods or state variables associated with this object.
.LP
.HD
Configuration Parameters \fP
.RS
.IP \fIbandwidth_\fP
Link bandwidth in bits per second.
.IP \fIdelay_\fP
Link propagation delay in seconds.
.LP
There are no state variables associated with this object.
.SH "NETWORK DYNAMICS METHODS"
This section describes methods
to make the
links and nodes
in the topology
go up and down
according to various distributions.
A dynamic routing protocol should
generally be used whenever
a simulation is to be done
with network dynamics.
Note that a static topology model
is the default in ns.
.IP "\fB$ns rtmodel \fImodel model-params node1 [node2]\fP"
Make the link between
.I node1
and
.I node2
change between up and down states
according to the model
.I model.
In case only
.I node1
is specified all the links
incident on the node
would be brought up and down
according to the specified
.I model.
.I model-params
contains the parameters required for the relevant model
and is to be specified as a list
i.e. the parameters are to be
enclosed in curly brackets.
.I model
can be one of
.I Deterministic,
.I Exponential,
.I Manual,
.I Trace.
Returns a handle to a model object
corresponding to the specified
.I model.
In the Deterministic model
.I model-params
is
.I [start-time] up-interval down-interval [finish-time].
Starting from
.I start-time
the link is made up for
.I up-interval
and down for
.I down-interval
till
.I finish-time
is reached.
The default values for
start-time, up-interval, down-interval
are 0.5s, 2.0s, 1.0s respectively.
finish-time defaults to the end of the simulation.
The start-time defaults to 0.5s
in order to let the
routing protocol computation quiesce.
If the Exponential model is used
.I model-params
is of the form
.I up-interval down-interval
where the link up-time