]>
Commit | Line | Data |
---|---|---|
9cef6668 | 1 | /* |
cc192b50 | 2 | * $Id: defines.h,v 1.123 2007/12/14 23:11:46 amosjeffries Exp $ |
9cef6668 | 3 | * |
4 | * | |
2b6662ba | 5 | * SQUID Web Proxy Cache http://www.squid-cache.org/ |
9cef6668 | 6 | * ---------------------------------------------------------- |
7 | * | |
2b6662ba | 8 | * Squid is the result of efforts by numerous individuals from |
9 | * the Internet community; see the CONTRIBUTORS file for full | |
10 | * details. Many organizations have provided support for Squid's | |
11 | * development; see the SPONSORS file for full details. Squid is | |
12 | * Copyrighted (C) 2001 by the Regents of the University of | |
13 | * California; see the COPYRIGHT file for full details. Squid | |
14 | * incorporates software developed and/or copyrighted by other | |
15 | * sources; see the CREDITS file for full details. | |
9cef6668 | 16 | * |
17 | * This program is free software; you can redistribute it and/or modify | |
18 | * it under the terms of the GNU General Public License as published by | |
19 | * the Free Software Foundation; either version 2 of the License, or | |
20 | * (at your option) any later version. | |
21 | * | |
22 | * This program is distributed in the hope that it will be useful, | |
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | * GNU General Public License for more details. | |
26 | * | |
27 | * You should have received a copy of the GNU General Public License | |
28 | * along with this program; if not, write to the Free Software | |
29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
30 | * | |
31 | */ | |
f13f02e9 | 32 | #ifndef SQUID_DEFINES_H |
33 | #define SQUID_DEFINES_H | |
b5638623 | 34 | |
a8258824 | 35 | #ifndef TRUE |
36 | #define TRUE 1 | |
37 | #endif | |
38 | #ifndef FALSE | |
39 | #define FALSE 0 | |
40 | #endif | |
41 | ||
e1f7507e AJ |
42 | #ifndef BUFSIZ |
43 | #define BUFSIZ 4096 /* make unreasonable guess */ | |
44 | #endif | |
45 | ||
a8258824 | 46 | #define ACL_NAME_SZ 32 |
47 | #define BROWSERNAMELEN 128 | |
48 | ||
49 | #define ACL_SUNDAY 0x01 | |
50 | #define ACL_MONDAY 0x02 | |
51 | #define ACL_TUESDAY 0x04 | |
52 | #define ACL_WEDNESDAY 0x08 | |
53 | #define ACL_THURSDAY 0x10 | |
54 | #define ACL_FRIDAY 0x20 | |
55 | #define ACL_SATURDAY 0x40 | |
56 | #define ACL_ALLWEEK 0x7F | |
57 | #define ACL_WEEKDAYS 0x3E | |
58 | ||
2c82c69d | 59 | #define MAXHTTPPORTS 128 |
a8258824 | 60 | |
a8258824 | 61 | /* Select types. */ |
62 | #define COMM_SELECT_READ (0x1) | |
63 | #define COMM_SELECT_WRITE (0x2) | |
a8258824 | 64 | |
79a15e0a | 65 | #define COMM_NONBLOCKING 0x01 |
66 | #define COMM_NOCLOEXEC 0x02 | |
cdc33f35 | 67 | #define COMM_REUSEADDR 0x04 |
c303f6e3 | 68 | #define COMM_TRANSPARENT 0x08 |
79a15e0a | 69 | |
c772f001 | 70 | #include "Debug.h" |
8250688c | 71 | #define do_debug(SECTION, LEVEL) ((Debug::level = (LEVEL)) > Debug::Levels[SECTION]) |
a8258824 | 72 | #define debug(SECTION, LEVEL) \ |
8250688c | 73 | do_debug(SECTION, LEVEL) ? (void) 0 : _db_print |
cb69b4c7 | 74 | |
a8258824 | 75 | #define safe_free(x) if (x) { xxfree(x); x = NULL; } |
76 | ||
77 | #define DISK_OK (0) | |
78 | #define DISK_ERROR (-1) | |
79 | #define DISK_EOF (-2) | |
a8258824 | 80 | #define DISK_NO_SPACE_LEFT (-6) |
81 | ||
a8258824 | 82 | #define DNS_INBUF_SZ 4096 |
83 | ||
a8258824 | 84 | #define FD_DESC_SZ 64 |
85 | ||
164a44a8 | 86 | #define FQDN_LOOKUP_IF_MISS 0x01 |
a8258824 | 87 | #define FQDN_MAX_NAMES 5 |
a8258824 | 88 | |
a8258824 | 89 | #define HTTP_REPLY_FIELD_SZ 128 |
90 | ||
91 | #define BUF_TYPE_8K 1 | |
92 | #define BUF_TYPE_MALLOC 2 | |
93 | ||
94 | #define ANONYMIZER_NONE 0 | |
95 | #define ANONYMIZER_STANDARD 1 | |
96 | #define ANONYMIZER_PARANOID 2 | |
97 | ||
def67559 | 98 | #define USER_IDENT_SZ 64 |
a8258824 | 99 | #define IDENT_NONE 0 |
100 | #define IDENT_PENDING 1 | |
101 | #define IDENT_DONE 2 | |
102 | ||
164a44a8 | 103 | #define IP_LOOKUP_IF_MISS 0x01 |
a8258824 | 104 | |
a8258824 | 105 | #define MAX_MIME 4096 |
106 | ||
107 | /* Mark a neighbor cache as dead if it doesn't answer this many pings */ | |
108 | #define HIER_MAX_DEFICIT 20 | |
109 | ||
a8258824 | 110 | #define ICP_FLAG_HIT_OBJ 0x80000000ul |
111 | #define ICP_FLAG_SRC_RTT 0x40000000ul | |
112 | ||
a8258824 | 113 | /* Version */ |
a8258824 | 114 | #define ICP_VERSION_2 2 |
115 | #define ICP_VERSION_3 3 | |
116 | #define ICP_VERSION_CURRENT ICP_VERSION_2 | |
117 | ||
db1cd23c | 118 | #define DIRECT_UNKNOWN 0 |
119 | #define DIRECT_NO 1 | |
120 | #define DIRECT_MAYBE 2 | |
121 | #define DIRECT_YES 3 | |
a8258824 | 122 | |
a8258824 | 123 | #define REDIRECT_AV_FACTOR 1000 |
124 | ||
125 | #define REDIRECT_NONE 0 | |
126 | #define REDIRECT_PENDING 1 | |
127 | #define REDIRECT_DONE 2 | |
128 | ||
73e67ee0 | 129 | #define AUTHENTICATE_AV_FACTOR 1000 |
94439e4e | 130 | /* AUTHENTICATION */ |
73e67ee0 | 131 | |
94439e4e | 132 | #define NTLM_CHALLENGE_SZ 300 |
73e67ee0 | 133 | |
a8258824 | 134 | #define CONNECT_PORT 443 |
135 | ||
136 | #define current_stacksize(stack) ((stack)->top - (stack)->base) | |
137 | ||
138 | /* logfile status */ | |
139 | #define LOG_ENABLE 1 | |
140 | #define LOG_DISABLE 0 | |
141 | ||
142 | #define SM_PAGE_SIZE 4096 | |
add2192d | 143 | #define MAX_CLIENT_BUF_SZ 4096 |
a8258824 | 144 | |
663a6f83 | 145 | #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit))))) |
146 | #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit))))) | |
147 | #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit)))) | |
d8b249ef | 148 | |
149 | /* bit opearations on a char[] mask of unlimited length */ | |
150 | #define CBIT_BIT(bit) (1<<((bit)%8)) | |
151 | #define CBIT_BIN(mask, bit) (mask)[(bit)>>3] | |
152 | #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit))) | |
153 | #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit))) | |
154 | #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit)) | |
a8258824 | 155 | |
a8258824 | 156 | #define MAX_FILES_PER_DIR (1<<20) |
157 | ||
788652f7 | 158 | #define MAX_URL 8192 |
a8258824 | 159 | #define MAX_LOGIN_SZ 128 |
160 | ||
a8258824 | 161 | #define PEER_MAX_ADDRESSES 10 |
e39dc0e0 | 162 | #define RTT_AV_FACTOR 50 |
d1b63fc8 | 163 | #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */ |
a8258824 | 164 | |
dc835977 | 165 | #define PEER_DEAD 0 |
166 | #define PEER_ALIVE 1 | |
167 | ||
9b312a19 | 168 | #define AUTH_MSG_SZ 4096 |
169 | #define HTTP_REPLY_BUF_SZ 4096 | |
58cd5bbd | 170 | #define CLIENT_REQ_BUF_SZ 4096 |
603a02fd | 171 | |
03d7b07f | 172 | #if !defined(ERROR_BUF_SZ) && defined(MAX_URL) |
173 | #define ERROR_BUF_SZ (MAX_URL << 2) | |
174 | #endif | |
175 | ||
6ccb94e5 | 176 | #if SQUID_SNMP |
177 | #define VIEWINCLUDED 1 | |
178 | #define VIEWEXCLUDED 2 | |
179 | #endif | |
a21fbb54 | 180 | |
69c01cd7 | 181 | #define STORE_META_OK 0x03 |
182 | #define STORE_META_DIRTY 0x04 | |
183 | #define STORE_META_BAD 0x05 | |
a7c05555 | 184 | |
185 | #define IPC_NONE 0 | |
186 | #define IPC_TCP_SOCKET 1 | |
187 | #define IPC_UDP_SOCKET 2 | |
188 | #define IPC_FIFO 3 | |
1ccc0d40 | 189 | #define IPC_UNIX_STREAM 4 |
190 | #define IPC_UNIX_DGRAM 5 | |
191 | ||
192 | #if HAVE_SOCKETPAIR && defined (AF_UNIX) | |
193 | #define IPC_STREAM IPC_UNIX_STREAM | |
194 | #define IPC_DGRAM IPC_UNIX_DGRAM | |
195 | #else | |
196 | #define IPC_STREAM IPC_TCP_SOCKET | |
197 | #define IPC_DGRAM IPC_UDP_SOCKET | |
198 | #endif | |
f09f5b26 | 199 | |
200 | #define STORE_META_KEY STORE_META_KEY_MD5 | |
201 | ||
202 | #define STORE_META_TLD_START sizeof(int)+sizeof(char) | |
203 | #define STORE_META_TLD_SIZE STORE_META_TLD_START | |
204 | #define SwapMetaType(x) (char)x[0] | |
205 | #define SwapMetaSize(x) &x[sizeof(char)] | |
206 | #define SwapMetaData(x) &x[STORE_META_TLD_START] | |
47f6e231 | 207 | #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t)) |
208 | #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t)) | |
f09f5b26 | 209 | |
2c29838d | 210 | #define COUNT_INTERVAL 60 |
211 | /* | |
212 | * keep 60 minutes' worth of per-minute readings (+ current reading) | |
213 | */ | |
214 | #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1 | |
215 | /* | |
216 | * keep 3 days' (72 hours) worth of hourly readings | |
399e85ea | 217 | */ |
2c29838d | 218 | #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL) |
451b07c5 | 219 | |
99edd1c3 | 220 | /* handy to determine the #elements in a static array */ |
221 | #define countof(arr) (sizeof(arr)/sizeof(*arr)) | |
309ad3b6 | 222 | |
223 | /* | |
224 | * Max number of ICP messages to receive per call to icpHandleUdp | |
225 | */ | |
42b51993 | 226 | #ifdef _SQUID_MSWIN_ |
227 | #define INCOMING_ICP_MAX 1 | |
228 | #else | |
309ad3b6 | 229 | #define INCOMING_ICP_MAX 15 |
42b51993 | 230 | #endif |
ef523f99 | 231 | /* |
232 | * Max number of DNS messages to receive per call to DNS read handler | |
233 | */ | |
42b51993 | 234 | #ifdef _SQUID_MSWIN_ |
235 | #define INCOMING_DNS_MAX 1 | |
236 | #else | |
ef523f99 | 237 | #define INCOMING_DNS_MAX 15 |
42b51993 | 238 | #endif |
309ad3b6 | 239 | /* |
240 | * Max number of HTTP connections to accept per call to httpAccept | |
241 | * and PER HTTP PORT | |
242 | */ | |
42b51993 | 243 | #ifdef _SQUID_MSWIN_ |
244 | #define INCOMING_HTTP_MAX 1 | |
245 | #else | |
309ad3b6 | 246 | #define INCOMING_HTTP_MAX 10 |
42b51993 | 247 | #endif |
309ad3b6 | 248 | #define INCOMING_TOTAL_MAX (INCOMING_ICP_MAX+INCOMING_HTTP_MAX) |
98829f69 | 249 | |
250 | /* | |
251 | * This many TCP connections must FAIL before we mark the | |
252 | * peer as DEAD | |
253 | */ | |
254 | #define PEER_TCP_MAGIC_COUNT 10 | |
cc27d775 | 255 | |
7e3ce7b9 | 256 | #define URI_WHITESPACE_STRIP 0 |
d548ee64 | 257 | #define URI_WHITESPACE_ALLOW 1 |
258 | #define URI_WHITESPACE_ENCODE 2 | |
259 | #define URI_WHITESPACE_CHOP 3 | |
7e3ce7b9 | 260 | #define URI_WHITESPACE_DENY 4 |
86ed3fd2 | 261 | |
262 | #ifndef _PATH_DEVNULL | |
4da086c4 | 263 | #ifdef _SQUID_MSWIN_ |
264 | #define _PATH_DEVNULL "NUL" | |
265 | #else | |
86ed3fd2 | 266 | #define _PATH_DEVNULL "/dev/null" |
267 | #endif | |
4da086c4 | 268 | #endif |
c4aefe96 | 269 | |
270 | #ifndef O_TEXT | |
271 | #define O_TEXT 0 | |
272 | #endif | |
273 | #ifndef O_BINARY | |
274 | #define O_BINARY 0 | |
275 | #endif | |
0e6d05ef | 276 | |
5d1a7121 | 277 | /* |
278 | * Macro to find file access mode | |
279 | */ | |
280 | #ifdef O_ACCMODE | |
281 | #define FILE_MODE(x) ((x)&O_ACCMODE) | |
282 | #else | |
283 | #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR)) | |
284 | #endif | |
285 | ||
add2192d | 286 | #define HTTP_REQBUF_SZ 4096 |
a50bfe93 | 287 | |
288 | /* CygWin & Windows NT Port */ | |
ec4daaa5 | 289 | #ifdef _SQUID_WIN32_ |
a50bfe93 | 290 | #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP |
291 | #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN | |
292 | #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE | |
293 | #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128 | |
294 | #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129 | |
295 | #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130 | |
296 | #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131 | |
7c202175 | 297 | #define _WIN_SQUID_DEFAULT_SERVICE_NAME "Squid" |
a50bfe93 | 298 | #define _WIN_SQUID_SERVICE_OPTION "--ntservice" |
299 | #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0 | |
300 | #define _WIN_SQUID_RUN_MODE_SERVICE 1 | |
301 | #endif | |
302 | ||
f13f02e9 | 303 | #endif /* SQUID_DEFINES_H */ |