cmu-trace.h

Go to the documentation of this file.
00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-
00002  *
00003  * Copyright (c) 1997 Regents of the University of California.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. All advertising materials mentioning features or use of this software
00015  *    must display the following acknowledgement:
00016  *  This product includes software developed by the Computer Systems
00017  *  Engineering Group at Lawrence Berkeley Laboratory.
00018  * 4. Neither the name of the University nor of the Laboratory may be used
00019  *    to endorse or promote products derived from this software without
00020  *    specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  *
00034  * $Header: /nfs/jade/vint/CVSROOT/ns-2/trace/cmu-trace.h,v 1.25 2005/07/27 01:13:45 tomh Exp $
00035  */
00036 
00037 /* Ported from CMU/Monarch's code, nov'98 -Padma.*/
00038 
00039 #ifndef __cmu_trace__
00040 #define __cmu_trace__
00041 
00042 #include "trace.h"
00043 #include "god.h"
00044 
00045 #ifndef __PRETTY_FUNCTION__
00046 #define __PRETTY_FUNCTION__ ("")
00047 #endif /* !__PRETTY_FUNCTION__ */
00048 
00049 /* ======================================================================
00050    Global Defines
00051    ====================================================================== */
00052 #define DROP            'D'
00053 #define RECV            'r'
00054 #define SEND        's'
00055 #define FWRD        'f'
00056 
00057 // change wrt Mike's code
00058 #define EOT             'x'
00059 
00060 
00061 
00062 #define TR_ROUTER   0x01
00063 #define TR_MAC      0x02
00064 #define TR_IFQ      0x04
00065 #define TR_AGENT    0x08
00066 
00067 #define DROP_END_OF_SIMULATION      "END"
00068 #define DROP_MAC_COLLISION      "COL"
00069 #define DROP_MAC_DUPLICATE      "DUP"
00070 #define DROP_MAC_PACKET_ERROR       "ERR"
00071 #define DROP_MAC_RETRY_COUNT_EXCEEDED   "RET"
00072 #define DROP_MAC_INVALID_STATE      "STA"
00073 #define DROP_MAC_BUSY           "BSY"
00074 #define DROP_MAC_INVALID_DST            "DST"
00075 #define DROP_MAC_SLEEP                  "SLP"   // smac sleep state
00076 
00077 #define DROP_RTR_NO_ROUTE       "NRTE"  // no route
00078 #define DROP_RTR_ROUTE_LOOP     "LOOP"  // routing loop
00079 #define DROP_RTR_TTL                    "TTL"   // ttl reached zero
00080 #define DROP_RTR_QFULL                  "IFQ"   // queue full
00081 #define DROP_RTR_QTIMEOUT               "TOUT"  // packet expired
00082 #define DROP_RTR_MAC_CALLBACK           "CBK"   // MAC callback
00083 #define DROP_RTR_SALVAGE            "SAL"
00084 
00085 #define DROP_IFQ_QFULL                  "IFQ"   // no buffer space in IFQ
00086 #define DROP_IFQ_ARP_FULL               "ARP"   // dropped by ARP
00087 #define DROP_IFQ_FILTER                 "FIL"
00088 
00089 #define DROP_OUTSIDE_SUBNET             "OUT"   // dropped by base stations if received rtg updates from nodes outside its domain.
00090 
00091 #define MAX_ID_LEN  3
00092 #define MAX_NODE    4096
00093 
00094 class CMUTrace : public Trace {
00095 public:
00096     CMUTrace(const char *s, char t);
00097     void    recv(Packet *p, Handler *h);
00098     void    recv(Packet *p, const char* why);
00099 
00100 private:
00101     char    tracename[MAX_ID_LEN + 1];
00102     int nodeColor[MAX_NODE];
00103         int     tracetype;
00104         MobileNode *node_;
00105     int     newtrace_;
00106 
00107     //<zheng: ns 2.27 removed the following part, but we need it to control the broadcast radius>
00108         static double  bradius;
00109         static double  radius_scaling_factor_;
00110         static double  duration_scaling_factor_;
00111         static void calculate_broadcast_parameters();
00112     //</zheng>
00113 
00114         int initialized() { return node_ && 1; }
00115     int node_energy();
00116     int command(int argc, const char*const* argv);
00117     void    format(Packet *p, const char *why);
00118 
00119         void    nam_format(Packet *p, int offset);
00120 
00121     void    format_mac_common(Packet *p, const char *why, int offset);
00122     void    format_mac(Packet *p, int offset);
00123     void    format_smac(Packet *p, int offset);
00124     void    format_ip(Packet *p, int offset);
00125 
00126     void    format_arp(Packet *p, int offset);
00127     void    format_hdlc(Packet *p, int offset);
00128     void    format_dsr(Packet *p, int offset);
00129     void    format_msg(Packet *p, int offset);
00130     void    format_tcp(Packet *p, int offset);
00131     void    format_sctp(Packet *p, int offset);
00132     void    format_rtp(Packet *p, int offset);
00133     void    format_tora(Packet *p, int offset);
00134         void    format_imep(Packet *p, int offset);
00135         void    format_aodv(Packet *p, int offset);
00136 };
00137 
00138 #endif /* __cmu_trace__ */

Generated on Tue Mar 6 16:47:43 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6