⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node184.html

📁 相关搜索: ns2仿真结果分析 all-awk ns2 ns2 无限网络中awk文件 ... [2.tcl.rar] - 在ns2平台上实现对AODV协议的模拟
💻 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.6 Trace Support</TITLE><META NAME="description" CONTENT="16.1.6 Trace Support"><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="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html"><LINK REL="previous" HREF="node179.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node179.html"><LINK REL="up" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><LINK REL="next" HREF="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html4114"  HREF="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html4108"  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="tex2html4102"  HREF="node183.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node183.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html4110"  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="tex2html4112"  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="tex2html4115"  HREF="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html">16.1.7 Revised format for</A><B> Up:</B> <A NAME="tex2html4109"  HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html4103"  HREF="node183.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node183.html">16.1.5.4 AODV</A> &nbsp <B>  <A NAME="tex2html4111"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html4113"  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="SECTION031316000000000000000"></A><A NAME="sec:mobile-trace"></A><BR>16.1.6 Trace Support</H2><P>The trace support for wireless simulations currently use cmu-traceobjects. In the future this shall be extended to merge with trace andmonitoring support available in ns, which would also include nam supportfor wireless modules. For now we will explain briefly with cmu-traceobjects and how they may be used to trace packets for wireless scenarios. <P>The cmu-trace objects are of three types - <TT>CMUTrace/Drop</TT>,<TT>CMUTrace/Recv</TT> and <TT>CMUTrace/Send</TT>. These are used for tracingpackets that are dropped, received and sent by agents, routers, mac layersor interface queues in . The methods and procedures used forimplementing wireless trace support can be found undertrace.{cc,h} and tcl/lib/ns-cmutrace.tcl.<P>A cmu-trace object may be created by the following API:<PRE>set sndT [cmu-trace Send "RTR" $self]</PRE> which creates a trace object, sndT, of the type <TT>CMUTrace/Send</TT>for tracing all packets that are sent out in a router. The traceobjects may be used to trace packets in MAC, agents (routing orothers), routers or any other NsObject. <P>The cmu-trace object <TT>CMUTrace</TT> is derived from the base class<TT>Trace</TT>. See Chapter&nbsp;<A HREF="node265.html#chap:trace" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html#chap:trace">23</A> for details on class<TT>Trace</TT>. The class <TT>CMUTrace</TT> is defined as the following:<P><PRE>class CMUTrace : public Trace {public:        CMUTrace(const char *s, char t);        void    recv(Packet *p, Handler *h);        void    recv(Packet *p, const char* why);private:        int off_arp_;        int off_mac_;        int off_sr_;        char    tracename[MAX_ID_LEN + 1];        int     tracetype;        MobileNode *node_;        int initialized() { return node_ &amp;&amp; 1; }        int     command(int argc, const char*const* argv);        void    format(Packet *p, const char *why);        void    format_mac(Packet *p, const char *why, int offset);        void    format_ip(Packet *p, int offset);        void    format_arp(Packet *p, int offset);        void    format_dsr(Packet *p, int offset);        void    format_msg(Packet *p, int offset);        void    format_tcp(Packet *p, int offset);        void    format_rtp(Packet *p, int offset);};</PRE><P>The type field (described in <TT>Trace</TT> class definition) is used todifferentiate among different types of traces. For cmu-trace this can be<B>s</B> for sending, <B>r</B> for receiving or <B>D</B> for dropping apacket. A fourth type <B>f</B> is used to denote forwarding of a packet(When the node is not the originator of the packet). Similar to the method Trace::format(), the CMUTrace::format() defines anddictates the trace file format. The method is shown below: <PRE>void CMUTrace::format(Packet* p, const char *why){        hdr_cmn *ch = HDR_CMN(p);        int offset = 0;        /*         * Log the MAC Header         */        format_mac(p, why, offset);        offset = strlen(wrk_);        switch(ch-\&gt;ptype()) {        case PT_MAC:                break;        case PT_ARP:                format_arp(p, offset);                break;        default:                format_ip(p, offset);                offset = strlen(wrk_);                switch(ch-\&gt;ptype()) {                case PT_DSR:                        format_dsr(p, offset);                        break;                case PT_MESSAGE:                case PT_UDP:                        format_msg(p, offset);                        break;                                        case PT_TCP:                case PT_ACK:                        format_tcp(p, offset);                        break;                                        case PT_CBR:                        format_rtp(p, offset);                        break;                ..........                }        }}</PRE>The above function calls different format functions depending on the typeof the packet being traced. All traces are written to the buffer wrk_. Acount of the offset for the buffer is kept and is passed along thedifferent trace functions. The most basic format is defined byformat_mac() and is used to trace all pkt types. The other formatfunctions print additional information as defined by the packet types. Themac format prints the following:   <PRE>\#ifdef LOG_POSITION        double x = 0.0, y = 0.0, z = 0.0;        node_-\&gt;getLoc(&amp;x, &amp;y, &amp;z);\#endif        sprintf(wrk_ + offset,\#ifdef LOG_POSITION                "%c %.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x] ",\#else                "%c %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] ",\#endif                op,                    // s, r, D or f                Scheduler::instance().clock(),  // time stamp                src_,                  // the nodeid for this node\#ifdef LOG_POSITION                x,                     // x co-ord                 y,                     // y co-ord\#endif                tracename,             // name of object type tracing                why,                   // reason, if any                ch-\&gt;uid(),             // identifier for this event                packet_info.name(ch-\&gt;ptype()), // packet type                ch-\&gt;size(),                    // size of cmn header                mh-\&gt;dh_duration,       // expected time to send data                 ETHER_ADDR(mh-\&gt;dh_da), // mac_destination address                ETHER_ADDR(mh-\&gt;dh_sa),         // mac_sender address                GET_ETHER_TYPE(mh-\&gt;dh_body));  // type - arp or IP</PRE><P>If the LOG_POSITION is defined the x and y co-ordinates for themobilenode is also printed. The descriptions for different fields in themac trace are given in the comments above. For all IP packets additionalIP header fields are also added to the above trace. The IP trace isdescribed below:<P><PRE>sprintf(wrk_ + offset, "------- [%d:%d %d:%d %d %d] ",                src,          // IP src address                ih-\&gt;sport_,   // src port number                dst,          // IP dest address                ih-\&gt;dport_,   // dest port number                ih-\&gt;ttl_,     // TTL value                 (ch-\&gt;next_hop_ \&lt; 0) ? 0 : ch-\&gt;next_hop_); // next hopaddress, if any.</PRE><P>An example of a trace for a tcp packet is as follows:<PRE>r 160.093884945 _6_ RTR  --- 5 tcp 1492 [a2 4 6 800] ------- [65536:0 16777984:0 31 16777984] [1 0] 2 0</PRE>Here we see a TCP data packet being received by a node with id of 6. UIDof this pkt is 5 with a cmn hdr size of 1492. The mac details shows an IPpkt (ETHERTYPE_IP is defined as 0x0800, ETHERTYPE_ARP is 0x0806 ), mac-idof this receiving node is 4. That of the sending node is 6 and expectedtime to send this data pkt over the wireless channel is a2 (hex2decconversion: 160+2 sec). Additionally, IP traces information about IP srcand destination addresses. The src translates (using a 3 levelhier-address of 8/8/8) to a address string of 0.1.0 with port of 0. Thedest address is 1.0.3 with port address of 0. The TTL value is 31 and thedestination was a hop away from the src. Additionally TCP format printsinformation about tcp seqno of 1, ackno of 0. See other formats describedin /cmu-trace.cc for DSR, UDP/MESSAGE, TCP/ACK and CBR packet types.<P>Other trace formats are also used by the routing agents (TORA and DSR) tolog certain special routing events like "originating" (adding a SR headerto a packet) or  "ran off the end of a source route" indicating some sortof routing problem with the source route etc. These special event tracesbegin with "S" for DSR and "T" for Tora and maybe found in tora/tora.cc for TORA and dsr/dsrgent.cc for DSRrouting agent.<P><HR><!--Navigation Panel--><A NAME="tex2html4114"  HREF="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html4108"  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="tex2html4102"  HREF="node183.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node183.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html4110"  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="tex2html4112"  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="tex2html4115"  HREF="node185.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node185.html">16.1.7 Revised format for</A><B> Up:</B> <A NAME="tex2html4109"  HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html4103"  HREF="node183.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node183.html">16.1.5.4 AODV</A> &nbsp <B>  <A NAME="tex2html4111"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html4113"  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 + -