1 /* 2 * Copyright (C) 1996-2021 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 /* Namespace pollution from fcntl.h as of FreeBSD r345982 */ 13 #undef FD_NONE 14 15 enum fd_type { 16 FD_NONE_TYPE, 17 FD_LOG, 18 FD_FILE, 19 FD_SOCKET, 20 FD_PIPE, 21 FD_MSGHDR, 22 FD_UNKNOWN 23 }; 24 25 enum { 26 FD_READ, 27 FD_WRITE 28 }; 29 30 typedef enum { 31 PEER_NONE, 32 PEER_SIBLING, 33 PEER_PARENT, 34 PEER_MULTICAST 35 } peer_t; 36 37 typedef enum _mem_status_t { 38 NOT_IN_MEMORY, 39 IN_MEMORY 40 } mem_status_t; 41 42 typedef enum { 43 PING_NONE, 44 PING_WAITING, 45 PING_DONE 46 } ping_status_t; 47 48 typedef enum { 49 STORE_OK, 50 STORE_PENDING 51 } store_status_t; 52 53 /// StoreEntry relationship with a disk cache 54 typedef enum { 55 /// StoreEntry is currently not associated with any disk store entry. 56 /// Does not guarantee (or preclude!) a matching disk store entry existence. 57 SWAPOUT_NONE, 58 /// StoreEntry is being swapped out to the associated disk store entry. 59 /// Guarantees the disk store entry existence. 60 SWAPOUT_WRITING, 61 /// StoreEntry is associated with a complete (i.e., fully swapped out) disk store entry. 62 /// Guarantees the disk store entry existence. 63 SWAPOUT_DONE, 64 /// StoreEntry is associated with an unusable disk store entry. 65 /// Swapout attempt has failed. The entry should be marked for eventual deletion. 66 /// Guarantees the disk store entry existence. 67 SWAPOUT_FAILED 68 } swap_status_t; 69 70 typedef enum { 71 STORE_NON_CLIENT, 72 STORE_MEM_CLIENT, 73 STORE_DISK_CLIENT 74 } store_client_t; 75 76 /* 77 * These are for StoreEntry->flag, which is defined as a SHORT 78 * 79 * NOTE: These flags are written to swap.state, so think very carefully 80 * about deleting or re-assigning! 81 */ 82 enum { 83 ENTRY_SPECIAL, 84 ENTRY_REVALIDATE_ALWAYS, 85 86 /// Tiny Store writes are likely. The writes should be aggregated together 87 /// before Squid announces the new content availability to the store 88 /// clients. For example, forming a cached HTTP response header may result 89 /// in dozens of StoreEntry::write() calls, many of which adding as little 90 /// as two bytes. Sharing those small writes with the store clients 91 /// increases overhead, especially because the client code can do nothing 92 /// useful with the written content until the whole response header is 93 /// stored. Might be combined with ENTRY_FWD_HDR_WAIT. TODO: Rename to 94 /// ENTRY_DELAY_WHILE_COALESCING to emphasize the difference from and 95 /// similarity with ENTRY_FWD_HDR_WAIT. 96 DELAY_SENDING, 97 RELEASE_REQUEST, ///< prohibits making the key public 98 REFRESH_REQUEST, 99 ENTRY_REVALIDATE_STALE, 100 ENTRY_DISPATCHED, 101 KEY_PRIVATE, 102 103 /// The current entry response may change. The contents of an entry in this 104 /// state must not be shared with its store clients. For example, Squid 105 /// receives (and buffers) an HTTP/504 response but may decide to retry that 106 /// transaction to receive a successful response from another server 107 /// instead. Might be combined with DELAY_SENDING. TODO: Rename to 108 /// ENTRY_DELAY_WHILE_WOBBLING to emphasize the difference from and 109 /// similarity with DELAY_SENDING. 110 ENTRY_FWD_HDR_WAIT, 111 ENTRY_NEGCACHED, 112 ENTRY_VALIDATED, 113 ENTRY_BAD_LENGTH, 114 ENTRY_ABORTED 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 /* parse state of HttpReply or HttpRequest */ 160 typedef enum { 161 psReadyToParseStartLine = 0, 162 psReadyToParseHeaders, 163 psParsed, 164 psError 165 } HttpMsgParseState; 166 167 enum { 168 PCTILE_HTTP, 169 PCTILE_ICP_QUERY, 170 PCTILE_DNS, 171 PCTILE_HIT, 172 PCTILE_MISS, 173 PCTILE_NM, 174 PCTILE_NH, 175 PCTILE_ICP_REPLY 176 }; 177 178 enum { 179 SENT, 180 RECV 181 }; 182 183 /* 184 * These are field indicators for raw cache-cache netdb transfers 185 */ 186 enum { 187 NETDB_EX_NONE, 188 NETDB_EX_NETWORK, 189 NETDB_EX_RTT, 190 NETDB_EX_HOPS 191 }; 192 193 /* 194 * Return codes from checkVary(request) 195 */ 196 enum { 197 VARY_NONE, 198 VARY_MATCH, 199 VARY_OTHER, 200 VARY_CANCEL 201 }; 202 203 /* 204 * Store digest state enum 205 */ 206 typedef enum { 207 DIGEST_READ_NONE, 208 DIGEST_READ_REPLY, 209 DIGEST_READ_HEADERS, 210 DIGEST_READ_CBLOCK, 211 DIGEST_READ_MASK, 212 DIGEST_READ_DONE 213 } digest_read_state_t; 214 215 /* CygWin & Windows NT Port */ 216 #if _SQUID_WINDOWS_ 217 /* 218 * Supported Windows OS types codes 219 */ 220 enum { 221 _WIN_OS_UNKNOWN, 222 _WIN_OS_WIN32S, 223 _WIN_OS_WIN95, 224 _WIN_OS_WIN98, 225 _WIN_OS_WINME, 226 _WIN_OS_WINNT, 227 _WIN_OS_WIN2K, 228 _WIN_OS_WINXP, 229 _WIN_OS_WINNET, 230 _WIN_OS_WINLON, 231 _WIN_OS_WIN7 232 }; 233 #endif /* _SQUID_WINDOWS_ */ 234 235 enum { 236 DISABLE_PMTU_OFF, 237 DISABLE_PMTU_ALWAYS, 238 DISABLE_PMTU_TRANSPARENT 239 }; 240 241 #if USE_HTCP 242 /* 243 * TODO: This should be in htcp.h 244 */ 245 typedef enum { 246 HTCP_CLR_PURGE, 247 HTCP_CLR_INVALIDATION 248 } htcp_clr_reason; 249 #endif /* USE_HTCP */ 250 251 #endif /* SQUID_ENUMS_H */ 252 253