defines.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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 IPC_NONE 0
91#define IPC_TCP_SOCKET 1
92#define IPC_UDP_SOCKET 2
93#define IPC_FIFO 3
94#define IPC_UNIX_STREAM 4
95#define IPC_UNIX_DGRAM 5
96
97/* required for AF_UNIX below to be defined [on FreeBSD] */
98#if HAVE_SYS_SOCKET_H
99#include <sys/socket.h>
100#endif
101
102#if HAVE_SOCKETPAIR && defined (AF_UNIX)
103#define IPC_STREAM IPC_UNIX_STREAM
104#define IPC_DGRAM IPC_UNIX_DGRAM
105#else
106#define IPC_STREAM IPC_TCP_SOCKET
107#define IPC_DGRAM IPC_UDP_SOCKET
108#endif
109
110#define COUNT_INTERVAL 60
111/*
112 * keep 60 minutes' worth of per-minute readings (+ current reading)
113 */
114#define N_COUNT_HIST (3600 / COUNT_INTERVAL) + 1
115/*
116 * keep 3 days' (72 hours) worth of hourly readings
117 */
118#define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
119
120/*
121 * This many TCP connections must FAIL before we mark the
122 * peer as DEAD
123 */
124#define PEER_TCP_MAGIC_COUNT 10
125
126#define URI_WHITESPACE_STRIP 0
127#define URI_WHITESPACE_ALLOW 1
128#define URI_WHITESPACE_ENCODE 2
129#define URI_WHITESPACE_CHOP 3
130#define URI_WHITESPACE_DENY 4
131
132#ifndef O_TEXT
133#define O_TEXT 0
134#endif
135#ifndef O_BINARY
136#define O_BINARY 0
137#endif
138
139/*
140 * Macro to find file access mode
141 */
142#ifdef O_ACCMODE
143#define FILE_MODE(x) ((x)&O_ACCMODE)
144#else
145#define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
146#endif
147
148/* CygWin & Windows NT Port */
149#if _SQUID_WINDOWS_
150#define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
151#define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
152#define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
153#define _WIN_SQUID_SERVICE_CONTROL_ROTATE 128
154#define _WIN_SQUID_SERVICE_CONTROL_RECONFIGURE 129
155#define _WIN_SQUID_SERVICE_CONTROL_DEBUG 130
156#define _WIN_SQUID_SERVICE_CONTROL_INTERRUPT 131
157#define _WIN_SQUID_SERVICE_OPTION "--ntservice"
158#define _WIN_SQUID_RUN_MODE_INTERACTIVE 0
159#define _WIN_SQUID_RUN_MODE_SERVICE 1
160#endif
161
162#endif /* SQUID_DEFINES_H */
163

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors