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