1 #ifndef SQUID_SSL_CONTEXT_STORAGE_H
2 #define SQUID_SSL_CONTEXT_STORAGE_H
6 #include "base/LruMap.h"
7 #include "CacheManager.h"
8 #include "ip/Address.h"
9 #include "mgr/Action.h"
10 #include "mgr/Command.h"
11 #include "SquidTime.h"
12 #include "ssl/gadgets.h"
19 #include <openssl/ssl.h>
21 /// TODO: Replace on real size.
22 #define SSL_CTX_SIZE 1024
27 /** Reports cached SSL certificate stats to Cache Manager.
28 * TODO: Use "Report" functions instead friend class.
30 class CertificateStorageAction
: public Mgr::Action
33 CertificateStorageAction(const Mgr::Command::Pointer
&cmd
);
34 static Pointer
Create(const Mgr::Command::Pointer
&cmd
);
35 virtual void dump (StoreEntry
*sentry
);
37 * We do not support aggregation of information across workers
38 * TODO: aggregate these stats
40 virtual bool aggregatable() const { return false; }
43 typedef LruMap
<SSL_CTX_Pointer
, SSL_CTX_SIZE
> LocalContextStorage
;
45 /// Class for storing/manipulating LocalContextStorage per local listening address/port.
46 class GlobalContextStorage
48 friend class CertificateStorageAction
;
50 GlobalContextStorage();
51 ~GlobalContextStorage();
52 /// Create new SSL context storage for the local listening address/port.
53 void addLocalStorage(Ip::Address
const & address
, size_t size_of_store
);
54 /// Return the local storage for the given listening address/port.
55 LocalContextStorage
& getLocalStorage(Ip::Address
const & address
);
56 /// When reconfigring should be called this method.
57 void reconfigureStart();
59 /// Called by getLocalStorage method
60 void reconfigureFinish();
61 bool reconfiguring
; ///< True if system reconfiguring now.
62 /// Storage used on configure or reconfigure.
63 std::map
<Ip::Address
, size_t> configureStorage
;
64 /// Map for storing all local ip address and their local storages.
65 std::map
<Ip::Address
, LocalContextStorage
*> storage
;
68 /// Global cache for store all SSL server certificates.
69 extern GlobalContextStorage TheGlobalContextStorage
;
73 #endif // SQUID_SSL_CONTEXT_STORAGE_H