]> git.ipfire.org Git - thirdparty/squid.git/blob - src/security/NegotiationHistory.h
2bb4550dd29ac38bed87b3f9cd5f7fe3a05fbedc
[thirdparty/squid.git] / src / security / NegotiationHistory.h
1 /*
2 * Copyright (C) 1996-2022 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_SECURITY_NEGOTIATIONHISTORY_H
10 #define SQUID_SRC_SECURITY_NEGOTIATIONHISTORY_H
11
12 #include "anyp/ProtocolVersion.h"
13 #include "security/Handshake.h"
14 #include "security/Session.h"
15
16 namespace Security {
17
18 class NegotiationHistory
19 {
20 public:
21 NegotiationHistory();
22
23 /// Extract negotiation information from TLS object
24 void retrieveNegotiatedInfo(const Security::SessionPointer &);
25
26 /// Extract information from parser stored in TlsDetails object
27 void retrieveParsedInfo(Security::TlsDetails::Pointer const &details);
28
29 const char *cipherName() const; ///< The name of negotiated cipher
30 /// String representation of TLS negotiated version
31 const char *negotiatedVersion() const {return printTlsVersion(version_);}
32 /// String representation of the received TLS hello message version.
33 const char *helloVersion() const {return printTlsVersion(helloVersion_);}
34 /// String representation of the maximum supported TLS version
35 /// by remote peer
36 const char *supportedVersion() const {return printTlsVersion(supportedVersion_);}
37 private:
38 /// String representation of the TLS version 'v'
39 const char *printTlsVersion(AnyP::ProtocolVersion const &v) const;
40 AnyP::ProtocolVersion helloVersion_; ///< The TLS version of the hello message
41 AnyP::ProtocolVersion supportedVersion_; ///< The maximum supported TLS version
42 AnyP::ProtocolVersion version_; ///< The negotiated TLS version
43 #if USE_OPENSSL
44 const SSL_CIPHER *cipher; ///< The negotiated cipher
45 #endif
46 };
47
48 } // namespace Security
49
50 #endif /* SQUID_SRC_SECURITY_NEGOTIATIONHISTORY_H */
51