]> git.ipfire.org Git - thirdparty/squid.git/blame - src/defines.h
Various audit updates
[thirdparty/squid.git] / src / defines.h
CommitLineData
9cef6668 1/*
9cef6668 2 *
2b6662ba 3 * SQUID Web Proxy Cache http://www.squid-cache.org/
9cef6668 4 * ----------------------------------------------------------
5 *
2b6662ba 6 * Squid is the result of efforts by numerous individuals from
7 * the Internet community; see the CONTRIBUTORS file for full
8 * details. Many organizations have provided support for Squid's
9 * development; see the SPONSORS file for full details. Squid is
10 * Copyrighted (C) 2001 by the Regents of the University of
11 * California; see the COPYRIGHT file for full details. Squid
12 * incorporates software developed and/or copyrighted by other
13 * sources; see the CREDITS file for full details.
9cef6668 14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
26ac0430 19 *
9cef6668 20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
26ac0430 24 *
9cef6668 25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
28 *
29 */
f13f02e9 30#ifndef SQUID_DEFINES_H
31#define SQUID_DEFINES_H
b5638623 32
a8258824 33#ifndef TRUE
34#define TRUE 1
35#endif
36#ifndef FALSE
37#define FALSE 0
38#endif
39
e1f7507e
AJ
40#ifndef BUFSIZ
41#define BUFSIZ 4096 /* make unreasonable guess */
42#endif
43
a8258824 44#define BROWSERNAMELEN 128
45
46#define ACL_SUNDAY 0x01
47#define ACL_MONDAY 0x02
48#define ACL_TUESDAY 0x04
49#define ACL_WEDNESDAY 0x08
50#define ACL_THURSDAY 0x10
51#define ACL_FRIDAY 0x20
52#define ACL_SATURDAY 0x40
53#define ACL_ALLWEEK 0x7F
54#define ACL_WEEKDAYS 0x3E
55
a8258824 56/* Select types. */
57#define COMM_SELECT_READ (0x1)
58#define COMM_SELECT_WRITE (0x2)
a8258824 59
a8258824 60#define DISK_OK (0)
61#define DISK_ERROR (-1)
62#define DISK_EOF (-2)
a8258824 63#define DISK_NO_SPACE_LEFT (-6)
64
a8258824 65#define DNS_INBUF_SZ 4096
66
a8258824 67#define FD_DESC_SZ 64
68
164a44a8 69#define FQDN_LOOKUP_IF_MISS 0x01
a8258824 70#define FQDN_MAX_NAMES 5
a8258824 71
a8258824 72#define HTTP_REPLY_FIELD_SZ 128
73
74#define BUF_TYPE_8K 1
75#define BUF_TYPE_MALLOC 2
76
77#define ANONYMIZER_NONE 0
78#define ANONYMIZER_STANDARD 1
79#define ANONYMIZER_PARANOID 2
80
def67559 81#define USER_IDENT_SZ 64
a8258824 82#define IDENT_NONE 0
83#define IDENT_PENDING 1
84#define IDENT_DONE 2
85
164a44a8 86#define IP_LOOKUP_IF_MISS 0x01
a8258824 87
a8258824 88#define MAX_MIME 4096
89
90/* Mark a neighbor cache as dead if it doesn't answer this many pings */
91#define HIER_MAX_DEFICIT 20
92
a8258824 93#define ICP_FLAG_HIT_OBJ 0x80000000ul
94#define ICP_FLAG_SRC_RTT 0x40000000ul
95
a8258824 96/* Version */
a8258824 97#define ICP_VERSION_2 2
98#define ICP_VERSION_3 3
99#define ICP_VERSION_CURRENT ICP_VERSION_2
100
db1cd23c 101#define DIRECT_UNKNOWN 0
102#define DIRECT_NO 1
103#define DIRECT_MAYBE 2
104#define DIRECT_YES 3
a8258824 105
a8258824 106#define REDIRECT_AV_FACTOR 1000
107
108#define REDIRECT_NONE 0
109#define REDIRECT_PENDING 1
110#define REDIRECT_DONE 2
111
73e67ee0 112#define AUTHENTICATE_AV_FACTOR 1000
94439e4e 113/* AUTHENTICATION */
73e67ee0 114
94439e4e 115#define NTLM_CHALLENGE_SZ 300
73e67ee0 116
a8258824 117#define CONNECT_PORT 443
118
119#define current_stacksize(stack) ((stack)->top - (stack)->base)
120
121/* logfile status */
122#define LOG_ENABLE 1
123#define LOG_DISABLE 0
124
125#define SM_PAGE_SIZE 4096
add2192d 126#define MAX_CLIENT_BUF_SZ 4096
a8258824 127
663a6f83 128#define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit)))))
129#define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit)))))
130#define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit))))
d8b249ef 131
132/* bit opearations on a char[] mask of unlimited length */
133#define CBIT_BIT(bit) (1<<((bit)%8))
134#define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
135#define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
136#define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
137#define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
a8258824 138
a8258824 139#define MAX_FILES_PER_DIR (1<<20)
140
788652f7 141#define MAX_URL 8192
a8258824 142#define MAX_LOGIN_SZ 128
143
a8258824 144#define PEER_MAX_ADDRESSES 10
e39dc0e0 145#define RTT_AV_FACTOR 50
d1b63fc8 146#define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */
a8258824 147
dc835977 148#define PEER_DEAD 0
149#define PEER_ALIVE 1
150
9b312a19 151#define AUTH_MSG_SZ 4096
152#define HTTP_REPLY_BUF_SZ 4096
58cd5bbd 153#define CLIENT_REQ_BUF_SZ 4096
603a02fd 154
03d7b07f 155#if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
156#define ERROR_BUF_SZ (MAX_URL << 2)
157#endif
158
6ccb94e5 159#if SQUID_SNMP
160#define VIEWINCLUDED 1
161#define VIEWEXCLUDED 2
162#endif
a21fbb54 163
69c01cd7 164#define STORE_META_OK 0x03
165#define STORE_META_DIRTY 0x04
166#define STORE_META_BAD 0x05
a7c05555 167
168#define IPC_NONE 0
169#define IPC_TCP_SOCKET 1
170#define IPC_UDP_SOCKET 2
171#define IPC_FIFO 3
1ccc0d40 172#define IPC_UNIX_STREAM 4
173#define IPC_UNIX_DGRAM 5
174
5b346515
AR
175/* required for AF_UNIX below to be defined [on FreeBSD] */
176#if HAVE_SYS_SOCKET_H
f4199ea5 177#include <sys/socket.h>
5b346515
AR
178#endif
179
1ccc0d40 180#if HAVE_SOCKETPAIR && defined (AF_UNIX)
181#define IPC_STREAM IPC_UNIX_STREAM
182#define IPC_DGRAM IPC_UNIX_DGRAM
183#else
184#define IPC_STREAM IPC_TCP_SOCKET
185#define IPC_DGRAM IPC_UDP_SOCKET
186#endif
f09f5b26 187
188#define STORE_META_KEY STORE_META_KEY_MD5
189
190#define STORE_META_TLD_START sizeof(int)+sizeof(char)
191#define STORE_META_TLD_SIZE STORE_META_TLD_START
192#define SwapMetaType(x) (char)x[0]
193#define SwapMetaSize(x) &x[sizeof(char)]
194#define SwapMetaData(x) &x[STORE_META_TLD_START]
f45dd259
AJ
195#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t))
196#define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t))
f09f5b26 197
2c29838d 198#define COUNT_INTERVAL 60
199/*
200 * keep 60 minutes' worth of per-minute readings (+ current reading)
201 */
202#define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
203/*
204 * keep 3 days' (72 hours) worth of hourly readings
399e85ea 205 */
2c29838d 206#define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
451b07c5 207
99edd1c3 208/* handy to determine the #elements in a static array */
209#define countof(arr) (sizeof(arr)/sizeof(*arr))
309ad3b6 210
98829f69 211/*
212 * This many TCP connections must FAIL before we mark the
213 * peer as DEAD
214 */
215#define PEER_TCP_MAGIC_COUNT 10
cc27d775 216
7e3ce7b9 217#define URI_WHITESPACE_STRIP 0
d548ee64 218#define URI_WHITESPACE_ALLOW 1
219#define URI_WHITESPACE_ENCODE 2
220#define URI_WHITESPACE_CHOP 3
7e3ce7b9 221#define URI_WHITESPACE_DENY 4
86ed3fd2 222
c4aefe96 223#ifndef O_TEXT
224#define O_TEXT 0
225#endif
226#ifndef O_BINARY
227#define O_BINARY 0
228#endif
0e6d05ef 229
5d1a7121 230/*
231 * Macro to find file access mode
232 */
233#ifdef O_ACCMODE
234#define FILE_MODE(x) ((x)&O_ACCMODE)
235#else
236#define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
237#endif
238
add2192d 239#define HTTP_REQBUF_SZ 4096
a50bfe93 240
241/* CygWin & Windows NT Port */
be266cb2 242#if _SQUID_WINDOWS_
a50bfe93 243#define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
244#define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
245#define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
246#define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
247#define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
248#define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
249#define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
a50bfe93 250#define _WIN_SQUID_SERVICE_OPTION "--ntservice"
251#define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
252#define _WIN_SQUID_RUN_MODE_SERVICE 1
253#endif
254
f13f02e9 255#endif /* SQUID_DEFINES_H */