' ########################################################################################
' Microsoft Windows
' File: WinSnmp.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
'/* WinSNMP.h */
'/* Copyright (C) 1993-1999 Microsoft Corporation */
'/* v1.0 - Sep 13, 1993 */
'/* v1.1 - Jun 12, 1994 */
'/* v2.0 - Nov 1, 1997 */
'/* - Nov 17, 1997: inc limits.h, tests for ULONG/UINT_MAX */
'/* - Mar 23, 1998: fixed typo in "lpClientData" */
'/* Questions/comments to Bob Natale, bnatale@acecomm.com */
#IF NOT %DEF(PBX_WinSnmp_PBI)
#DEFINE PBX_WinSnmp_PBI
%EQUATE `WINSNMP_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'#include <limits.h>
'/* WinSNMP API Type Definitions */
'typedef HANDLE HSNMP_SESSION, FAR *LPHSNMP_SESSION;
'typedef HANDLE HSNMP_ENTITY, FAR *LPHSNMP_ENTITY;
'typedef HANDLE HSNMP_CONTEXT, FAR *LPHSNMP_CONTEXT;
'typedef HANDLE HSNMP_PDU, FAR *LPHSNMP_PDU;
'typedef HANDLE HSNMP_VBL, FAR *LPHSNMP_VBL;
'typedef unsigned char smiBYTE, FAR *smiLPBYTE;
'/* SNMP-related types */
'#if ULONG_MAX == 4294967295U
'typedef signed long smiINT, FAR *smiLPINT;
'typedef smiINT smiINT32, FAR *smiLPINT32;
'typedef unsigned long smiUINT32, FAR *smiLPUINT32;
'#elif UINT_MAX == 4294967295U
'typedef int smiINT, FAR *smiLPINT;
'typedef smiINT smiINT32, FAR *smiLPINT32;
'typedef unsigned int smiUINT32, FAR *smiLPUINT32;
'#else
'#error can not define smiINT and smiUINT
'#endif
' // Size = 8 bytes
TYPE smiOCTETS DWORD
 len AS DWORD ' smiUINT32
 ptr AS BYTE PTR ' smiLPBYTE
END TYPE
' // Size = 8 bytes
TYPE smiOID DWORD
 len AS DWORD ' smiUINT32
 ptr AS DWORD PTR ' smiLPUINT32
END TYPE
'typedef const smiOID FAR *smiLPCOID;
'typedef smiOCTETS smiIPADDR, FAR *smiLPIPADDR;
'typedef smiUINT32 smiCNTR32, FAR *smiLPCNTR32;
'typedef smiUINT32 smiGAUGE32, FAR *smiLPGAUGE32;
'typedef smiUINT32 smiTIMETICKS, FAR *smiLPTIMETICKS;
'typedef smiOCTETS smiOPAQUE, FAR *smiLPOPAQUE;
'typedef smiOCTETS smiNSAPADDR, FAR *smiLPNSAPADDR;
' // Size = 8 bytes
TYPE smiCNTR64 DWORD
 hipart AS DWORD ' smiUINT32
 lopart AS DWORD ' smiUINT32
END TYPE
'/* ASN/BER Base Types */
'/* (used in forming SYNTAXes and certain SNMP types/values) */
%EQUATE `ASN_UNIVERSAL = &H00
%EQUATE `ASN_APPLICATION = &H40
%EQUATE `ASN_CONTEXT = &H80
%EQUATE `ASN_PRIVATE = &HC0
%EQUATE `ASN_PRIMITIVE = &H00
%EQUATE `ASN_CONSTRUCTOR = &H20
'/* SNMP ObjectSyntax Values */
%EQUATE `SNMP_SYNTAX_SEQUENCE = %ASN_UNIVERSAL OR %ASN_CONSTRUCTOR OR &H10
'/* These values are used in the "syntax" member of the smiVALUE structure which follows */
%EQUATE `SNMP_SYNTAX_INT = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H02
%EQUATE `SNMP_SYNTAX_BITS = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H03
%EQUATE `SNMP_SYNTAX_OCTETS = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H04
%EQUATE `SNMP_SYNTAX_NULL = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H05
%EQUATE `SNMP_SYNTAX_OID = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H06
%EQUATE `SNMP_SYNTAX_INT32 = %SNMP_SYNTAX_INT
%EQUATE `SNMP_SYNTAX_IPADDR = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H00
%EQUATE `SNMP_SYNTAX_CNTR32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H01
%EQUATE `SNMP_SYNTAX_GAUGE32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H02
%EQUATE `SNMP_SYNTAX_TIMETICKS = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H03
%EQUATE `SNMP_SYNTAX_OPAQUE = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H04
%EQUATE `SNMP_SYNTAX_NSAPADDR = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H05
%EQUATE `SNMP_SYNTAX_CNTR64 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H06
%EQUATE `SNMP_SYNTAX_UINT32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H07
%EQUATE `SNMP_SYNTAX_UNSIGNED32 = %SNMP_SYNTAX_GAUGE32
'/* Exception conditions in response PDUs for SNMPv2 */
%EQUATE `SNMP_SYNTAX_NOSUCHOBJECT = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H00
%EQUATE `SNMP_SYNTAX_NOSUCHINSTANCE = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H01
%EQUATE `SNMP_SYNTAX_ENDOFMIBVIEW = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H02
' // Size = 8 bytes
UNION smiVALUE_UNION DWORD
 sNumber AS INTEGER ' smiINT
 uNumber AS DWORD ' smiUINT32
 hNumber AS QUAD ' smiCNTR64
 string AS smiOCTETS ' smiOCTETS
 oid AS smiOID ' smiOID
 empty AS BYTE ' smiBYTE
