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.

113 lines
2.5 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 _SNMP_EVT_PROV_EVTPROV_H
  13. #define _SNMP_EVT_PROV_EVTPROV_H
  14. template <> inline BOOL AFXAPI CompareElements<CString, LPCWSTR>(const CString* pElement1, const LPCWSTR* pElement2)
  15. {
  16. //return TRUE if equal
  17. return (pElement1->CompareNoCase(*pElement2) == 0);
  18. }
  19. template <> inline UINT AFXAPI HashKey <LPCWSTR> (LPCWSTR key)
  20. {
  21. CString tmp(key);
  22. tmp.MakeUpper();
  23. return HashKeyLPCWSTR((const WCHAR*)tmp);
  24. }
  25. class CWbemServerWrap
  26. {
  27. private:
  28. LONG m_ref;
  29. IWbemServices *m_Serv;
  30. CMap<CString, LPCWSTR, SCacheEntry*, SCacheEntry*> m_ClassMap;
  31. public:
  32. CWbemServerWrap(IWbemServices *pServ);
  33. ULONG AddRef();
  34. ULONG Release();
  35. IWbemServices* GetServer() { return m_Serv; }
  36. HRESULT GetObject(BSTR a_path, IWbemContext *a_pCtx, IWbemClassObject **a_ppObj);
  37. HRESULT GetMapperObject(BSTR a_path, IWbemContext *a_pCtx, IWbemClassObject **a_ppObj);
  38. ~CWbemServerWrap();
  39. };
  40. class CTrapEventProvider : public IWbemEventProvider, public IWbemProviderInit
  41. {
  42. private:
  43. CWbemServerWrap* m_pNamespace;
  44. IWbemObjectSink* m_pEventSink;
  45. CEventProviderThread* m_thrd;
  46. LONG m_ref;
  47. //copy constuctor not defined so not allowed!
  48. CTrapEventProvider(CTrapEventProvider&);
  49. void operator=(const CTrapEventProvider&);
  50. public:
  51. DWORD m_MapType;
  52. CTrapEventProvider(DWORD mapperType, CEventProviderThread* thrd);
  53. CWbemServerWrap* GetNamespace();
  54. IWbemObjectSink* GetEventSink();
  55. void AddRefAll();
  56. void ReleaseAll();
  57. ~CTrapEventProvider();
  58. //interface methods
  59. //==================
  60. STDMETHODIMP ProvideEvents(
  61. IWbemObjectSink* pSink,
  62. LONG lFlags
  63. );
  64. STDMETHODIMP QueryInterface(REFIID riid, PVOID* ppv);
  65. STDMETHODIMP_(ULONG) AddRef();
  66. STDMETHODIMP_(ULONG) Release();
  67. /* IWbemProviderInit methods */
  68. STDMETHODIMP Initialize (
  69. LPWSTR pszUser,
  70. LONG lFlags,
  71. LPWSTR pszNamespace,
  72. LPWSTR pszLocale,
  73. IWbemServices *pCIMOM, // For anybody
  74. IWbemContext *pCtx,
  75. IWbemProviderInitSink *pInitSink // For init signals
  76. );
  77. };
  78. #endif //_SNMP_EVT_PROV_EVTPROV_H