/*
- * 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>
#include <openssl/ssl.h>
#endif
-/// TODO: Replace on real size.
-#define SSL_CTX_SIZE 1024
-
namespace Ssl
{
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
} //namespace Ssl
#endif // USE_OPENSSL
-#endif // SQUID_SSL_CONTEXT_STORAGE_H
+#endif /* SQUID_SRC_SSL_CONTEXT_STORAGE_H */