]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 1996-2025 The Squid Software Foundation and contributors | |
3 | * | |
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. | |
7 | */ | |
8 | ||
9 | #ifndef SQUID_SRC_DEFINES_H | |
10 | #define SQUID_SRC_DEFINES_H | |
11 | ||
12 | #ifndef TRUE | |
13 | #define TRUE 1 | |
14 | #endif | |
15 | #ifndef FALSE | |
16 | #define FALSE 0 | |
17 | #endif | |
18 | ||
19 | #ifndef BUFSIZ | |
20 | #define BUFSIZ 4096 /* make unreasonable guess */ | |
21 | #endif | |
22 | ||
23 | /* Select types. */ | |
24 | #define COMM_SELECT_READ (0x1) | |
25 | #define COMM_SELECT_WRITE (0x2) | |
26 | ||
27 | #define DISK_OK (0) | |
28 | #define DISK_ERROR (-1) | |
29 | #define DISK_EOF (-2) | |
30 | #define DISK_NO_SPACE_LEFT (-6) | |
31 | ||
32 | #define FD_DESC_SZ 64 | |
33 | ||
34 | #define FQDN_LOOKUP_IF_MISS 0x01 | |
35 | #define FQDN_MAX_NAMES 5 | |
36 | ||
37 | #define IP_LOOKUP_IF_MISS 0x01 | |
38 | ||
39 | #define ICP_FLAG_SRC_RTT 0x40000000ul | |
40 | ||
41 | /* Version */ | |
42 | #define ICP_VERSION_2 2 | |
43 | #define ICP_VERSION_3 3 | |
44 | #define ICP_VERSION_CURRENT ICP_VERSION_2 | |
45 | ||
46 | #define DIRECT_UNKNOWN 0 | |
47 | #define DIRECT_NO 1 | |
48 | #define DIRECT_MAYBE 2 | |
49 | #define DIRECT_YES 3 | |
50 | ||
51 | #define REDIRECT_AV_FACTOR 1000 | |
52 | ||
53 | #define REDIRECT_NONE 0 | |
54 | #define REDIRECT_PENDING 1 | |
55 | #define REDIRECT_DONE 2 | |
56 | ||
57 | /* AUTHENTICATION */ | |
58 | ||
59 | /* logfile status */ | |
60 | #define LOG_ENABLE 1 | |
61 | #define LOG_DISABLE 0 | |
62 | ||
63 | #define SM_PAGE_SIZE 4096 | |
64 | ||
65 | #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit))))) | |
66 | #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit))))) | |
67 | #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit)))) | |
68 | ||
69 | /* bit opearations on a char[] mask of unlimited length */ | |
70 | #define CBIT_BIT(bit) (1<<((bit)%8)) | |
71 | #define CBIT_BIN(mask, bit) (mask)[(bit)>>3] | |
72 | #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit))) | |
73 | #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit))) | |
74 | #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit)) | |
75 | ||
76 | #define MAX_URL 8192 | |
77 | #define MAX_LOGIN_SZ 128 | |
78 | ||
79 | #define PEER_MAX_ADDRESSES 10 | |
80 | #define RTT_AV_FACTOR 50 | |
81 | #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */ | |
82 | ||
83 | #define PEER_DEAD 0 | |
84 | #define PEER_ALIVE 1 | |
85 | ||
86 | #define CLIENT_REQ_BUF_SZ 4096 | |
87 | ||
88 | #define IPC_NONE 0 | |
89 | #define IPC_TCP_SOCKET 1 | |
90 | #define IPC_UDP_SOCKET 2 | |
91 | #define IPC_FIFO 3 | |
92 | #define IPC_UNIX_STREAM 4 | |
93 | #define IPC_UNIX_DGRAM 5 | |
94 | ||
95 | /* required for AF_UNIX below to be defined [on FreeBSD] */ | |
96 | #if HAVE_SYS_SOCKET_H | |
97 | #include <sys/socket.h> | |
98 | #endif | |
99 | ||
100 | #if HAVE_SOCKETPAIR && defined (AF_UNIX) | |
101 | #define IPC_STREAM IPC_UNIX_STREAM | |
102 | #define IPC_DGRAM IPC_UNIX_DGRAM | |
103 | #else | |
104 | #define IPC_STREAM IPC_TCP_SOCKET | |
105 | #define IPC_DGRAM IPC_UDP_SOCKET | |
106 | #endif | |
107 | ||
108 | #define COUNT_INTERVAL 60 | |
109 | /* | |
110 | * keep 60 minutes' worth of per-minute readings (+ current reading) | |
111 | */ | |
112 | #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1 | |
113 | /* | |
114 | * keep 3 days' (72 hours) worth of hourly readings | |
115 | */ | |
116 | #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL) | |
117 | ||
118 | /* | |
119 | * This many TCP connections must FAIL before we mark the | |
120 | * peer as DEAD | |
121 | */ | |
122 | #define PEER_TCP_MAGIC_COUNT 10 | |
123 | ||
124 | #define URI_WHITESPACE_STRIP 0 | |
125 | #define URI_WHITESPACE_ALLOW 1 | |
126 | #define URI_WHITESPACE_ENCODE 2 | |
127 | #define URI_WHITESPACE_CHOP 3 | |
128 | #define URI_WHITESPACE_DENY 4 | |
129 | ||
130 | #ifndef O_TEXT | |
131 | #define O_TEXT 0 | |
132 | #endif | |
133 | #ifndef O_BINARY | |
134 | #define O_BINARY 0 | |
135 | #endif | |
136 | ||
137 | /* | |
138 | * Macro to find file access mode | |
139 | */ | |
140 | #ifdef O_ACCMODE | |
141 | #define FILE_MODE(x) ((x)&O_ACCMODE) | |
142 | #else | |
143 | #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR)) | |
144 | #endif | |
145 | ||
146 | /* CygWin & Windows NT Port */ | |
147 | #if _SQUID_WINDOWS_ | |
148 | #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP | |
149 | #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN | |
150 | #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE | |
151 | #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128 | |
152 | #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129 | |
153 | #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130 | |
154 | #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131 | |
155 | #define _WIN_SQUID_SERVICE_OPTION "--ntservice" | |
156 | #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0 | |
157 | #define _WIN_SQUID_RUN_MODE_SERVICE 1 | |
158 | #endif | |
159 | ||
160 | #endif /* SQUID_SRC_DEFINES_H */ | |
161 |