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__ ("")
00047 #endif
00048
00049
00050
00051
00052 #define DROP 'D'
00053 #define RECV 'r'
00054 #define SEND 's'
00055 #define FWRD 'f'
00056
00057
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
00108 static double bradius;
00109 static double radius_scaling_factor_;
00110 static double duration_scaling_factor_;
00111 static void calculate_broadcast_parameters();
00112
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