2012-05-31 09:33:35 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2014-07-24 19:59:32 +00:00
|
|
|
|
|
|
|
#ifndef nsSmartCardMonitor_h
|
|
|
|
#define nsSmartCardMonitor_h
|
2005-06-02 01:14:02 +00:00
|
|
|
|
|
|
|
#include "prthread.h"
|
|
|
|
#include "secmod.h"
|
|
|
|
#include "plhash.h"
|
|
|
|
#include "pkcs11t.h"
|
|
|
|
|
|
|
|
class SmartCardThreadEntry;
|
|
|
|
class SmartCardMonitoringThread;
|
|
|
|
|
|
|
|
//
|
|
|
|
// manage a group of SmartCardMonitoringThreads
|
|
|
|
//
|
|
|
|
class SmartCardThreadList {
|
|
|
|
public:
|
|
|
|
SmartCardThreadList();
|
|
|
|
~SmartCardThreadList();
|
2014-07-24 19:59:32 +00:00
|
|
|
void Remove(SECMODModule* module);
|
|
|
|
nsresult Add(SmartCardMonitoringThread* thread);
|
|
|
|
|
2005-06-02 01:14:02 +00:00
|
|
|
private:
|
2014-07-24 19:59:32 +00:00
|
|
|
SmartCardThreadEntry* head;
|
2005-06-02 01:14:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// monitor a Module for token insertion and removal
|
|
|
|
//
|
|
|
|
// NOTE: this provides the application the ability to dynamically add slots
|
|
|
|
// on the fly as necessary.
|
|
|
|
//
|
|
|
|
class SmartCardMonitoringThread
|
|
|
|
{
|
|
|
|
public:
|
2014-08-31 23:26:27 +00:00
|
|
|
explicit SmartCardMonitoringThread(SECMODModule* module);
|
2005-06-02 01:14:02 +00:00
|
|
|
~SmartCardMonitoringThread();
|
|
|
|
|
|
|
|
nsresult Start();
|
|
|
|
void Stop();
|
|
|
|
|
|
|
|
void Execute();
|
|
|
|
void Interrupt();
|
|
|
|
|
2014-07-24 19:59:32 +00:00
|
|
|
const SECMODModule* GetModule();
|
2005-06-02 01:14:02 +00:00
|
|
|
|
|
|
|
private:
|
2014-07-24 19:59:32 +00:00
|
|
|
static void LaunchExecute(void* arg);
|
|
|
|
void SetTokenName(CK_SLOT_ID slotid, const char* tokenName, uint32_t series);
|
|
|
|
const char* GetTokenName(CK_SLOT_ID slotid);
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t GetTokenSeries(CK_SLOT_ID slotid);
|
2014-07-24 19:59:32 +00:00
|
|
|
void SendEvent(const nsAString& type, const char* tokenName);
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2014-07-24 19:59:32 +00:00
|
|
|
SECMODModule* mModule;
|
|
|
|
PLHashTable* mHash;
|
2005-06-02 01:14:02 +00:00
|
|
|
PRThread* mThread;
|
|
|
|
};
|
|
|
|
|
2014-07-24 19:59:32 +00:00
|
|
|
#endif // nsSmartCardMonitor_h
|