]> git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
Merge from trunk
[thirdparty/squid.git] / src / defines.h
1 /*
2 * $Id$
3 *
4 *
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
7 *
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.
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 */
32 #ifndef SQUID_DEFINES_H
33 #define SQUID_DEFINES_H
34
35 #ifndef TRUE
36 #define TRUE 1
37 #endif
38 #ifndef FALSE
39 #define FALSE 0
40 #endif
41
42 #ifndef BUFSIZ
43 #define BUFSIZ 4096 /* make unreasonable guess */
44 #endif
45
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
59 #define MAXHTTPPORTS 128
60
61 /* Select types. */
62 #define COMM_SELECT_READ (0x1)
63 #define COMM_SELECT_WRITE (0x2)
64
65 /*
66 #define COMM_NONBLOCKING 0x01
67 #define COMM_NOCLOEXEC 0x02
68 #define COMM_REUSEADDR 0x04
69 #define COMM_TRANSPARENT 0x08
70 #define COMM_DOBIND 0x10
71 */
72
73 #define DISK_OK (0)
74 #define DISK_ERROR (-1)
75 #define DISK_EOF (-2)
76 #define DISK_NO_SPACE_LEFT (-6)
77
78 #define DNS_INBUF_SZ 4096
79
80 #define FD_DESC_SZ 64
81
82 #define FQDN_LOOKUP_IF_MISS 0x01
83 #define FQDN_MAX_NAMES 5
84
85 #define HTTP_REPLY_FIELD_SZ 128
86
87 #define BUF_TYPE_8K 1
88 #define BUF_TYPE_MALLOC 2
89
90 #define ANONYMIZER_NONE 0
91 #define ANONYMIZER_STANDARD 1
92 #define ANONYMIZER_PARANOID 2
93
94 #define USER_IDENT_SZ 64
95 #define IDENT_NONE 0
96 #define IDENT_PENDING 1
97 #define IDENT_DONE 2
98
99 #define IP_LOOKUP_IF_MISS 0x01
100
101 #define MAX_MIME 4096
102
103 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
104 #define HIER_MAX_DEFICIT 20
105
106 #define ICP_FLAG_HIT_OBJ 0x80000000ul
107 #define ICP_FLAG_SRC_RTT 0x40000000ul
108
109 /* Version */
110 #define ICP_VERSION_2 2
111 #define ICP_VERSION_3 3
112 #define ICP_VERSION_CURRENT ICP_VERSION_2
113
114 #define DIRECT_UNKNOWN 0
115 #define DIRECT_NO 1
116 #define DIRECT_MAYBE 2
117 #define DIRECT_YES 3
118
119 #define REDIRECT_AV_FACTOR 1000
120
121 #define REDIRECT_NONE 0
122 #define REDIRECT_PENDING 1
123 #define REDIRECT_DONE 2
124
125 #define AUTHENTICATE_AV_FACTOR 1000
126 /* AUTHENTICATION */
127
128 #define NTLM_CHALLENGE_SZ 300
129
130 #define CONNECT_PORT 443
131
132 #define current_stacksize(stack) ((stack)->top - (stack)->base)
133
134 /* logfile status */
135 #define LOG_ENABLE 1
136 #define LOG_DISABLE 0
137
138 #define SM_PAGE_SIZE 4096
139 #define MAX_CLIENT_BUF_SZ 4096
140
141 #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit)))))
142 #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit)))))
143 #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit))))
144
145 /* bit opearations on a char[] mask of unlimited length */
146 #define CBIT_BIT(bit) (1<<((bit)%8))
147 #define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
148 #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
149 #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
150 #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
151
152 #define MAX_FILES_PER_DIR (1<<20)
153
154 #define MAX_URL 8192
155 #define MAX_LOGIN_SZ 128
156
157 #define PEER_MAX_ADDRESSES 10
158 #define RTT_AV_FACTOR 50
159 #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */
160
161 #define PEER_DEAD 0
162 #define PEER_ALIVE 1
163
164 #define AUTH_MSG_SZ 4096
165 #define HTTP_REPLY_BUF_SZ 4096
166 #define CLIENT_REQ_BUF_SZ 4096
167
168 #if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
169 #define ERROR_BUF_SZ (MAX_URL << 2)
170 #endif
171
172 #if SQUID_SNMP
173 #define VIEWINCLUDED 1
174 #define VIEWEXCLUDED 2
175 #endif
176
177 #define STORE_META_OK 0x03
178 #define STORE_META_DIRTY 0x04
179 #define STORE_META_BAD 0x05
180
181 #define IPC_NONE 0
182 #define IPC_TCP_SOCKET 1
183 #define IPC_UDP_SOCKET 2
184 #define IPC_FIFO 3
185 #define IPC_UNIX_STREAM 4
186 #define IPC_UNIX_DGRAM 5
187
188 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
189 #define IPC_STREAM IPC_UNIX_STREAM
190 #define IPC_DGRAM IPC_UNIX_DGRAM
191 #else
192 #define IPC_STREAM IPC_TCP_SOCKET
193 #define IPC_DGRAM IPC_UDP_SOCKET
194 #endif
195
196 #define STORE_META_KEY STORE_META_KEY_MD5
197
198 #define STORE_META_TLD_START sizeof(int)+sizeof(char)
199 #define STORE_META_TLD_SIZE STORE_META_TLD_START
200 #define SwapMetaType(x) (char)x[0]
201 #define SwapMetaSize(x) &x[sizeof(char)]
202 #define SwapMetaData(x) &x[STORE_META_TLD_START]
203 #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t))
204 #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t))
205
206 #define COUNT_INTERVAL 60
207 /*
208 * keep 60 minutes' worth of per-minute readings (+ current reading)
209 */
210 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
211 /*
212 * keep 3 days' (72 hours) worth of hourly readings
213 */
214 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
215
216 /* handy to determine the #elements in a static array */
217 #define countof(arr) (sizeof(arr)/sizeof(*arr))
218
219 /*
220 * Max number of ICP messages to receive per call to icpHandleUdp
221 */
222 #ifdef _SQUID_MSWIN_
223 #define INCOMING_ICP_MAX 1
224 #else
225 #define INCOMING_ICP_MAX 15
226 #endif
227 /*
228 * Max number of DNS messages to receive per call to DNS read handler
229 */
230 #ifdef _SQUID_MSWIN_
231 #define INCOMING_DNS_MAX 1
232 #else
233 #define INCOMING_DNS_MAX 15
234 #endif
235 /*
236 * Max number of HTTP connections to accept per call to httpAccept
237 * and PER HTTP PORT
238 */
239 #ifdef _SQUID_MSWIN_
240 #define INCOMING_HTTP_MAX 1
241 #else
242 #define INCOMING_HTTP_MAX 10
243 #endif
244 #define INCOMING_TOTAL_MAX (INCOMING_ICP_MAX+INCOMING_HTTP_MAX)
245
246 /*
247 * This many TCP connections must FAIL before we mark the
248 * peer as DEAD
249 */
250 #define PEER_TCP_MAGIC_COUNT 10
251
252 #define URI_WHITESPACE_STRIP 0
253 #define URI_WHITESPACE_ALLOW 1
254 #define URI_WHITESPACE_ENCODE 2
255 #define URI_WHITESPACE_CHOP 3
256 #define URI_WHITESPACE_DENY 4
257
258 #ifndef O_TEXT
259 #define O_TEXT 0
260 #endif
261 #ifndef O_BINARY
262 #define O_BINARY 0
263 #endif
264
265 /*
266 * Macro to find file access mode
267 */
268 #ifdef O_ACCMODE
269 #define FILE_MODE(x) ((x)&O_ACCMODE)
270 #else
271 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
272 #endif
273
274 #define HTTP_REQBUF_SZ 4096
275
276 /* CygWin & Windows NT Port */
277 #ifdef _SQUID_WIN32_
278 #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
279 #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
280 #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
281 #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
282 #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
283 #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
284 #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
285 #define _WIN_SQUID_DEFAULT_SERVICE_NAME "Squid"
286 #define _WIN_SQUID_SERVICE_OPTION "--ntservice"
287 #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
288 #define _WIN_SQUID_RUN_MODE_SERVICE 1
289 #endif
290
291 #endif /* SQUID_DEFINES_H */