]> git.ipfire.org Git - thirdparty/squid.git/blob - src/anyp/ProtocolType.h
Cleanup: un-wrap C++ header includes
[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_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 */