00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
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
00048
00049
00050
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