]> 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 #if HAVE_OSTREAM
5 #include <ostream>
6 #endif
7
8 namespace AnyP {
9
10 /**
11 * List of all protocols known and supported.
12 * This is a combined list. It is used as type-codes where needed and
13 * the AnyP::ProtocolType_Str array of strings may be used for display
14 */
15 typedef enum {
16 PROTO_NONE = 0,
17 PROTO_HTTP,
18 PROTO_FTP,
19 PROTO_HTTPS,
20 PROTO_GOPHER,
21 PROTO_WAIS,
22 PROTO_CACHEOBJ,
23 PROTO_ICP,
24 #if USE_HTCP
25 PROTO_HTCP,
26 #endif
27 PROTO_URN,
28 PROTO_WHOIS,
29 PROTO_INTERNAL,
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 */