]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ssl/context_storage.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / ssl / context_storage.h
index 40bf1ddd8c63a387fca4d2541d9149f5579a25f6..4dd49968c410c8d03100b63bfd375820f970c60f 100644 (file)
@@ -1,23 +1,23 @@
 /*
- * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
-#ifndef SQUID_SSL_CONTEXT_STORAGE_H
-#define SQUID_SSL_CONTEXT_STORAGE_H
+#ifndef SQUID_SRC_SSL_CONTEXT_STORAGE_H
+#define SQUID_SRC_SSL_CONTEXT_STORAGE_H
 
 #if USE_OPENSSL
 
-#include "base/LruMap.h"
+#include "base/ClpMap.h"
 #include "CacheManager.h"
+#include "compat/openssl.h"
 #include "ip/Address.h"
 #include "mgr/Action.h"
 #include "mgr/Command.h"
-#include "security/forward.h"
-#include "SquidTime.h"
+#include "security/Context.h"
 #include "ssl/gadgets.h"
 
 #include <list>
@@ -26,9 +26,6 @@
 #include <openssl/ssl.h>
 #endif
 
-/// TODO: Replace on real size.
-#define SSL_CTX_SIZE 1024
-
 namespace  Ssl
 {
 
@@ -40,15 +37,18 @@ class CertificateStorageAction : public Mgr::Action
 public:
     CertificateStorageAction(const Mgr::Command::Pointer &cmd);
     static Pointer Create(const Mgr::Command::Pointer &cmd);
-    virtual void dump (StoreEntry *sentry);
+    void dump (StoreEntry *sentry) override;
     /**
      * We do not support aggregation of information across workers
      * TODO: aggregate these stats
      */
-    virtual bool aggregatable() const { return false; }
+    bool aggregatable() const override { return false; }
 };
 
-typedef LruMap<SBuf, Security::ContextPointer, SSL_CTX_SIZE> LocalContextStorage;
+inline uint64_t MemoryUsedByContext(const Security::ContextPointer &) {
+    return 1024; // TODO: Calculate approximate memory usage by the context.
+}
+using LocalContextStorage = ClpMap<SBuf, Security::ContextPointer, MemoryUsedByContext>;
 
 /// Class for storing/manipulating LocalContextStorage per local listening address/port.
 class GlobalContextStorage
@@ -78,5 +78,5 @@ extern GlobalContextStorage TheGlobalContextStorage;
 } //namespace Ssl
 #endif // USE_OPENSSL
 
-#endif // SQUID_SSL_CONTEXT_STORAGE_H
+#endif /* SQUID_SRC_SSL_CONTEXT_STORAGE_H */