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.

     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 "mozilla/RefPtr.h"
    11 #include "nsNSSIOLayer.h"
    13 class nsClientAuthRememberService;
    14 class nsIObserver;
    16 namespace mozilla {
    17 namespace psm {
    19 class SharedSSLState {
    20 public:
    21   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedSSLState)
    22   SharedSSLState();
    23   ~SharedSSLState();
    25   static void GlobalInit();
    26   static void GlobalCleanup();
    28   nsClientAuthRememberService* GetClientAuthRememberService() {
    29     return mClientAuthRemember;
    30   }
    32   nsSSLIOLayerHelpers& IOLayerHelpers() {
    33     return mIOLayerHelpers;
    34   }
    36   // Main-thread only
    37   void ResetStoredData();
    38   void NotePrivateBrowsingStatus();
    39   void SetOCSPStaplingEnabled(bool staplingEnabled)
    40   {
    41     mOCSPStaplingEnabled = staplingEnabled;
    42   }
    44   // The following methods may be called from any thread
    45   bool SocketCreated();
    46   void NoteSocketCreated();
    47   static void NoteCertOverrideServiceInstantiated();
    48   static void NoteCertDBServiceInstantiated();
    49   bool IsOCSPStaplingEnabled() const { return mOCSPStaplingEnabled; }
    51 private:
    52   void Cleanup();
    54   nsCOMPtr<nsIObserver> mObserver;
    55   RefPtr<nsClientAuthRememberService> mClientAuthRemember;
    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
    60   // reading/writing.
    61   Mutex mMutex;
    62   bool mSocketCreated;
    63   bool mOCSPStaplingEnabled;
    64 };
    66 SharedSSLState* PublicSSLState();
    67 SharedSSLState* PrivateSSLState();
    69 } // namespace psm
    70 } // namespace mozilla
    72 #endif

mercurial