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.

121 lines
3.0 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2000, Microsoft Corporation
  4. //
  5. // File: DfsFolderReferralData.hxx
  6. //
  7. // Contents: the DFS Folder Referral dataclass
  8. //
  9. // Classes: DfsFolderReferralData
  10. //
  11. // History: Dec. 8 2000, Author: udayh
  12. //
  13. //-----------------------------------------------------------------------------
  14. #ifndef __DFS_FOLDER_REFERRAL_DATA__
  15. #define __DFS_FOLDER_REFERRAL_DATA__
  16. #include "DfsReferralData.hxx"
  17. #include "DfsFolder.hxx"
  18. //+----------------------------------------------------------------------------
  19. //
  20. // Class: DfsFolderReferralData
  21. //
  22. // Synopsis: This class implements the DfsFolderReferralData class
  23. //
  24. //-----------------------------------------------------------------------------
  25. class DfsFolderReferralData: public DfsReferralData
  26. {
  27. private:
  28. DfsFolder *_pOwningFolder; // The folder to which this belongs.
  29. public:
  30. DfsFolderReferralData *pPrevLoaded, *pNextLoaded; // Loaded list.
  31. public:
  32. //
  33. // Function DfsFolderReferralData: Constructor for this class.
  34. // Creates the event on which other threads should wait while load is
  35. // in progress.
  36. //
  37. DfsFolderReferralData( DFSSTATUS *pStatus, DfsFolder *pCaller) :
  38. DfsReferralData( pStatus ,DFS_OBJECT_TYPE_FOLDER_REFERRAL_DATA )
  39. {
  40. pPrevLoaded = pNextLoaded = NULL;
  41. if (*pStatus == ERROR_SUCCESS)
  42. {
  43. _pOwningFolder = pCaller;
  44. _pOwningFolder->AcquireReference();
  45. }
  46. else {
  47. _pOwningFolder = NULL;
  48. }
  49. }
  50. //
  51. // Function ~DfsFolderReferralData: Destructor.
  52. // First we call UnloadReferralData to destroy the loaded referral
  53. // within this instance. We then release the parent folder.
  54. //
  55. ~DfsFolderReferralData()
  56. {
  57. if ( _pOwningFolder != NULL )
  58. {
  59. _pOwningFolder->UnloadReferralData( this );
  60. _pOwningFolder->ReleaseReference();
  61. _pOwningFolder = NULL;
  62. }
  63. }
  64. //
  65. // This referral data is attached to a folder. Detach it from the
  66. // folder so that the rest of the DFS structures can be freed up
  67. // while we cache only this referral information.
  68. //
  69. VOID
  70. DetachFromFolder()
  71. {
  72. if ( _pOwningFolder != NULL )
  73. {
  74. _pOwningFolder->RemoveReferralData(this, NULL);
  75. _pOwningFolder->ReleaseReference();
  76. _pOwningFolder = NULL;
  77. }
  78. }
  79. //
  80. // Function GetOwningFolder: Get the folder that owns this referral data.
  81. //
  82. DfsFolder *
  83. GetOwningFolder()
  84. {
  85. return _pOwningFolder;
  86. }
  87. VOID
  88. SetRootReferral()
  89. {
  90. _Flags |= DFS_ROOT_REFERRAL;
  91. }
  92. BOOLEAN
  93. IsRootReferral()
  94. {
  95. return ( (_Flags & DFS_ROOT_REFERRAL) == DFS_ROOT_REFERRAL );
  96. }
  97. };
  98. #endif // __DFS_FOLDER_REFERRAL_DATA__