defines.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 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_DEFINES_H
10 #define SQUID_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 USER_IDENT_SZ 64
38 
39 #define IP_LOOKUP_IF_MISS 0x01
40 
41 #define ICP_FLAG_SRC_RTT 0x40000000ul
42 
43 /* Version */
44 #define ICP_VERSION_2 2
45 #define ICP_VERSION_3 3
46 #define ICP_VERSION_CURRENT ICP_VERSION_2
47 
48 #define DIRECT_UNKNOWN 0
49 #define DIRECT_NO 1
50 #define DIRECT_MAYBE 2
51 #define DIRECT_YES 3
52 
53 #define REDIRECT_AV_FACTOR 1000
54 
55 #define REDIRECT_NONE 0
56 #define REDIRECT_PENDING 1
57 #define REDIRECT_DONE 2
58 
59 /* AUTHENTICATION */
60 
61 /* logfile status */
62 #define LOG_ENABLE 1
63 #define LOG_DISABLE 0
64 
65 #define SM_PAGE_SIZE 4096
66 
67 #define EBIT_SET(flag, bit) ((void)((flag) |= ((1L<<(bit)))))
68 #define EBIT_CLR(flag, bit) ((void)((flag) &= ~((1L<<(bit)))))
69 #define EBIT_TEST(flag, bit) ((flag) & ((1L<<(bit))))
70 
71 /* bit opearations on a char[] mask of unlimited length */
72 #define CBIT_BIT(bit) (1<<((bit)%8))
73 #define CBIT_BIN(mask, bit) (mask)[(bit)>>3]
74 #define CBIT_SET(mask, bit) ((void)(CBIT_BIN(mask, bit) |= CBIT_BIT(bit)))
75 #define CBIT_CLR(mask, bit) ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
76 #define CBIT_TEST(mask, bit) (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
77 
78 #define MAX_URL 8192
79 #define MAX_LOGIN_SZ 128
80 
81 #define PEER_MAX_ADDRESSES 10
82 #define RTT_AV_FACTOR 50
83 #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */
84 
85 #define PEER_DEAD 0
86 #define PEER_ALIVE 1
87 
88 #define CLIENT_REQ_BUF_SZ 4096
89 
90 #define STORE_META_OK 0x03
91 
92 #define IPC_NONE 0
93 #define IPC_TCP_SOCKET 1
94 #define IPC_UDP_SOCKET 2
95 #define IPC_FIFO 3
96 #define IPC_UNIX_STREAM 4
97 #define IPC_UNIX_DGRAM 5
98 
99 /* required for AF_UNIX below to be defined [on FreeBSD] */
100 #if HAVE_SYS_SOCKET_H
101 #include <sys/socket.h>
102 #endif
103 
104 #if HAVE_SOCKETPAIR && defined (AF_UNIX)
105 #define IPC_STREAM IPC_UNIX_STREAM
106 #define IPC_DGRAM IPC_UNIX_DGRAM
107 #else
108 #define IPC_STREAM IPC_TCP_SOCKET
109 #define IPC_DGRAM IPC_UDP_SOCKET
110 #endif
111 
112 #define STORE_META_KEY STORE_META_KEY_MD5
113 
114 #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t))
115 #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t))
116 
117 #define COUNT_INTERVAL 60
118 /*
119  * keep 60 minutes' worth of per-minute readings (+ current reading)
120  */
121 #define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
122 /*
123  * keep 3 days' (72 hours) worth of hourly readings
124  */
125 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
126 
127 /*
128  * This many TCP connections must FAIL before we mark the
129  * peer as DEAD
130  */
131 #define PEER_TCP_MAGIC_COUNT 10
132 
133 #define URI_WHITESPACE_STRIP 0
134 #define URI_WHITESPACE_ALLOW 1
135 #define URI_WHITESPACE_ENCODE 2
136 #define URI_WHITESPACE_CHOP 3
137 #define URI_WHITESPACE_DENY 4
138 
139 #ifndef O_TEXT
140 #define O_TEXT 0
141 #endif
142 #ifndef O_BINARY
143 #define O_BINARY 0
144 #endif
145 
146 /*
147  * Macro to find file access mode
148  */
149 #ifdef O_ACCMODE
150 #define FILE_MODE(x) ((x)&O_ACCMODE)
151 #else
152 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
153 #endif
154 
155 /* CygWin & Windows NT Port */
156 #if _SQUID_WINDOWS_
157 #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
158 #define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
159 #define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
160 #define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
161 #define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
162 #define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
163 #define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
164 #define _WIN_SQUID_SERVICE_OPTION "--ntservice"
165 #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
166 #define _WIN_SQUID_RUN_MODE_SERVICE 1
167 #endif
168 
169 #endif /* SQUID_DEFINES_H */
170 

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors