security/manager/ssl/src/SharedSSLState.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef SharedSSLState_h
michael@0 8 #define SharedSSLState_h
michael@0 9
michael@0 10 #include "mozilla/RefPtr.h"
michael@0 11 #include "nsNSSIOLayer.h"
michael@0 12
michael@0 13 class nsClientAuthRememberService;
michael@0 14 class nsIObserver;
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace psm {
michael@0 18
michael@0 19 class SharedSSLState {
michael@0 20 public:
michael@0 21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedSSLState)
michael@0 22 SharedSSLState();
michael@0 23 ~SharedSSLState();
michael@0 24
michael@0 25 static void GlobalInit();
michael@0 26 static void GlobalCleanup();
michael@0 27
michael@0 28 nsClientAuthRememberService* GetClientAuthRememberService() {
michael@0 29 return mClientAuthRemember;
michael@0 30 }
michael@0 31
michael@0 32 nsSSLIOLayerHelpers& IOLayerHelpers() {
michael@0 33 return mIOLayerHelpers;
michael@0 34 }
michael@0 35
michael@0 36 // Main-thread only
michael@0 37 void ResetStoredData();
michael@0 38 void NotePrivateBrowsingStatus();
michael@0 39 void SetOCSPStaplingEnabled(bool staplingEnabled)
michael@0 40 {
michael@0 41 mOCSPStaplingEnabled = staplingEnabled;
michael@0 42 }
michael@0 43
michael@0 44 // The following methods may be called from any thread
michael@0 45 bool SocketCreated();
michael@0 46 void NoteSocketCreated();
michael@0 47 static void NoteCertOverrideServiceInstantiated();
michael@0 48 static void NoteCertDBServiceInstantiated();
michael@0 49 bool IsOCSPStaplingEnabled() const { return mOCSPStaplingEnabled; }
michael@0 50
michael@0 51 private:
michael@0 52 void Cleanup();
michael@0 53
michael@0 54 nsCOMPtr<nsIObserver> mObserver;
michael@0 55 RefPtr<nsClientAuthRememberService> mClientAuthRemember;
michael@0 56 nsSSLIOLayerHelpers mIOLayerHelpers;
michael@0 57
michael@0 58 // True if any sockets have been created that use this shared data.
michael@0 59 // Requires synchronization between the socket and main threads for
michael@0 60 // reading/writing.
michael@0 61 Mutex mMutex;
michael@0 62 bool mSocketCreated;
michael@0 63 bool mOCSPStaplingEnabled;
michael@0 64 };
michael@0 65
michael@0 66 SharedSSLState* PublicSSLState();
michael@0 67 SharedSSLState* PrivateSSLState();
michael@0 68
michael@0 69 } // namespace psm
michael@0 70 } // namespace mozilla
michael@0 71
michael@0 72 #endif

mercurial