]> git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
- Separated raw HTTP headers from their "compiled" values. Squid is now
[thirdparty/squid.git] / src / defines.h
1
2 #ifndef TRUE
3 #define TRUE 1
4 #endif
5 #ifndef FALSE
6 #define FALSE 0
7 #endif
8
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)
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)
34 #define COMM_ERR_CLOSING (-9)
35
36 /* Select types. */
37 #define COMM_SELECT_READ (0x1)
38 #define COMM_SELECT_WRITE (0x2)
39 #define MAX_DEBUG_SECTIONS 100
40
41 #define COMM_NONBLOCKING 0x01
42 #define COMM_NOCLOEXEC 0x02
43 #define COMM_REUSEADDR 0x04
44
45 #ifdef HAVE_SYSLOG
46 #define debug(SECTION, LEVEL) \
47 ((_db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : _db_print
48 #else
49 #define debug(SECTION, LEVEL) \
50 ((LEVEL) > debugLevels[SECTION]) ? (void) 0 : _db_print
51 #endif
52
53 #define safe_free(x) if (x) { xxfree(x); x = NULL; }
54
55 #define DISK_OK (0)
56 #define DISK_ERROR (-1)
57 #define DISK_EOF (-2)
58 #define DISK_NO_SPACE_LEFT (-6)
59
60 #define DNS_INBUF_SZ 4096
61
62 #define FD_DESC_SZ 64
63
64 #define FQDN_LOOKUP_IF_MISS 0x01
65 #define FQDN_MAX_NAMES 5
66
67 /*
68 * Here are some good prime number choices. It's important not to
69 * choose a prime number that is too close to exact powers of 2.
70 *
71 * HASH_SIZE 103 // prime number < 128
72 * HASH_SIZE 229 // prime number < 256
73 * HASH_SIZE 467 // prime number < 512
74 * HASH_SIZE 977 // prime number < 1024
75 * HASH_SIZE 1979 // prime number < 2048
76 * HASH_SIZE 4019 // prime number < 4096
77 * HASH_SIZE 6037 // prime number < 6144
78 * HASH_SIZE 7951 // prime number < 8192
79 * HASH_SIZE 12149 // prime number < 12288
80 * HASH_SIZE 16231 // prime number < 16384
81 * HASH_SIZE 33493 // prime number < 32768
82 * HASH_SIZE 65357 // prime number < 65536
83 */
84
85 #define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */
86
87 #define HTTP_REPLY_FIELD_SZ 128
88
89 #define BUF_TYPE_8K 1
90 #define BUF_TYPE_MALLOC 2
91
92 #define ANONYMIZER_NONE 0
93 #define ANONYMIZER_STANDARD 1
94 #define ANONYMIZER_PARANOID 2
95
96 #define ICP_IDENT_SZ 64
97 #define IDENT_NONE 0
98 #define IDENT_PENDING 1
99 #define IDENT_DONE 2
100
101 #define IP_LOOKUP_IF_MISS 0x01
102
103 #define MAX_MIME 4096
104
105 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
106 #define HIER_MAX_DEFICIT 20
107
108 #define ICP_FLAG_HIT_OBJ 0x80000000ul
109 #define ICP_FLAG_SRC_RTT 0x40000000ul
110
111 /* Version */
112 #define ICP_VERSION_2 2
113 #define ICP_VERSION_3 3
114 #define ICP_VERSION_CURRENT ICP_VERSION_2
115
116 #define DIRECT_NO 0
117 #define DIRECT_MAYBE 1
118 #define DIRECT_YES 2
119
120 #define REDIRECT_AV_FACTOR 1000
121
122 #define REDIRECT_NONE 0
123 #define REDIRECT_PENDING 1
124 #define REDIRECT_DONE 2
125
126 #define CONNECT_PORT 443
127
128 #define current_stacksize(stack) ((stack)->top - (stack)->base)
129
130 /* logfile status */
131 #define LOG_ENABLE 1
132 #define LOG_DISABLE 0
133
134 #define SM_PAGE_SIZE 4096
135 #define DISK_PAGE_SIZE 8192
136
137 #define EBIT_SET(flag, bit) ((void)((flag) |= ((1<<(bit)))))
138 #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1<<(bit)))))
139 #define EBIT_TEST(flag, bit) ((flag) & ((1<<(bit))))
140
141 /* bit opearations on a char[] mask of unlimited length */
142 #define CBIT_BIT(bit) (1<<((bit)%8))
143 #define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
144 #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
145 #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
146 #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
147
148 #define MAX_FILES_PER_DIR (1<<20)
149
150 #define MAX_URL 4096
151 #define MAX_LOGIN_SZ 128
152
153 #define PEER_MAX_ADDRESSES 10
154 #define RTT_AV_FACTOR 1000
155
156 /* flags for peer->mcast.flags */
157 #define PEER_COUNT_EVENT_PENDING 1
158 #define PEER_COUNTING 2
159
160 #define PEER_DEAD 0
161 #define PEER_ALIVE 1
162
163 #define AUTH_MSG_SZ 4096
164 #define HTTP_REPLY_BUF_SZ 4096
165
166 #if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
167 #define ERROR_BUF_SZ (MAX_URL << 2)
168 #endif
169
170 #define READ_AHEAD_GAP (1<<14)
171
172 #if SQUID_SNMP
173 #define VIEWINCLUDED 1
174 #define VIEWEXCLUDED 2
175 #endif
176
177 #define STORE_META_OK 0x03
178 #define STORE_META_DIRTY 0x04
179 #define STORE_META_BAD 0x05
180
181 #define IPC_NONE 0
182 #define IPC_TCP_SOCKET 1
183 #define IPC_UDP_SOCKET 2
184 #define IPC_FIFO 3
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(u_short)+sizeof(int))
194
195 #define STORE_ENTRY_WITH_MEMOBJ 1
196 #define STORE_ENTRY_WITHOUT_MEMOBJ 0
197 #define STORE_SWAP_BUF DISK_PAGE_SIZE
198 #define VM_WINDOW_SZ DISK_PAGE_SIZE
199
200 #define SKIP_BASIC_SZ ((size_t) 6)
201
202 #define COUNT_INTERVAL 60
203 /*
204 * keep 60 minutes' worth of per-minute readings (+ current reading)
205 */
206 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
207 /*
208 * keep 3 days' (72 hours) worth of hourly readings
209 */
210 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
211
212 /* were to look for errors if config path fails */
213 #define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
214
215 /* gb_type operations */
216 #define gb_flush_limit (0x3FFFFFFF)
217 #define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
218
219 /* iteration for HttpHdrRange */
220 #define HttpHdrRangeInitPos (-1)