security/manager/ssl/src/nsSmartCardMonitor.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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

mercurial