📄 node175.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>16.1.3 Network Components in a mobilenode</TITLE><META NAME="description" CONTENT="16.1.3 Network Components in a mobilenode"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html"><LINK REL="previous" HREF="node174.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node174.html"><LINK REL="up" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><LINK REL="next" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html3986" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3980" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3974" HREF="node174.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node174.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3982" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3984" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3987" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html">16.1.4 Different MAC layer</A><B> Up:</B> <A NAME="tex2html3981" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html3975" HREF="node174.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node174.html">16.1.2 Creating Node movements</A>   <B> <A NAME="tex2html3983" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3985" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H2><A NAME="SECTION031313000000000000000"></A><A NAME="sec:mobilenode-components"></A><BR>16.1.3 Network Components in a mobilenode</H2><P>The network stack for a mobilenode consists of a link layer(LL), anARP module connected to LL, an interface priority queue(IFq), a maclayer(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() intcl/lib/ns-mobilenode.tcl is shown below:<P><PRE>## 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}</PRE> <P>The plumbing in the above method creates the network stack we see inFigure <A HREF="node173.html#fig:mobilenode-dsdv" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html#fig:mobilenode-dsdv">16.1</A>.<P>Each component is briefly described here. Hopefully more detaileddocuentation from CMU shall be available in the future. <DL><DT><STRONG><B>Link Layer</B></STRONG></DT><DD>The <TT>LL</TT> used by mobilenode is same as described in Chapter <A HREF="node142.html#chap:lan" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html#chap:lan">14</A>. 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 <TT>LL</TT> by the Routing Agent. The <TT>LL</TT> hands down packets to the interface queue. For all incoming packets (out of the channel), the mac layer hands up packets to the <TT>LL</TT> which is then handed off at the <TT>node_entry_</TT> point. The LL../ns-2/ll.h is implemented in ll.{cc,h} and tcl/lan/ns-ll.tcl.<P></DD><DT><STRONG><B>ARP</B></STRONG></DT><DD>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.<P></DD><DT><STRONG><B>Interface Queue</B></STRONG></DT><DD>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.<P></DD><DT><STRONG><B>Mac Layer</B></STRONG></DT><DD>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}.<P></DD><DT><STRONG><B>Tap Agents</B></STRONG></DT><DD><TT>Agents</TT> 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. <P></DD><DT><STRONG><B>Network Interfaces</B></STRONG></DT><DD>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.<P></DD><DT><STRONG><B>Radio Propagation Model</B></STRONG></DT><DD>It uses Friss-space attenuation () at near distances and an approximation to Two ray Ground () at far distances. The approximation assumes specular reflection off a flat ground plane. See tworayground.{cc,h} for implementation.<P></DD><DT><STRONG><B>Antenna</B></STRONG></DT><DD>An omni-directional antenna having unity gain is used by mobilenodes. See antenna.{cc,h} for implementation details. </DD></DL><P><HR><!--Navigation Panel--><A NAME="tex2html3986" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3980" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3974" HREF="node174.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node174.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3982" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3984" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3987" HREF="node176.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node176.html">16.1.4 Different MAC layer</A><B> Up:</B> <A NAME="tex2html3981" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html3975" HREF="node174.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node174.html">16.1.2 Creating Node movements</A>   <B> <A NAME="tex2html3983" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3985" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -