]>
Commit | Line | Data |
---|---|---|
89c4ed63 A |
1 | |
2 | /* | |
3 | Copyright (c) 2000 | |
4 | International Computer Science Institute | |
5 | All rights reserved. | |
6 | ||
7 | This file may contain software code originally developed for the | |
8 | Sting project. The Sting software carries the following copyright: | |
9 | ||
10 | Copyright (c) 1998, 1999 | |
11 | Stefan Savage and the University of Washington. | |
12 | All rights reserved. | |
13 | ||
14 | Redistribution and use in source and binary forms, with or without | |
15 | modification, are permitted provided that the following conditions | |
16 | are met: | |
17 | 1. Redistributions of source code must retain the above copyright | |
18 | notice, this list of conditions and the following disclaimer. | |
19 | 2. Redistributions in binary form must reproduce the above copyright | |
20 | notice, this list of conditions and the following disclaimer in the | |
21 | documentation and/or other materials provided with the distribution. | |
22 | 3. All advertising materials mentioning features or use of this software | |
23 | must display the following acknowledgment: | |
24 | This product includes software developed by ACIRI, the AT&T | |
25 | Center for Internet Research at ICSI (the International Computer | |
26 | Science Institute). This product may also include software developed | |
27 | by Stefan Savage at the University of Washington. | |
28 | 4. The names of ACIRI, ICSI, Stefan Savage and University of Washington | |
29 | may not be used to endorse or promote products derived from this software | |
30 | without specific prior written permission. | |
31 | ||
32 | THIS SOFTWARE IS PROVIDED BY ICSI AND CONTRIBUTORS ``AS IS'' AND | |
33 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
34 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
35 | ARE DISCLAIMED. IN NO EVENT SHALL ICSI OR CONTRIBUTORS BE LIABLE | |
36 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
37 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
38 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
39 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
40 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
41 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
42 | SUCH DAMAGE. | |
43 | */ | |
44 | ||
45 | #include <signal.h> | |
46 | ||
47 | #define MAXRESETRETRANSMITS (3) | |
48 | /*#define INSESSION(p, src, sport, dst, dport) \ | |
49 | (((p)->ip.ip_src == (src)) && ((p)->ip.ip_dst == (dst)) && \ | |
50 | ((p)->ip.ip_p == IPPROTOCOL_TCP) && \ | |
51 | ((p)->tcp.tcp_sport == htons(sport)) && \ | |
52 | ((p)->tcp.tcp_dport == htons(dport)))*/ | |
53 | ||
54 | #define INSESSION(p, src, sport, dst, dport) \ | |
55 | (((p)->ip->ip_src == (src)) && ((p)->ip->ip_dst == (dst)) && \ | |
56 | ((p)->ip->ip_p == IPPROTOCOL_TCP) && \ | |
57 | ((p)->tcp->tcp_sport == htons(sport)) && \ | |
58 | ((p)->tcp->tcp_dport == htons(dport))) | |
59 | ||
60 | #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) | |
61 | #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) | |
62 | #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) | |
63 | #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) | |
64 | ||
65 | #define DEFAULT_TARGETPORT (80) | |
66 | #define DEFAULT_MSS 1360 | |
67 | #define DEFAULT_MTU 1500 | |
68 | #define RTT_TO_MULT 5 | |
69 | #define PLOTDIFF 0.00009 | |
70 | ||
71 | /* Response codes */ | |
72 | #define FAIL -1 | |
73 | #define SUCCESS 0 | |
74 | #define NO_TARGET_CANON_INFO 1 | |
75 | #define NO_LOCAL_HOSTNAME 2 | |
76 | #define NO_SRC_CANON_INFO 3 | |
77 | #define NO_SESSION_ESTABLISH 4 | |
78 | #define MSS_TOO_SMALL 5 | |
79 | #define BAD_ARGS 6 | |
80 | #define FIREWALL_ERR 7 | |
81 | #define ERR_SOCKET_OPEN 8 | |
82 | #define ERR_SOCKOPT 9 | |
83 | #define ERR_MEM_ALLOC 10 | |
84 | #define NO_CONNECTION 11 | |
85 | #define MSS_ERR 12 | |
86 | #define BUFFER_OVERFLOW 13 | |
87 | #define UNWANTED_PKT_DROP 14 | |
88 | #define EARLY_RST 15 | |
89 | #define UNEXPECTED_PKT 16 | |
90 | #define DIFF_FLOW 17 | |
91 | #define ERR_CHECKSUM 18 | |
92 | #define NOT_ENOUGH_PKTS 19 | |
93 | #define BAD_OPT_LEN 20 | |
94 | #define TOO_MANY_PKTS 21 | |
95 | #define NO_DATA_RCVD 22 | |
96 | #define NO_TRGET_SPECIFIED 23 | |
97 | #define BAD_OPTIONS 24 | |
98 | #define TOO_MANY_TIMEOUTS 25 | |
99 | #define TOO_MANY_RXMTS 26 | |
100 | #define NO_SACK 27 | |
101 | #define ERR_IN_SB_CALC 28 | |
102 | #define TOO_MANY_HOLES 29 | |
103 | #define TOO_MANY_DROPS 30 | |
104 | #define UNWANTED_PKT_REORDER 31 | |
105 | #define NO_PMTUD_ENABLED 32 | |
106 | #define UNKNOWN_BEHAVIOR 33 | |
107 | #define NO_SYNACK_RCVD 34 | |
108 | #define SEND_REQUEST_FAILED 35 | |
109 | #define PKT_SIZE_CHANGED 36 | |
110 | #define ECN_SYN_DROP 37 | |
111 | ||
112 | #define DEFAULT_FILENAME "/" | |
113 | ||
114 | #define RTT_TO_MULT 5 | |
115 | #define SYNTIMEOUT (2.0) | |
116 | #define REXMITDELAY (2.0) | |
117 | #define MAXSYNRETRANSMITS (6) | |
118 | #define MAXDATARETRANSMITS (6) | |
119 | ||
120 | /* HTTP Response Codes */ | |
121 | #define HTTP_OK "200" | |
122 | ||
123 | ||
124 | void SendReset(); | |
125 | void SigHandle (int signo); | |
126 | void Cleanup(); | |
127 | void Quit(int how); | |
128 | double GetTime(); | |
129 | double GetTimeMicroSeconds(); | |
130 | void PrintTimeStamp(struct timeval *ts); | |
131 | void processBadPacket (struct IPPacket *p); | |
132 | void busy_wait (double wait); |