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.

implemented in a single Mac object. For sending, the Mac object must follow a certain medium access protocol beforetra<strong>ns</strong>mitting the packet on the channel. For receiving, the MAC layer is respo<strong>ns</strong>ible for delivering the packet to the link layer.Above the MAC layer, the link layer can potentially have many functionalities such as queuing <strong>and</strong> link-level retra<strong>ns</strong>mission.<strong>The</strong> need of having a wide variety of link-level schemes leads to the division of functionality into two components: Queue<strong>and</strong> LL (link-layer). <strong>The</strong> Queue object, simul<strong>at</strong>ing the interface queue, belongs to the same Queue class th<strong>at</strong> is describedin Chapter 7. <strong>The</strong> LL object implements a particular d<strong>at</strong>a link protocol, such as ARQ. By combining both the sending <strong>and</strong>receiving functionalities into one module, the LL object can also support other mechanisms such as piggybacking.14.3 Channel Class<strong>The</strong> Channel class simul<strong>at</strong>es the actual tra<strong>ns</strong>mission of the packet <strong>at</strong> the physical layer. <strong>The</strong> basic Channel implementsa shared medium with support for contention mechanisms. It allows the MAC to carry out carrier se<strong>ns</strong>e, contention, <strong>and</strong>collision detection. If more than one tra<strong>ns</strong>missio<strong>ns</strong> overlaps in time, a channel raises the collision flag. By checking this flag,the MAC object can implement collision detection <strong>and</strong> h<strong>and</strong>ling.Since the tra<strong>ns</strong>mission time is a function of the number of bits in the packet <strong>and</strong> the modul<strong>at</strong>ion speed of each individualinterface (MAC), the Channel object only sets its busy signal for the dur<strong>at</strong>ion requested by the MAC object. It alsoschedules the packets to be delivered to the destin<strong>at</strong>ion MAC objects after the tra<strong>ns</strong>mission time plus the propag<strong>at</strong>ion delay.14.3.1 Channel St<strong>at</strong>e<strong>The</strong> C++ class Channel includes enough internal st<strong>at</strong>e to schedule packet delivery <strong>and</strong> detect collisio<strong>ns</strong>. It exports thefollowing OTcl configur<strong>at</strong>ion parameter:delay_propag<strong>at</strong>ion delay on the channel14.3.2 Example: Channel <strong>and</strong> classifier of the physical layerset channel_ [new Channel]$channel_ set delay_ 4us# propag<strong>at</strong>ion delayset mcl_ [new Classifier/Mac]$channel_ target $mcl_$mcl_ i<strong>ns</strong>tall $mac_DA $recv_iface. . .14.3.3 Channel Class in C++In C++, the class Channel extends the Connector object with several new methods to support a variety of MAC protocols.<strong>The</strong> class is defined as follow in ~<strong>ns</strong>/channel.h:class Channel : public Connector {public:Channel();133

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

Saved successfully!

Ooh no, something went wrong!