Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 #ifndef _NSSMARTCARDMONITOR_
5 #define _NSSMARTCARDMONITOR_
7 #include "prthread.h"
8 #include "secmod.h"
9 #include "plhash.h"
10 #include "pkcs11t.h"
12 class SmartCardThreadEntry;
13 class SmartCardMonitoringThread;
15 //
16 // manage a group of SmartCardMonitoringThreads
17 //
18 class SmartCardThreadList {
19 public:
20 SmartCardThreadList();
21 ~SmartCardThreadList();
22 void Remove(SECMODModule *module);
23 nsresult Add(SmartCardMonitoringThread *thread);
24 private:
25 SmartCardThreadEntry *head;
26 };
28 //
29 // monitor a Module for token insertion and removal
30 //
31 // NOTE: this provides the application the ability to dynamically add slots
32 // on the fly as necessary.
33 //
34 class SmartCardMonitoringThread
35 {
36 public:
37 SmartCardMonitoringThread(SECMODModule *module);
38 ~SmartCardMonitoringThread();
40 nsresult Start();
41 void Stop();
43 void Execute();
44 void Interrupt();
46 const SECMODModule *GetModule();
48 private:
50 static void LaunchExecute(void *arg);
51 void SetTokenName(CK_SLOT_ID slotid, const char *tokenName, uint32_t series);
52 const char *GetTokenName(CK_SLOT_ID slotid);
53 uint32_t GetTokenSeries(CK_SLOT_ID slotid);
54 nsresult SendEvent(const nsAString &type,const char *tokenName);
57 SECMODModule *mModule;
58 PLHashTable *mHash;
59 PRThread* mThread;
60 };
62 #endif