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.

286 lines
10 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 _SNMPPropertyProvider_H_
  13. #define _SNMPPropertyProvider_H_
  14. extern CRITICAL_SECTION s_ProviderCriticalSection ;
  15. class SnmpInstanceDefaultThreadObject : public SnmpThreadObject
  16. {
  17. private:
  18. protected:
  19. public:
  20. SnmpInstanceDefaultThreadObject ( const char *threadName = NULL ) : SnmpThreadObject ( threadName ) {} ;
  21. ~SnmpInstanceDefaultThreadObject () {} ;
  22. void Initialise () ;
  23. void Uninitialise () { CoUninitialize () ; }
  24. } ;
  25. class CImpPropProv : public IWbemServices , public IWbemProviderInit
  26. {
  27. private:
  28. BOOL initialised ;
  29. LONG m_referenceCount ; //Object reference count
  30. CCriticalSection criticalSection ;
  31. WbemNamespacePath namespacePath ;
  32. wchar_t *thisNamespace ;
  33. IWbemServices *server ;
  34. IWbemServices *parentServer ;
  35. IWbemProviderInitSink *m_InitSink ;
  36. char *ipAddressString ;
  37. char *ipAddressValue ;
  38. wchar_t *m_localeId ;
  39. BOOL m_getNotifyCalled ;
  40. BOOL m_getSnmpNotifyCalled ;
  41. CCriticalSection m_notificationLock;
  42. CCriticalSection m_snmpNotificationLock;
  43. IWbemClassObject *m_notificationClassObject ;
  44. IWbemClassObject *m_snmpNotificationClassObject ;
  45. private:
  46. HRESULT SetServer ( IWbemServices *serverArg );
  47. HRESULT SetParentServer ( IWbemServices *parentServerArg ) ;
  48. BOOL AttachParentServer (
  49. WbemSnmpErrorObject &a_errorObject ,
  50. BSTR Namespace,
  51. IWbemContext *pCtx
  52. ) ;
  53. BOOL ObtainCachedIpAddress ( WbemSnmpErrorObject &a_errorObject ) ;
  54. protected:
  55. public:
  56. CImpPropProv () ;
  57. ~CImpPropProv () ;
  58. static BOOL s_Initialised ;
  59. // Implementation
  60. IWbemServices *GetServer () ;
  61. IWbemServices *GetParentServer () ;
  62. WbemNamespacePath *GetNamespacePath () { return & namespacePath ; }
  63. wchar_t *GetThisNamespace () ;
  64. void SetThisNamespace ( wchar_t *thisNamespaceArg ) ;
  65. void SetLocaleId ( wchar_t *localeId ) ;
  66. wchar_t *GetLocaleId () { return m_localeId ; }
  67. char *GetIpAddressString () { return ipAddressString ; }
  68. char *GetIpAddressValue () { return ipAddressValue ; }
  69. BOOL FetchSnmpNotificationObject (
  70. WbemSnmpErrorObject &a_errorObject ,
  71. IWbemContext *a_Ctx
  72. ) ;
  73. BOOL FetchNotificationObject (
  74. WbemSnmpErrorObject &a_errorObject ,
  75. IWbemContext *a_Ctx
  76. ) ;
  77. IWbemClassObject *GetNotificationObject ( WbemSnmpErrorObject &a_errorObject ) ;
  78. IWbemClassObject *GetSnmpNotificationObject ( WbemSnmpErrorObject &a_errorObject ) ;
  79. //Non-delegating object IUnknown
  80. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  81. STDMETHODIMP_( ULONG ) AddRef () ;
  82. STDMETHODIMP_( ULONG ) Release () ;
  83. /* IWbemServices methods */
  84. HRESULT STDMETHODCALLTYPE OpenNamespace(
  85. /* [in] */ const BSTR Namespace,
  86. /* [in] */ long lFlags,
  87. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  88. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  89. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult) ;
  90. HRESULT STDMETHODCALLTYPE CancelAsyncCall(
  91. /* [in] */ IWbemObjectSink __RPC_FAR *pSink) ;
  92. HRESULT STDMETHODCALLTYPE QueryObjectSink(
  93. /* [in] */ long lFlags,
  94. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler) ;
  95. HRESULT STDMETHODCALLTYPE GetObject(
  96. /* [in] */ const BSTR ObjectPath,
  97. /* [in] */ long lFlags,
  98. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  99. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  100. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  101. HRESULT STDMETHODCALLTYPE GetObjectAsync(
  102. /* [in] */ const BSTR ObjectPath,
  103. /* [in] */ long lFlags,
  104. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  105. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  106. HRESULT STDMETHODCALLTYPE PutClass(
  107. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  108. /* [in] */ long lFlags,
  109. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  110. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  111. HRESULT STDMETHODCALLTYPE PutClassAsync(
  112. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  113. /* [in] */ long lFlags,
  114. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  115. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  116. HRESULT STDMETHODCALLTYPE DeleteClass(
  117. /* [in] */ const BSTR Class,
  118. /* [in] */ long lFlags,
  119. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  120. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  121. HRESULT STDMETHODCALLTYPE DeleteClassAsync(
  122. /* [in] */ const BSTR Class,
  123. /* [in] */ long lFlags,
  124. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  125. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  126. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  127. /* [in] */ const BSTR Superclass,
  128. /* [in] */ long lFlags,
  129. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  130. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  131. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  132. /* [in] */ const BSTR Superclass,
  133. /* [in] */ long lFlags,
  134. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  135. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  136. HRESULT STDMETHODCALLTYPE PutInstance(
  137. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  138. /* [in] */ long lFlags,
  139. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  140. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  141. HRESULT STDMETHODCALLTYPE PutInstanceAsync(
  142. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  143. /* [in] */ long lFlags,
  144. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  145. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  146. HRESULT STDMETHODCALLTYPE DeleteInstance(
  147. /* [in] */ const BSTR ObjectPath,
  148. /* [in] */ long lFlags,
  149. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  150. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  151. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
  152. /* [in] */ const BSTR ObjectPath,
  153. /* [in] */ long lFlags,
  154. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  155. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  156. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  157. /* [in] */ const BSTR Class,
  158. /* [in] */ long lFlags,
  159. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  160. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  161. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
  162. /* [in] */ const BSTR Class,
  163. /* [in] */ long lFlags,
  164. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  165. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  166. HRESULT STDMETHODCALLTYPE ExecQuery(
  167. /* [in] */ const BSTR QueryLanguage,
  168. /* [in] */ const BSTR Query,
  169. /* [in] */ long lFlags,
  170. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  171. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  172. HRESULT STDMETHODCALLTYPE ExecQueryAsync(
  173. /* [in] */ const BSTR QueryLanguage,
  174. /* [in] */ const BSTR Query,
  175. /* [in] */ long lFlags,
  176. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  177. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  178. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  179. /* [in] */ const BSTR QueryLanguage,
  180. /* [in] */ const BSTR Query,
  181. /* [in] */ long lFlags,
  182. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  183. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  184. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
  185. /* [in] */ const BSTR QueryLanguage,
  186. /* [in] */ const BSTR Query,
  187. /* [in] */ long lFlags,
  188. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  189. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  190. HRESULT STDMETHODCALLTYPE ExecMethod(
  191. /* [in] */ const BSTR ObjectPath,
  192. /* [in] */ const BSTR MethodName,
  193. /* [in] */ long lFlags,
  194. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  195. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  196. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppOutParams,
  197. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  198. HRESULT STDMETHODCALLTYPE ExecMethodAsync(
  199. /* [in] */ const BSTR ObjectPath,
  200. /* [in] */ const BSTR MethodName,
  201. /* [in] */ long lFlags,
  202. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  203. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  204. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  205. /* IWbemProviderInit methods */
  206. HRESULT STDMETHODCALLTYPE Initialize(
  207. /* [in] */ LPWSTR pszUser,
  208. /* [in] */ LONG lFlags,
  209. /* [in] */ LPWSTR pszNamespace,
  210. /* [in] */ LPWSTR pszLocale,
  211. /* [in] */ IWbemServices *pCIMOM, // For anybody
  212. /* [in] */ IWbemContext *pCtx,
  213. /* [in] */ IWbemProviderInitSink *pInitSink // For init signals
  214. );
  215. } ;
  216. #endif