00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TRACEPROTO_H
00021 #define TRACEPROTO_H 1
00022
00023 #define TP_BUF_SIZE 1024
00024 #define NO_PROMISC 0
00025 #define TP_DONT_FRAG 0x4000
00026 #define SNAPLEN 2048
00027 #define FILTERSIZE 150
00028 #define LINUX_OFFSET 2
00029 #define TP_IF_ARRAY 10
00030 #define TP_TIMESTAMP_LEN 22
00031
00032 enum packet_track {
00033 TP_PACKET_NO,
00034 TP_PACKET_MATCH,
00035 TP_PACKET_TIMEOUT,
00036 TP_PACKET_DONE
00037 };
00038
00039
00040
00041
00042
00043
00044 enum accounting {
00045 TP_ACCOUNT_NONE,
00046 TP_ACCOUNT_TOTAL,
00047 TP_ACCOUNT_FULL
00048 };
00049
00050 enum output {
00051 TP_GRAPHIC_OUTPUT,
00052 TP_CLASSIC_OUTPUT,
00053 TP_MIN_OUTPUT,
00054 TP_SCRIPT_OUTPUT,
00055 TP_CURSES_OUTPUT,
00056 TP_STD_OUTPUT,
00057 TP_NO_OUTPUT
00058 };
00059
00060 enum output_items {
00061 TP_OUT_HEADER,
00062 TP_OUT_HOP_NUMBER,
00063 TP_OUT_HOP_INFO,
00064 TP_OUT_TIME,
00065 TP_OUT_FOOTER
00066 };
00067
00068 enum packet_numbers {
00069 TP_TYPE_NULL,
00070 TP_TYPE_NR,
00071 TP_TYPE_SYN,
00072 TP_TYPE_ACK,
00073 TP_TYPE_SYNACK,
00074 TP_TYPE_SEC,
00075 TP_TYPE_RST,
00076 TP_TYPE_ACKRST,
00077 TP_TYPE_FIN,
00078 TP_TYPE_UDP,
00079 TP_TYPE_TIMXCEED,
00080 TP_TYPE_PORT_UNREACH,
00081 TP_TYPE_HOST_UNREACH,
00082 TP_TYPE_NET_UNREACH,
00083 TP_TYPE_ICMP,
00084 TP_TYPE_ECHOREPLY,
00085 TP_TYPE_PROHIB,
00086 TP_TYPE_OTHER
00087 };
00088
00089 enum bool { NO = 0, YES = 1 };
00090
00091 enum tp_tstamps {
00092 TP_TIMESTAMP_STD = 0,
00093 TP_TIMESTAMP_US,
00094 TP_TIMESTAMP_DESCEND,
00095 TP_TIMESTAMP_EPOCH
00096 };
00097
00098
00099
00100
00101
00102
00103
00104 struct tp_align_ref {
00105 struct tp_align_ref * next;
00106 u_char * ref;
00107 } tp_align_freelist;
00108
00109 struct {
00110 unsigned int continuous : 1;
00111 unsigned int continuous_accounting : 1;
00112 unsigned int do_skip : 1;
00113 unsigned int do_audit_exit : 1;
00114 unsigned int do_audit : 1;
00115 unsigned int tcp_resets : 1;
00116 unsigned int as_discovery : 1;
00117 unsigned int default_if : 1;
00118 unsigned int timestamp : 1;
00119 unsigned int rndm_src_port;
00120 unsigned int packets_per_hop;
00121 int max_ttl;
00122 int min_ttl;
00123 int min_src_port;
00124 int max_src_port;
00125 int min_dst_port;
00126 int max_dst_port;
00127 int src_port_incr;
00128 int dst_port_incr;
00129 int wait_timeout;
00130 int wait_between_packets;
00131 char const * protocol;
00132 char interface [ TP_IF_ARRAY ];
00133
00134 int account_level;
00135 void ( * report ) ( int, struct in_addr *, int );
00136 char * skip_str;
00137 int * skips;
00138 int output_style;
00139 unsigned int payload_size;
00140 char * target;
00141 struct addrinfo *target_addrinfo_list_start;
00142 struct addrinfo *target_addrinfo;
00143 struct hostent * packed_target_reverse;
00144 char * target_reverse;
00145 int libnet_resolve_choice;
00146 int hop_incr_unit;
00147 char const * filter_text;
00148 char timestamp_str [ TP_TIMESTAMP_LEN ];
00149 char timestamp_style;
00150 struct addrinfo hint;
00151 } behavior;
00152
00153 struct {
00154 int dst_port;
00155 int src_port;
00156 int protocol_number;
00157 unsigned short ip_packet_len;
00158 unsigned char * payload;
00159 unsigned char tcp_flags;
00160 long packed_target;
00161 long packed_src;
00162 unsigned short frag_bit;
00163 unsigned short ip_id;
00164 } packet;
00165
00166 struct {
00167 char * prog;
00168 unsigned int account_hops;
00169 struct hop_record {
00170 int distance;
00171 double min_time;
00172 double max_time;
00173 double median_time;
00174 double ave_time;
00175 int num_packets;
00176 int lost_packets;
00177 int hop_changes;
00178 } * hop_record;
00179 int continuous_count;
00180 libnet_t * packet;
00181 libnet_ptag_t tcp_h;
00182 libnet_ptag_t udp_h;
00183 libnet_ptag_t icmp_h;
00184 libnet_ptag_t ip_h;
00185 char pc_error [ PCAP_ERRBUF_SIZE ];
00186 char * error_buff[LIBNET_ERRBUF_SIZE];
00187 int current_hop;
00188 unsigned int packets_this_hop;
00189 int packet_match;
00190 struct timeval start_time;
00191 struct timeval end_time;
00192 struct timeval packet_wait;
00193 double trip_time;
00194 pcap_t * psocket;
00195
00196
00197
00198
00199
00200 struct fake_pcap {
00201 int fd;
00202 char unused [ 1024 ];
00203 } * fake_psocket;
00204 fd_set wheel;
00205 unsigned char * capture_buf;
00206 struct pcap_pkthdr psock_hdr;
00207 struct libnet_ipv4_hdr * ip_hdr;
00208 unsigned int low_ttl;
00209 unsigned int incr_error : 1;
00210 unsigned int target_response : 1;
00211 } state;
00212
00213 struct {
00214 unsigned int loop : 1;
00215 unsigned int interface : 1;
00216 unsigned int send_buf : 1;
00217 unsigned int recv_buf : 1;
00218 unsigned int packet_length : 1;
00219 unsigned int timestamp : 1;
00220 unsigned int as_lookup : 1;
00221 unsigned int memory : 1;
00222 } debug;
00223
00224 #endif