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