MgmtAPI.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:6k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*++
  2. Copyright (c) 1992-1999 Microsoft Corporation
  3. Module Name:
  4.     mgmtapi.h
  5. Abstract:
  6.     Definitions for SNMP Management API Development.
  7. --*/
  8. #ifndef _INC_MGMTAPI
  9. #define _INC_MGMTAPI
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. ///////////////////////////////////////////////////////////////////////////////
  14. //                                                                           //
  15. // Additional header files                                                   //
  16. //                                                                           //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #include <snmp.h>
  19. #include <winsock.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. ///////////////////////////////////////////////////////////////////////////////
  24. //                                                                           //
  25. // MGMT API error code definitions                                           //
  26. //                                                                           //
  27. ///////////////////////////////////////////////////////////////////////////////
  28. #define SNMP_MGMTAPI_TIMEOUT                40
  29. #define SNMP_MGMTAPI_SELECT_FDERRORS        41
  30. #define SNMP_MGMTAPI_TRAP_ERRORS            42
  31. #define SNMP_MGMTAPI_TRAP_DUPINIT           43
  32. #define SNMP_MGMTAPI_NOTRAPS                44
  33. #define SNMP_MGMTAPI_AGAIN                  45
  34. #define SNMP_MGMTAPI_INVALID_CTL            46
  35. #define SNMP_MGMTAPI_INVALID_SESSION        47
  36. #define SNMP_MGMTAPI_INVALID_BUFFER         48
  37. ///////////////////////////////////////////////////////////////////////////////
  38. //                                                                           //
  39. // MGMT API control codes
  40. //                                                                           //
  41. ///////////////////////////////////////////////////////////////////////////////
  42. #define MGMCTL_SETAGENTPORT             0x01
  43. ///////////////////////////////////////////////////////////////////////////////
  44. //                                                                           //
  45. // MGMT API type definitions                                                 //
  46. //                                                                           //
  47. ///////////////////////////////////////////////////////////////////////////////
  48. typedef PVOID LPSNMP_MGR_SESSION;
  49. ///////////////////////////////////////////////////////////////////////////////
  50. //                                                                           //
  51. // MGMT API prototypes                                                       //
  52. //                                                                           //
  53. ///////////////////////////////////////////////////////////////////////////////
  54. LPSNMP_MGR_SESSION
  55. SNMP_FUNC_TYPE
  56. SnmpMgrOpen(
  57.     IN LPSTR lpAgentAddress,                // Name/address of target agent
  58.     IN LPSTR lpAgentCommunity,              // Community for target agent
  59.     IN INT   nTimeOut,                      // Comm time-out in milliseconds
  60.     IN INT   nRetries                       // Comm time-out/retry count
  61.     );
  62. BOOL
  63. SNMP_FUNC_TYPE
  64. SnmpMgrCtl(
  65.     LPSNMP_MGR_SESSION session,             // pointer to the MGMTAPI session
  66.     DWORD              dwCtlCode,           // control code for the command requested
  67.     LPVOID             lpvInBuffer,         // buffer with the input parameters for the operation
  68.     DWORD              cbInBuffer,          // size of lpvInBuffer in bytes
  69.     LPVOID             lpvOUTBuffer,        // buffer for all the output parameters of the command
  70.     DWORD              cbOUTBuffer,         // size of lpvOUTBuffer
  71.     LPDWORD            lpcbBytesReturned    // space used from lpvOutBuffer
  72.     );
  73. BOOL
  74. SNMP_FUNC_TYPE
  75. SnmpMgrClose(
  76.     IN LPSNMP_MGR_SESSION session           // SNMP session pointer
  77.     );
  78. SNMPAPI
  79. SNMP_FUNC_TYPE
  80. SnmpMgrRequest(
  81.     IN     LPSNMP_MGR_SESSION session,           // SNMP session pointer
  82.     IN     BYTE               requestType,       // Get, GetNext, or Set
  83.     IN OUT RFC1157VarBindList *variableBindings, // Varible bindings
  84.        OUT AsnInteger         *errorStatus,      // Result error status
  85.        OUT AsnInteger         *errorIndex        // Result error index
  86.     );
  87. BOOL
  88. SNMP_FUNC_TYPE
  89. SnmpMgrStrToOid(
  90.     IN  LPSTR               string,         // OID string to be converted
  91.     OUT AsnObjectIdentifier *oid            // OID internal representation
  92.     );
  93. BOOL
  94. SNMP_FUNC_TYPE
  95. SnmpMgrOidToStr(
  96.     IN  AsnObjectIdentifier *oid,           // OID to be converted
  97.     OUT LPSTR               *string         // OID string representation
  98.     );
  99. BOOL
  100. SNMP_FUNC_TYPE
  101. SnmpMgrTrapListen(
  102.     OUT HANDLE *phTrapAvailable             // Event indicating trap available
  103.     );
  104. BOOL
  105. SNMP_FUNC_TYPE
  106. SnmpMgrGetTrap(
  107.     OUT AsnObjectIdentifier *enterprise,         // Generating enterprise
  108.     OUT AsnNetworkAddress   *IPAddress,          // Generating IP address
  109.     OUT AsnInteger          *genericTrap,        // Generic trap type
  110.     OUT AsnInteger          *specificTrap,       // Enterprise specific type
  111.     OUT AsnTimeticks        *timeStamp,          // Time stamp
  112.     OUT RFC1157VarBindList  *variableBindings    // Variable bindings
  113.     );
  114. BOOL
  115. SNMP_FUNC_TYPE
  116. SnmpMgrGetTrapEx(
  117.     OUT AsnObjectIdentifier *enterprise,       // Generating enterprise
  118.     OUT AsnNetworkAddress   *agentAddress,     // Generating agent addr
  119.     OUT AsnNetworkAddress   *sourceAddress,    // Generating network addr
  120.     OUT AsnInteger          *genericTrap,      // Generic trap type
  121.     OUT AsnInteger          *specificTrap,     // Enterprise specific type
  122.     OUT AsnOctetString      *community,        // Generating community
  123.     OUT AsnTimeticks        *timeStamp,        // Time stamp
  124.     OUT RFC1157VarBindList  *variableBindings  // Variable bindings
  125.     );
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif // _INC_MGMTAPI