]> git.ipfire.org Git - thirdparty/squid.git/blame - src/defines.h
typo
[thirdparty/squid.git] / src / defines.h
CommitLineData
a8258824 1
9cef6668 2/*
b515fc11 3 * $Id: defines.h,v 1.66 1998/09/14 22:18:45 wessels Exp $
9cef6668 4 *
5 *
6 * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
7 * ----------------------------------------------------------
8 *
9 * Squid is the result of efforts by numerous individuals from the
10 * Internet community. Development is led by Duane Wessels of the
11 * National Laboratory for Applied Network Research and funded by the
12 * National Science Foundation. Squid is Copyrighted (C) 1998 by
13 * Duane Wessels and the University of California San Diego. Please
14 * see the COPYRIGHT file for full details. Squid incorporates
15 * software developed and/or copyrighted by other sources. Please see
16 * the CREDITS file for full details.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
31 *
32 */
33
a8258824 34#ifndef TRUE
35#define TRUE 1
36#endif
37#ifndef FALSE
38#define FALSE 0
39#endif
40
a8258824 41#define ACL_NAME_SZ 32
42#define BROWSERNAMELEN 128
43
44#define ACL_SUNDAY 0x01
45#define ACL_MONDAY 0x02
46#define ACL_TUESDAY 0x04
47#define ACL_WEDNESDAY 0x08
48#define ACL_THURSDAY 0x10
49#define ACL_FRIDAY 0x20
50#define ACL_SATURDAY 0x40
51#define ACL_ALLWEEK 0x7F
52#define ACL_WEEKDAYS 0x3E
53
54#define DefaultDnsChildrenMax 32 /* 32 processes */
55#define DefaultRedirectChildrenMax 32 /* 32 processes */
73e67ee0 56#define DefaultAuthenticateChildrenMax 32 /* 32 processes */
a8258824 57#define MAXHTTPPORTS 12
58
59#define COMM_OK (0)
60#define COMM_ERROR (-1)
a8258824 61#define COMM_NOMESSAGE (-3)
62#define COMM_TIMEOUT (-4)
63#define COMM_SHUTDOWN (-5)
64#define COMM_INPROGRESS (-6)
65#define COMM_ERR_CONNECT (-7)
66#define COMM_ERR_DNS (-8)
96f1be5d 67#define COMM_ERR_CLOSING (-9)
a8258824 68
a8258824 69/* Select types. */
70#define COMM_SELECT_READ (0x1)
71#define COMM_SELECT_WRITE (0x2)
72#define MAX_DEBUG_SECTIONS 100
73
79a15e0a 74#define COMM_NONBLOCKING 0x01
75#define COMM_NOCLOEXEC 0x02
cdc33f35 76#define COMM_REUSEADDR 0x04
79a15e0a 77
a8258824 78#define debug(SECTION, LEVEL) \
79 ((_db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : _db_print
cb69b4c7 80
a8258824 81#define safe_free(x) if (x) { xxfree(x); x = NULL; }
82
83#define DISK_OK (0)
84#define DISK_ERROR (-1)
85#define DISK_EOF (-2)
a8258824 86#define DISK_NO_SPACE_LEFT (-6)
87
a8258824 88#define DNS_INBUF_SZ 4096
89
a8258824 90#define FD_DESC_SZ 64
91
164a44a8 92#define FQDN_LOOKUP_IF_MISS 0x01
a8258824 93#define FQDN_MAX_NAMES 5
a8258824 94
a8258824 95#define HTTP_REPLY_FIELD_SZ 128
96
97#define BUF_TYPE_8K 1
98#define BUF_TYPE_MALLOC 2
99
100#define ANONYMIZER_NONE 0
101#define ANONYMIZER_STANDARD 1
102#define ANONYMIZER_PARANOID 2
103
def67559 104#define USER_IDENT_SZ 64
a8258824 105#define IDENT_NONE 0
106#define IDENT_PENDING 1
107#define IDENT_DONE 2
108
164a44a8 109#define IP_LOOKUP_IF_MISS 0x01
a8258824 110
a8258824 111#define MAX_MIME 4096
112
113/* Mark a neighbor cache as dead if it doesn't answer this many pings */
114#define HIER_MAX_DEFICIT 20
115
a8258824 116#define ICP_FLAG_HIT_OBJ 0x80000000ul
117#define ICP_FLAG_SRC_RTT 0x40000000ul
118
a8258824 119/* Version */
a8258824 120#define ICP_VERSION_2 2
121#define ICP_VERSION_3 3
122#define ICP_VERSION_CURRENT ICP_VERSION_2
123
124#define DIRECT_NO 0
125#define DIRECT_MAYBE 1
126#define DIRECT_YES 2
127
a8258824 128#define REDIRECT_AV_FACTOR 1000
129
130#define REDIRECT_NONE 0
131#define REDIRECT_PENDING 1
132#define REDIRECT_DONE 2
133
73e67ee0 134#define AUTHENTICATE_AV_FACTOR 1000
135
136#define AUTHENTICATE_NONE 0
137#define AUTHENTICATE_PENDING 1
138#define AUTHENTICATE_DONE 2
139
a8258824 140#define CONNECT_PORT 443
141
142#define current_stacksize(stack) ((stack)->top - (stack)->base)
143
144/* logfile status */
145#define LOG_ENABLE 1
146#define LOG_DISABLE 0
147
148#define SM_PAGE_SIZE 4096
149#define DISK_PAGE_SIZE 8192
150
d8b249ef 151#define EBIT_SET(flag, bit) ((void)((flag) |= ((1<<(bit)))))
152#define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1<<(bit)))))
153#define EBIT_TEST(flag, bit) ((flag) & ((1<<(bit))))
154
155/* bit opearations on a char[] mask of unlimited length */
156#define CBIT_BIT(bit) (1<<((bit)%8))
157#define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
158#define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
159#define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
160#define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
a8258824 161
a8258824 162#define MAX_FILES_PER_DIR (1<<20)
163
164#define MAX_URL 4096
165#define MAX_LOGIN_SZ 128
166
a8258824 167#define PEER_MAX_ADDRESSES 10
e39dc0e0 168#define RTT_AV_FACTOR 50
a8258824 169
dc835977 170#define PEER_DEAD 0
171#define PEER_ALIVE 1
172
9b312a19 173#define AUTH_MSG_SZ 4096
174#define HTTP_REPLY_BUF_SZ 4096
603a02fd 175
03d7b07f 176#if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
177#define ERROR_BUF_SZ (MAX_URL << 2)
178#endif
179
8350fe9b 180#define READ_AHEAD_GAP (1<<14)
6ccb94e5 181
182#if SQUID_SNMP
183#define VIEWINCLUDED 1
184#define VIEWEXCLUDED 2
185#endif
a21fbb54 186
69c01cd7 187#define STORE_META_OK 0x03
188#define STORE_META_DIRTY 0x04
189#define STORE_META_BAD 0x05
a7c05555 190
191#define IPC_NONE 0
192#define IPC_TCP_SOCKET 1
193#define IPC_UDP_SOCKET 2
194#define IPC_FIFO 3
f09f5b26 195
196#define STORE_META_KEY STORE_META_KEY_MD5
197
198#define STORE_META_TLD_START sizeof(int)+sizeof(char)
199#define STORE_META_TLD_SIZE STORE_META_TLD_START
200#define SwapMetaType(x) (char)x[0]
201#define SwapMetaSize(x) &x[sizeof(char)]
202#define SwapMetaData(x) &x[STORE_META_TLD_START]
203#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(int))
204
205#define STORE_ENTRY_WITH_MEMOBJ 1
206#define STORE_ENTRY_WITHOUT_MEMOBJ 0
207#define STORE_SWAP_BUF DISK_PAGE_SIZE
208#define VM_WINDOW_SZ DISK_PAGE_SIZE
a200bbd2 209
210#define SKIP_BASIC_SZ ((size_t) 6)
e9a13293 211
d11d0d98 212#define PINGER_PAYLOAD_SZ 8192
213
2c29838d 214#define COUNT_INTERVAL 60
215/*
216 * keep 60 minutes' worth of per-minute readings (+ current reading)
217 */
218#define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
219/*
220 * keep 3 days' (72 hours) worth of hourly readings
399e85ea 221 */
2c29838d 222#define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
451b07c5 223
1d803566 224/* were to look for errors if config path fails */
225#define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
7faf2bdb 226
227/* gb_type operations */
228#define gb_flush_limit (0x3FFFFFFF)
229#define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
02922e76 230
231/* iteration for HttpHdrRange */
232#define HttpHdrRangeInitPos (-1)
99edd1c3 233
234/* use this and only this to initialize HttpHeaderPos */
235#define HttpHeaderInitPos (-1)
236
237/* handy to determine the #elements in a static array */
238#define countof(arr) (sizeof(arr)/sizeof(*arr))
309ad3b6 239
137ee196 240/* to initialize static variables (see also MemBufNull) */
241#define MemBufNULL { NULL, 0, 0, 0, NULL }
242
309ad3b6 243/*
244 * Max number of ICP messages to receive per call to icpHandleUdp
245 */
246#define INCOMING_ICP_MAX 15
247/*
248 * Max number of HTTP connections to accept per call to httpAccept
249 * and PER HTTP PORT
250 */
251#define INCOMING_HTTP_MAX 10
252#define INCOMING_TOTAL_MAX (INCOMING_ICP_MAX+INCOMING_HTTP_MAX)
98829f69 253
254/*
255 * This many TCP connections must FAIL before we mark the
256 * peer as DEAD
257 */
258#define PEER_TCP_MAGIC_COUNT 10
cc27d775 259
260#define CLIENT_SOCK_SZ 4096