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 nsPKCS11Slot_h
8 : #define nsPKCS11Slot_h
9 :
10 : #include "ScopedNSSTypes.h"
11 : #include "nsIPKCS11Module.h"
12 : #include "nsIPKCS11ModuleDB.h"
13 : #include "nsIPKCS11Slot.h"
14 : #include "nsISupports.h"
15 : #include "nsNSSShutDown.h"
16 : #include "nsString.h"
17 : #include "pk11func.h"
18 :
19 : class nsPKCS11Slot : public nsIPKCS11Slot,
20 : public nsNSSShutDownObject
21 : {
22 : public:
23 : NS_DECL_ISUPPORTS
24 : NS_DECL_NSIPKCS11SLOT
25 :
26 : explicit nsPKCS11Slot(PK11SlotInfo* slot);
27 :
28 : protected:
29 : virtual ~nsPKCS11Slot();
30 :
31 : private:
32 : mozilla::UniquePK11SlotInfo mSlot;
33 : nsCString mSlotDesc;
34 : nsCString mSlotManufacturerID;
35 : nsCString mSlotHWVersion;
36 : nsCString mSlotFWVersion;
37 : int mSeries;
38 :
39 : virtual void virtualDestroyNSSReference() override;
40 : void destructorSafeDestroyNSSReference();
41 : nsresult refreshSlotInfo(const nsNSSShutDownPreventionLock& proofOfLock);
42 : nsresult GetAttributeHelper(const nsACString& attribute,
43 : /*out*/ nsACString& xpcomOutParam);
44 : };
45 :
46 : class nsPKCS11Module : public nsIPKCS11Module,
47 : public nsNSSShutDownObject
48 : {
49 : public:
50 : NS_DECL_ISUPPORTS
51 : NS_DECL_NSIPKCS11MODULE
52 :
53 : explicit nsPKCS11Module(SECMODModule* module);
54 :
55 : protected:
56 : virtual ~nsPKCS11Module();
57 :
58 : private:
59 : mozilla::UniqueSECMODModule mModule;
60 :
61 : virtual void virtualDestroyNSSReference() override;
62 : void destructorSafeDestroyNSSReference();
63 : };
64 :
65 : class nsPKCS11ModuleDB : public nsIPKCS11ModuleDB
66 : , public nsNSSShutDownObject
67 : {
68 : public:
69 : NS_DECL_ISUPPORTS
70 : NS_DECL_NSIPKCS11MODULEDB
71 :
72 : nsPKCS11ModuleDB();
73 :
74 : protected:
75 : virtual ~nsPKCS11ModuleDB();
76 :
77 : // Nothing to release.
78 0 : virtual void virtualDestroyNSSReference() override {}
79 : };
80 :
81 : #define NS_PKCS11MODULEDB_CID \
82 : { 0xff9fbcd7, 0x9517, 0x4334, \
83 : { 0xb9, 0x7a, 0xce, 0xed, 0x78, 0x90, 0x99, 0x74 }}
84 :
85 : #endif // nsPKCS11Slot_h
|