]> git.ipfire.org Git - thirdparty/squid.git/blob - src/anyp/ProtocolType.h
Merged from parent (trunk 11270, circa 3.2.0.5+)
[thirdparty/squid.git] / src / anyp / ProtocolType.h
1 #ifndef _SQUID_SRC_ANYP_PROTOCOLTYPE_H
2 #define _SQUID_SRC_ANYP_PROTOCOLTYPE_H
3
4 #if HAVE_OSTREAM
5 #include <ostream>
6 #endif
7
8 namespace AnyP
9 {
10
11 /**
12 * List of all protocols known and supported.
13 * This is a combined list. It is used as type-codes where needed and
14 * the AnyP::ProtocolType_Str array of strings may be used for display
15 */
16 typedef enum {
17 PROTO_NONE = 0,
18 PROTO_HTTP,
19 PROTO_FTP,
20 PROTO_HTTPS,
21 PROTO_GOPHER,
22 PROTO_WAIS,
23 PROTO_CACHE_OBJECT,
24 PROTO_ICP,
25 #if USE_HTCP
26 PROTO_HTCP,
27 #endif
28 PROTO_URN,
29 PROTO_WHOIS,
30 PROTO_INTERNAL,
31 PROTO_ICY,
32 PROTO_UNKNOWN,
33 PROTO_MAX
34 } ProtocolType;
35
36 extern const char *ProtocolType_str[];
37
38 /** Display the registered Protocol Type (in upper case).
39 * If the protocol is not a registered AnyP::ProtocolType nothing will be displayed.
40 * The caller is responsible for any alternative text.
41 */
42 inline std::ostream &
43 operator <<(std::ostream &os, ProtocolType const &p)
44 {
45 if (PROTO_NONE <= p && p < PROTO_MAX)
46 os << ProtocolType_str[p];
47 else
48 os << static_cast<int>(p);
49 return os;
50 }
51
52 } // namespace AnyP
53
54 #endif /* _SQUID_SRC_ANYP_PROTOCOLTYPE_H */