Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
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/. */
6 :
7 : #ifndef nsPK11TokenDB_h
8 : #define nsPK11TokenDB_h
9 :
10 : #include "nsCOMPtr.h"
11 : #include "nsIPK11Token.h"
12 : #include "nsIPK11TokenDB.h"
13 : #include "nsISupports.h"
14 : #include "nsNSSHelper.h"
15 : #include "nsNSSShutDown.h"
16 : #include "nsString.h"
17 : #include "pk11func.h"
18 : #include "ScopedNSSTypes.h"
19 :
20 : class nsPK11Token : public nsIPK11Token,
21 : public nsNSSShutDownObject
22 : {
23 : public:
24 : NS_DECL_ISUPPORTS
25 : NS_DECL_NSIPK11TOKEN
26 :
27 : explicit nsPK11Token(PK11SlotInfo *slot);
28 :
29 : protected:
30 : virtual ~nsPK11Token();
31 :
32 : private:
33 : friend class nsPK11TokenDB;
34 : nsresult refreshTokenInfo(const nsNSSShutDownPreventionLock& proofOfLock);
35 :
36 : nsCString mTokenName;
37 : nsCString mTokenLabel;
38 : nsCString mTokenManufacturerID;
39 : nsCString mTokenHWVersion;
40 : nsCString mTokenFWVersion;
41 : nsCString mTokenSerialNum;
42 : mozilla::UniquePK11SlotInfo mSlot;
43 : int mSeries;
44 : nsCOMPtr<nsIInterfaceRequestor> mUIContext;
45 : virtual void virtualDestroyNSSReference() override;
46 : void destructorSafeDestroyNSSReference();
47 : nsresult GetAttributeHelper(const nsACString& attribute,
48 : /*out*/ nsACString& xpcomOutParam);
49 : };
50 :
51 : class nsPK11TokenDB : public nsIPK11TokenDB
52 : , public nsNSSShutDownObject
53 : {
54 : public:
55 : NS_DECL_ISUPPORTS
56 : NS_DECL_NSIPK11TOKENDB
57 :
58 : nsPK11TokenDB();
59 :
60 : protected:
61 : virtual ~nsPK11TokenDB();
62 :
63 : // Nothing to release.
64 0 : virtual void virtualDestroyNSSReference() override {}
65 : };
66 :
67 : #define NS_PK11TOKENDB_CID \
68 : { 0xb084a2ce, 0x1dd1, 0x11b2, \
69 : { 0xbf, 0x10, 0x83, 0x24, 0xf8, 0xe0, 0x65, 0xcc }}
70 :
71 : #endif // nsPK11TokenDB_h
|