150 likes | 384 Views
Objective. Quick introduction to using DSRNot about wireless simulation as suchLeaves not much in terms of using DSRDSR code recompiling for various optionsDSR code recompiling for various trace messages. DSR characteristics. ReactiveSource-routingARP-like behaviorRouter object in ns
E N D
1. Using DSR in ns2 Rishi Sinha
2. Objective Quick introduction to using DSR
Not about wireless simulation as such
Leaves not much in terms of using DSR
DSR code recompiling for various options
DSR code recompiling for various trace messages
3. DSR characteristics Reactive
Source-routing
ARP-like behavior
Router object in ns sends and receives packets from agents and link layer
4. DSR basic mechanisms Route discovery limited
Route discovery flooding
Source route construction
Route reply
Route error
Salvaging
5. DSR in ns script $ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
6. The val array set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) DSR ;# routing protocol
7. DSR code in ns $NS/dsr/dsragent.cc
Edit to make changes
In $NS:
make depend
make
ns defaults - $NS/tcl/lib/ns-default.tcl
8. DSR traces using node-config $ns_ node-config -routerTrace ON
s 128.014398266 _0_ RTR --- 3 DSR 24 [0 0 0 0] ------- [0:255 2:255 32 0] 1 [1 2] [0 2 0 0->0] [0 0 0 0->0]
Send
Time
Node
Router or agent
Packet (event) id
Packet type
Size
9. DSR traces using DSR code Unconditional trace () statements
Conditional trace statements verbose
trace() implementation checks for verbose
So unconditional not output
Make changes in dsragent.cc and recompile ns
10. Non-verbose output void
DSRAgent::trace(char* fmt, ...)
{
...
?if (verbose) {
va_start(ap, fmt);
vsprintf(logtarget->pt_->buffer(), fmt, ap);
logtarget->pt_->dump();
va_end(ap);
?}
}
11. Non-verbose output Remove the conditional shown above
SRR 127.93668 _0_ new-request 0 0 #1 -> 2
SRR 128.00957 _0_ new-request 16 0 #2 -> 2
SRR 128.021161410 _2_ reply-sent 2 -> 0 #2 (len 3) [(0) 1 2 ]
12. Verbose output Let the conditional be
Output will include non-verbose output
Change these lines:
static const int verbose = 0;
static const int verbose_srr = 0;
13. Verbose output S$miss 127.93668 _0_ 0 -> 2
Sdebug 127.93668 _0_ stuck into send buff 0 -> 2
S$hit 135.40639 _0_ 0 -> 2 [(0) 1 2 ]
14. DSR options Timeouts
Time arp_timeout = 30.0e-3; // (sec) arp request timeout
Time rt_rq_period = 0.5; // (sec) length of one backoff period
Time rt_rq_max_period = 10.0; // (sec) maximum time between rt reqs
bool dsragent_snoop_forwarded_errors = true;
// give errors we forward to our cache?
bool dsragent_snoop_source_routes = true;
// should we snoop on any source routes we see?
15. Trace file analysis Using grep and awk to get times of all cache misses:
$ cat file.tr > awk $1==S\$miss{print $2, $3}
Using grep and awk to get times of all drops:
$ cat file.tr > awk $1==SRR && $4==dropped{print $2, $3}