]>
Commit | Line | Data |
---|---|---|
9cef6668 | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 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 current_stacksize(stack) ((stack)->top - (stack)->base) |
97 | ||
98 | /* logfile status */ | |
99 | #define LOG_ENABLE 1 | |
100 | #define LOG_DISABLE 0 | |
101 | ||
102 | #define SM_PAGE_SIZE 4096 | |
add2192d | 103 | #define MAX_CLIENT_BUF_SZ 4096 |
a8258824 | 104 | |
f53969cc SM |
105 | #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit))))) |
106 | #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit))))) | |
107 | #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit)))) | |
d8b249ef | 108 | |
109 | /* bit opearations on a char[] mask of unlimited length */ | |
110 | #define CBIT_BIT(bit) (1<<((bit)%8)) | |
111 | #define CBIT_BIN(mask, bit) (mask)[(bit)>>3] | |
f53969cc SM |
112 | #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit))) |
113 | #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit))) | |
114 | #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit)) | |
a8258824 | 115 | |
a8258824 | 116 | #define MAX_FILES_PER_DIR (1<<20) |
117 | ||
788652f7 | 118 | #define MAX_URL 8192 |
a8258824 | 119 | #define MAX_LOGIN_SZ 128 |
120 | ||
a8258824 | 121 | #define PEER_MAX_ADDRESSES 10 |
e39dc0e0 | 122 | #define RTT_AV_FACTOR 50 |
f53969cc | 123 | #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */ |
a8258824 | 124 | |
dc835977 | 125 | #define PEER_DEAD 0 |
126 | #define PEER_ALIVE 1 | |
127 | ||
9b312a19 | 128 | #define AUTH_MSG_SZ 4096 |
129 | #define HTTP_REPLY_BUF_SZ 4096 | |
58cd5bbd | 130 | #define CLIENT_REQ_BUF_SZ 4096 |
603a02fd | 131 | |
03d7b07f | 132 | #if !defined(ERROR_BUF_SZ) && defined(MAX_URL) |
133 | #define ERROR_BUF_SZ (MAX_URL << 2) | |
134 | #endif | |
135 | ||
6ccb94e5 | 136 | #if SQUID_SNMP |
137 | #define VIEWINCLUDED 1 | |
138 | #define VIEWEXCLUDED 2 | |
139 | #endif | |
a21fbb54 | 140 | |
69c01cd7 | 141 | #define STORE_META_OK 0x03 |
142 | #define STORE_META_DIRTY 0x04 | |
143 | #define STORE_META_BAD 0x05 | |
a7c05555 | 144 | |
145 | #define IPC_NONE 0 | |
146 | #define IPC_TCP_SOCKET 1 | |
147 | #define IPC_UDP_SOCKET 2 | |
148 | #define IPC_FIFO 3 | |
1ccc0d40 | 149 | #define IPC_UNIX_STREAM 4 |
150 | #define IPC_UNIX_DGRAM 5 | |
151 | ||
5b346515 AR |
152 | /* required for AF_UNIX below to be defined [on FreeBSD] */ |
153 | #if HAVE_SYS_SOCKET_H | |
f4199ea5 | 154 | #include <sys/socket.h> |
5b346515 AR |
155 | #endif |
156 | ||
1ccc0d40 | 157 | #if HAVE_SOCKETPAIR && defined (AF_UNIX) |
158 | #define IPC_STREAM IPC_UNIX_STREAM | |
159 | #define IPC_DGRAM IPC_UNIX_DGRAM | |
160 | #else | |
161 | #define IPC_STREAM IPC_TCP_SOCKET | |
162 | #define IPC_DGRAM IPC_UDP_SOCKET | |
163 | #endif | |
f09f5b26 | 164 | |
165 | #define STORE_META_KEY STORE_META_KEY_MD5 | |
166 | ||
167 | #define STORE_META_TLD_START sizeof(int)+sizeof(char) | |
168 | #define STORE_META_TLD_SIZE STORE_META_TLD_START | |
169 | #define SwapMetaType(x) (char)x[0] | |
170 | #define SwapMetaSize(x) &x[sizeof(char)] | |
171 | #define SwapMetaData(x) &x[STORE_META_TLD_START] | |
f45dd259 AJ |
172 | #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t)) |
173 | #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t)) | |
f09f5b26 | 174 | |
2c29838d | 175 | #define COUNT_INTERVAL 60 |
176 | /* | |
177 | * keep 60 minutes' worth of per-minute readings (+ current reading) | |
178 | */ | |
179 | #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1 | |
180 | /* | |
181 | * keep 3 days' (72 hours) worth of hourly readings | |
399e85ea | 182 | */ |
2c29838d | 183 | #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL) |
451b07c5 | 184 | |
99edd1c3 | 185 | /* handy to determine the #elements in a static array */ |
186 | #define countof(arr) (sizeof(arr)/sizeof(*arr)) | |
309ad3b6 | 187 | |
98829f69 | 188 | /* |
189 | * This many TCP connections must FAIL before we mark the | |
190 | * peer as DEAD | |
191 | */ | |
192 | #define PEER_TCP_MAGIC_COUNT 10 | |
cc27d775 | 193 | |
7e3ce7b9 | 194 | #define URI_WHITESPACE_STRIP 0 |
d548ee64 | 195 | #define URI_WHITESPACE_ALLOW 1 |
196 | #define URI_WHITESPACE_ENCODE 2 | |
197 | #define URI_WHITESPACE_CHOP 3 | |
7e3ce7b9 | 198 | #define URI_WHITESPACE_DENY 4 |
86ed3fd2 | 199 | |
c4aefe96 | 200 | #ifndef O_TEXT |
201 | #define O_TEXT 0 | |
202 | #endif | |
203 | #ifndef O_BINARY | |
204 | #define O_BINARY 0 | |
205 | #endif | |
0e6d05ef | 206 | |
5d1a7121 | 207 | /* |
208 | * Macro to find file access mode | |
209 | */ | |
210 | #ifdef O_ACCMODE | |
211 | #define FILE_MODE(x) ((x)&O_ACCMODE) | |
212 | #else | |
213 | #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR)) | |
214 | #endif | |
215 | ||
f53969cc | 216 | #define HTTP_REQBUF_SZ 4096 |
a50bfe93 | 217 | |
218 | /* CygWin & Windows NT Port */ | |
be266cb2 | 219 | #if _SQUID_WINDOWS_ |
a50bfe93 | 220 | #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP |
221 | #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN | |
222 | #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE | |
f53969cc SM |
223 | #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128 |
224 | #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129 | |
225 | #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130 | |
226 | #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131 | |
227 | #define _WIN_SQUID_SERVICE_OPTION "--ntservice" | |
228 | #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0 | |
229 | #define _WIN_SQUID_RUN_MODE_SERVICE 1 | |
a50bfe93 | 230 | #endif |
231 | ||
f13f02e9 | 232 | #endif /* SQUID_DEFINES_H */ |
f53969cc | 233 |