]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
3 * SQUID Web Proxy Cache http://www.squid-cache.org/
4 * ----------------------------------------------------------
6 * Squid is the result of efforts by numerous individuals from
7 * the Internet community; see the CONTRIBUTORS file for full
8 * details. Many organizations have provided support for Squid's
9 * development; see the SPONSORS file for full details. Squid is
10 * Copyrighted (C) 2001 by the Regents of the University of
11 * California; see the COPYRIGHT file for full details. Squid
12 * incorporates software developed and/or copyrighted by other
13 * sources; see the CREDITS file for full details.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 #ifndef SQUID_DEFINES_H
31 #define SQUID_DEFINES_H
41 #define BUFSIZ 4096 /* make unreasonable guess */
44 #define BROWSERNAMELEN 128
46 #define ACL_SUNDAY 0x01
47 #define ACL_MONDAY 0x02
48 #define ACL_TUESDAY 0x04
49 #define ACL_WEDNESDAY 0x08
50 #define ACL_THURSDAY 0x10
51 #define ACL_FRIDAY 0x20
52 #define ACL_SATURDAY 0x40
53 #define ACL_ALLWEEK 0x7F
54 #define ACL_WEEKDAYS 0x3E
57 #define COMM_SELECT_READ (0x1)
58 #define COMM_SELECT_WRITE (0x2)
61 #define DISK_ERROR (-1)
63 #define DISK_NO_SPACE_LEFT (-6)
65 #define DNS_INBUF_SZ 4096
69 #define FQDN_LOOKUP_IF_MISS 0x01
70 #define FQDN_MAX_NAMES 5
72 #define HTTP_REPLY_FIELD_SZ 128
75 #define BUF_TYPE_MALLOC 2
77 #define ANONYMIZER_NONE 0
78 #define ANONYMIZER_STANDARD 1
79 #define ANONYMIZER_PARANOID 2
81 #define USER_IDENT_SZ 64
83 #define IDENT_PENDING 1
86 #define IP_LOOKUP_IF_MISS 0x01
90 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
91 #define HIER_MAX_DEFICIT 20
93 #define ICP_FLAG_HIT_OBJ 0x80000000ul
94 #define ICP_FLAG_SRC_RTT 0x40000000ul
97 #define ICP_VERSION_2 2
98 #define ICP_VERSION_3 3
99 #define ICP_VERSION_CURRENT ICP_VERSION_2
101 #define DIRECT_UNKNOWN 0
103 #define DIRECT_MAYBE 2
106 #define REDIRECT_AV_FACTOR 1000
108 #define REDIRECT_NONE 0
109 #define REDIRECT_PENDING 1
110 #define REDIRECT_DONE 2
112 #define AUTHENTICATE_AV_FACTOR 1000
115 #define NTLM_CHALLENGE_SZ 300
117 #define CONNECT_PORT 443
119 #define current_stacksize(stack) ((stack)->top - (stack)->base)
123 #define LOG_DISABLE 0
125 #define SM_PAGE_SIZE 4096
126 #define MAX_CLIENT_BUF_SZ 4096
128 #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit)))))
129 #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit)))))
130 #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit))))
132 /* bit opearations on a char[] mask of unlimited length */
133 #define CBIT_BIT(bit) (1<<((bit)%8))
134 #define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
135 #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
136 #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
137 #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
139 #define MAX_FILES_PER_DIR (1<<20)
142 #define MAX_LOGIN_SZ 128
144 #define PEER_MAX_ADDRESSES 10
145 #define RTT_AV_FACTOR 50
146 #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */
151 #define AUTH_MSG_SZ 4096
152 #define HTTP_REPLY_BUF_SZ 4096
153 #define CLIENT_REQ_BUF_SZ 4096
155 #if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
156 #define ERROR_BUF_SZ (MAX_URL << 2)
160 #define VIEWINCLUDED 1
161 #define VIEWEXCLUDED 2
164 #define STORE_META_OK 0x03
165 #define STORE_META_DIRTY 0x04
166 #define STORE_META_BAD 0x05
169 #define IPC_TCP_SOCKET 1
170 #define IPC_UDP_SOCKET 2
172 #define IPC_UNIX_STREAM 4
173 #define IPC_UNIX_DGRAM 5
175 /* required for AF_UNIX below to be defined [on FreeBSD] */
176 #if HAVE_SYS_SOCKET_H
177 #include <sys/socket.h>
180 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
181 #define IPC_STREAM IPC_UNIX_STREAM
182 #define IPC_DGRAM IPC_UNIX_DGRAM
184 #define IPC_STREAM IPC_TCP_SOCKET
185 #define IPC_DGRAM IPC_UDP_SOCKET
188 #define STORE_META_KEY STORE_META_KEY_MD5
190 #define STORE_META_TLD_START sizeof(int)+sizeof(char)
191 #define STORE_META_TLD_SIZE STORE_META_TLD_START
192 #define SwapMetaType(x) (char)x[0]
193 #define SwapMetaSize(x) &x[sizeof(char)]
194 #define SwapMetaData(x) &x[STORE_META_TLD_START]
195 #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t))
196 #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t))
198 #define COUNT_INTERVAL 60
200 * keep 60 minutes' worth of per-minute readings (+ current reading)
202 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
204 * keep 3 days' (72 hours) worth of hourly readings
206 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
208 /* handy to determine the #elements in a static array */
209 #define countof(arr) (sizeof(arr)/sizeof(*arr))
212 * This many TCP connections must FAIL before we mark the
215 #define PEER_TCP_MAGIC_COUNT 10
217 #define URI_WHITESPACE_STRIP 0
218 #define URI_WHITESPACE_ALLOW 1
219 #define URI_WHITESPACE_ENCODE 2
220 #define URI_WHITESPACE_CHOP 3
221 #define URI_WHITESPACE_DENY 4
231 * Macro to find file access mode
234 #define FILE_MODE(x) ((x)&O_ACCMODE)
236 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
239 #define HTTP_REQBUF_SZ 4096
241 /* CygWin & Windows NT Port */
243 #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
244 #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
245 #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
246 #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
247 #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
248 #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
249 #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
250 #define _WIN_SQUID_DEFAULT_SERVICE_NAME "Squid"
251 #define _WIN_SQUID_SERVICE_OPTION "--ntservice"
252 #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
253 #define _WIN_SQUID_RUN_MODE_SERVICE 1
256 #endif /* SQUID_DEFINES_H */