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.

While the first example uses a small topology of 3 nodes, the second example ru<strong>ns</strong> over a topology of 50 nodes. <strong>The</strong>se scriptscan be run simply by typing$<strong>ns</strong> tcl/ex/wireless.tcl (or /wireless-test.tcl)<strong>The</strong> four ad-hoc routing protocols th<strong>at</strong> are currently supported are Destin<strong>at</strong>ion Sequence Distance Vector (DSDV), DynamicSource Routing (DSR), Temporally ordered Routing Algorithm (TORA) <strong>and</strong> Adhoc On-dem<strong>and</strong> Distance Vector (AODV).<strong>The</strong> primitive to cre<strong>at</strong>e a mobilenode is described below. Please note th<strong>at</strong> the old APIs for cre<strong>at</strong>ing a mobilenode dependedon which routing protocol was used, likeset mnode [$opt(rp)-cre<strong>at</strong>e-mobile-node $id]where$opt(rp)defines "dsdv", "aodv", "tora" or "dsr" <strong>and</strong> id is the index for the mobilenode. But the old API’s use is being deprec<strong>at</strong>ed <strong>and</strong>the new API is described as follows:.$<strong>ns</strong>_ node-config -adhocRouting $opt(adhocRouting)-llType $opt(ll)-macType $opt(mac)-ifqType $opt(ifq)-ifqLen $opt(ifqlen)-antType $opt(ant)-propI<strong>ns</strong>tance [new $opt(prop)]-phyType $opt(netif)-channel [new $opt(chan)]-topoI<strong>ns</strong>tance $topo-wiredRouting OFF-agentTrace ON-routerTrace OFF-macTrace OFF<strong>The</strong> above API configures for a mobilenode with all the given values of adhoc-routing protocol, network stack, channel,topography,propag<strong>at</strong>ion model, with wired routing turned on or off (required for wired-cum-wireless scenarios) <strong>and</strong>tracing turned on or off <strong>at</strong> different levels (router, mac, agent). Incase hierarchical addressing is being used, the hier addressof the node needs to be passed as well. For more info about this comm<strong>and</strong> (part of new node APIs) see chapter titled"Restructuring <strong>ns</strong> node <strong>and</strong> new Node APIs" in <strong>ns</strong> <strong>Notes</strong> <strong>and</strong> <strong>Document<strong>at</strong>ion</strong>.Next actually cre<strong>at</strong>e the mobilenodes as follows:for { set j 0 } { $j < $opt(nn)} {incr j} {set node_($j) [ $<strong>ns</strong>_ node ]$node_($i) r<strong>and</strong>om-motion 0 ;# disable r<strong>and</strong>om motion}<strong>The</strong> above procedure cre<strong>at</strong>es a mobilenode (split)object, cre<strong>at</strong>es an adhoc-routing routing agent as specified, cre<strong>at</strong>es thenetwork stack co<strong>ns</strong>isting of a link layer, interface queue, mac layer, <strong>and</strong> a network interface with an antenna, uses the defined145

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

Saved successfully!

Ooh no, something went wrong!