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.

283 lines
9.9 KiB

  1. //***************************************************************************
  2. //
  3. // PropertyProvider.H
  4. //
  5. // Module: Sample Mini Server for Ole MS
  6. //
  7. // Purpose: Genral purpose include file.
  8. //
  9. // Copyright (c) 1996-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. #ifndef _SNMPClassProvider_H_
  13. #define _SNMPClassProvider_H_
  14. extern CRITICAL_SECTION s_ProviderCriticalSection ;
  15. class SnmpClassDefaultThreadObject : public SnmpThreadObject
  16. {
  17. private:
  18. protected:
  19. public:
  20. SnmpClassDefaultThreadObject ( const char *threadName = NULL ) : SnmpThreadObject ( threadName ) {} ;
  21. ~SnmpClassDefaultThreadObject () {} ;
  22. void Initialise () ;
  23. void Uninitialise () { CoUninitialize () ; }
  24. } ;
  25. class CImpClasProv : public IWbemServices , public IWbemProviderInit
  26. {
  27. private:
  28. LONG m_referenceCount ; //Object reference count
  29. private:
  30. BOOL initialised ;
  31. IWbemServices *propertyProvider ;
  32. IWbemServices *server ;
  33. IWbemServices *parentServer ;
  34. IWbemProviderInitSink *m_InitSink ;
  35. char *ipAddressString ;
  36. char *ipAddressValue ;
  37. wchar_t *thisNamespace ;
  38. WbemNamespacePath namespacePath ;
  39. CCriticalSection m_notificationLock;
  40. CCriticalSection m_snmpNotificationLock;
  41. IWbemClassObject *m_notificationClassObject ;
  42. IWbemClassObject *m_snmpNotificationClassObject ;
  43. BOOL m_getNotifyCalled ;
  44. BOOL m_getSnmpNotifyCalled ;
  45. private:
  46. HRESULT SetServer ( IWbemServices *serverArg ) ;
  47. HRESULT SetParentServer ( IWbemServices *parentServerArg ) ;
  48. BOOL AttachParentServer (
  49. WbemSnmpErrorObject &a_errorObject ,
  50. BSTR ObjectPath,
  51. IWbemContext *pCtx
  52. ) ;
  53. BOOL ObtainCachedIpAddress ( WbemSnmpErrorObject &a_errorObject ) ;
  54. protected:
  55. public:
  56. CImpClasProv () ;
  57. ~CImpClasProv () ;
  58. void SetProvider ( IWbemServices *provider ) ;
  59. IWbemServices *GetParentServer () ;
  60. IWbemServices *GetServer () ;
  61. WbemNamespacePath *GetNamespacePath () ;
  62. wchar_t *GetThisNamespace () ;
  63. void SetThisNamespace ( wchar_t *thisNamespaceArg ) ;
  64. char *GetIpAddressString () { return ipAddressString ; }
  65. char *GetIpAddressValue () { return ipAddressValue ; }
  66. BOOL FetchSnmpNotificationObject (
  67. WbemSnmpErrorObject &a_errorObject ,
  68. IWbemContext *a_Ctx
  69. ) ;
  70. BOOL FetchNotificationObject (
  71. WbemSnmpErrorObject &a_errorObject ,
  72. IWbemContext *a_Ctx
  73. ) ;
  74. IWbemClassObject *GetNotificationObject ( WbemSnmpErrorObject &a_errorObject ) ;
  75. IWbemClassObject *GetSnmpNotificationObject ( WbemSnmpErrorObject &a_errorObject ) ;
  76. public:
  77. static BOOL s_Initialised ;
  78. //Non-delegating object IUnknown
  79. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  80. STDMETHODIMP_( ULONG ) AddRef () ;
  81. STDMETHODIMP_( ULONG ) Release () ;
  82. public:
  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