Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

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.18 2003/02/22 03:53:35 buchheim 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__ ((const char *) 0)
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 #define TR_ROUTER       0x01
00058 #define TR_MAC          0x02
00059 #define TR_IFQ          0x04
00060 #define TR_AGENT        0x08
00061 
00062 #define DROP_END_OF_SIMULATION          "END"
00063 #define DROP_MAC_COLLISION              "COL"
00064 #define DROP_MAC_DUPLICATE              "DUP"
00065 #define DROP_MAC_PACKET_ERROR           "ERR"
00066 #define DROP_MAC_RETRY_COUNT_EXCEEDED   "RET"
00067 #define DROP_MAC_INVALID_STATE          "STA"
00068 #define DROP_MAC_BUSY                   "BSY"
00069 #define DROP_MAC_INVALID_DST            "DST"
00070 #define DROP_MAC_SLEEP                  "SLP"   // smac sleep state
00071 
00072 #define DROP_RTR_NO_ROUTE               "NRTE"  // no route
00073 #define DROP_RTR_ROUTE_LOOP             "LOOP"  // routing loop
00074 #define DROP_RTR_TTL                    "TTL"   // ttl reached zero
00075 #define DROP_RTR_QFULL                  "IFQ"   // queue full
00076 #define DROP_RTR_QTIMEOUT               "TOUT"  // packet expired
00077 #define DROP_RTR_MAC_CALLBACK           "CBK"   // MAC callback
00078 #define DROP_RTR_SALVAGE                "SAL"
00079 
00080 #define DROP_IFQ_QFULL                  "IFQ"   // no buffer space in IFQ
00081 #define DROP_IFQ_ARP_FULL               "ARP"   // dropped by ARP
00082 #define DROP_IFQ_FILTER                 "FIL"
00083 
00084 #define DROP_OUTSIDE_SUBNET             "OUT"   // dropped by base stations if received rtg updates from nodes outside its domain.
00085 
00086 #define MAX_ID_LEN      3
00087 #define MAX_NODE        4096
00088 
00089 class CMUTrace : public Trace {
00090 public:
00091         CMUTrace(const char *s, char t);
00092         void    recv(Packet *p, Handler *h);
00093         void    recv(Packet *p, const char* why);
00094 
00095 private:
00096         char    tracename[MAX_ID_LEN + 1];
00097         int     nodeColor[MAX_NODE];
00098         int     tracetype;
00099         MobileNode *node_;
00100         int     newtrace_;
00101 
00102         static double  bradius;
00103         static double  radius_scaling_factor_;
00104         static double  duration_scaling_factor_;
00105         static void calculate_broadcast_parameters();
00106 
00107         int initialized() { return node_ && 1; }
00108         int node_energy();
00109         int     command(int argc, const char*const* argv);
00110         void    format(Packet *p, const char *why);
00111 
00112         void    nam_format(Packet *p, int offset);
00113 
00114         void    format_mac(Packet *p, const char *why, int offset);
00115         void    format_ip(Packet *p, int offset);
00116 
00117         void    format_arp(Packet *p, int offset);
00118         void    format_dsr(Packet *p, int offset);
00119         void    format_msg(Packet *p, int offset);
00120         void    format_tcp(Packet *p, int offset);
00121         void    format_rtp(Packet *p, int offset);
00122         void    format_tora(Packet *p, int offset);
00123         void    format_imep(Packet *p, int offset);
00124         void    format_aodv(Packet *p, int offset);
00125 };
00126 
00127 #endif /* __cmu_trace__ */

Generated on Tue Apr 20 12:14:12 2004 for NS2.26SourcesOriginal by doxygen 1.3.3