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.

190 lines
4.4 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: NTOp.h
  6. * Content: NameTable Operation Object Header File
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 09/23/00 mjn Created
  12. * 03/30/01 mjn Changes to prevent multiple loading/unloading of SP's
  13. * mjn Added m_pSP, SetSP(), GetSP()
  14. *@@END_MSINTERNAL
  15. *
  16. ***************************************************************************/
  17. #ifndef __NT_OP_H__
  18. #define __NT_OP_H__
  19. #include "ServProv.h"
  20. //**********************************************************************
  21. // Constant definitions
  22. //**********************************************************************
  23. #define NAMETABLE_OP_FLAG_IN_USE 0x0001
  24. //**********************************************************************
  25. // Macro definitions
  26. //**********************************************************************
  27. //**********************************************************************
  28. // Structure definitions
  29. //**********************************************************************
  30. class CFixedPool;
  31. class CRefCountBuffer;
  32. class CServiceProvider;
  33. typedef struct _DIRECTNETOBJECT DIRECTNETOBJECT;
  34. //**********************************************************************
  35. // Variable definitions
  36. //**********************************************************************
  37. extern CFixedPool g_NameTableOpPool;
  38. //**********************************************************************
  39. // Function prototypes
  40. //**********************************************************************
  41. //**********************************************************************
  42. // Class prototypes
  43. //**********************************************************************
  44. // class for NameTable Operations
  45. class CNameTableOp
  46. {
  47. public:
  48. #undef DPF_MODNAME
  49. #define DPF_MODNAME "CNameTableOp::FPMAlloc"
  50. static BOOL FPMAlloc( void* pvItem, void* pvContext )
  51. {
  52. CNameTableOp* pNTOp = (CNameTableOp*)pvItem;
  53. pNTOp->m_Sig[0] = 'N';
  54. pNTOp->m_Sig[1] = 'T';
  55. pNTOp->m_Sig[2] = 'O';
  56. pNTOp->m_Sig[3] = 'P';
  57. pNTOp->m_bilinkNameTableOps.Initialize();
  58. return(TRUE);
  59. };
  60. #undef DPF_MODNAME
  61. #define DPF_MODNAME "CNameTableOp::FPMInitialize"
  62. static void FPMInitialize( void* pvItem, void* pvContext )
  63. {
  64. CNameTableOp* pNTOp = (CNameTableOp*)pvItem;
  65. pNTOp->m_pdnObject = static_cast<DIRECTNETOBJECT*>(pvContext);
  66. pNTOp->m_dwFlags = 0;
  67. pNTOp->m_dwMsgId = 0;
  68. pNTOp->m_dwVersion = 0;
  69. pNTOp->m_dwVersionNotUsed = 0;
  70. pNTOp->m_pRefCountBuffer = NULL;
  71. pNTOp->m_pSP = NULL;
  72. DNASSERT(pNTOp->m_bilinkNameTableOps.IsEmpty());
  73. };
  74. #undef DPF_MODNAME
  75. #define DPF_MODNAME "CNameTableOp::FPMRelease"
  76. static void FPMRelease( void* pvItem )
  77. {
  78. const CNameTableOp* pNTOp = (CNameTableOp*)pvItem;
  79. DNASSERT(pNTOp->m_bilinkNameTableOps.IsEmpty());
  80. };
  81. void ReturnSelfToPool( void )
  82. {
  83. g_NameTableOpPool.Release( this );
  84. };
  85. void SetInUse( void )
  86. {
  87. m_dwFlags |= NAMETABLE_OP_FLAG_IN_USE;
  88. };
  89. BOOL IsInUse( void ) const
  90. {
  91. if (m_dwFlags & NAMETABLE_OP_FLAG_IN_USE)
  92. {
  93. return( TRUE );
  94. }
  95. return( FALSE );
  96. };
  97. void SetMsgId( const DWORD dwMsgId )
  98. {
  99. m_dwMsgId = dwMsgId;
  100. };
  101. DWORD GetMsgId( void ) const
  102. {
  103. return( m_dwMsgId );
  104. };
  105. void SetVersion( const DWORD dwVersion )
  106. {
  107. m_dwVersion = dwVersion;
  108. };
  109. DWORD GetVersion( void ) const
  110. {
  111. return( m_dwVersion );
  112. };
  113. void SetRefCountBuffer( CRefCountBuffer *const pRefCountBuffer )
  114. {
  115. if (pRefCountBuffer)
  116. {
  117. pRefCountBuffer->AddRef();
  118. }
  119. m_pRefCountBuffer = pRefCountBuffer;
  120. };
  121. CRefCountBuffer *GetRefCountBuffer( void )
  122. {
  123. return( m_pRefCountBuffer );
  124. };
  125. void SetSP( CServiceProvider *const pSP )
  126. {
  127. if (pSP)
  128. {
  129. pSP->AddRef();
  130. }
  131. m_pSP = pSP;
  132. };
  133. CServiceProvider *GetSP( void )
  134. {
  135. return( m_pSP );
  136. };
  137. CBilink m_bilinkNameTableOps;
  138. private:
  139. BYTE m_Sig[4]; // Signature
  140. DWORD m_dwFlags;
  141. DWORD m_dwMsgId;
  142. DWORD m_dwVersion;
  143. DWORD m_dwVersionNotUsed;
  144. CRefCountBuffer *m_pRefCountBuffer;
  145. CServiceProvider *m_pSP;
  146. DIRECTNETOBJECT *m_pdnObject;
  147. };
  148. #undef DPF_MODNAME
  149. #endif // __NT_OP_H__