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