Leaked source code of windows server 2003
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.

201 lines
6.5 KiB

  1. // HAdptvCntr.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_HADPTVCNTR_H)
  8. #define SLBCSP_HADPTVCNTR_H
  9. #include <string>
  10. #include <stack>
  11. #include <cciCont.h>
  12. #include "slbRCPtr.h"
  13. #include "Securable.h"
  14. #include "CachingObj.h"
  15. #include "ACntrReg.h"
  16. #include "Secured.h"
  17. #include "Container.h"
  18. // Forward declaration necessary to satisfy HAdaptiveContainer's declaration
  19. class AdaptiveContainer;
  20. class HAdaptiveContainer
  21. : public slbRefCnt::RCPtr<AdaptiveContainer>
  22. {
  23. public:
  24. // Types
  25. // C'tors/D'tors
  26. HAdaptiveContainer(AdaptiveContainer *pacntr = 0);
  27. explicit
  28. HAdaptiveContainer(AdaptiveContainerKey const &rKey);
  29. // Operators
  30. // Operations
  31. // Access
  32. // Predicates
  33. protected:
  34. // Types
  35. // C'tors/D'tors
  36. // Operators
  37. // Operations
  38. // Access
  39. // Predicates
  40. // Variables
  41. private:
  42. // Types
  43. // C'tors/D'tors
  44. // Operators
  45. // Operations
  46. // Access
  47. // Predicates
  48. // Variables
  49. };
  50. // Adaptive Container is a reference counted wrapper to a CCI
  51. // Container providing several features the CCI ignores. The first is
  52. // adapting to the CCI container that currently represents the
  53. // physical container on the card. This is necessary in case the
  54. // cards state changed between transactions and card's contents
  55. // changed. If the container no longer exists, then an exception is
  56. // thrown; otherwise the Adaptive Container references the (refreshed)
  57. // CCI container reference.
  58. //
  59. // Second, one unique adaptive container is maintained for all threads since
  60. // the CCI does not reflect changes made to one CContainer in all
  61. // CContainer objects that refer to the same container.
  62. //
  63. // Third, an adaptive container cannot be created unless the container
  64. // it represents is exists on the card. When instantiating, the
  65. // container is created if it doesn't exist.
  66. //
  67. // An adaptive container provides a Securable interface to lock
  68. // transactions to the container (card) it represents.
  69. class AdaptiveContainer
  70. : public Lockable,
  71. private Securable,
  72. public AdaptiveContainerRegistrar,
  73. public Container
  74. {
  75. public:
  76. // Types
  77. // Friends
  78. friend void
  79. Retained<HAdaptiveContainer>::DoAcquire();
  80. friend void
  81. Secured<HAdaptiveContainer>::DoAcquire();
  82. friend void
  83. Retained<HAdaptiveContainer>::DoRelease();
  84. friend void
  85. Secured<HAdaptiveContainer>::DoRelease();
  86. friend EnrolleeType
  87. AdaptiveContainerRegistrar::Instance(KeyType const &rkey);
  88. // C'tors/D'tors
  89. // Operators
  90. // Operations
  91. void
  92. ClearCache();
  93. // Access
  94. cci::CContainer
  95. TheCContainer();
  96. HCardContext
  97. CardContext(bool Reconnect = true);
  98. static EnrolleeType
  99. Find(AdaptiveContainerKey const &rKey);
  100. std::string
  101. Name() const;
  102. void
  103. NullifyCard();
  104. // Predicates
  105. protected:
  106. // Types
  107. // C'tors/D'tors
  108. explicit
  109. AdaptiveContainer(AdaptiveContainerKey const &rKey);
  110. ~AdaptiveContainer();
  111. // Operators
  112. // Operations
  113. void
  114. ClearCardContext();
  115. void
  116. DiscardHook();
  117. static EnrolleeType
  118. DoInstantiation(AdaptiveContainerKey const &rKey);
  119. void
  120. EnrollHook();
  121. // Access
  122. // Predicates
  123. bool
  124. KeepEnrolled();
  125. void
  126. ReconnectOnError(scu::OsException const &rExc,
  127. Retained<HCardContext> &rhcardctx);
  128. // Variables
  129. private:
  130. // Types
  131. // C'tors/D'tors
  132. // Operators
  133. // Operations
  134. void
  135. Abandon();
  136. void
  137. Expire();
  138. void
  139. RefreshContainer();
  140. void
  141. Relinquish();
  142. void
  143. Retain();
  144. void
  145. Secure();
  146. // Access
  147. // Predicates
  148. // Variables
  149. // The card could be derived from the CCI container object but
  150. // since the CCI allows card objects to be reused, the card may
  151. // not be the container originally found. The CardContext class
  152. // tries to mitigate that problem by storing an HCardContext in a
  153. // container's context object.
  154. HAdaptiveContainerKey m_hacKey;
  155. bool m_fValidContext;
  156. std::list<Retained<HCardContext> > m_stkRetainedCardContexts;
  157. std::list<Secured<HCardContext> > m_stkSecuredCardContexts;
  158. };
  159. #endif // SLBCSP_HADPTVCNTR_H