12.07.2015
•
Views
Chapter 5Nodes and Packet ForwardingThis chapter describes one aspect of creating a topology in ns, i.e., creating the nodes. In the next chapter (Chapter 6), wewill describe second aspect of creating the topology, i.e., connecting the nodes to form links.Recall that each simulation requires a single instance of the class Simulator to control and operate that simulation.The class provides instance procedures to create and manage the topology, and internally stores references to each elementof the topology. We begin by describing the procedures in the class Simulator (Section 5.1). We then describe the instanceprocedures in the class Node (Section 5.2) to access and operate on individual nodes. We conclude with detailed descriptionsof the Classifier (Section 5.4) from which the more complex node objects are formed.The procedures and functions described in this chapter can be found in ~ns/tcl/lib/ns-lib.tcl, ~ns/tcl/lib/ns-node.tcl,~ns/tcl/lib/ns-rtmodule.tcl, ~ns/rtmodule.{cc,h}, ~ns/classifier.{cc, h}, ~ns/classifier-addr.cc, ~ns/classifier-mcast.cc, ~ns/classifiermpath.cc,and, ~ns/replicator.cc.5.1 Node BasicsThe basic primitive for creating a node isset ns [new Simulator]$ns nodeThe instance procedure node constructs a node out of more simple classifier objects (Section 5.4). The Node itself is astandalone class in OTcl. However, most of the components of the node are themselves TclObjects. The typical structureof a (unicast) node is as shown in Figure 5.1. This simple structure consists of two TclObjects: an address classifer(classifer_) and a port classifier (dmux_). The function of these classifiers is to distribute incoming packets to thecorrect agent or outgoing link.All nodes contain at least the following components:• an address or id_, monotonically increasing by 1 (from initial value 0) across the simulation namespace as nodes arecreated,• a list of neighbors (neighbor_),45
NODEPortClassifierAgentAgentAddrClassifierdmux_Agentagents_Node entryentry_classifier_LinkLinkLinkFigure 5.1: Structure of a Unicast Node. Notice that entry_ is simply a label variable instead of a real object, e.g., theclassifier_.• a list of agents (agent_),• a node type identifier (nodetype_), and• a routing module (described in Section 5.5 below)By default, nodes in ns are constructed for unicast simulations. In order to enable multicast simulation, the simulation shouldbe created with an option “-multicast on”, e.g.:set ns [new Simulator -multicast on]The internal structure of a typical multicast node is shown in Figure 5.2.When a simulation uses multicast routing, the highest bit of the address indicates whether the particular address is a multicastaddress or an unicast address. If the bit is 0, the address represents a unicast address, else the address represents a multicastaddress.46
-
Page 6 and 7:
18 Radio Propagation Models 17718.1
-
Page 8 and 9:
30 Multicast Routing 25130.1 Multic
-
Page 10 and 11:
38.2.5 An example . . . . . . . . .
-
Page 12 and 13:
X Other 40347 Educational use of NS
-
Page 14:
# so, we lied. now, we define the t
-
Page 17 and 18:
Chapter 2Undocumented FacilitiesNs
-
Page 19 and 20:
Part IInterface to the Interpreter1
-
Page 21 and 22:
• if you can do what you want by
-
Page 23 and 24:
• tcl.result(const char* s)Pass t
-
Page 25 and 26:
By convention in ns, the class Agen
-
Page 27 and 28:
$object set bwvar 1500kb$object set
-
Page 29 and 30:
For a C++ variable to be traceable,
-
Page 31 and 32:
3.5 Class TclClassThis compiled cla
-
Page 33 and 34:
class Packet {......static int hdrl
-
Page 35 and 36:
The actual arguments passed by the
-
Page 37 and 38:
class TclClass (Section 3.5) define
-
Page 39 and 40:
Chapter 4The Class SimulatorThe ove
-
Page 41 and 42:
4.2.2 the heap schedulerThe heap sc
-
Page 43 and 44:
4.4 Commands at a glanceSynopsis:ns
-
Page 45:
$ns_ dumpqCommand for dumping event
-
Page 49 and 50:
The Node instance variable, entry_,
-
Page 51 and 52:
The default values for all the abov
-
Page 53 and 54:
The classify() method is pure virtu
-
Page 55 and 56:
};The class imposes no direct seman
-
Page 57 and 58:
flow-specific queuing disciplines a
-
Page 59 and 60:
5.5 Routing Module and Classifier O
-
Page 61 and 62:
Module NameRtModule/BaseRtModule/Mc
-
Page 63 and 64:
$node neighborsThis returns the lis
-
Page 65 and 66:
Linkhead_enqT_queue_ deqT_ link_ tt
-
Page 67 and 68:
6.2 ConnectorsConnectors, unlink cl
-
Page 69 and 70:
$ns_ link-lossmodel This function
-
Page 71 and 72:
Chapter 7Queue Management and Packe
-
Page 73 and 74:
}}}void Queue::resume(){Packet* p =
-
Page 75 and 76:
7.3 Different types of Queue object
-
Page 77 and 78:
maxidle_ is the maximum amount of t
-
Page 79 and 80:
dst_ The destination address of pac
-
Page 81 and 82:
7.5.2 ConfigurationRunning a JoBS s
-
Page 83 and 84:
mean_pkt_size_ Used to set the expe
-
Page 85 and 86:
Demarker objects$q trace-file This
-
Page 87 and 88:
The recv() method overrides the bas
-
Page 89 and 90:
9.2 ImplementationThe procedures an
-
Page 91 and 92:
Average sending rateTSW window leng
-
Page 93 and 94:
The following command adds an entry
-
Page 95 and 96:
$qCE configQ 0 1 10 20 0.10Note tha
-
Page 97 and 98:
Chapter 10AgentsAgents represent en
-
Page 99 and 100:
CtrMcast/EncapCtrMcast/DecapMessage
-
Page 101 and 102:
}bind("windowOption_", &wnd_option_
-
Page 103 and 104:
hdr_flags* nf = (hdr_flags*)npkt->a
-
Page 105 and 106:
public:ECHO_Timer(ECHO_Agent *a) :
-
Page 107 and 108:
10.6.4 Using the agent through OTcl
-
Page 109 and 110:
State Variables are:dupacks_ Number
-
Page 111 and 112:
$agent attach-tbf Attaches a token
-
Page 113 and 114:
(void)Scheduler::instance().schedul
-
Page 115 and 116:
* outstanding, cancel it.*/void Tcp
-
Page 117 and 118:
Chapter 12Packet Headers and Format
-
Page 119 and 120:
method is now obsolete; its usage i
-
Page 121 and 122:
Packethdrsize_next_bits()points to
-
Page 123 and 124:
the system’s memory allocator. In
-
Page 125 and 126:
}incr hdrlen_ $incrreturn $baseFrom
-
Page 127 and 128:
Chapter 13Error ModelThis chapter d
-
Page 129 and 130:
SimpleLink::errormodule argsSimulat
-
Page 131 and 132:
This is a simple example of how to
-
Page 133 and 134:
Higher LayersNode 1Node 2. . .Node
-
Page 135 and 136:
};void recv(Packet* p, Handler*);vi
-
Page 137 and 138:
and the frame type. It then passes
-
Page 139 and 140:
$ll_ set delay_ $delay$ll_ set band
-
Page 141 and 142:
14.10 Commands at a glanceThe follo
-
Page 143 and 144:
15.2.1 Default Hierarchical Setting
-
Page 145 and 146:
Chapter 16Mobile Networking in nsTh
-
Page 147 and 148:
entry_addrdemuxIP addressdefaulttar
-
Page 149 and 150:
16.1.2 Creating Node movementsThe m
-
Page 151 and 152:
set netif $netif_($t)set mac $mac_(
-
Page 153 and 154:
the hardware address of a packet’
-
Page 155 and 156:
destined to itself to the port dmux
-
Page 157 and 158:
switch(ch->ptype()) {case PT_MAC:br
-
Page 159 and 160:
16.1.7 Revised format for wireless
-
Page 161 and 162:
Packet info at "Application level"
-
Page 163 and 164:
The main problem facing the wired-c
-
Page 165 and 166:
target_target_encapsulatorreg_agent
-
Page 167 and 168:
why: This avoids header clashes bet
-
Page 169 and 170:
This command is used to create a Go
-
Page 171 and 172:
Chapter 17Satellite Networking in n
-
Page 173 and 174:
in counter-rotating planes (where t
-
Page 175 and 176:
• Position/Sat/Geo A geostationar
-
Page 177 and 178:
$ns add-isl $ltype $node1 $node2 $b
-
Page 179 and 180:
$satrouteobject_ compute_routeswher
-
Page 181 and 182:
This will add an error model to the
-
Page 183 and 184:
lh_firstnameobj‘‘name’’ is
-
Page 185 and 186:
from routing agentto Node->entrySat
-
Page 187 and 188:
$satnode add-isl This method c
-
Page 189 and 190:
set prop [new Propagation/FreeSpace
-
Page 191 and 192:
18.3.2 Using shadowing modelBefore
-
Page 193 and 194:
Chapter 19Energy Model in nsEnergy
-
Page 195 and 196:
Chapter 20Directed DiffusionThe dir
-
Page 197 and 198:
However if we have a large and dens
-
Page 199 and 200:
yr application in the ns context. T
-
Page 201 and 202:
value of opt(pre-stop) is usually t
-
Page 203 and 204:
21.2 Implementation of XCP in NSIn
-
Page 205 and 206:
the persistent queue length in the
-
Page 207 and 208:
Thruput2 0.054024 60000residue_pos_
-
Page 209 and 210:
Chapter 22DelayBox: Per-Flow Delay
-
Page 211 and 212:
$ns attach-agent $n_sink $sink# mak
-
Page 213 and 214:
Chapter 23Changes made to the IEEE
-
Page 215 and 216:
Part IIISupport214
-
Page 217 and 218:
endenddocument pargvcPrint out argc
-
Page 219 and 220:
24.4.2 Memory Conservation TipsSome
-
Page 221 and 222:
Chapter 25Mathematical SupportThe s
-
Page 223 and 224:
set run [lindex $argv 0]}if {$run <
-
Page 225 and 226:
}$sizeRNG next-substream# print the
-
Page 227 and 228:
protected:RNG* rng_;};Classes deriv
-
Page 229 and 230:
ns-random is implemented in ~ns/mis
-
Page 231 and 232:
Chapter 26Trace and Monitoring Supp
-
Page 233 and 234:
The monitor-queue function is const
-
Page 235 and 236:
also used to accumulate packet drop
-
Page 237 and 238:
}name,th->size(),flags,iph->flowid(
-
Page 239 and 240:
PT_TORA,PT_DSR,PT_AODV,// insert ne
-
Page 241 and 242:
The QueueMonitor class is not deriv
-
Page 243 and 244:
$ns_ trace-all This is the command
-
Page 245 and 246:
Chapter 27Test Suite SupportThe ns
-
Page 247 and 248:
... ...}$ns_ at $opt(stop).1 "$self
-
Page 249 and 250:
Example: To enable debugging in Que
-
Page 251 and 252:
Chapter 29Unicast RoutingThis secti
-
Page 253 and 254:
Asymmetric Routing Asymmetric routi
-
Page 255 and 256:
class RouteLogic This class defines
-
Page 257 and 258:
— The procedure init-all{} is a g
-
Page 259 and 260:
Global Actions Once the detailed ac
-
Page 261 and 262:
This dumps next hop information in
-
Page 263 and 264:
$ns mrtproto ST;# specify shared tr
-
Page 265 and 266:
Dense Mode The Dense Mode protocol
-
Page 267 and 268:
and unique label (id). Thus, “inc
-
Page 269 and 270:
add-iif{ifid link},add-oif{link if}
-
Page 271 and 272:
CtrMcastComp is the centralised mul
-
Page 273 and 274:
$ns_ mrtproto This command specifi
-
Page 275 and 276:
Chapter 31Network DynamicsThis chap
-
Page 277 and 278:
v 0.8123 link-up 3 5v 0.8123 link-u
-
Page 279 and 280:
The first argument is the time at w
-
Page 281 and 282:
$ns_ rtmodel This command defines
-
Page 283 and 284:
$ns set-address-format hierarchical
-
Page 285 and 286:
32.4 Hierarchical Routing with Sess
-
Page 287 and 288:
Chapter 33UDP Agents33.1 UDP Agents
-
Page 289 and 290:
Chapter 34TCP AgentsThis section de
-
Page 291 and 292:
set ns [new Simulator]set node1 [$n
-
Page 293 and 294:
34.2.1 The Base TCP SinkThe base TC
-
Page 295 and 296:
Agent/TCP/FullTcp set dupseg_fix_ t
-
Page 297 and 298:
34.5 Tracing TCP DynamicsThe behavi
-
Page 299 and 300:
Chapter 35SCTP AgentsThis chapter d
-
Page 301 and 302:
Figure 35.1: Example of a Multihome
-
Page 303 and 304:
Note: the actual value of these tra
-
Page 305 and 306:
1.526624 1 4 sctp 1500 -------D 0 1
-
Page 307 and 308:
$ns at 5.0 "finish"$ns run35.5.2 Mu
-
Page 309 and 310:
Chapter 36Agent/SRMThis chapter des
-
Page 311 and 312:
36.1.2 Other Configuration Paramete
-
Page 313 and 314:
3.6274 n 0 m r 1 type repair servi
-
Page 315 and 316:
3.6029 n 3 m r 2 Q NTIMER at 3.730
-
Page 317 and 318:
36.4 Loss Detection—The Class SRM
-
Page 319 and 320:
same packet. The repair objet does
-
Page 321 and 322:
}hdr_asrm* seh = (hdr_asrm*) p->acc
-
Page 323 and 324:
set grp [Node allocaddr]$srm set ds
-
Page 325 and 326:
#set up the multicast routingDM set
-
Page 327 and 328:
37.3 Architecture of the PLM Protoc
-
Page 329 and 330:
We add in void PLMLossMonitor::recv
-
Page 331 and 332:
Part VIApplication330
-
Page 333 and 334:
Traffic generatorsApplication/Traff
-
Page 335 and 336:
• recv(int nbytes)—Announces th
-
Page 337 and 338:
1. EXPOO_Traffic—generates traffi
-
Page 339 and 340:
set src [new Agent/UDP]set sink [ne
-
Page 341 and 342:
Application FTP FTP objects produce
-
Page 343 and 344:
send_data(ADU)Application(HttpApp,
-
Page 345 and 346:
39.1.4 Transmitting user data over
-
Page 347 and 348:
and teardown of connections. Only O
-
Page 349 and 350:
TclObjectPagePoolPagePool/CompMathP
-
Page 351 and 352:
PagePool/ProxyTrace takes these two
-
Page 353 and 354:
}int id_; // object IDWebTrafSessio
-
Page 355 and 356:
An Http/Server object waits for inc
-
Page 357 and 358:
set tmp [new RandomVariable/Exponen
-
Page 359 and 360:
Object Type Event Type Explaination
-
Page 361 and 362:
Chapter 40Worm ModelIn this chapter
-
Page 363 and 364:
$w local-p 0.5Following are some co
-
Page 365 and 366:
(nsnode) clientcloudPackM ime(nsnod
-
Page 367 and 368:
HTTP responsesclients servers Delay
-
Page 369 and 370:
41.5 Commands at a GlanceThe follow
-
Page 371 and 372:
• HTTP response size (bytes)• s
-
Page 373 and 374:
Chapter 42Session-level Packet Dist
-
Page 375 and 376:
42.1.2 Inserting a Loss ModuleWhen
-
Page 377 and 378:
Delay and Loss Modules Each receive
-
Page 379 and 380:
Chapter 43Asim: approximate analyti
-
Page 381 and 382:
set n(1) [$ns node]set link(0:1) [$
-
Page 383 and 384:
Part VIIIEmulation382
-
Page 385 and 386:
When using the emulation mode, a sp
-
Page 387 and 388:
set intf [$pf1 open readonly]puts "
-
Page 389 and 390:
puts "install nets into taps..."$a0
-
Page 391 and 392:
Chapter 45Nam45.1 IntroductionNam i
-
Page 393 and 394:
• Button 6 (Chevron logo) - Close
-
Page 395 and 396:
Second, when dealing with randomly
-
Page 397 and 398:
dst_portaddr,seqno,flags,sname);A n
-
Page 399 and 400:
• up• down• right• left•
-
Page 401 and 402:
46.1.7 Agent TracingAgent trace eve
-
Page 403 and 404:
v -t 1.0 -e node_tclscript 2 "Echo
-
Page 405 and 406:
If nam ever gets to the end of an e
-
Page 407 and 408:
l :link-t time-s source id-d des
-
Page 409 and 410:
E :D :P :a :session enqueue-t time
-
Page 411 and 412:
v :V :N :W :g :A :c :q :execute tcl
-
Page 413 and 414:
$ns duplex-link-op orient right$ns
-
Page 415 and 416:
Chapter 47Educational use of NS and
-
Page 417 and 418:
Bibliography[1] C. Alaettinoğlu, A