123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef _DNS_DNSTLSSESSIONCACHE_H
- #define _DNS_DNSTLSSESSIONCACHE_H
- #include <deque>
- #include <mutex>
- #include <openssl/ssl.h>
- #include <android-base/thread_annotations.h>
- namespace android {
- namespace net {
- class DnsTlsSessionCache {
- public:
-
-
- void prepareSslContext(SSL_CTX* _Nonnull ssl_ctx);
- bool prepareSsl(SSL* _Nonnull ssl);
-
-
-
-
-
- bssl::UniquePtr<SSL_SESSION> getSession() EXCLUDES(mLock);
- private:
- static constexpr size_t kMaxSize = 5;
- static int newSessionCallback(SSL* _Nullable ssl, SSL_SESSION* _Nullable session);
- std::mutex mLock;
- void recordSession(SSL_SESSION* _Nullable session) EXCLUDES(mLock);
-
- std::deque<bssl::UniquePtr<SSL_SESSION>> mSessions GUARDED_BY(mLock);
- };
- }
- }
- #endif
|