]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ssl/helper.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ssl / helper.h
1 /*
2 * Copyright (C) 1996-2017 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_SSL_HELPER_H
10 #define SQUID_SSL_HELPER_H
11
12 #if USE_OPENSSL
13
14 #include "base/AsyncJobCalls.h"
15 #include "base/LruMap.h"
16 #include "helper/forward.h"
17 #include "security/forward.h"
18 #include "ssl/cert_validate_message.h"
19 #include "ssl/crtd_message.h"
20
21 namespace Ssl
22 {
23 #if USE_SSL_CRTD
24 /**
25 * Set of thread for ssl_crtd. This class is singleton. Use this class only
26 * over GetIntance() static method. This class use helper structure
27 * for threads management.
28 */
29 class Helper
30 {
31 public:
32 static Helper * GetInstance(); ///< Instance class.
33 void Init(); ///< Init helper structure.
34 void Shutdown(); ///< Shutdown helper structure.
35 /// Submit crtd message to external crtd server.
36 void sslSubmit(CrtdMessage const & message, HLPCB * callback, void *data);
37 private:
38 Helper();
39 ~Helper();
40
41 helper * ssl_crtd; ///< helper for management of ssl_crtd.
42 };
43 #endif
44
45 class CertValidationRequest;
46 class CertValidationResponse;
47 class CertValidationHelper
48 {
49 public:
50 typedef UnaryMemFunT<Security::PeerConnector, CertValidationResponse::Pointer> CbDialer;
51
52 typedef void CVHCB(void *, Ssl::CertValidationResponse const &);
53 static CertValidationHelper * GetInstance(); ///< Instance class.
54 void Init(); ///< Init helper structure.
55 void Shutdown(); ///< Shutdown helper structure.
56 /// Submit crtd request message to external crtd server.
57 void sslSubmit(Ssl::CertValidationRequest const & request, AsyncCall::Pointer &);
58 private:
59 CertValidationHelper();
60 ~CertValidationHelper();
61
62 helper * ssl_crt_validator; ///< helper for management of ssl_crtd.
63 public:
64 typedef LruMap<Ssl::CertValidationResponse::Pointer, sizeof(Ssl::CertValidationResponse::Pointer) + sizeof(Ssl::CertValidationResponse)> LruCache;
65 static LruCache *HelperCache; ///< cache for cert validation helper
66 };
67
68 } //namespace Ssl
69
70 #endif /* USE_OPENSSL */
71 #endif // SQUID_SSL_HELPER_H
72