Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | #ifndef _NSSMARTCARDMONITOR_ |
michael@0 | 5 | #define _NSSMARTCARDMONITOR_ |
michael@0 | 6 | |
michael@0 | 7 | #include "prthread.h" |
michael@0 | 8 | #include "secmod.h" |
michael@0 | 9 | #include "plhash.h" |
michael@0 | 10 | #include "pkcs11t.h" |
michael@0 | 11 | |
michael@0 | 12 | class SmartCardThreadEntry; |
michael@0 | 13 | class SmartCardMonitoringThread; |
michael@0 | 14 | |
michael@0 | 15 | // |
michael@0 | 16 | // manage a group of SmartCardMonitoringThreads |
michael@0 | 17 | // |
michael@0 | 18 | class SmartCardThreadList { |
michael@0 | 19 | public: |
michael@0 | 20 | SmartCardThreadList(); |
michael@0 | 21 | ~SmartCardThreadList(); |
michael@0 | 22 | void Remove(SECMODModule *module); |
michael@0 | 23 | nsresult Add(SmartCardMonitoringThread *thread); |
michael@0 | 24 | private: |
michael@0 | 25 | SmartCardThreadEntry *head; |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | // |
michael@0 | 29 | // monitor a Module for token insertion and removal |
michael@0 | 30 | // |
michael@0 | 31 | // NOTE: this provides the application the ability to dynamically add slots |
michael@0 | 32 | // on the fly as necessary. |
michael@0 | 33 | // |
michael@0 | 34 | class SmartCardMonitoringThread |
michael@0 | 35 | { |
michael@0 | 36 | public: |
michael@0 | 37 | SmartCardMonitoringThread(SECMODModule *module); |
michael@0 | 38 | ~SmartCardMonitoringThread(); |
michael@0 | 39 | |
michael@0 | 40 | nsresult Start(); |
michael@0 | 41 | void Stop(); |
michael@0 | 42 | |
michael@0 | 43 | void Execute(); |
michael@0 | 44 | void Interrupt(); |
michael@0 | 45 | |
michael@0 | 46 | const SECMODModule *GetModule(); |
michael@0 | 47 | |
michael@0 | 48 | private: |
michael@0 | 49 | |
michael@0 | 50 | static void LaunchExecute(void *arg); |
michael@0 | 51 | void SetTokenName(CK_SLOT_ID slotid, const char *tokenName, uint32_t series); |
michael@0 | 52 | const char *GetTokenName(CK_SLOT_ID slotid); |
michael@0 | 53 | uint32_t GetTokenSeries(CK_SLOT_ID slotid); |
michael@0 | 54 | nsresult SendEvent(const nsAString &type,const char *tokenName); |
michael@0 | 55 | |
michael@0 | 56 | |
michael@0 | 57 | SECMODModule *mModule; |
michael@0 | 58 | PLHashTable *mHash; |
michael@0 | 59 | PRThread* mThread; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | #endif |