next up previous contents index
Next: 15.1.4 Different types of Up: 15.1 The basic wireless Previous: 15.1.2 Creating Node movements

   
15.1.3 Network Components in a mobilenode

The network stack for a mobilenode consists of a link layer(LL), an ARP module connected to LL, an interface priority queue(IFq), a mac layer(MAC), a network interface(netIF), all connected to the channel. These network components are created and plumbed together in OTcl. The relevant MobileNode method add-interface() in tcl/lib/ns-mobilenode.tcl is shown below:

#
#  The following setups up link layer, mac layer, network interface
#  and physical layer structures for the mobile node.
#
Node/MobileNode instproc add-interface { channel pmodel 
                lltype mactype qtype qlen iftype anttype } {

        $self instvar arptable_ nifs_
        $self instvar netif_ mac_ ifq_ ll_

        global ns_ MacTrace opt

        set t $nifs_
        incr nifs_

        set netif_($t)  [new $iftype]           ;# net-interface
        set mac_($t)    [new $mactype]          ;# mac layer
        set ifq_($t)    [new $qtype]            ;# interface queue
        set ll_($t)     [new $lltype]           ;# link layer
        set ant_($t)    [new $anttype]

        #
        # Local Variables
        #
        set nullAgent_ [$ns_ set nullAgent_]
        set netif $netif_($t)
        set mac $mac_($t)
        set ifq $ifq_($t)
        set ll $ll_($t)

        #
        # Initialize ARP table only once.
        #
        if { $arptable_ == "" } {
            set arptable_ [new ARPTable $self $mac]
            set drpT [cmu-trace Drop "IFQ" $self]
            $arptable_ drop-target $drpT
        }

        #
        # Link Layer
        #
        $ll arptable $arptable_
        $ll mac $mac
        $ll up-target [$self entry]
        $ll down-target $ifq

        #
        # Interface Queue
        #
        $ifq target $mac
        $ifq set qlim_ $qlen
        set drpT [cmu-trace Drop "IFQ" $self]
        $ifq drop-target $drpT

        #
        # Mac Layer
        #
        $mac netif $netif
        $mac up-target $ll
        $mac down-target $netif
        $mac nodes $opt(nn)

        #
        # Network Interface
        #
        $netif channel $channel
        $netif up-target $mac
        $netif propagation $pmodel      ;# Propagation Model
        $netif node $self               ;# Bind node \<---\> interface
        $netif antenna $ant_($t)        ;# attach antenna

        #
        # Physical Channel
        #
        $channel addif $netif           ;# add to list of interfaces

        # ============================================================
        # Setting up trace objects
        
        if { $MacTrace == "ON" } {
            #
            # Trace RTS/CTS/ACK Packets
            #
            set rcvT [cmu-trace Recv "MAC" $self]
            $mac log-target $rcvT


            #
            # Trace Sent Packets
            #
            set sndT [cmu-trace Send "MAC" $self]
            $sndT target [$mac sendtarget]
            $mac sendtarget $sndT

            #
            # Trace Received Packets
            #
            set rcvT [cmu-trace Recv "MAC" $self]
            $rcvT target [$mac recvtarget]
            $mac recvtarget $rcvT

            #
            # Trace Dropped Packets
            #
            set drpT [cmu-trace Drop "MAC" $self]
            $mac drop-target $drpT
        } else {
            $mac log-target [$ns_ set nullAgent_]
            $mac drop-target [$ns_ set nullAgent_]
        }

        # ============================================================

        $self addif $netif
}

The plumbing in the above method creates the network stack we see in Figure 15.1.

Each component is briefly described here. Hopefully more detailed docuentation from CMU shall be available in the future.

Link Layer
The LL used by mobilenode is same as described in Chapter 13. The only difference being the link layer for mobilenode, has an ARP module connected to it which resolves all IP to hardware (Mac) address conversions. Normally for all outgoing (into the channel) packets, the packets are handed down to the LL by the Routing Agent. The LL hands down packets to the interface queue. For all incoming packets (out of the channel), the mac layer hands up packets to the LL which is then handed off at the node_entry_ point. The LL../ns-2/ll.h is implemented in ll.{cc,h} and tcl/lan/ns-ll.tcl.

ARP
The Address Resolution Protocol (implemented in BSD style) module receives queries from Link layer. If ARP has the hardware address for destination, it writes it into the mac header of the packet. Otherwise it broadcasts an ARP query, and caches the packet temporarily. For each unknown destination hardware address, there is a buffer for a single packet. Incase additional packets to the same destination is sent to ARP, the earlier buffered packet is dropped. Once the hardware address of a packet"s next hop is known, the packet is inserted into the interface queue. The ARPTable../ns-2/arp.h is implemented in arp.{cc,h} and tcl/lib/ns-mobilenode.tcl.

Interface Queue
The PriQueue../ns-2/priqueue.h is implemented as a priority queue which gives priority to routing rotocol packets, inserting them at the head of the queue. It supports running a filter over all packets in the queue and removes those with a specified destination address. See priqueue.{cc,h} for interface queue implementation.

Mac Layer
The IEEE 802.11 distributed coordination function (DCF) Mac protocol has been implemented by CMU. It uses a RTS/CTS/DATA/ACK pattern for all unicast packets and simply sends out DATA for all broadcast packets. The implementation uses both physical and virtual carrier sense. The Mac802_11../ns-2/mac-802_11.h is implemented in mac-802_11.{cc,h}.
Tap Agents
Agents that subclass themselves as Tap../ns-2/mac.h defined in mac.h can register themselves with the mac object using method installTap(). If the particular Mac protocol permits it, the tap will promiscuously be given all packets received by the mac layer, before address filtering is done. See mac.{cc,h} for Tap implementation.

Network Interfaces
The Network Interphase layer serves as a hardware interface which is used by mobilenode to access the channel. The wireless shared media interface is implemented as Phy/WirelessPhy../ns-2/wireless-phy.h. This interface subject to collisions and the radio propagation model receives packets transmitted by other node interfaces to the channel. The interface stamps each transmitted packet with the meta-data related to the transmitting interface like the transmission power, wavelength etc. This meta-data in pkt header is used by the propagation model in receiving network interface to determine if the packet has minimum power to be received and/or captured and/or detected (carrier sense) by the receiving node. The model approximates the DSSS radio interface (Lucent WaveLan direct-sequence spread-spectrum). See phy.{cc.h} and wireless-phy.{cc,h} for network interface implementations.

Radio Propagation Model
It uses Friss-space attenuation (1/r2) at near distances and an approximation to Two ray Ground (1/r4) at far distances. The approximation assumes specular reflection off a flat ground plane. See tworayground.{cc,h} for implementation.

Antenna
An omni-directional antenna having unity gain is used by mobilenodes. See antenna.{cc,h} for implementation details.


next up previous contents index
Next: 15.1.4 Different types of Up: 15.1 The basic wireless Previous: 15.1.2 Creating Node movements

2000-08-24