]> git.ipfire.org Git - thirdparty/squid.git/blob - src/security/BlindPeerConnector.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / security / BlindPeerConnector.h
1 /*
2 * Copyright (C) 1996-2023 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_BLINDPEERCONNECTOR_H
10 #define SQUID_SRC_SECURITY_BLINDPEERCONNECTOR_H
11
12 #include "security/PeerConnector.h"
13
14 class ErrorState;
15
16 namespace Security
17 {
18
19 /// A simple PeerConnector for SSL/TLS cache_peers. No SslBump capabilities.
20 class BlindPeerConnector: public Security::PeerConnector {
21 CBDATA_CHILD(BlindPeerConnector);
22 public:
23 BlindPeerConnector(HttpRequestPointer &aRequest,
24 const Comm::ConnectionPointer &aServerConn,
25 const AsyncCallback<EncryptorAnswer> &aCallback,
26 const AccessLogEntryPointer &alp,
27 const time_t timeout = 0) :
28 AsyncJob("Security::BlindPeerConnector"),
29 Security::PeerConnector(aServerConn, aCallback, alp, timeout)
30 {
31 request = aRequest;
32 }
33
34 /* Security::PeerConnector API */
35
36 /// Calls parent initialize(), configures the created TLS session object
37 /// to try and reuse a TLS session and sets the hostname to use for
38 /// certificate validation
39 /// \returns true on successful initialization
40 bool initialize(Security::SessionPointer &) override;
41
42 /// Return the configured TLS context object
43 Security::ContextPointer getTlsContext() override;
44
45 /// On success, stores the used TLS session for later use.
46 /// On error, informs the peer.
47 void noteNegotiationDone(ErrorState *) override;
48 };
49
50 } // namespace Security
51
52 #endif /* SQUID_SRC_SECURITY_BLINDPEERCONNECTOR_H */
53