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.

146 lines
2.9 KiB

  1. /*****************************************************************************\
  2. * MODULE: olesnmp.h
  3. *
  4. * PURPOSE: Declaration of the CSNMP
  5. *
  6. * Copyright (C) 1997-1998 Microsoft Corporation
  7. *
  8. * History:
  9. *
  10. * 08/16/97 paulmo Created
  11. * 09/12/97 weihaic Moved to oleprn.dll
  12. * 02/14/01 weihaic Added GetAsByte
  13. *
  14. \*****************************************************************************/
  15. #ifndef __OLESNMP_H_
  16. #define __OLESNMP_H_
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CSNMP
  19. class ATL_NO_VTABLE CSNMP :
  20. public CComObjectRootEx<CComMultiThreadModel>,
  21. public CComCoClass<CSNMP, &CLSID_SNMP>,
  22. public ISupportErrorInfoImpl<&IID_ISNMP>,
  23. public IDispatchImpl<ISNMP, &IID_ISNMP, &LIBID_OLEPRNLib>
  24. {
  25. public:
  26. CSNMP(
  27. VOID
  28. );
  29. ~CSNMP(
  30. VOID
  31. );
  32. DECLARE_REGISTRY_RESOURCEID(IDR_SNMP)
  33. BEGIN_COM_MAP(CSNMP)
  34. COM_INTERFACE_ENTRY(ISNMP)
  35. COM_INTERFACE_ENTRY(IDispatch)
  36. END_COM_MAP()
  37. // ISNMP
  38. public:
  39. STDMETHOD(Open)(
  40. IN BSTR bstrHost,
  41. IN BSTR bstrCommunity,
  42. IN VARIANT varRetry,
  43. IN VARIANT varTimeout
  44. );
  45. STDMETHOD(OIDFromString)(
  46. IN BSTR bstrOID,
  47. OUT VARIANT *pvarOID
  48. );
  49. STDMETHOD(Close)(
  50. VOID
  51. );
  52. STDMETHOD(Get)(
  53. IN BSTR bstrOID,
  54. OUT VARIANT *pvarValue
  55. );
  56. STDMETHOD(GetList)(
  57. IN VARIANT *pvarList,
  58. OUT VARIANT *pvarValue
  59. );
  60. STDMETHOD(GetTree)(
  61. IN BSTR varTree,
  62. OUT VARIANT *pvarValue
  63. );
  64. STDMETHOD(Set)(
  65. IN BSTR bstrOID,
  66. OUT VARIANT varValue
  67. );
  68. STDMETHOD(SetList)(
  69. IN VARIANT *pvarName,
  70. IN VARIANT *pvarValue
  71. );
  72. STDMETHOD(GetAsByte)(
  73. IN BSTR bstrOID,
  74. OUT PUINT puValue
  75. );
  76. private:
  77. HRESULT
  78. RfcToVarList (
  79. long lbound,
  80. RFC1157VarBindList * prfcVarList,
  81. SAFEARRAY *psaOut);
  82. HRESULT
  83. VarToRfcVarList (
  84. long lbound,
  85. long ubound,
  86. SAFEARRAY *psa,
  87. RFC1157VarBindList * prfcVarList
  88. );
  89. HRESULT
  90. SetSnmpScriptError (
  91. DWORD dwError
  92. );
  93. HRESULT
  94. SetWinSnmpApiError(
  95. DWORD dwError
  96. );
  97. static HRESULT
  98. VariantToRFC1157 (
  99. RFC1157VarBind *varb,
  100. VARIANT *var
  101. );
  102. static HRESULT
  103. RFC1157ToUInt(
  104. PUINT puValue,
  105. RFC1157VarBind * prfcvbValue
  106. );
  107. static HRESULT
  108. VarListAdd(
  109. BSTR bstrOID,
  110. RFC1157VarBindList *vl,
  111. VARIANT *v = NULL
  112. );
  113. static HRESULT
  114. RFC1157ToVariant(
  115. VARIANT *v,
  116. RFC1157VarBind *varb
  117. );
  118. LPSNMP_MGR_SESSION m_SNMPSession;
  119. };
  120. #endif //__SNMP_H_