1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef SharedSSLState_h
8 #define SharedSSLState_h
10 #include "nsNSSIOLayer.h"
17 class SharedSSLState
{
19 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedSSLState
)
20 explicit SharedSSLState(uint32_t aTlsFlags
= 0);
22 static void GlobalInit();
23 static void GlobalCleanup();
25 nsSSLIOLayerHelpers
& IOLayerHelpers() { return mIOLayerHelpers
; }
28 void ResetStoredData();
29 void NotePrivateBrowsingStatus();
30 void SetOCSPStaplingEnabled(bool staplingEnabled
) {
31 mOCSPStaplingEnabled
= staplingEnabled
;
33 void SetOCSPMustStapleEnabled(bool mustStapleEnabled
) {
34 mOCSPMustStapleEnabled
= mustStapleEnabled
;
36 void SetSignedCertTimestampsEnabled(bool signedCertTimestampsEnabled
) {
37 mSignedCertTimestampsEnabled
= signedCertTimestampsEnabled
;
40 // The following methods may be called from any thread
42 void NoteSocketCreated();
43 static void NoteCertOverrideServiceInstantiated();
44 bool IsOCSPStaplingEnabled() const { return mOCSPStaplingEnabled
; }
45 bool IsOCSPMustStapleEnabled() const { return mOCSPMustStapleEnabled
; }
46 bool IsSignedCertTimestampsEnabled() const {
47 return mSignedCertTimestampsEnabled
;
55 nsCOMPtr
<nsIObserver
> mObserver
;
56 nsSSLIOLayerHelpers mIOLayerHelpers
;
58 // True if any sockets have been created that use this shared data.
59 // Requires synchronization between the socket and main threads for
61 Mutex mMutex MOZ_UNANNOTATED
;
63 bool mOCSPStaplingEnabled
;
64 bool mOCSPMustStapleEnabled
;
65 bool mSignedCertTimestampsEnabled
;
68 SharedSSLState
* PublicSSLState();
69 SharedSSLState
* PrivateSSLState();
72 } // namespace mozilla