]> git.ipfire.org Git - thirdparty/squid.git/blob - src/enums.h
Source Format Enforcement (#963)
[thirdparty/squid.git] / src / enums.h
1 /*
2 * Copyright (C) 1996-2022 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_ENUMS_H
10 #define SQUID_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 enum {
23 FD_READ,
24 FD_WRITE
25 };
26
27 typedef enum {
28 PEER_NONE,
29 PEER_SIBLING,
30 PEER_PARENT,
31 PEER_MULTICAST
32 } peer_t;
33
34 typedef enum _mem_status_t {
35 NOT_IN_MEMORY,
36 IN_MEMORY
37 } mem_status_t;
38
39 typedef enum {
40 /// Has not considered whether to send ICP queries to peers yet.
41 PING_NONE,
42 /// Sent ICP queries to peers and still awaiting responses.
43 PING_WAITING,
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.
46 PING_DONE
47 } ping_status_t;
48
49 typedef enum {
50 STORE_OK,
51 STORE_PENDING
52 } store_status_t;
53
54 /// StoreEntry relationship with a disk cache
55 typedef enum {
56 /// StoreEntry is currently not associated with any disk store entry.
57 /// Does not guarantee (or preclude!) a matching disk store entry existence.
58 SWAPOUT_NONE,
59 /// StoreEntry is being swapped out to the associated disk store entry.
60 /// Guarantees the disk store entry existence.
61 SWAPOUT_WRITING,
62 /// StoreEntry is associated with a complete (i.e., fully swapped out) disk store entry.
63 /// Guarantees the disk store entry existence.
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
69 } swap_status_t;
70
71 typedef enum {
72 STORE_NON_CLIENT,
73 STORE_MEM_CLIENT,
74 STORE_DISK_CLIENT
75 } store_client_t;
76
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 */
83 enum {
84 ENTRY_SPECIAL,
85 ENTRY_REVALIDATE_ALWAYS,
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.
97 DELAY_SENDING,
98 RELEASE_REQUEST, ///< prohibits making the key public
99 REFRESH_REQUEST,
100 ENTRY_REVALIDATE_STALE,
101 ENTRY_DISPATCHED,
102 KEY_PRIVATE,
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.
111 ENTRY_FWD_HDR_WAIT,
112 ENTRY_NEGCACHED,
113 ENTRY_VALIDATED,
114 ENTRY_BAD_LENGTH,
115 ENTRY_ABORTED,
116 /// Whether the entry serves collapsed hits now.
117 /// Meaningful only for public entries.
118 ENTRY_REQUIRES_COLLAPSING
119 };
120
121 /*
122 * These are for client Streams. Each node in the stream can be queried for
123 * its status
124 */
125 typedef enum {
126 STREAM_NONE, /* No particular status */
127 STREAM_COMPLETE, /* All data has been flushed, no more reads allowed */
128 /* an unpredicted end has occurred, no more
129 * reads occurred, but no need to tell
130 * downstream that an error occurred
131 */
132 STREAM_UNPLANNED_COMPLETE,
133 /* An error has occurred in this node or an above one,
134 * and the node is not generating an error body / it's
135 * midstream
136 */
137 STREAM_FAILED
138 } clientStream_status_t;
139
140 /* stateful helper callback response codes */
141 typedef enum {
142 S_HELPER_UNKNOWN,
143 S_HELPER_RESERVE,
144 S_HELPER_RELEASE
145 } stateful_helper_callback_t;
146
147 #if SQUID_SNMP
148 enum {
149 SNMP_C_VIEW,
150 SNMP_C_USER,
151 SNMP_C_COMMUNITY
152 };
153 #endif /* SQUID_SNMP */
154
155 enum {
156 STORE_LOG_CREATE,
157 STORE_LOG_SWAPIN,
158 STORE_LOG_SWAPOUT,
159 STORE_LOG_RELEASE,
160 STORE_LOG_SWAPOUTFAIL
161 };
162
163 enum {
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
172 };
173
174 enum {
175 SENT,
176 RECV
177 };
178
179 /*
180 * These are field indicators for raw cache-cache netdb transfers
181 */
182 enum {
183 NETDB_EX_NONE,
184 NETDB_EX_NETWORK,
185 NETDB_EX_RTT,
186 NETDB_EX_HOPS
187 };
188
189 /*
190 * Return codes from checkVary(request)
191 */
192 enum {
193 VARY_NONE,
194 VARY_MATCH,
195 VARY_OTHER,
196 VARY_CANCEL
197 };
198
199 /*
200 * Store digest state enum
201 */
202 typedef enum {
203 DIGEST_READ_NONE,
204 DIGEST_READ_REPLY,
205 DIGEST_READ_HEADERS,
206 DIGEST_READ_CBLOCK,
207 DIGEST_READ_MASK,
208 DIGEST_READ_DONE
209 } digest_read_state_t;
210
211 /* CygWin & Windows NT Port */
212 #if _SQUID_WINDOWS_
213 /*
214 * Supported Windows OS types codes
215 */
216 enum {
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,
224 _WIN_OS_WINXP,
225 _WIN_OS_WINNET,
226 _WIN_OS_WINLON,
227 _WIN_OS_WIN7
228 };
229 #endif /* _SQUID_WINDOWS_ */
230
231 enum {
232 DISABLE_PMTU_OFF,
233 DISABLE_PMTU_ALWAYS,
234 DISABLE_PMTU_TRANSPARENT
235 };
236
237 #if USE_HTCP
238 /*
239 * TODO: This should be in htcp.h
240 */
241 typedef enum {
242 HTCP_CLR_PURGE,
243 HTCP_CLR_INVALIDATION
244 } htcp_clr_reason;
245 #endif /* USE_HTCP */
246
247 #endif /* SQUID_ENUMS_H */
248