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.

149 lines
3.8 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_EVTMAP_H
  13. #define _SNMP_EVT_PROV_EVTMAP_H
  14. class CWbemServerWrap;
  15. typedef enum tag_NameElementType
  16. { MYWBEM_NAME_ELEMENT_TYPE_PROPERTY = 0,
  17. MYWBEM_NAME_ELEMENT_TYPE_INDEX = 1
  18. } MYWBEM_NAME_ELEMENT_TYPE;
  19. typedef union tag_NameElementUnion
  20. {
  21. WCHAR* m_wszPropertyName;
  22. long m_lArrayIndex;
  23. } MYWBEM_NAME_ELEMENT_UNION;
  24. typedef struct tag_NameElement
  25. {
  26. short m_nType;
  27. MYWBEM_NAME_ELEMENT_UNION Element;
  28. } MYWBEM_NAME_ELEMENT;
  29. typedef struct _tag_WbemPropertyName
  30. {
  31. long m_lNumElements;
  32. MYWBEM_NAME_ELEMENT __RPC_FAR *m_aElements;
  33. } WBEM_PROPERTY_NAME;
  34. struct VarBindObjectStruct
  35. {
  36. BOOL fDone;
  37. SnmpVarBind* pVarBind;
  38. };
  39. struct VarBindObjectArrayStruct
  40. {
  41. VarBindObjectStruct* vbs;
  42. UINT length;
  43. VarBindObjectArrayStruct(VarBindObjectStruct* a_vbs, UINT a_length) : vbs(a_vbs), length(a_length) {}
  44. };
  45. class CMapToEvent
  46. {
  47. protected:
  48. CString m_addr; //sending address
  49. CString m_ctxt; //sending context
  50. CString m_oid; //snmptrap OID
  51. CString m_transport; //the transport protocol
  52. CString m_class; //the event class name
  53. IWbemClassObject *m_object; //the actual event instance which has been "spawned"
  54. CWbemServerWrap *m_nspace; //the namespace we are working in
  55. IWbemClassObject *m_vbdefn; //the snmpvarbind class object
  56. BOOL m_btriedGeneric; //indicates if the generic class has been tried
  57. BOOL m_btryGeneric; //indicates that the generic class should be tried
  58. BOOL m_bCheckedVersion; //indicates whether the version has been determined
  59. BOOL m_bSNMPv1; //indicates the SNMP version
  60. VarBindObjectArrayStruct m_vbs; //the varbinds
  61. CMapToEvent();
  62. //sets the m_class variable. if btryGeneric is set gets the generic class.
  63. //if m_btryGeneric is not set and a generic class is returned m_btriedGeneric
  64. //must be set to true.
  65. virtual BOOL GetClass();
  66. virtual BOOL GetSpecificClass() = 0;
  67. virtual const wchar_t* GetV1Class() = 0;
  68. virtual const wchar_t* GetV2Class() = 0;
  69. void GetClassInstance(IWbemClassObject** ppObj);
  70. virtual HRESULT GetStandardProperty(long lNumElements,
  71. MYWBEM_NAME_ELEMENT *aElements,
  72. long lFlags,
  73. VARIANT *pvValue);
  74. virtual HRESULT GetPropertyValue(long lNumElements,
  75. MYWBEM_NAME_ELEMENT *aElements,
  76. long lFlags,
  77. VARIANT *pvValue);
  78. virtual HRESULT GetSpecificPropertyValue(long lNumElements,
  79. MYWBEM_NAME_ELEMENT *aElements,
  80. long lFlags,
  81. VARIANT *pvValue) = 0;
  82. virtual HRESULT GetVBProperty(long lNumElements,
  83. MYWBEM_NAME_ELEMENT *aElements,
  84. long lFlags,
  85. VARIANT *pvValue);
  86. BOOL IsSNMPv1();
  87. IWbemClassObject* GetVBClassDefn();
  88. IWbemClassObject* GetVBClassObjectByIndex(UINT index);
  89. BOOL GetVBPropValueByIndex(UINT index, CString& type, VARIANT& vval);
  90. BOOL GetVBPropOIDByIndex(UINT index, VARIANT& vOid);
  91. public:
  92. enum EMappingType
  93. {
  94. REFERENT_MAPPER = 0,
  95. ENCAPSULATED_MAPPER = 1
  96. };
  97. virtual void ResetData();
  98. virtual void GenerateInstance(IWbemClassObject** ppInst) = 0;
  99. BOOL TriedGeneric() { return m_btriedGeneric; }
  100. void SetTryGeneric();
  101. void SetData(const char* sender_addr,
  102. const char* security_Context,
  103. const char* snmpTrapOid,
  104. const char* transport,
  105. SnmpVarBindList& vbList,
  106. CWbemServerWrap* nspace);
  107. virtual ~CMapToEvent();
  108. };
  109. #endif //_SNMP_EVT_PROV_EVTMAP_H