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_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. 26 * This class use helper structure for threads management. 27 */ 28 class Helper 29 { 30 public: 31 static void Init(); ///< Init helper structure. 32 static void Shutdown(); ///< Shutdown helper structure. 33 static void Reconfigure(); ///< Reconfigure helper structure. 34 /// Submit crtd message to external crtd server. 35 static void Submit(CrtdMessage const & message, HLPCB * callback, void *data); 36 private: 37 static helper * ssl_crtd; ///< helper for management of ssl_crtd. 38 }; 39 #endif 40 41 class CertValidationRequest; 42 class CertValidationResponse; 43 class CertValidationHelper 44 { 45 public: 46 typedef UnaryMemFunT<Security::PeerConnector, CertValidationResponse::Pointer> CbDialer; 47 48 typedef void CVHCB(void *, Ssl::CertValidationResponse const &); 49 static void Init(); ///< Init helper structure. 50 static void Shutdown(); ///< Shutdown helper structure. 51 static void Reconfigure(); ///< Reconfigure helper structure 52 /// Submit crtd request message to external crtd server. 53 static void Submit(Ssl::CertValidationRequest const & request, AsyncCall::Pointer &); 54 private: 55 static helper * ssl_crt_validator; ///< helper for management of ssl_crtd. 56 public: 57 typedef LruMap<SBuf, Ssl::CertValidationResponse::Pointer, sizeof(Ssl::CertValidationResponse::Pointer) + sizeof(Ssl::CertValidationResponse)> LruCache; 58 static LruCache *HelperCache; ///< cache for cert validation helper 59 }; 60 61 } //namespace Ssl 62 63 #endif /* USE_OPENSSL */ 64 #endif // SQUID_SSL_HELPER_H 65 66