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.

#endifop,// s, r, D or fScheduler::i<strong>ns</strong>tance().clock(), // time stampsrc_,// the nodeid for this node#ifdef LOG_POSITIONx, // x co-ordy, // y co-ord#endiftracename,// name of object type tracingwhy,// reason, if anych->uid(),// identifier for this eventpacket_info.name(ch->ptype()), // packet typech->size(),// size of cmn headermh->dh_dur<strong>at</strong>ion, // expected time to send d<strong>at</strong>aETHER_ADDR(mh->dh_da), // mac_destin<strong>at</strong>ion addressETHER_ADDR(mh->dh_sa),// mac_sender addressGET_ETHER_TYPE(mh->dh_body)); // type - arp or IPIf the LOG_POSITION is defined the x <strong>and</strong> y co-ordin<strong>at</strong>es for the mobilenode is also printed. <strong>The</strong> descriptio<strong>ns</strong> for differentfields in the mac trace are given in the comments above. For all IP packets additional IP header fields are also added to theabove trace. <strong>The</strong> IP trace is described below:sprintf(wrk_ + offset, "------- [%d:%d %d:%d %d %d] ",src,// IP src addressih->sport_, // src port numberdst,// IP dest addressih->dport_, // dest port numberih->ttl_, // TTL value(ch->next_hop_ < 0) ? 0 : ch->next_hop_); // next hopaddress, if any.An example of a trace for a tcp packet is as follows:r 160.093884945 _6_ RTR --- 5 tcp 1492 [a2 4 6 800] ------- [65536:0 16777984:0 31 16777984] [1 0] 2 0Here we see a TCP d<strong>at</strong>a packet being received by a node with id of 6. UID of this pkt is 5 with a cmn hdr size of 1492. <strong>The</strong> macdetails shows an IP pkt (ETHERTYPE_IP is defined as 0x0800, ETHERTYPE_ARP is 0x0806 ), mac-id of this receivingnode is 4. Th<strong>at</strong> of the sending node is 6 <strong>and</strong> expected time to send this d<strong>at</strong>a pkt over the wireless channel is a2 (hex2decconversion: 160+2 sec). Additionally, IP traces inform<strong>at</strong>ion about IP src <strong>and</strong> destin<strong>at</strong>ion addresses. <strong>The</strong> src tra<strong>ns</strong>l<strong>at</strong>es (usinga 3 level hier-address of 8/8/8) to a address string of 0.1.0 with port of 0. <strong>The</strong> dest address is 1.0.3 with port address of 0.<strong>The</strong> TTL value is 31 <strong>and</strong> the destin<strong>at</strong>ion was a hop away from the src. Additionally TCP form<strong>at</strong> prints inform<strong>at</strong>ion about tcpseqno of 1, ackno of 0. See other form<strong>at</strong>s described in ~<strong>ns</strong>//cmu-trace.cc for DSR, UDP/MESSAGE, TCP/ACK <strong>and</strong> CBRpacket types.Other trace form<strong>at</strong>s are also used by the routing agents (TORA <strong>and</strong> DSR) to log certain special routing events like "origin<strong>at</strong>ing"(adding a SR header to a packet) or "ran off the end of a source route" indic<strong>at</strong>ing some sort of routing problem with the sourceroute etc. <strong>The</strong>se special event traces begin with "S" for DSR <strong>and</strong> "T" for Tora <strong>and</strong> may be found in ~<strong>ns</strong>/tora/tora.cc for TORA<strong>and</strong> ~<strong>ns</strong>/dsr/dsrgent.cc for DSR routing agent.157

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

Saved successfully!

Ooh no, something went wrong!