1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsSmartCardMonitor.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +#ifndef _NSSMARTCARDMONITOR_ 1.8 +#define _NSSMARTCARDMONITOR_ 1.9 + 1.10 +#include "prthread.h" 1.11 +#include "secmod.h" 1.12 +#include "plhash.h" 1.13 +#include "pkcs11t.h" 1.14 + 1.15 +class SmartCardThreadEntry; 1.16 +class SmartCardMonitoringThread; 1.17 + 1.18 +// 1.19 +// manage a group of SmartCardMonitoringThreads 1.20 +// 1.21 +class SmartCardThreadList { 1.22 +public: 1.23 + SmartCardThreadList(); 1.24 + ~SmartCardThreadList(); 1.25 + void Remove(SECMODModule *module); 1.26 + nsresult Add(SmartCardMonitoringThread *thread); 1.27 +private: 1.28 + SmartCardThreadEntry *head; 1.29 +}; 1.30 + 1.31 +// 1.32 +// monitor a Module for token insertion and removal 1.33 +// 1.34 +// NOTE: this provides the application the ability to dynamically add slots 1.35 +// on the fly as necessary. 1.36 +// 1.37 +class SmartCardMonitoringThread 1.38 +{ 1.39 + public: 1.40 + SmartCardMonitoringThread(SECMODModule *module); 1.41 + ~SmartCardMonitoringThread(); 1.42 + 1.43 + nsresult Start(); 1.44 + void Stop(); 1.45 + 1.46 + void Execute(); 1.47 + void Interrupt(); 1.48 + 1.49 + const SECMODModule *GetModule(); 1.50 + 1.51 + private: 1.52 + 1.53 + static void LaunchExecute(void *arg); 1.54 + void SetTokenName(CK_SLOT_ID slotid, const char *tokenName, uint32_t series); 1.55 + const char *GetTokenName(CK_SLOT_ID slotid); 1.56 + uint32_t GetTokenSeries(CK_SLOT_ID slotid); 1.57 + nsresult SendEvent(const nsAString &type,const char *tokenName); 1.58 + 1.59 + 1.60 + SECMODModule *mModule; 1.61 + PLHashTable *mHash; 1.62 + PRThread* mThread; 1.63 +}; 1.64 + 1.65 +#endif