1 /*
2  * Copyright (C) 1996-2021 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_SECURITY_ENCRYPTORANSWER_H
10 #define SQUID_SECURITY_ENCRYPTORANSWER_H
11 
12 #include "base/CbcPointer.h"
13 #include "comm/forward.h"
14 
15 class ErrorState;
16 
17 namespace Security {
18 
19 /// Peer encrypted connection setup results (supplied via a callback).
20 /// The connection to peer was secured if and only if the error member is nil.
21 class EncryptorAnswer
22 {
23 public:
EncryptorAnswer()24     EncryptorAnswer(): tunneled(false) {}
25     ~EncryptorAnswer(); ///< deletes error if it is still set
26     Comm::ConnectionPointer conn; ///< peer connection (secured on success)
27 
28     /// answer recepients must clear the error member in order to keep its info
29     /// XXX: We should refcount ErrorState instead of cbdata-protecting it.
30     CbcPointer<ErrorState> error; ///< problem details (nil on success)
31 
32     /// whether we spliced the connections instead of negotiating encryption
33     bool tunneled;
34 };
35 
36 std::ostream &operator <<(std::ostream &, const Security::EncryptorAnswer &);
37 
38 } // namepace Security
39 
40 #endif /* SQUID_SECURITY_ENCRYPTORANSWER_H */
41 
42