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.

151 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. csets.hxx
  5. Abstract:
  6. CClientSet objects represent sets of OIDs which are referenced by
  7. one or more local client processes.
  8. Author:
  9. Mario Goertzel [MarioGo]
  10. Revision History:
  11. MarioGo 04-08-95 Bits 'n pieces
  12. MarioGo 12-28-95 Locally unique ids
  13. --*/
  14. #ifndef __CSET_HXX
  15. #define __CSET_HXX
  16. class CClientSet : public CId2TableElement
  17. /*++
  18. Class Description:
  19. Represents a set of OIDs in use by a local user on a remote
  20. (or local) machine. Instances are indexed by machine ID
  21. and the a pointer to the users CToken objec.
  22. Memebers:
  23. _setid - A uuid allocated by the server during the first
  24. update ping. Uniqueness is not required by the client.
  25. _lastping - Time of last successful ping.
  26. _sequence - The sequence number of the last successful ping.
  27. // _factor - Power of two multiplier for ping period. Not implemented.
  28. _fChange - The set of OIDs has changed since the last update ping.
  29. _hServer - current saved binding handle to the server.
  30. _pMid - Pointer to the CMid instance for this user. We own a reference.
  31. _blistOids - A CBList instance containing pointers to all the OIDs
  32. owned by this set. The set holds a reference on each.
  33. _plist - CPListElement instance used by the worker thread to maintain
  34. sets in time sorted order.
  35. --*/
  36. {
  37. private:
  38. SETID _setid;
  39. CTime _lastping;
  40. CMid *_pMid;
  41. RPC_BINDING_HANDLE _hServer;
  42. USHORT _iBinding;
  43. USHORT _sequence;
  44. USHORT _cFailedPings;
  45. USHORT _fChange:1;
  46. USHORT _fSecure:1;
  47. CBList _blistOids;
  48. CPListElement _plist;
  49. public:
  50. CClientSet(
  51. IN CMid *pMid,
  52. IN CToken *pToken
  53. ) :
  54. CId2TableElement(pMid->Id(), (ID)pToken),
  55. _blistOids(16),
  56. _sequence(0),
  57. _cFailedPings(0),
  58. _setid(0),
  59. _hServer(0),
  60. _fChange(TRUE),
  61. _fSecure(TRUE)
  62. {
  63. // Client lock held shared.
  64. pToken->AddRef();
  65. _pMid = pMid;
  66. _pMid->Reference();
  67. }
  68. CClientSet::~CClientSet()
  69. {
  70. ASSERT(gpClientLock->HeldExclusive());
  71. ASSERT(_blistOids.Size() == 0);
  72. // REVIEW: make sure the linker throws out all copies of this except
  73. // the inline versions. Otherwise, make this out-of-line and rethink
  74. // other inline d'tors.
  75. _pMid->Release();
  76. CToken *pToken = (CToken *)Id2();
  77. pToken->Release();
  78. gpClientSetTable->Remove(this);
  79. // Possible to get here w/o freeing the binding?
  80. if (_hServer)
  81. RpcBindingFree(&_hServer);
  82. }
  83. ORSTATUS RegisterObject(CClientOid *);
  84. void ObjectUpdate(CClientOid *pOid)
  85. {
  86. ASSERT(gpClientLock->HeldExclusive());
  87. _fChange = TRUE;
  88. }
  89. ORSTATUS PingServer();
  90. void NextPing(CTime &ctimePing)
  91. {
  92. ctimePing = _lastping;
  93. ctimePing += BasePingInterval;
  94. }
  95. static CClientSet *ContainingRecord(CListElement *ple) {
  96. return CONTAINING_RECORD(ple, CClientSet, _plist);
  97. }
  98. void Insert() {
  99. gpClientSetPList->Insert(&_plist);
  100. }
  101. CPListElement * Remove() {
  102. return(gpClientSetPList->Remove(&_plist));
  103. }
  104. };
  105. #endif // __CSET_HXX