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