]> git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
Merge from trunk
[thirdparty/squid.git] / src / defines.h
1 /*
2 *
3 * SQUID Web Proxy Cache http://www.squid-cache.org/
4 * ----------------------------------------------------------
5 *
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.
14 *
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.
19 *
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.
24 *
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.
28 *
29 */
30 #ifndef SQUID_DEFINES_H
31 #define SQUID_DEFINES_H
32
33 #ifndef TRUE
34 #define TRUE 1
35 #endif
36 #ifndef FALSE
37 #define FALSE 0
38 #endif
39
40 #ifndef BUFSIZ
41 #define BUFSIZ 4096 /* make unreasonable guess */
42 #endif
43
44 #define BROWSERNAMELEN 128
45
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
55
56 /* Select types. */
57 #define COMM_SELECT_READ (0x1)
58 #define COMM_SELECT_WRITE (0x2)
59
60 #define DISK_OK (0)
61 #define DISK_ERROR (-1)
62 #define DISK_EOF (-2)
63 #define DISK_NO_SPACE_LEFT (-6)
64
65 #define DNS_INBUF_SZ 4096
66
67 #define FD_DESC_SZ 64
68
69 #define FQDN_LOOKUP_IF_MISS 0x01
70 #define FQDN_MAX_NAMES 5
71
72 #define HTTP_REPLY_FIELD_SZ 128
73
74 #define BUF_TYPE_8K 1
75 #define BUF_TYPE_MALLOC 2
76
77 #define ANONYMIZER_NONE 0
78 #define ANONYMIZER_STANDARD 1
79 #define ANONYMIZER_PARANOID 2
80
81 #define USER_IDENT_SZ 64
82 #define IDENT_NONE 0
83 #define IDENT_PENDING 1
84 #define IDENT_DONE 2
85
86 #define IP_LOOKUP_IF_MISS 0x01
87
88 #define MAX_MIME 4096
89
90 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
91 #define HIER_MAX_DEFICIT 20
92
93 #define ICP_FLAG_HIT_OBJ 0x80000000ul
94 #define ICP_FLAG_SRC_RTT 0x40000000ul
95
96 /* Version */
97 #define ICP_VERSION_2 2
98 #define ICP_VERSION_3 3
99 #define ICP_VERSION_CURRENT ICP_VERSION_2
100
101 #define DIRECT_UNKNOWN 0
102 #define DIRECT_NO 1
103 #define DIRECT_MAYBE 2
104 #define DIRECT_YES 3
105
106 #define REDIRECT_AV_FACTOR 1000
107
108 #define REDIRECT_NONE 0
109 #define REDIRECT_PENDING 1
110 #define REDIRECT_DONE 2
111
112 #define AUTHENTICATE_AV_FACTOR 1000
113 /* AUTHENTICATION */
114
115 #define NTLM_CHALLENGE_SZ 300
116
117 #define CONNECT_PORT 443
118
119 #define current_stacksize(stack) ((stack)->top - (stack)->base)
120
121 /* logfile status */
122 #define LOG_ENABLE 1
123 #define LOG_DISABLE 0
124
125 #define SM_PAGE_SIZE 4096
126 #define MAX_CLIENT_BUF_SZ 4096
127
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))))
131
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))
138
139 #define MAX_FILES_PER_DIR (1<<20)
140
141 #define MAX_URL 8192
142 #define MAX_LOGIN_SZ 128
143
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 */
147
148 #define PEER_DEAD 0
149 #define PEER_ALIVE 1
150
151 #define AUTH_MSG_SZ 4096
152 #define HTTP_REPLY_BUF_SZ 4096
153 #define CLIENT_REQ_BUF_SZ 4096
154
155 #if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
156 #define ERROR_BUF_SZ (MAX_URL << 2)
157 #endif
158
159 #if SQUID_SNMP
160 #define VIEWINCLUDED 1
161 #define VIEWEXCLUDED 2
162 #endif
163
164 #define STORE_META_OK 0x03
165 #define STORE_META_DIRTY 0x04
166 #define STORE_META_BAD 0x05
167
168 #define IPC_NONE 0
169 #define IPC_TCP_SOCKET 1
170 #define IPC_UDP_SOCKET 2
171 #define IPC_FIFO 3
172 #define IPC_UNIX_STREAM 4
173 #define IPC_UNIX_DGRAM 5
174
175 /* required for AF_UNIX below to be defined [on FreeBSD] */
176 #if HAVE_SYS_SOCKET_H
177 #include <sys/socket.h>
178 #endif
179
180 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
181 #define IPC_STREAM IPC_UNIX_STREAM
182 #define IPC_DGRAM IPC_UNIX_DGRAM
183 #else
184 #define IPC_STREAM IPC_TCP_SOCKET
185 #define IPC_DGRAM IPC_UDP_SOCKET
186 #endif
187
188 #define STORE_META_KEY STORE_META_KEY_MD5
189
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))
197
198 #define COUNT_INTERVAL 60
199 /*
200 * keep 60 minutes' worth of per-minute readings (+ current reading)
201 */
202 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
203 /*
204 * keep 3 days' (72 hours) worth of hourly readings
205 */
206 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
207
208 /* handy to determine the #elements in a static array */
209 #define countof(arr) (sizeof(arr)/sizeof(*arr))
210
211 /*
212 * This many TCP connections must FAIL before we mark the
213 * peer as DEAD
214 */
215 #define PEER_TCP_MAGIC_COUNT 10
216
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
222
223 #ifndef O_TEXT
224 #define O_TEXT 0
225 #endif
226 #ifndef O_BINARY
227 #define O_BINARY 0
228 #endif
229
230 /*
231 * Macro to find file access mode
232 */
233 #ifdef O_ACCMODE
234 #define FILE_MODE(x) ((x)&O_ACCMODE)
235 #else
236 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
237 #endif
238
239 #define HTTP_REQBUF_SZ 4096
240
241 /* CygWin & Windows NT Port */
242 #if _SQUID_WINDOWS_
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
254 #endif
255
256 #endif /* SQUID_DEFINES_H */