]> git.ipfire.org Git - thirdparty/squid.git/blame - src/anyp/ProtocolType.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / anyp / ProtocolType.h
CommitLineData
bbc27441 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
bbc27441
AJ
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
0c3d3f65
AJ
9#ifndef _SQUID_SRC_ANYP_PROTOCOLTYPE_H
10#define _SQUID_SRC_ANYP_PROTOCOLTYPE_H
11
0c3d3f65 12#include <ostream>
0c3d3f65 13
10c40d99
A
14namespace AnyP
15{
0c3d3f65 16
6c880a16 17// TODO order by current protocol popularity (eg HTTPS before FTP)
0c3d3f65
AJ
18/**
19 * List of all protocols known and supported.
20 * This is a combined list. It is used as type-codes where needed and
21 * the AnyP::ProtocolType_Str array of strings may be used for display
22 */
23typedef enum {
24 PROTO_NONE = 0,
25 PROTO_HTTP,
26 PROTO_FTP,
27 PROTO_HTTPS,
330f829e
AJ
28 PROTO_COAP,
29 PROTO_COAPS,
0c3d3f65
AJ
30 PROTO_GOPHER,
31 PROTO_WAIS,
39a19cb7 32 PROTO_CACHE_OBJECT,
0c3d3f65
AJ
33 PROTO_ICP,
34#if USE_HTCP
35 PROTO_HTCP,
36#endif
37 PROTO_URN,
38 PROTO_WHOIS,
0c3d3f65 39 PROTO_ICY,
67c99fc6 40 PROTO_TLS,
d9219c2b 41 PROTO_SSL,
6b2b6cfe 42 PROTO_AUTHORITY_FORM,
0c3d3f65
AJ
43 PROTO_UNKNOWN,
44 PROTO_MAX
45} ProtocolType;
46
47extern const char *ProtocolType_str[];
48
49/** Display the registered Protocol Type (in upper case).
50 * If the protocol is not a registered AnyP::ProtocolType nothing will be displayed.
51 * The caller is responsible for any alternative text.
52 */
53inline std::ostream &
54operator <<(std::ostream &os, ProtocolType const &p)
55{
56 if (PROTO_NONE <= p && p < PROTO_MAX)
57 os << ProtocolType_str[p];
58 else
59 os << static_cast<int>(p);
60 return os;
61}
62
63} // namespace AnyP
64
65#endif /* _SQUID_SRC_ANYP_PROTOCOLTYPE_H */
f53969cc 66