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