]> git.ipfire.org Git - thirdparty/squid.git/blame_incremental - src/enums.h
Simplify appending SBuf to String (#2108)
[thirdparty/squid.git] / src / enums.h
... / ...
CommitLineData
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_ENUMS_H
10#define SQUID_SRC_ENUMS_H
11
12enum fd_type {
13 FD_NONE_TYPE,
14 FD_LOG,
15 FD_FILE,
16 FD_SOCKET,
17 FD_PIPE,
18 FD_MSGHDR,
19 FD_UNKNOWN
20};
21
22typedef enum {
23 PEER_NONE,
24 PEER_SIBLING,
25 PEER_PARENT,
26 PEER_MULTICAST
27} peer_t;
28
29typedef enum _mem_status_t {
30 NOT_IN_MEMORY,
31 IN_MEMORY
32} mem_status_t;
33
34typedef enum {
35 /// Has not considered whether to send ICP queries to peers yet.
36 PING_NONE,
37 /// Sent ICP queries to peers and still awaiting responses.
38 PING_WAITING,
39 /// Not waiting for ICP responses now and will not send ICP queries later.
40 /// The ICP queries may (or may not) have been sent earlier.
41 PING_DONE
42} ping_status_t;
43
44typedef enum {
45 STORE_OK,
46 STORE_PENDING
47} store_status_t;
48
49/// StoreEntry relationship with a disk cache
50typedef enum {
51 /// StoreEntry is currently not associated with any disk store entry.
52 /// Does not guarantee (or preclude!) a matching disk store entry existence.
53 SWAPOUT_NONE,
54 /// StoreEntry is being swapped out to the associated disk store entry.
55 /// Guarantees the disk store entry existence.
56 SWAPOUT_WRITING,
57 /// StoreEntry is associated with a complete (i.e., fully swapped out) disk store entry.
58 /// Guarantees the disk store entry existence.
59 SWAPOUT_DONE,
60 /// StoreEntry is associated with an unusable disk store entry.
61 /// Swapout attempt has failed. The entry should be marked for eventual deletion.
62 /// Guarantees the disk store entry existence.
63 SWAPOUT_FAILED
64} swap_status_t;
65
66typedef enum {
67 STORE_NON_CLIENT,
68 STORE_MEM_CLIENT,
69 STORE_DISK_CLIENT
70} store_client_t;
71
72/*
73 * These are for StoreEntry->flag, which is defined as a SHORT
74 *
75 * NOTE: These flags are written to swap.state, so think very carefully
76 * about deleting or re-assigning!
77 */
78enum {
79 ENTRY_SPECIAL,
80 ENTRY_REVALIDATE_ALWAYS,
81
82 /// Tiny Store writes are likely. The writes should be aggregated together
83 /// before Squid announces the new content availability to the store
84 /// clients. For example, forming a cached HTTP response header may result
85 /// in dozens of StoreEntry::write() calls, many of which adding as little
86 /// as two bytes. Sharing those small writes with the store clients
87 /// increases overhead, especially because the client code can do nothing
88 /// useful with the written content until the whole response header is
89 /// stored. Might be combined with ENTRY_FWD_HDR_WAIT. TODO: Rename to
90 /// ENTRY_DELAY_WHILE_COALESCING to emphasize the difference from and
91 /// similarity with ENTRY_FWD_HDR_WAIT.
92 DELAY_SENDING,
93 RELEASE_REQUEST, ///< prohibits making the key public
94 REFRESH_REQUEST,
95 ENTRY_REVALIDATE_STALE,
96 ENTRY_DISPATCHED,
97 KEY_PRIVATE,
98
99 /// The current entry response may change. The contents of an entry in this
100 /// state must not be shared with its store clients. For example, Squid
101 /// receives (and buffers) an HTTP/504 response but may decide to retry that
102 /// transaction to receive a successful response from another server
103 /// instead. Might be combined with DELAY_SENDING. TODO: Rename to
104 /// ENTRY_DELAY_WHILE_WOBBLING to emphasize the difference from and
105 /// similarity with DELAY_SENDING.
106 ENTRY_FWD_HDR_WAIT,
107 ENTRY_NEGCACHED,
108 ENTRY_VALIDATED,
109 ENTRY_BAD_LENGTH,
110 ENTRY_ABORTED,
111 /// Whether the entry serves collapsed hits now.
112 /// Meaningful only for public entries.
113 ENTRY_REQUIRES_COLLAPSING
114};
115
116/*
117 * These are for client Streams. Each node in the stream can be queried for
118 * its status
119 */
120typedef enum {
121 STREAM_NONE, /* No particular status */
122 STREAM_COMPLETE, /* All data has been flushed, no more reads allowed */
123 /* an unpredicted end has occurred, no more
124 * reads occurred, but no need to tell
125 * downstream that an error occurred
126 */
127 STREAM_UNPLANNED_COMPLETE,
128 /* An error has occurred in this node or an above one,
129 * and the node is not generating an error body / it's
130 * midstream
131 */
132 STREAM_FAILED
133} clientStream_status_t;
134
135/* stateful helper callback response codes */
136typedef enum {
137 S_HELPER_UNKNOWN,
138 S_HELPER_RESERVE,
139 S_HELPER_RELEASE
140} stateful_helper_callback_t;
141
142#if SQUID_SNMP
143enum {
144 SNMP_C_VIEW,
145 SNMP_C_USER,
146 SNMP_C_COMMUNITY
147};
148#endif /* SQUID_SNMP */
149
150enum {
151 STORE_LOG_CREATE,
152 STORE_LOG_SWAPIN,
153 STORE_LOG_SWAPOUT,
154 STORE_LOG_RELEASE,
155 STORE_LOG_SWAPOUTFAIL
156};
157
158enum {
159 PCTILE_HTTP,
160 PCTILE_ICP_QUERY,
161 PCTILE_DNS,
162 PCTILE_HIT,
163 PCTILE_MISS,
164 PCTILE_NM,
165 PCTILE_NH,
166 PCTILE_ICP_REPLY
167};
168
169enum {
170 SENT,
171 RECV
172};
173
174/*
175 * These are field indicators for raw cache-cache netdb transfers
176 */
177enum {
178 NETDB_EX_NONE,
179 NETDB_EX_NETWORK,
180 NETDB_EX_RTT,
181 NETDB_EX_HOPS
182};
183
184/*
185 * Return codes from checkVary(request)
186 */
187enum {
188 VARY_NONE,
189 VARY_MATCH,
190 VARY_OTHER,
191 VARY_CANCEL
192};
193
194/*
195 * Store digest state enum
196 */
197typedef enum {
198 DIGEST_READ_NONE,
199 DIGEST_READ_REPLY,
200 DIGEST_READ_CBLOCK,
201 DIGEST_READ_MASK
202} digest_read_state_t;
203
204/* CygWin & Windows NT Port */
205#if _SQUID_WINDOWS_
206/*
207 * Supported Windows OS types codes
208 */
209enum {
210 _WIN_OS_UNKNOWN,
211 _WIN_OS_WIN32S,
212 _WIN_OS_WIN95,
213 _WIN_OS_WIN98,
214 _WIN_OS_WINME,
215 _WIN_OS_WINNT,
216 _WIN_OS_WIN2K,
217 _WIN_OS_WINXP,
218 _WIN_OS_WINNET,
219 _WIN_OS_WINLON,
220 _WIN_OS_WIN7
221};
222#endif /* _SQUID_WINDOWS_ */
223
224enum {
225 DISABLE_PMTU_OFF,
226 DISABLE_PMTU_ALWAYS,
227 DISABLE_PMTU_TRANSPARENT
228};
229
230#if USE_HTCP
231/*
232 * TODO: This should be in htcp.h
233 */
234typedef enum {
235 HTCP_CLR_PURGE,
236 HTCP_CLR_INVALIDATION
237} htcp_clr_reason;
238#endif /* USE_HTCP */
239
240#endif /* SQUID_SRC_ENUMS_H */
241