END UNION
' // Size = 12 bytes
TYPE smiVALUE DWORD
 syntax AS DWORD ' smiUINT32
 value AS smiVALUE_UNION
END TYPE
'/* SNMP Limits */
%EQUATE `MAXOBJIDSIZE = 128 ' /* Max number of components in an OID */
%EQUATE `MAXOBJIDSTRSIZE = 1408 ' /* Max len of decoded MAXOBJIDSIZE OID */
'/* PDU Type Values */
%EQUATE `SNMP_PDU_GET = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H0
%EQUATE `SNMP_PDU_GETNEXT = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H1
%EQUATE `SNMP_PDU_RESPONSE = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H2
%EQUATE `SNMP_PDU_SET = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H3
'/* SNMP_PDU_V1TRAP is obsolete in SNMPv2 */
%EQUATE `SNMP_PDU_V1TRAP = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H4
%EQUATE `SNMP_PDU_GETBULK = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H5
%EQUATE `SNMP_PDU_INFORM = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H6
%EQUATE `SNMP_PDU_TRAP = %ASN_CONTEXT OR %ASN_CONSTRUCTOR OR &H7
'/*Constants for SnmpListenEx*/
%EQUATE `SNMPLISTEN_USEENTITY_ADDR = 0 ' /*Use entity address*/
%EQUATE `SNMPLISTEN_ALL_ADDR = 1 ' /*Use any address based on address family and port no*/
'/* SNMPv1 Trap Values */
'/* (These values might be superfluous wrt WinSNMP applications) */
%EQUATE `SNMP_TRAP_COLDSTART = 0
%EQUATE `SNMP_TRAP_WARMSTART = 1
%EQUATE `SNMP_TRAP_LINKDOWN = 2
%EQUATE `SNMP_TRAP_LINKUP = 3
%EQUATE `SNMP_TRAP_AUTHFAIL = 4
%EQUATE `SNMP_TRAP_EGPNEIGHBORLOSS = 5
%EQUATE `SNMP_TRAP_ENTERPRISESPECIFIC = 6
'/* SNMP Error Codes Returned in Error_status Field of PDU */
'/* (these are NOT WinSNMP API Error Codes */
'/* Error Codes Common to SNMPv1 and SNMPv2 */
%EQUATE `SNMP_ERROR_NOERROR = 0
%EQUATE `SNMP_ERROR_TOOBIG = 1
%EQUATE `SNMP_ERROR_NOSUCHNAME = 2
%EQUATE `SNMP_ERROR_BADVALUE = 3
%EQUATE `SNMP_ERROR_READONLY = 4
%EQUATE `SNMP_ERROR_GENERR = 5
'' /* Error Codes Added for SNMPv2 */
%EQUATE `SNMP_ERROR_NOACCESS = 6
%EQUATE `SNMP_ERROR_WRONGTYPE = 7
%EQUATE `SNMP_ERROR_WRONGLENGTH = 8
%EQUATE `SNMP_ERROR_WRONGENCODING = 9
%EQUATE `SNMP_ERROR_WRONGVALUE = 10
%EQUATE `SNMP_ERROR_NOCREATION = 11
%EQUATE `SNMP_ERROR_INCONSISTENTVALUE = 12
%EQUATE `SNMP_ERROR_RESOURCEUNAVAILABLE = 13
%EQUATE `SNMP_ERROR_COMMITFAILED = 14
%EQUATE `SNMP_ERROR_UNDOFAILED = 15
%EQUATE `SNMP_ERROR_AUTHORIZATIONERROR = 16
%EQUATE `SNMP_ERROR_NOTWRITABLE = 17
%EQUATE `SNMP_ERROR_INCONSISTENTNAME = 18
' /* WinSNMP API Values */
' /* Values used to indicate entity/context translation modes */
%EQUATE `SNMPAPI_TRANSLATED = 0
%EQUATE `SNMPAPI_UNTRANSLATED_V1 = 1
%EQUATE `SNMPAPI_UNTRANSLATED_V2 = 2
' /* Values used to indicate "SNMP level" supported by the implementation */
%EQUATE `SNMPAPI_NO_SUPPORT = 0
%EQUATE `SNMPAPI_V1_SUPPORT = 1
%EQUATE `SNMPAPI_V2_SUPPORT = 2
%EQUATE `SNMPAPI_M2M_SUPPORT = 3
' /* Values used to indicate retransmit mode in the implementation */
%EQUATE `SNMPAPI_OFF = 0 ' /* Refuse support */
%EQUATE `SNMPAPI_ON = 1 ' /* Request support */
' /* WinSNMP API Function Return Codes */
'typedef smiUINT32 SNMPAPI_STATUS; ' /* Used for function ret values */
%EQUATE `SNMPAPI_FAILURE = 0 ' /* Generic error code */
%EQUATE `SNMPAPI_SUCCESS = 1 ' /* Generic success code */
' /* WinSNMP API Error Codes (for SnmpGetLastError) */
' /* (NOT SNMP Response-PDU error_status codes) */
%EQUATE `SNMPAPI_ALLOC_ERROR = 2 ' /* Error allocating memory */
%EQUATE `SNMPAPI_CONTEXT_INVALID = 3 ' /* Invalid context parameter */
%EQUATE `SNMPAPI_CONTEXT_UNKNOWN = 4 ' /* Unknown context parameter */
%EQUATE `SNMPAPI_ENTITY_INVALID = 5 ' /* Invalid entity parameter */
%EQUATE `SNMPAPI_ENTITY_UNKNOWN = 6 ' /* Unknown entity parameter */
%EQUATE `SNMPAPI_INDEX_INVALID = 7 ' /* Invalid VBL index parameter */
%EQUATE `SNMPAPI_NOOP = 8 ' /* No operation performed */
%EQUATE `SNMPAPI_OID_INVALID = 9 ' /* Invalid OID parameter */
%EQUATE `SNMPAPI_OPERATION_INVALID = 10 ' /* Invalid/unsupported operation */
%EQUATE `SNMPAPI_OUTPUT_TRUNCATED = 11 ' /* Insufficient output buf len */
%EQUATE `SNMPAPI_PDU_INVALID = 12 ' /* Invalid PDU parameter */
%EQUATE `SNMPAPI_SESSION_INVALID = 13 ' /* Invalid session parameter */
%EQUATE `SNMPAPI_SYNTAX_INVALID = 14 ' /* Invalid syntax in smiVALUE */
%EQUATE `SNMPAPI_VBL_INVALID = 15 ' /* Invalid VBL parameter */
%EQUATE `SNMPAPI_MODE_INVALID = 16 ' /* Invalid mode parameter */
%EQUATE `SNMPAPI_SIZE_INVALID = 17 ' /* Invalid size/length parameter */
%EQUATE `SNMPAPI_NOT_INITIALIZED = 18 ' /* SnmpStartup failed/not called */
%EQUATE `SNMPAPI_MESSAGE_INVALID = 19 ' /* Invalid SNMP message format */
%EQUATE `SNMPAPI_HWND_INVALID = 20 ' /* Invalid Window handle */
%EQUATE `SNMPAPI_OTHER_ERROR = 99 ' /* For internal/undefined errors */
' /* Generic Transport Layer (TL) Errors */
%EQUATE `SNMPAPI_TL_NOT_INITIALIZED = 100 ' /* TL not initialized */
%EQUATE `SNMPAPI_TL_NOT_SUPPORTED = 101 ' /* TL does not support protocol */
%EQUATE `SNMPAPI_TL_NOT_AVAILABLE = 102 ' /* Network subsystem has failed */
%EQUATE `SNMPAPI_TL_RESOURCE_ERROR = 103 ' /* TL resource error */
%EQUATE `SNMPAPI_TL_UNDELIVERABLE = 104 ' /* Destination unreachable */
%EQUATE `SNMPAPI_TL_SRC_INVALID = 105 ' /* Source endpoint invalid */
%EQUATE `SNMPAPI_TL_INVALID_PARAM = 106 ' /* Input parameter invalid */
%EQUATE `SNMPAPI_TL_IN_USE = 107 ' /* Source endpoint in use */
%EQUATE `SNMPAPI_TL_TIMEOUT = 108 ' /* No response before timeout */
%EQUATE `SNMPAPI_TL_PDU_TOO_BIG = 109 ' /* PDU too big for send/receive */
%EQUATE `SNMPAPI_TL_OTHER = 199 ' /* Undefined TL error */
'/* WinSNMP API Function Prototypes */
'/* v2.0: Structure for SnmpGetVendorInfo() output */
%EQUATE `MAXVENDORINFO = 32
' // Size = 196 bytes
TYPE smiVENDORINFO DWORD
 vendorName AS ASCIIZ * %MAXVENDORINFO * 2 ' char[MAXVENDORINFO*2]
 vendorContact AS ASCIIZ * %MAXVENDORINFO * 2 ' char[MAXVENDORINFO*2]
 vendorVersionId AS ASCIIZ * %MAXVENDORINFO ' char[MAXVENDORINFO]
 vendorVersionDate AS ASCIIZ * %MAXVENDORINFO ' char[MAXVENDORINFO]
 vendorEnterprise AS DWORD ' smiUINT32
END TYPE
'/* v2.0: Callback format for SnmpCreateSession() fCallback parameter */
'typedef SNMPAPI_STATUS (CALLBACK *SNMPAPI_CALLBACK)
' (IN HSNMP_SESSION hSession,
' IN HWND hWnd,
' IN UINT wMsg,
' IN WPARAM wParam,
' IN LPARAM lParam,
' IN LPVOID lpClientData);
'FUNCTION SNMPAPI_CALLBACK ( ' BYVAL DWORD
' , BYVAL DWORD
' , BYVAL DWORD
' , BYVAL DWORD
' , BYVAL LONG
' , BYVAL DWORD
' ) AS DWORD
'/* Local Database Functions */
DECLARE FUNCTION SnmpGetTranslateMode LIB "wsnmp32.dll" ALIAS "SnmpGetTranslateMode" ( BYREF nTranslateMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetTranslateMode LIB "wsnmp32.dll" ALIAS "SnmpSetTranslateMode" ( BYVAL nTranslateMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpGetRetransmitMode LIB "wsnmp32.dll" ALIAS "SnmpGetRetransmitMode" ( BYREF nRetransmitMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetRetransmitMode LIB "wsnmp32.dll" ALIAS "SnmpSetRetransmitMode" ( BYVAL nRetransmitMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpGetTimeout LIB "wsnmp32.dll" ALIAS "SnmpGetTimeout" ( BYVAL hEntity AS QUAD , BYREF nPolicyTimeout AS QUAD , BYREF nActualTimeout AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetTimeout LIB "wsnmp32.dll" ALIAS "SnmpSetTimeout" ( BYVAL hEntity AS QUAD , BYVAL nPolicyTimeout AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpGetRetry LIB "wsnmp32.dll" ALIAS "SnmpGetRetry" ( BYVAL hEntity AS QUAD , BYREF nPolicyRetry AS QUAD , BYREF nActualRetry AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetRetry LIB "wsnmp32.dll" ALIAS "SnmpSetRetry" ( BYVAL hEntity AS QUAD , BYVAL nPolicyRetry AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Following Local Database Functions added in v2.0 */
DECLARE FUNCTION SnmpGetVendorInfo LIB "wsnmp32.dll" ALIAS "SnmpGetVendorInfo" ( BYREF vendorInfo AS smiVENDORINFO ) AS QUAD ' SNMPAPI_STATUS
'/* Communications Functions */
DECLARE FUNCTION SnmpStartup LIB "wsnmp32.dll" ALIAS "SnmpStartup" ( BYREF nMajorVersion AS QUAD , BYREF nMinorVersion AS QUAD , BYREF nLevel AS QUAD , BYREF nTranslateMode AS QUAD , BYREF nRetransmitMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpCleanup LIB "wsnmp32.dll" ALIAS "SnmpCleanup" ( ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpOpen LIB "wsnmp32.dll" ALIAS "SnmpOpen" ( BYVAL hWnd AS QUAD , BYVAL wMsg AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpClose LIB "wsnmp32.dll" ALIAS "SnmpClose" ( BYVAL session AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSendMsg LIB "wsnmp32.dll" ALIAS "SnmpSendMsg" ( BYVAL session AS QUAD , BYVAL srcEntity AS QUAD , BYVAL dstEntity AS QUAD , BYVAL context AS QUAD , BYVAL PDU AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpRecvMsg LIB "wsnmp32.dll" ALIAS "SnmpRecvMsg" ( BYVAL session AS QUAD , BYREF srcEntity AS QUAD , BYREF dstEntity AS QUAD , BYREF context AS QUAD , BYREF PDU AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpRegister LIB "wsnmp32.dll" ALIAS "SnmpRegister" ( BYVAL session AS QUAD , BYVAL srcEntity AS QUAD , BYVAL dstEntity AS QUAD , BYVAL context AS QUAD , BYREF notification AS smiOID , BYVAL state AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Following Communications Functions added in v2.0 */
DECLARE FUNCTION SnmpCreateSession LIB "wsnmp32.dll" ALIAS "SnmpCreateSession" ( BYVAL hWnd AS QUAD , BYVAL wMsg AS QUAD , BYVAL fCallBack AS QUAD , BYVAL lpClientData AS QUAD ) AS QUAD ' HSNMP_SESSION
DECLARE FUNCTION SnmpListen LIB "wsnmp32.dll" ALIAS "SnmpListen" ( BYVAL hEntity AS QUAD , BYVAL lStatus AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpListenEx LIB "wsnmp32.dll" ALIAS "SnmpListenEx" ( BYVAL hEntity AS QUAD , BYVAL lStatus AS QUAD , BYVAL nUseEntityAddr AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpCancelMsg LIB "wsnmp32.dll" ALIAS "SnmpCancelMsg" ( BYVAL session AS QUAD , BYVAL reqId AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Extensions to Communications Functions */
DECLARE FUNCTION SnmpStartupEx LIB "wsnmp32.dll" ALIAS "SnmpStartupEx" ( BYREF nMajorVersion AS QUAD , BYREF nMinorVersion AS QUAD , BYREF nLevel AS QUAD , BYREF nTranslateMode AS QUAD , BYREF nRetransmitMode AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'typedef SNMPAPI_STATUS (__stdcall * PFNSNMPSTARTUPEX)( smiLPUINT32,
' smiLPUINT32,
' smiLPUINT32,
' smiLPUINT32,
DECLARE FUNCTION SnmpCleanupEx LIB "wsnmp32.dll" ALIAS "SnmpCleanupEx" ( ) AS QUAD ' SNMPAPI_STATUS
'typedef SNMPAPI_STATUS (__stdcall * PFNSNMPCLEANUPEX)(void);
'/* Entity/Context Functions */
DECLARE FUNCTION SnmpStrToEntity LIB "wsnmp32.dll" ALIAS "SnmpStrToEntity" ( BYVAL session AS QUAD , BYREF string AS ASCIIZ ) AS QUAD ' HSNMP_ENTITY
DECLARE FUNCTION SnmpEntityToStr LIB "wsnmp32.dll" ALIAS "SnmpEntityToStr" ( BYVAL entity AS QUAD , BYVAL size AS QUAD , BYREF string AS ASCIIZ ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpFreeEntity LIB "wsnmp32.dll" ALIAS "SnmpFreeEntity" ( BYVAL entity AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpStrToContext LIB "wsnmp32.dll" ALIAS "SnmpStrToContext" ( BYVAL session AS QUAD , BYREF string As smiOCTETS ) AS QUAD ' HSNMP_CONTEXT
DECLARE FUNCTION SnmpContextToStr LIB "wsnmp32.dll" ALIAS "SnmpContextToStr" ( BYVAL context AS QUAD , BYREF string AS smiOCTETS ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpFreeContext LIB "wsnmp32.dll" ALIAS "SnmpFreeContext" ( BYVAL context AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Following Entity/Context Functions added in v2.0 */
DECLARE FUNCTION SnmpSetPort LIB "wsnmp32.dll" ALIAS "SnmpSetPort" ( BYVAL hEntity AS QUAD , BYVAL nPort AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* PDU Functions */
DECLARE FUNCTION SnmpCreatePdu LIB "wsnmp32.dll" ALIAS "SnmpCreatePdu" ( BYVAL session AS QUAD , BYVAL PDU_type AS LONG , BYVAL request_id AS QUAD , BYVAL error_status AS LONG , BYVAL error_index AS LONG , BYVAL varbindlist AS QUAD ) AS QUAD ' HSNMP_PDU
DECLARE FUNCTION SnmpGetPduData LIB "wsnmp32.dll" ALIAS "SnmpGetPduData" ( BYVAL PDU AS QUAD , BYREF PDU_type AS LONG , BYREF request_id AS QUAD , BYREF error_status AS LONG , BYREF error_index AS LONG , BYREF varbindlist AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetPduData LIB "wsnmp32.dll" ALIAS "SnmpSetPduData" ( BYVAL PDU AS QUAD , BYREF PDU_type AS LONG , BYREF request_id AS QUAD , BYREF non_repeaters AS LONG , BYREF max_repetitions AS LONG , BYREF varbindlist AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpDuplicatePdu LIB "wsnmp32.dll" ALIAS "SnmpDuplicatePdu" ( BYVAL session AS QUAD , BYVAL PDU AS QUAD ) AS QUAD ' HSNMP_PDU
DECLARE FUNCTION SnmpFreePdu LIB "wsnmp32.dll" ALIAS "SnmpFreePdu" ( BYVAL PDU AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Variable-Binding Functions */
DECLARE FUNCTION SnmpCreateVbl LIB "wsnmp32.dll" ALIAS "SnmpCreateVbl" ( BYVAL session AS QUAD , BYREF name AS smiOID , BYREF value AS smiVALUE ) AS QUAD ' HSNMP_VBL
DECLARE FUNCTION SnmpDuplicateVbl LIB "wsnmp32.dll" ALIAS "SnmpDuplicateVbl" ( BYVAL session AS QUAD , BYVAL vbl AS QUAD ) AS QUAD ' HSNMP_VBL
DECLARE FUNCTION SnmpFreeVbl LIB "wsnmp32.dll" ALIAS "SnmpFreeVbl" ( BYVAL vbl AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpCountVbl LIB "wsnmp32.dll" ALIAS "SnmpCountVbl" ( BYVAL vbl AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpGetVb LIB "wsnmp32.dll" ALIAS "SnmpGetVb" ( BYVAL vbl AS QUAD , BYVAL index AS QUAD , BYREF name AS smiOID , BYREF value AS smiVALUE ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpSetVb LIB "wsnmp32.dll" ALIAS "SnmpSetVb" ( BYVAL vbl AS QUAD , BYVAL index AS QUAD , BYREF name AS smiOID , BYREF value AS smiVALUE ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpDeleteVb LIB "wsnmp32.dll" ALIAS "SnmpDeleteVb" ( BYVAL vbl AS QUAD , BYVAL index AS QUAD ) AS QUAD ' SNMPAPI_STATUS
'/* Utility Functions */
DECLARE FUNCTION SnmpGetLastError LIB "wsnmp32.dll" ALIAS "SnmpGetLastError" ( BYVAL session AS QUAD ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpStrToOid LIB "wsnmp32.dll" ALIAS "SnmpStrToOid" ( BYREF string AS ASCIIZ , BYREF dstOID AS smiOID ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpOidToStr LIB "wsnmp32.dll" ALIAS "SnmpOidToStr" ( BYREF srcOID AS smiOID , BYVAL size AS QUAD , BYREF string AS ASCIIZ ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpOidCopy LIB "wsnmp32.dll" ALIAS "SnmpOidCopy" ( BYREF srcOID AS smiOID , BYREF dstOID AS smiOID ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpOidCompare LIB "wsnmp32.dll" ALIAS "SnmpOidCompare" ( BYREF xOID AS smiOID , BYREF yOID AS smiOID , BYVAL maxlen AS QUAD , BYREF result AS LONG ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpEncodeMsg LIB "wsnmp32.dll" ALIAS "SnmpEncodeMsg" ( BYVAL session AS QUAD , BYVAL srcEntity AS QUAD , BYVAL dstEntity AS QUAD , BYVAL context AS QUAD , BYVAL pdu AS QUAD , BYREF msgBufDesc AS smiOCTETS ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpDecodeMsg LIB "wsnmp32.dll" ALIAS "SnmpDecodeMsg" ( BYVAL session AS QUAD , BYREF srcEntity AS QUAD , BYREF dstEntity AS QUAD , BYREF context AS QUAD , BYREF pdu AS QUAD , BYREF msgBufDesc AS smiOCTETS ) AS QUAD ' SNMPAPI_STATUS
DECLARE FUNCTION SnmpFreeDescriptor LIB "wsnmp32.dll" ALIAS "SnmpFreeDescriptor" ( BYVAL syntax AS QUAD , BYREF descriptor AS smiOCTETS ) AS QUAD ' SNMPAPI_STATUS
#ENDIF
