Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
5.3 KiB

  1. // HCardCtx.h -- Handle Card ConTeXt class declaration
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SLBCSP_HCARDCTX_H)
  8. #define SLBCSP_HCARDCTX_H
  9. #include <string>
  10. #include <memory>
  11. #include <stack>
  12. #include <TransactionWrap.h>
  13. #include <cciCard.h>
  14. #include "slbRCPtr.h"
  15. #include "Lockable.h"
  16. #include "Securable.h"
  17. #include "CachingObj.h"
  18. #include "CardCtxReg.h"
  19. #include "LoginId.h"
  20. #include "Secured.h"
  21. // Forward declaration required to satisfy HCardContext's declaration
  22. class CardContext;
  23. class HCardContext
  24. : public slbRefCnt::RCPtr<CardContext>
  25. {
  26. public:
  27. // Types
  28. // C'tors/D'tors
  29. HCardContext(CardContext *pcardctx = 0);
  30. explicit
  31. HCardContext(std::string const &rsReaderName);
  32. // Operators
  33. // Operations
  34. // Access
  35. // Predicates
  36. protected:
  37. // Types
  38. // C'tors/D'tors
  39. // Operators
  40. // Operations
  41. // Access
  42. // Predicates
  43. // Variables
  44. private:
  45. // Types
  46. // C'tors/D'tors
  47. // Operators
  48. // Operations
  49. // Access
  50. // Predicates
  51. // Variables
  52. };
  53. // Forward declarations required to break circular dependency of
  54. // LoginContext and LoginTask class declarations on HCardContext.
  55. class LoginContext;
  56. class LoginTask;
  57. // Maintains aspects of the card context that the CCI ignores.
  58. class CardContext
  59. : public slbRefCnt::RCObject,
  60. public Lockable,
  61. private Securable,
  62. private CachingObject,
  63. public CardContextRegistrar
  64. {
  65. public:
  66. // Types
  67. // Friends
  68. friend void
  69. Retained<HCardContext>::DoAcquire();
  70. friend void
  71. Secured<HCardContext>::DoAcquire();
  72. friend void
  73. Retained<HCardContext>::DoRelease();
  74. friend void
  75. Secured<HCardContext>::DoRelease();
  76. friend EnrolleeType
  77. CardContextRegistrar::Instance(KeyType const &rkey);
  78. // C'tors/D'tors
  79. // Operators
  80. // Operations
  81. void
  82. ClearLogin(LoginIdentity const &rlid);
  83. void
  84. Login(LoginIdentity const &rlid,
  85. LoginTask &rlt,
  86. bool fForceLogin = false);
  87. void
  88. Logout();
  89. // Access
  90. cci::CCard
  91. Card();
  92. // Predicates
  93. protected:
  94. // Types
  95. // C'tors/D'tors
  96. explicit
  97. CardContext(std::string const &rsReaderName);
  98. ~CardContext() throw();
  99. // Operators
  100. // Operations
  101. void
  102. DiscardHook();
  103. static EnrolleeType
  104. DoInstantiation(std::string const &rsReaderName);
  105. void
  106. EnrollHook();
  107. // Access
  108. // Predicates
  109. bool
  110. KeepEnrolled();
  111. // Variables
  112. private:
  113. // Types
  114. // C'tors/D'tors
  115. // Operators
  116. // Operations
  117. void
  118. Abandon();
  119. void
  120. ClearCache();
  121. void
  122. DeleteCache();
  123. void
  124. Relinquish();
  125. void
  126. Retain();
  127. void
  128. UpdateMarkers();
  129. void
  130. Secure();
  131. // Access
  132. // Predicates
  133. // Variables
  134. std::list<std::auto_ptr<Guarded<CardContext *> > > m_stkapGuards;
  135. std::auto_ptr<cci::CTransactionWrap> m_aptwCard;
  136. // count of active securers to the card. Declared LONG for
  137. // compatibility with Windows interlocking routines.
  138. LONG m_cSecurers;
  139. cci::CCard m_card;
  140. std::map<LoginIdentity, std::auto_ptr<LoginContext> > m_mloginctx;
  141. iop::CMarker m_mrkLastWrite;
  142. iop::CMarker m_mrkLastChvChange;
  143. };
  144. #endif // SLBCSP_HCARDCTX_H