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.

the hardware address of a packet’s next hop is known, the packet is i<strong>ns</strong>erted into the interface queue. <strong>The</strong> classARPTable is implemented in ~<strong>ns</strong>/arp.{cc,h} <strong>and</strong> ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-mobilenode.tcl.Interface Queue <strong>The</strong> class PriQueue is implemented as a priority queue which gives priority to routing rotocol packets,i<strong>ns</strong>erting them <strong>at</strong> the head of the queue. It supports running a filter over all packets in the queue <strong>and</strong> removes those witha specified destin<strong>at</strong>ion address. See ~<strong>ns</strong>/priqueue.{cc,h} for interface queue implement<strong>at</strong>ion.Mac Layer <strong>The</strong> IEEE 802.11 distributed coordin<strong>at</strong>ion function (DCF) Mac protocol has been implemented by CMU. It usesa RTS/CTS/DATA/ACK p<strong>at</strong>tern for all unicast packets <strong>and</strong> simply sends out DATA for all broadcast packets. <strong>The</strong>implement<strong>at</strong>ion uses both physical <strong>and</strong> virtual carrier se<strong>ns</strong>e. <strong>The</strong> class Mac802_11 is implemented in ~<strong>ns</strong>/mac-802_11.{cc,h}.Tap Agents Agents th<strong>at</strong> subclass themselves as class Tap defined in mac.h can register themselves with the mac objectusing method i<strong>ns</strong>tallTap(). If the particular Mac protocol permits it, the tap will promiscuously be given all packetsreceived by the mac layer, before address filtering is done. See ~<strong>ns</strong>/mac.{cc,h} for class Tapmplement<strong>at</strong>ion.Network Interfaces <strong>The</strong> Network Interphase layer serves as a hardware interface which is used by mobilenode to access thechannel. <strong>The</strong> wireless shared media interface is implemented as class Phy/WirelessPhy. This interface subjectto collisio<strong>ns</strong> <strong>and</strong> the radio propag<strong>at</strong>ion model receives packets tra<strong>ns</strong>mitted by other node interfaces to the channel. <strong>The</strong>interface stamps each tra<strong>ns</strong>mitted packet with the meta-d<strong>at</strong>a rel<strong>at</strong>ed to the tra<strong>ns</strong>mitting interface like the tra<strong>ns</strong>missionpower, wavelength etc. This meta-d<strong>at</strong>a in pkt header is used by the propag<strong>at</strong>ion model in receiving network interfaceto determine if the packet has minimum power to be received <strong>and</strong>/or captured <strong>and</strong>/or detected (carrier se<strong>ns</strong>e) by thereceiving node. <strong>The</strong> model approxim<strong>at</strong>es the DSSS radio interface (Lucent WaveLan direct-sequence spread-spectrum).See ~<strong>ns</strong>/phy.{cc.h} <strong>and</strong> ~<strong>ns</strong>/wireless-phy.{cc,h} for network interface implement<strong>at</strong>io<strong>ns</strong>.Radio Propag<strong>at</strong>ion Model It uses Friss-space <strong>at</strong>tenu<strong>at</strong>ion (1/r 2 ) <strong>at</strong> near distances <strong>and</strong> an approxim<strong>at</strong>ion to Two ray Ground(1/r 4 ) <strong>at</strong> far distances. <strong>The</strong> approxim<strong>at</strong>ion assumes specular reflection off a fl<strong>at</strong> ground plane. See ~<strong>ns</strong>/tworayground.{cc,h}for implement<strong>at</strong>ion.Antenna An omni-directional antenna having unity gain is used by mobilenodes. See ~<strong>ns</strong>/antenna.{cc,h} for implement<strong>at</strong>iondetails.16.1.4 Different MAC layer protocols for mobile networkingIn <strong>ns</strong>, two MAC layer protocols are implemented for mobile networks, which are 802.11 <strong>and</strong> TDMA. In this section we brieflydiscuss each of them.802.11 MAC protocolSee ~<strong>ns</strong>/mac-802_11.{cc,h} for implement<strong>at</strong>ion details.Preamble based TDMA protocolNote: this works is still <strong>at</strong> a preliminary stage, some practical issues, such as: contention in the preamble phase <strong>and</strong> time slotreuse in a multi-hop environment are not co<strong>ns</strong>idered.Unlike contention based MAC protocol (802.11, for example), a TDMA MAC protocol alloc<strong>at</strong>es different time slots for nodesto send <strong>and</strong> receive packets. <strong>The</strong> superset of these time slots is called a TDMA frame.Currently, <strong>ns</strong> supports a single hop, preamble-based TDMA MAC protocol. With this protocl, a TDMA frame contai<strong>ns</strong>preamble besides the d<strong>at</strong>a tra<strong>ns</strong>mission slots. Within the preamble, every node has a dedic<strong>at</strong>ed subslot <strong>and</strong> uses it to broadcast152

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

Saved successfully!

Ooh no, something went wrong!