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.

176 lines
3.3 KiB

  1. /*++
  2. Microsoft Windows NT RPC Name Service
  3. Copyright (C) Microsoft Corporation, 1995 - 1999
  4. Module Name:
  5. master.hxx
  6. Abstract:
  7. This header file defines two classes of master handles which are used to
  8. access information from a master locator. The information so obtained is
  9. cached in special cache entries in the local database.
  10. Author:
  11. Satish Thatte (SatishT) 10/21/95 Created all the code below except where
  12. otherwise indicated.
  13. --*/
  14. #ifndef _MASTER_
  15. #define _MASTER_
  16. #include <lmcons.h>
  17. #undef PASCAL
  18. #undef FAR
  19. /*++
  20. Class Definition:
  21. CMasterLookupHandle
  22. Abstract:
  23. This is the NS handle class for binding handle lookup from a master locator.
  24. --*/
  25. class CMasterLookupHandle : public CRemoteLookupHandle {
  26. /* binding handle for master locator */
  27. RPC_BINDING_HANDLE hCurrentMaster;
  28. /* lookup context handle for master locator */
  29. NSI_NS_HANDLE_T lookupHandle;
  30. BOOL fFinished;
  31. /* private prefetching function -- only calls CLIENT_I_nsi_lookup_next
  32. once, even if it doesn't get anything new. Result tells you whether
  33. anything was returned by CLIENT_I_nsi_lookup_next, not whether anything
  34. new was found.
  35. */
  36. BOOL fetchNext();
  37. void refresh() {
  38. /* refresh the supply in plhFetched if necessary, and update the
  39. fFinished flag accordingly */
  40. while ((!plhFetched || plhFetched->finished()) && !fFinished)
  41. fFinished = !fetchNext();
  42. }
  43. virtual void initialize();
  44. virtual void rundown();
  45. #if DBG
  46. static ULONG ulMasterLookupHandleCount;
  47. static ULONG ulMasterLookupHandleNo;
  48. ULONG ulHandleNo;
  49. #endif
  50. public:
  51. CMasterLookupHandle(
  52. UNSIGNED32 EntryNameSyntax,
  53. STRING_T EntryName,
  54. CGUIDVersion * pGVInterface,
  55. CGUIDVersion * pGVTransferSyntax,
  56. CGUID * pIDobject,
  57. unsigned long ulVectorSize,
  58. unsigned long ulCacheAge
  59. ) :
  60. CRemoteLookupHandle(
  61. EntryNameSyntax,
  62. EntryName,
  63. pGVInterface,
  64. pGVTransferSyntax,
  65. pIDobject,
  66. ulVectorSize,
  67. ulCacheAge
  68. )
  69. {
  70. hCurrentMaster = NULL;
  71. #if DBG
  72. ulMasterLookupHandleCount++;
  73. ulHandleNo = ++ulMasterLookupHandleNo;
  74. #endif
  75. }
  76. ~CMasterLookupHandle()
  77. {
  78. #if DBG
  79. ulMasterLookupHandleCount--;
  80. #endif
  81. }
  82. NSI_BINDING_VECTOR_T *next() {
  83. DBGOUT(TRACE,"CMasterLookupHandle::next called for Handle#" << ulHandleNo << "\n\n");
  84. if (StatusCode != RPC_S_OK) Raise(StatusCode);
  85. if (fNotInitialized) initialize();
  86. refresh();
  87. if (!fFinished)
  88. return plhFetched->next();
  89. else return NULL;
  90. }
  91. int finished() {
  92. DBGOUT(TRACE,"CMasterLookupHandle::finished called for Handle#" << ulHandleNo << "\n\n");
  93. if (StatusCode != RPC_S_OK) return TRUE;
  94. if (fNotInitialized) initialize();
  95. refresh();
  96. return fFinished;
  97. }
  98. };
  99. /*++
  100. Class Definition:
  101. CMasterObjectInqHandle
  102. Abstract:
  103. This is the NS handle class for object inquiry from a master locator.
  104. --*/
  105. class CMasterObjectInqHandle : public CRemoteObjectInqHandle {
  106. void initialize();
  107. public:
  108. CMasterObjectInqHandle(
  109. STRING_T EntryName,
  110. ULONG ulCachAge // ignored for now because Master doesn't
  111. ); // tell us the age of the info returned
  112. };
  113. #endif // _MASTER_