]> git.ipfire.org Git - thirdparty/squid.git/blob - src/enums.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / enums.h
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_SRC_ENUMS_H
10 #define SQUID_SRC_ENUMS_H
11
12 enum 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
22 typedef enum {
23 PEER_NONE,
24 PEER_SIBLING,
25 PEER_PARENT,
26 PEER_MULTICAST
27 } peer_t;
28
29 typedef enum _mem_status_t {
30 NOT_IN_MEMORY,
31 IN_MEMORY
32 } mem_status_t;
33
34 typedef 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
44 typedef enum {
45 STORE_OK,
46 STORE_PENDING
47 } store_status_t;
48
49 /// StoreEntry relationship with a disk cache
50 typedef 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
66 typedef 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 */
78 enum {
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 */
120 typedef 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 */
136 typedef enum {
137 S_HELPER_UNKNOWN,
138 S_HELPER_RESERVE,
139 S_HELPER_RELEASE
140 } stateful_helper_callback_t;
141
142 #if SQUID_SNMP
143 enum {
144 SNMP_C_VIEW,
145 SNMP_C_USER,
146 SNMP_C_COMMUNITY
147 };
148 #endif /* SQUID_SNMP */
149
150 enum {
151 STORE_LOG_CREATE,
152 STORE_LOG_SWAPIN,
153 STORE_LOG_SWAPOUT,
154 STORE_LOG_RELEASE,
155 STORE_LOG_SWAPOUTFAIL
156 };
157
158 enum {
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
169 enum {
170 SENT,
171 RECV
172 };
173
174 /*
175 * These are field indicators for raw cache-cache netdb transfers
176 */
177 enum {
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 */
187 enum {
188 VARY_NONE,
189 VARY_MATCH,
190 VARY_OTHER,
191 VARY_CANCEL
192 };
193
194 /*
195 * Store digest state enum
196 */
197 typedef enum {
198 DIGEST_READ_NONE,
199 DIGEST_READ_REPLY,
200 DIGEST_READ_CBLOCK,
201 DIGEST_READ_MASK,
202 DIGEST_READ_DONE
203 } digest_read_state_t;
204
205 /* CygWin & Windows NT Port */
206 #if _SQUID_WINDOWS_
207 /*
208 * Supported Windows OS types codes
209 */
210 enum {
211 _WIN_OS_UNKNOWN,
212 _WIN_OS_WIN32S,
213 _WIN_OS_WIN95,
214 _WIN_OS_WIN98,
215 _WIN_OS_WINME,
216 _WIN_OS_WINNT,
217 _WIN_OS_WIN2K,
218 _WIN_OS_WINXP,
219 _WIN_OS_WINNET,
220 _WIN_OS_WINLON,
221 _WIN_OS_WIN7
222 };
223 #endif /* _SQUID_WINDOWS_ */
224
225 enum {
226 DISABLE_PMTU_OFF,
227 DISABLE_PMTU_ALWAYS,
228 DISABLE_PMTU_TRANSPARENT
229 };
230
231 #if USE_HTCP
232 /*
233 * TODO: This should be in htcp.h
234 */
235 typedef enum {
236 HTCP_CLR_PURGE,
237 HTCP_CLR_INVALIDATION
238 } htcp_clr_reason;
239 #endif /* USE_HTCP */
240
241 #endif /* SQUID_SRC_ENUMS_H */
242