]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
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.
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.
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.
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.
32 #ifndef SQUID_DEFINES_H
33 #define SQUID_DEFINES_H
43 #define BUFSIZ 4096 /* make unreasonable guess */
46 #define ACL_NAME_SZ 32
47 #define BROWSERNAMELEN 128
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
59 #define MAXHTTPPORTS 128
62 #define COMM_SELECT_READ (0x1)
63 #define COMM_SELECT_WRITE (0x2)
65 #define safe_free(x) if (x) { xxfree(x); x = NULL; }
68 #define DISK_ERROR (-1)
70 #define DISK_NO_SPACE_LEFT (-6)
72 #define DNS_INBUF_SZ 4096
76 #define FQDN_LOOKUP_IF_MISS 0x01
77 #define FQDN_MAX_NAMES 5
79 #define HTTP_REPLY_FIELD_SZ 128
82 #define BUF_TYPE_MALLOC 2
84 #define ANONYMIZER_NONE 0
85 #define ANONYMIZER_STANDARD 1
86 #define ANONYMIZER_PARANOID 2
88 #define USER_IDENT_SZ 64
90 #define IDENT_PENDING 1
93 #define IP_LOOKUP_IF_MISS 0x01
97 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
98 #define HIER_MAX_DEFICIT 20
100 #define ICP_FLAG_HIT_OBJ 0x80000000ul
101 #define ICP_FLAG_SRC_RTT 0x40000000ul
104 #define ICP_VERSION_2 2
105 #define ICP_VERSION_3 3
106 #define ICP_VERSION_CURRENT ICP_VERSION_2
108 #define DIRECT_UNKNOWN 0
110 #define DIRECT_MAYBE 2
113 #define REDIRECT_AV_FACTOR 1000
115 #define REDIRECT_NONE 0
116 #define REDIRECT_PENDING 1
117 #define REDIRECT_DONE 2
119 #define AUTHENTICATE_AV_FACTOR 1000
122 #define NTLM_CHALLENGE_SZ 300
124 #define CONNECT_PORT 443
126 #define current_stacksize(stack) ((stack)->top - (stack)->base)
130 #define LOG_DISABLE 0
132 #define SM_PAGE_SIZE 4096
133 #define MAX_CLIENT_BUF_SZ 4096
135 #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit)))))
136 #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit)))))
137 #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit))))
139 /* bit opearations on a char[] mask of unlimited length */
140 #define CBIT_BIT(bit) (1<<((bit)%8))
141 #define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
142 #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
143 #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
144 #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
146 #define MAX_FILES_PER_DIR (1<<20)
149 #define MAX_LOGIN_SZ 128
151 #define PEER_MAX_ADDRESSES 10
152 #define RTT_AV_FACTOR 50
153 #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */
158 #define AUTH_MSG_SZ 4096
159 #define HTTP_REPLY_BUF_SZ 4096
160 #define CLIENT_REQ_BUF_SZ 4096
162 #if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
163 #define ERROR_BUF_SZ (MAX_URL << 2)
167 #define VIEWINCLUDED 1
168 #define VIEWEXCLUDED 2
171 #define STORE_META_OK 0x03
172 #define STORE_META_DIRTY 0x04
173 #define STORE_META_BAD 0x05
176 #define IPC_TCP_SOCKET 1
177 #define IPC_UDP_SOCKET 2
179 #define IPC_UNIX_STREAM 4
180 #define IPC_UNIX_DGRAM 5
182 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
183 #define IPC_STREAM IPC_UNIX_STREAM
184 #define IPC_DGRAM IPC_UNIX_DGRAM
186 #define IPC_STREAM IPC_TCP_SOCKET
187 #define IPC_DGRAM IPC_UDP_SOCKET
190 #define STORE_META_KEY STORE_META_KEY_MD5
192 #define STORE_META_TLD_START sizeof(int)+sizeof(char)
193 #define STORE_META_TLD_SIZE STORE_META_TLD_START
194 #define SwapMetaType(x) (char)x[0]
195 #define SwapMetaSize(x) &x[sizeof(char)]
196 #define SwapMetaData(x) &x[STORE_META_TLD_START]
197 #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t))
198 #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t))
200 #define COUNT_INTERVAL 60
202 * keep 60 minutes' worth of per-minute readings (+ current reading)
204 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
206 * keep 3 days' (72 hours) worth of hourly readings
208 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
210 /* handy to determine the #elements in a static array */
211 #define countof(arr) (sizeof(arr)/sizeof(*arr))
214 * Max number of ICP messages to receive per call to icpHandleUdp
217 #define INCOMING_ICP_MAX 1
219 #define INCOMING_ICP_MAX 15
222 * Max number of DNS messages to receive per call to DNS read handler
225 #define INCOMING_DNS_MAX 1
227 #define INCOMING_DNS_MAX 15
230 * Max number of HTTP connections to accept per call to httpAccept
234 #define INCOMING_HTTP_MAX 1
236 #define INCOMING_HTTP_MAX 10
238 #define INCOMING_TOTAL_MAX (INCOMING_ICP_MAX+INCOMING_HTTP_MAX)
241 * This many TCP connections must FAIL before we mark the
244 #define PEER_TCP_MAGIC_COUNT 10
246 #define URI_WHITESPACE_STRIP 0
247 #define URI_WHITESPACE_ALLOW 1
248 #define URI_WHITESPACE_ENCODE 2
249 #define URI_WHITESPACE_CHOP 3
250 #define URI_WHITESPACE_DENY 4
252 #ifndef _PATH_DEVNULL
254 #define _PATH_DEVNULL "NUL"
256 #define _PATH_DEVNULL "/dev/null"
268 * Macro to find file access mode
271 #define FILE_MODE(x) ((x)&O_ACCMODE)
273 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
276 #define HTTP_REQBUF_SZ 4096
278 /* CygWin & Windows NT Port */
280 #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
281 #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
282 #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
283 #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
284 #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
285 #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
286 #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
287 #define _WIN_SQUID_DEFAULT_SERVICE_NAME "Squid"
288 #define _WIN_SQUID_SERVICE_OPTION "--ntservice"
289 #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
290 #define _WIN_SQUID_RUN_MODE_SERVICE 1
293 #endif /* SQUID_DEFINES_H */