]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/defines.h
b3681ac22bf00b398846299ab497024f55d5e228
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_DEFINES_H
10 #define SQUID_SRC_DEFINES_H
20 #define BUFSIZ 4096 /* make unreasonable guess */
24 #define COMM_SELECT_READ (0x1)
25 #define COMM_SELECT_WRITE (0x2)
28 #define DISK_ERROR (-1)
30 #define DISK_NO_SPACE_LEFT (-6)
34 #define FQDN_LOOKUP_IF_MISS 0x01
35 #define FQDN_MAX_NAMES 5
37 #define IP_LOOKUP_IF_MISS 0x01
39 #define ICP_FLAG_SRC_RTT 0x40000000ul
42 #define ICP_VERSION_2 2
43 #define ICP_VERSION_3 3
44 #define ICP_VERSION_CURRENT ICP_VERSION_2
46 #define DIRECT_UNKNOWN 0
48 #define DIRECT_MAYBE 2
51 #define REDIRECT_AV_FACTOR 1000
53 #define REDIRECT_NONE 0
54 #define REDIRECT_PENDING 1
55 #define REDIRECT_DONE 2
63 #define SM_PAGE_SIZE 4096
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))))
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))
77 #define MAX_LOGIN_SZ 128
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 */
86 #define CLIENT_REQ_BUF_SZ 4096
89 #define IPC_TCP_SOCKET 1
90 #define IPC_UDP_SOCKET 2
92 #define IPC_UNIX_STREAM 4
93 #define IPC_UNIX_DGRAM 5
95 /* required for AF_UNIX below to be defined [on FreeBSD] */
97 #include <sys/socket.h>
100 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
101 #define IPC_STREAM IPC_UNIX_STREAM
102 #define IPC_DGRAM IPC_UNIX_DGRAM
104 #define IPC_STREAM IPC_TCP_SOCKET
105 #define IPC_DGRAM IPC_UDP_SOCKET
108 #define COUNT_INTERVAL 60
110 * keep 60 minutes' worth of per-minute readings (+ current reading)
112 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
114 * keep 3 days' (72 hours) worth of hourly readings
116 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
119 * This many TCP connections must FAIL before we mark the
122 #define PEER_TCP_MAGIC_COUNT 10
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
138 * Macro to find file access mode
141 #define FILE_MODE(x) ((x)&O_ACCMODE)
143 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
146 /* CygWin & Windows NT Port */
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
160 #endif /* SQUID_SRC_DEFINES_H */