]> git.ipfire.org Git - thirdparty/squid.git/blame - src/defines.h
debug
[thirdparty/squid.git] / src / defines.h
CommitLineData
a8258824 1
2#ifndef TRUE
3#define TRUE 1
4#endif
5#ifndef FALSE
6#define FALSE 0
7#endif
8
a8258824 9#define ACL_NAME_SZ 32
10#define BROWSERNAMELEN 128
11
12#define ACL_SUNDAY 0x01
13#define ACL_MONDAY 0x02
14#define ACL_TUESDAY 0x04
15#define ACL_WEDNESDAY 0x08
16#define ACL_THURSDAY 0x10
17#define ACL_FRIDAY 0x20
18#define ACL_SATURDAY 0x40
19#define ACL_ALLWEEK 0x7F
20#define ACL_WEEKDAYS 0x3E
21
22#define DefaultDnsChildrenMax 32 /* 32 processes */
23#define DefaultRedirectChildrenMax 32 /* 32 processes */
24#define MAXHTTPPORTS 12
25
26#define COMM_OK (0)
27#define COMM_ERROR (-1)
a8258824 28#define COMM_NOMESSAGE (-3)
29#define COMM_TIMEOUT (-4)
30#define COMM_SHUTDOWN (-5)
31#define COMM_INPROGRESS (-6)
32#define COMM_ERR_CONNECT (-7)
33#define COMM_ERR_DNS (-8)
96f1be5d 34#define COMM_ERR_CLOSING (-9)
a8258824 35
a8258824 36/* Select types. */
37#define COMM_SELECT_READ (0x1)
38#define COMM_SELECT_WRITE (0x2)
39#define MAX_DEBUG_SECTIONS 100
40
79a15e0a 41#define COMM_NONBLOCKING 0x01
42#define COMM_NOCLOEXEC 0x02
cdc33f35 43#define COMM_REUSEADDR 0x04
79a15e0a 44
a8258824 45#define debug(SECTION, LEVEL) \
46 ((_db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : _db_print
cb69b4c7 47
a8258824 48#define safe_free(x) if (x) { xxfree(x); x = NULL; }
49
50#define DISK_OK (0)
51#define DISK_ERROR (-1)
52#define DISK_EOF (-2)
a8258824 53#define DISK_NO_SPACE_LEFT (-6)
54
a8258824 55#define DNS_INBUF_SZ 4096
56
a8258824 57#define FD_DESC_SZ 64
58
164a44a8 59#define FQDN_LOOKUP_IF_MISS 0x01
a8258824 60#define FQDN_MAX_NAMES 5
a8258824 61
62/*
63 * Here are some good prime number choices. It's important not to
64 * choose a prime number that is too close to exact powers of 2.
26970499 65 *
4162ee3b 66 * HASH_SIZE 103 // prime number < 128
67 * HASH_SIZE 229 // prime number < 256
68 * HASH_SIZE 467 // prime number < 512
69 * HASH_SIZE 977 // prime number < 1024
70 * HASH_SIZE 1979 // prime number < 2048
71 * HASH_SIZE 4019 // prime number < 4096
72 * HASH_SIZE 6037 // prime number < 6144
73 * HASH_SIZE 7951 // prime number < 8192
74 * HASH_SIZE 12149 // prime number < 12288
75 * HASH_SIZE 16231 // prime number < 16384
76 * HASH_SIZE 33493 // prime number < 32768
77 * HASH_SIZE 65357 // prime number < 65536
a8258824 78 */
a8258824 79
f9e5a344 80#define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */
a8258824 81
82#define HTTP_REPLY_FIELD_SZ 128
83
84#define BUF_TYPE_8K 1
85#define BUF_TYPE_MALLOC 2
86
87#define ANONYMIZER_NONE 0
88#define ANONYMIZER_STANDARD 1
89#define ANONYMIZER_PARANOID 2
90
a8258824 91#define ICP_IDENT_SZ 64
92#define IDENT_NONE 0
93#define IDENT_PENDING 1
94#define IDENT_DONE 2
95
164a44a8 96#define IP_LOOKUP_IF_MISS 0x01
a8258824 97
a8258824 98#define MAX_MIME 4096
99
100/* Mark a neighbor cache as dead if it doesn't answer this many pings */
101#define HIER_MAX_DEFICIT 20
102
a8258824 103#define ICP_FLAG_HIT_OBJ 0x80000000ul
104#define ICP_FLAG_SRC_RTT 0x40000000ul
105
a8258824 106/* Version */
a8258824 107#define ICP_VERSION_2 2
108#define ICP_VERSION_3 3
109#define ICP_VERSION_CURRENT ICP_VERSION_2
110
111#define DIRECT_NO 0
112#define DIRECT_MAYBE 1
113#define DIRECT_YES 2
114
a8258824 115#define REDIRECT_AV_FACTOR 1000
116
117#define REDIRECT_NONE 0
118#define REDIRECT_PENDING 1
119#define REDIRECT_DONE 2
120
a8258824 121#define CONNECT_PORT 443
122
123#define current_stacksize(stack) ((stack)->top - (stack)->base)
124
125/* logfile status */
126#define LOG_ENABLE 1
127#define LOG_DISABLE 0
128
129#define SM_PAGE_SIZE 4096
130#define DISK_PAGE_SIZE 8192
131
d8b249ef 132#define EBIT_SET(flag, bit) ((void)((flag) |= ((1<<(bit)))))
133#define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1<<(bit)))))
134#define EBIT_TEST(flag, bit) ((flag) & ((1<<(bit))))
135
136/* bit opearations on a char[] mask of unlimited length */
137#define CBIT_BIT(bit) (1<<((bit)%8))
138#define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
139#define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
140#define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
141#define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
a8258824 142
a8258824 143#define MAX_FILES_PER_DIR (1<<20)
144
145#define MAX_URL 4096
146#define MAX_LOGIN_SZ 128
147
a8258824 148#define PEER_MAX_ADDRESSES 10
149#define RTT_AV_FACTOR 1000
150
151/* flags for peer->mcast.flags */
152#define PEER_COUNT_EVENT_PENDING 1
153#define PEER_COUNTING 2
4f117cb4 154
dc835977 155#define PEER_DEAD 0
156#define PEER_ALIVE 1
157
9b312a19 158#define AUTH_MSG_SZ 4096
159#define HTTP_REPLY_BUF_SZ 4096
603a02fd 160
03d7b07f 161#if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
162#define ERROR_BUF_SZ (MAX_URL << 2)
163#endif
164
8350fe9b 165#define READ_AHEAD_GAP (1<<14)
6ccb94e5 166
167#if SQUID_SNMP
168#define VIEWINCLUDED 1
169#define VIEWEXCLUDED 2
170#endif
a21fbb54 171
69c01cd7 172#define STORE_META_OK 0x03
173#define STORE_META_DIRTY 0x04
174#define STORE_META_BAD 0x05
a7c05555 175
176#define IPC_NONE 0
177#define IPC_TCP_SOCKET 1
178#define IPC_UDP_SOCKET 2
179#define IPC_FIFO 3
f09f5b26 180
181#define STORE_META_KEY STORE_META_KEY_MD5
182
183#define STORE_META_TLD_START sizeof(int)+sizeof(char)
184#define STORE_META_TLD_SIZE STORE_META_TLD_START
185#define SwapMetaType(x) (char)x[0]
186#define SwapMetaSize(x) &x[sizeof(char)]
187#define SwapMetaData(x) &x[STORE_META_TLD_START]
188#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(int))
189
190#define STORE_ENTRY_WITH_MEMOBJ 1
191#define STORE_ENTRY_WITHOUT_MEMOBJ 0
192#define STORE_SWAP_BUF DISK_PAGE_SIZE
193#define VM_WINDOW_SZ DISK_PAGE_SIZE
a200bbd2 194
195#define SKIP_BASIC_SZ ((size_t) 6)
e9a13293 196
d11d0d98 197#define PINGER_PAYLOAD_SZ 8192
198
2c29838d 199#define COUNT_INTERVAL 60
200/*
201 * keep 60 minutes' worth of per-minute readings (+ current reading)
202 */
203#define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
204/*
205 * keep 3 days' (72 hours) worth of hourly readings
399e85ea 206 */
2c29838d 207#define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
451b07c5 208
1d803566 209/* were to look for errors if config path fails */
210#define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
7faf2bdb 211
212/* gb_type operations */
213#define gb_flush_limit (0x3FFFFFFF)
214#define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
02922e76 215
216/* iteration for HttpHdrRange */
217#define HttpHdrRangeInitPos (-1)
99edd1c3 218
219/* use this and only this to initialize HttpHeaderPos */
220#define HttpHeaderInitPos (-1)
221
222/* handy to determine the #elements in a static array */
223#define countof(arr) (sizeof(arr)/sizeof(*arr))
309ad3b6 224
137ee196 225/* to initialize static variables (see also MemBufNull) */
226#define MemBufNULL { NULL, 0, 0, 0, NULL }
227
309ad3b6 228/*
229 * Max number of ICP messages to receive per call to icpHandleUdp
230 */
231#define INCOMING_ICP_MAX 15
232/*
233 * Max number of HTTP connections to accept per call to httpAccept
234 * and PER HTTP PORT
235 */
236#define INCOMING_HTTP_MAX 10
237#define INCOMING_TOTAL_MAX (INCOMING_ICP_MAX+INCOMING_HTTP_MAX)
98829f69 238
239/*
240 * This many TCP connections must FAIL before we mark the
241 * peer as DEAD
242 */
243#define PEER_TCP_MAGIC_COUNT 10