]>
Commit | Line | Data |
---|---|---|
9cef6668 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
9cef6668 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
9cef6668 | 7 | */ |
bbc27441 | 8 | |
f13f02e9 | 9 | #ifndef SQUID_DEFINES_H |
10 | #define SQUID_DEFINES_H | |
b5638623 | 11 | |
a8258824 | 12 | #ifndef TRUE |
13 | #define TRUE 1 | |
14 | #endif | |
15 | #ifndef FALSE | |
16 | #define FALSE 0 | |
17 | #endif | |
18 | ||
e1f7507e AJ |
19 | #ifndef BUFSIZ |
20 | #define BUFSIZ 4096 /* make unreasonable guess */ | |
21 | #endif | |
22 | ||
a8258824 | 23 | #define BROWSERNAMELEN 128 |
24 | ||
f53969cc SM |
25 | #define ACL_SUNDAY 0x01 |
26 | #define ACL_MONDAY 0x02 | |
27 | #define ACL_TUESDAY 0x04 | |
28 | #define ACL_WEDNESDAY 0x08 | |
29 | #define ACL_THURSDAY 0x10 | |
30 | #define ACL_FRIDAY 0x20 | |
31 | #define ACL_SATURDAY 0x40 | |
32 | #define ACL_ALLWEEK 0x7F | |
33 | #define ACL_WEEKDAYS 0x3E | |
a8258824 | 34 | |
a8258824 | 35 | /* Select types. */ |
36 | #define COMM_SELECT_READ (0x1) | |
37 | #define COMM_SELECT_WRITE (0x2) | |
a8258824 | 38 | |
a8258824 | 39 | #define DISK_OK (0) |
40 | #define DISK_ERROR (-1) | |
41 | #define DISK_EOF (-2) | |
a8258824 | 42 | #define DISK_NO_SPACE_LEFT (-6) |
43 | ||
a8258824 | 44 | #define DNS_INBUF_SZ 4096 |
45 | ||
f53969cc | 46 | #define FD_DESC_SZ 64 |
a8258824 | 47 | |
f53969cc | 48 | #define FQDN_LOOKUP_IF_MISS 0x01 |
a8258824 | 49 | #define FQDN_MAX_NAMES 5 |
a8258824 | 50 | |
a8258824 | 51 | #define HTTP_REPLY_FIELD_SZ 128 |
52 | ||
f53969cc | 53 | #define BUF_TYPE_8K 1 |
a8258824 | 54 | #define BUF_TYPE_MALLOC 2 |
55 | ||
f53969cc SM |
56 | #define ANONYMIZER_NONE 0 |
57 | #define ANONYMIZER_STANDARD 1 | |
58 | #define ANONYMIZER_PARANOID 2 | |
a8258824 | 59 | |
def67559 | 60 | #define USER_IDENT_SZ 64 |
a8258824 | 61 | #define IDENT_NONE 0 |
62 | #define IDENT_PENDING 1 | |
63 | #define IDENT_DONE 2 | |
64 | ||
f53969cc | 65 | #define IP_LOOKUP_IF_MISS 0x01 |
a8258824 | 66 | |
a8258824 | 67 | #define MAX_MIME 4096 |
68 | ||
69 | /* Mark a neighbor cache as dead if it doesn't answer this many pings */ | |
70 | #define HIER_MAX_DEFICIT 20 | |
71 | ||
a8258824 | 72 | #define ICP_FLAG_HIT_OBJ 0x80000000ul |
73 | #define ICP_FLAG_SRC_RTT 0x40000000ul | |
74 | ||
a8258824 | 75 | /* Version */ |
f53969cc SM |
76 | #define ICP_VERSION_2 2 |
77 | #define ICP_VERSION_3 3 | |
78 | #define ICP_VERSION_CURRENT ICP_VERSION_2 | |
a8258824 | 79 | |
db1cd23c | 80 | #define DIRECT_UNKNOWN 0 |
81 | #define DIRECT_NO 1 | |
82 | #define DIRECT_MAYBE 2 | |
83 | #define DIRECT_YES 3 | |
a8258824 | 84 | |
a8258824 | 85 | #define REDIRECT_AV_FACTOR 1000 |
86 | ||
87 | #define REDIRECT_NONE 0 | |
88 | #define REDIRECT_PENDING 1 | |
89 | #define REDIRECT_DONE 2 | |
90 | ||
73e67ee0 | 91 | #define AUTHENTICATE_AV_FACTOR 1000 |
94439e4e | 92 | /* AUTHENTICATION */ |
73e67ee0 | 93 | |
94439e4e | 94 | #define NTLM_CHALLENGE_SZ 300 |
73e67ee0 | 95 | |
a8258824 | 96 | #define CONNECT_PORT 443 |
97 | ||
98 | #define current_stacksize(stack) ((stack)->top - (stack)->base) | |
99 | ||
100 | /* logfile status */ | |
101 | #define LOG_ENABLE 1 | |
102 | #define LOG_DISABLE 0 | |
103 | ||
104 | #define SM_PAGE_SIZE 4096 | |
add2192d | 105 | #define MAX_CLIENT_BUF_SZ 4096 |
a8258824 | 106 | |
f53969cc SM |
107 | #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit))))) |
108 | #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit))))) | |
109 | #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit)))) | |
d8b249ef | 110 | |
111 | /* bit opearations on a char[] mask of unlimited length */ | |
112 | #define CBIT_BIT(bit) (1<<((bit)%8)) | |
113 | #define CBIT_BIN(mask, bit) (mask)[(bit)>>3] | |
f53969cc SM |
114 | #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit))) |
115 | #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit))) | |
116 | #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit)) | |
a8258824 | 117 | |
a8258824 | 118 | #define MAX_FILES_PER_DIR (1<<20) |
119 | ||
788652f7 | 120 | #define MAX_URL 8192 |
a8258824 | 121 | #define MAX_LOGIN_SZ 128 |
122 | ||
a8258824 | 123 | #define PEER_MAX_ADDRESSES 10 |
e39dc0e0 | 124 | #define RTT_AV_FACTOR 50 |
f53969cc | 125 | #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */ |
a8258824 | 126 | |
dc835977 | 127 | #define PEER_DEAD 0 |
128 | #define PEER_ALIVE 1 | |
129 | ||
9b312a19 | 130 | #define AUTH_MSG_SZ 4096 |
131 | #define HTTP_REPLY_BUF_SZ 4096 | |
58cd5bbd | 132 | #define CLIENT_REQ_BUF_SZ 4096 |
603a02fd | 133 | |
03d7b07f | 134 | #if !defined(ERROR_BUF_SZ) && defined(MAX_URL) |
135 | #define ERROR_BUF_SZ (MAX_URL << 2) | |
136 | #endif | |
137 | ||
6ccb94e5 | 138 | #if SQUID_SNMP |
139 | #define VIEWINCLUDED 1 | |
140 | #define VIEWEXCLUDED 2 | |
141 | #endif | |
a21fbb54 | 142 | |
69c01cd7 | 143 | #define STORE_META_OK 0x03 |
144 | #define STORE_META_DIRTY 0x04 | |
145 | #define STORE_META_BAD 0x05 | |
a7c05555 | 146 | |
147 | #define IPC_NONE 0 | |
148 | #define IPC_TCP_SOCKET 1 | |
149 | #define IPC_UDP_SOCKET 2 | |
150 | #define IPC_FIFO 3 | |
1ccc0d40 | 151 | #define IPC_UNIX_STREAM 4 |
152 | #define IPC_UNIX_DGRAM 5 | |
153 | ||
5b346515 AR |
154 | /* required for AF_UNIX below to be defined [on FreeBSD] */ |
155 | #if HAVE_SYS_SOCKET_H | |
f4199ea5 | 156 | #include <sys/socket.h> |
5b346515 AR |
157 | #endif |
158 | ||
1ccc0d40 | 159 | #if HAVE_SOCKETPAIR && defined (AF_UNIX) |
160 | #define IPC_STREAM IPC_UNIX_STREAM | |
161 | #define IPC_DGRAM IPC_UNIX_DGRAM | |
162 | #else | |
163 | #define IPC_STREAM IPC_TCP_SOCKET | |
164 | #define IPC_DGRAM IPC_UDP_SOCKET | |
165 | #endif | |
f09f5b26 | 166 | |
167 | #define STORE_META_KEY STORE_META_KEY_MD5 | |
168 | ||
169 | #define STORE_META_TLD_START sizeof(int)+sizeof(char) | |
170 | #define STORE_META_TLD_SIZE STORE_META_TLD_START | |
171 | #define SwapMetaType(x) (char)x[0] | |
172 | #define SwapMetaSize(x) &x[sizeof(char)] | |
173 | #define SwapMetaData(x) &x[STORE_META_TLD_START] | |
f45dd259 AJ |
174 | #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t)) |
175 | #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t)) | |
f09f5b26 | 176 | |
2c29838d | 177 | #define COUNT_INTERVAL 60 |
178 | /* | |
179 | * keep 60 minutes' worth of per-minute readings (+ current reading) | |
180 | */ | |
181 | #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1 | |
182 | /* | |
183 | * keep 3 days' (72 hours) worth of hourly readings | |
399e85ea | 184 | */ |
2c29838d | 185 | #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL) |
451b07c5 | 186 | |
99edd1c3 | 187 | /* handy to determine the #elements in a static array */ |
188 | #define countof(arr) (sizeof(arr)/sizeof(*arr)) | |
309ad3b6 | 189 | |
98829f69 | 190 | /* |
191 | * This many TCP connections must FAIL before we mark the | |
192 | * peer as DEAD | |
193 | */ | |
194 | #define PEER_TCP_MAGIC_COUNT 10 | |
cc27d775 | 195 | |
7e3ce7b9 | 196 | #define URI_WHITESPACE_STRIP 0 |
d548ee64 | 197 | #define URI_WHITESPACE_ALLOW 1 |
198 | #define URI_WHITESPACE_ENCODE 2 | |
199 | #define URI_WHITESPACE_CHOP 3 | |
7e3ce7b9 | 200 | #define URI_WHITESPACE_DENY 4 |
86ed3fd2 | 201 | |
c4aefe96 | 202 | #ifndef O_TEXT |
203 | #define O_TEXT 0 | |
204 | #endif | |
205 | #ifndef O_BINARY | |
206 | #define O_BINARY 0 | |
207 | #endif | |
0e6d05ef | 208 | |
5d1a7121 | 209 | /* |
210 | * Macro to find file access mode | |
211 | */ | |
212 | #ifdef O_ACCMODE | |
213 | #define FILE_MODE(x) ((x)&O_ACCMODE) | |
214 | #else | |
215 | #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR)) | |
216 | #endif | |
217 | ||
f53969cc | 218 | #define HTTP_REQBUF_SZ 4096 |
a50bfe93 | 219 | |
220 | /* CygWin & Windows NT Port */ | |
be266cb2 | 221 | #if _SQUID_WINDOWS_ |
a50bfe93 | 222 | #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP |
223 | #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN | |
224 | #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE | |
f53969cc SM |
225 | #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128 |
226 | #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129 | |
227 | #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130 | |
228 | #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131 | |
229 | #define _WIN_SQUID_SERVICE_OPTION "--ntservice" | |
230 | #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0 | |
231 | #define _WIN_SQUID_RUN_MODE_SERVICE 1 | |
a50bfe93 | 232 | #endif |
233 | ||
f13f02e9 | 234 | #endif /* SQUID_DEFINES_H */ |
f53969cc | 235 |