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.

220 lines
5.0 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. #ifndef _HELPER_H_
  13. #define _HELPER_H_
  14. /*helper classes
  15. */
  16. class SmirClassFactoryHelper;
  17. extern SmirClassFactoryHelper *g_pClassFactoryHelper;
  18. HRESULT CopyBSTR(BSTR *pDst, BSTR *pSrc);
  19. void FormatProviderErrorMsg(char*,int,HRESULT);
  20. class CNotificationMapper
  21. {
  22. public:
  23. CNotificationMapper(){}
  24. ~CNotificationMapper(){}
  25. static STDMETHODIMP Map(CSmir *a_Smir,IWbemClassObject *pObj, enum NotificationMapperType type);
  26. private:
  27. //private copy constructors to prevent bcopy
  28. CNotificationMapper(CNotificationMapper&);
  29. const CNotificationMapper& operator=(CNotificationMapper &);
  30. };
  31. class CXToClassAssociator
  32. {
  33. public:
  34. CXToClassAssociator(){}
  35. ~CXToClassAssociator(){}
  36. private:
  37. //private copy constructors to prevent bcopy
  38. CXToClassAssociator(CXToClassAssociator&);
  39. const CXToClassAssociator& operator=(CXToClassAssociator &);
  40. };
  41. class CGroupToClassAssociator : public CXToClassAssociator
  42. {
  43. public:
  44. CGroupToClassAssociator(){}
  45. ~CGroupToClassAssociator(){}
  46. static STDMETHODIMP Associate(CSmir *a_Smir,BSTR szModule, BSTR szGroup, ISmirClassHandle *hClass);
  47. private:
  48. //private copy constructors to prevent bcopy
  49. CGroupToClassAssociator(CXToClassAssociator&);
  50. const CGroupToClassAssociator& operator=(CGroupToClassAssociator &);
  51. };
  52. class CModuleToClassAssociator : public CXToClassAssociator
  53. {
  54. public:
  55. CModuleToClassAssociator(){}
  56. ~CModuleToClassAssociator(){}
  57. static STDMETHODIMP Associate(CSmir *a_Smir,BSTR szModule, ISmirClassHandle *hClass);
  58. private:
  59. //private copy constructors to prevent bcopy
  60. CModuleToClassAssociator(CXToClassAssociator&);
  61. const CModuleToClassAssociator& operator=(CModuleToClassAssociator &);
  62. };
  63. class CModuleToNotificationClassAssociator : public CXToClassAssociator
  64. {
  65. public:
  66. CModuleToNotificationClassAssociator(){}
  67. ~CModuleToNotificationClassAssociator(){}
  68. static STDMETHODIMP Associate(CSmir *a_Smir,BSTR szModule, ISmirNotificationClassHandle *hClass);
  69. private:
  70. //private copy constructors to prevent bcopy
  71. CModuleToNotificationClassAssociator(CXToClassAssociator&);
  72. const CModuleToNotificationClassAssociator& operator=(CModuleToNotificationClassAssociator &);
  73. };
  74. class CModuleToExtNotificationClassAssociator : public CXToClassAssociator
  75. {
  76. public:
  77. CModuleToExtNotificationClassAssociator(){}
  78. ~CModuleToExtNotificationClassAssociator(){}
  79. static STDMETHODIMP Associate(CSmir *a_Smir,BSTR szModule, ISmirExtNotificationClassHandle *hClass);
  80. private:
  81. //private copy constructors to prevent bcopy
  82. CModuleToExtNotificationClassAssociator(CXToClassAssociator&);
  83. const CModuleToExtNotificationClassAssociator& operator=(CModuleToExtNotificationClassAssociator &);
  84. };
  85. class CSMIRToClassAssociator : public CXToClassAssociator
  86. {
  87. public:
  88. CSMIRToClassAssociator(){}
  89. ~CSMIRToClassAssociator(){}
  90. static STDMETHODIMP Associate(CSmir *a_Smir,ISmirClassHandle *hClass);
  91. private:
  92. //private copy constructors to prevent bcopy
  93. CSMIRToClassAssociator(CSMIRToClassAssociator&);
  94. const CSMIRToClassAssociator& operator=(CSMIRToClassAssociator &);
  95. };
  96. class CSmirAccess
  97. {
  98. private:
  99. static STDMETHODIMP Connect (
  100. CSmir *a_Smir ,
  101. OUT IWbemServices **server,
  102. IN BSTR ObjectPath,
  103. IN BOOL relativeToSMIR
  104. );
  105. public:
  106. enum eOpenType {
  107. eModule=1,
  108. eGroup
  109. };
  110. //undefined constructor and destructor
  111. //so object should never be instantiated
  112. CSmirAccess();
  113. virtual ~CSmirAccess();
  114. static STDMETHODIMP Init();
  115. static void ShutDown();
  116. static STDMETHODIMP Open (
  117. CSmir *a_Smir ,
  118. IWbemServices **server,
  119. BSTR ObjectPath=NULL,
  120. BOOL relativeToSMIR = FALSE
  121. );
  122. static STDMETHODIMP Open (
  123. CSmir *a_Smir ,
  124. IWbemServices **server,
  125. ISmirClassHandle *hClass,
  126. eOpenType eType=eGroup
  127. );
  128. static STDMETHODIMP Open (
  129. CSmir *a_Smir ,
  130. IWbemServices **server,
  131. ISmirGroupHandle *hGroup,
  132. eOpenType eType=eGroup
  133. );
  134. static STDMETHODIMP Open (
  135. CSmir *a_Smir ,
  136. IWbemServices **server,
  137. ISmirModHandle *hMod
  138. );
  139. static STDMETHODIMP GetContext (
  140. CSmir *a_Smir ,
  141. IWbemContext **a_Context
  142. ) ;
  143. };
  144. class SmirClassFactoryHelper
  145. {
  146. private:
  147. CGroupHandleClassFactory *pGroupHandleClassFactory;
  148. CClassHandleClassFactory *pClassHandleClassFactory;
  149. CNotificationClassHandleClassFactory *pNotificationClassHandleClassFactory;
  150. CExtNotificationClassHandleClassFactory *pExtNotificationClassHandleClassFactory;
  151. CModHandleClassFactory *pModHandleClassFactory;
  152. CSMIRClassFactory *pSMIRClassFactory;
  153. public:
  154. SmirClassFactoryHelper();
  155. virtual ~SmirClassFactoryHelper();
  156. HRESULT CreateInstance(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
  157. };
  158. #endif