' ########################################################################################
' Microsoft Windows
' File: snmp.inc
' Contents: Definitions for SNMP development
' 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.
' ########################################################################################
#IF NOT %DEF(PBX_Snmp_PBI)
#DEFINE PBX_Snmp_PBI
%EQUATE `SNMP_INC = 1
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Type Definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
'#include <pshpack4.h>
' // Size = 12 bytes
TYPE AsnOctetString DWORD
 stream AS BYTE PTR ' BYTE *
 length AS DWORD ' UINT
 dynamic AS LONG
END TYPE
' // Size = 8 bytes
TYPE AsnObjectIdentifier DWORD
 idLength AS DWORD ' UINT
 ids AS DWORD PTR ' UINT *
END TYPE
'typedef LONG AsnInteger32;
'typedef ULONG AsnUnsigned32;
'typedef ULARGE_INTEGER AsnCounter64;
'typedef AsnUnsigned32 AsnCounter32;
'typedef AsnUnsigned32 AsnGauge32;
'typedef AsnUnsigned32 AsnTimeticks;
'typedef AsnOctetString AsnBits;
'typedef AsnOctetString AsnSequence;
'typedef AsnOctetString AsnImplicitSequence;
'typedef AsnOctetString AsnIPAddress;
'typedef AsnOctetString AsnNetworkAddress;
'typedef AsnOctetString AsnDisplayString;
'typedef AsnOctetString AsnOpaque;
MACRO AsnBits = AsnOctetString
MACRO AsnSequence = AsnOctetString
MACRO AsnImplicitSequence = AsnOctetString
MACRO AsnIPAddress = AsnOctetString
MACRO AsnNetworkAddress = AsnOctetString
MACRO AsnDisplayString = AsnOctetString
MACRO AsnOpaque = AsnOctetString
' // Size = 12 bytes
UNION AsnAny_UNION
 number AS LONG ' AsnInteger32 // ASN_INTEGER
 ' // ASN_INTEGER32
 unsigned32 AS DWORD ' AsnUnsigned32 // ASN_UNSIGNED32
 counter64 AS QUAD ' AsnCounter64 // ASN_COUNTER64
 string AS AsnOctetString ' AsnOctetString // ASN_OCTETSTRING
 bits AS AsnOctetString ' AsnBits // ASN_BITS
 object AS AsnObjectIdentifier ' AsnObjectIdentifier // ASN_OBJECTIDENTIFIER
 sequence AS AsnOctetString ' AsnSequence // ASN_SEQUENCE
 address AS AsnOctetString ' AsnIPAddress // ASN_IPADDRESS
 counter AS DWORD ' AsnCounter32 // ASN_COUNTER32
 gauge AS DWORD ' AsnGauge32 // ASN_GAUGE32
 ticks AS DWORD ' AsnTimeticks // ASN_TIMETICKS
 arbitrary AS AsnOctetString ' AsnOpaque // ASN_OPAQUE
END UNION
' // Size = 16 bytes
TYPE AsnAny DWORD
 asnType AS BYTE ' BYTE
 asnValue AS AsnAny_UNION
END TYPE
'typedef AsnObjectIdentifier AsnObjectName;
'typedef AsnAny AsnObjectSyntax;
' // Size = 24 bytes
TYPE SnmpVarBind DWORD
 name AS AsnObjectIdentifier
 value AS AsnAny
END TYPE
' // Size = 8 bytes
TYPE SnmpVarBindList DWORD
 list AS SnmpVarBind PTR ' SnmpVarBind *
 len AS DWORD ' UINT
END TYPE
'#include <poppack.h>
#IF NOT %DEF(%WINSNMP_INC)
'///////////////////////////////////////////////////////////////////////////////
'// //
'// ASN/BER Base Types //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `ASN_UNIVERSAL = &H00
%EQUATE `ASN_APPLICATION = &H40
%EQUATE `ASN_CONTEXT = &H80
%EQUATE `ASN_PRIVATE = &HC0
%EQUATE `ASN_PRIMITIVE = &H00
%EQUATE `ASN_CONSTRUCTOR = &H20
'///////////////////////////////////////////////////////////////////////////////
'// //
'// 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
%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
#ENDIF ' #IF NOT %DEF(%WINSNMP_INC)
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Simple Syntax Values //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `ASN_INTEGER = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H02
%EQUATE `ASN_BITS = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H03
%EQUATE `ASN_OCTETSTRING = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H04
%EQUATE `ASN_NULL = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H05
%EQUATE `ASN_OBJECTIDENTIFIER = %ASN_UNIVERSAL OR %ASN_PRIMITIVE OR &H06
%EQUATE `ASN_INTEGER32 = %ASN_INTEGER
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Constructor Syntax Values //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `ASN_SEQUENCE = %ASN_UNIVERSAL OR %ASN_CONSTRUCTOR OR &H10
%EQUATE `ASN_SEQUENCEOF = %ASN_SEQUENCE
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Application Syntax Values //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `ASN_IPADDRESS = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H00
%EQUATE `ASN_COUNTER32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H01
%EQUATE `ASN_GAUGE32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H02
%EQUATE `ASN_TIMETICKS = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H03
%EQUATE `ASN_OPAQUE = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H04
%EQUATE `ASN_COUNTER64 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H06
%EQUATE `ASN_UINTEGER32 = %ASN_APPLICATION OR %ASN_PRIMITIVE OR &H07
%EQUATE `ASN_RFC2578_UNSIGNED32 = %ASN_GAUGE32
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Exception Conditions //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_EXCEPTION_NOSUCHOBJECT = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H00
%EQUATE `SNMP_EXCEPTION_NOSUCHINSTANCE = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H01
%EQUATE `SNMP_EXCEPTION_ENDOFMIBVIEW = %ASN_CONTEXT OR %ASN_PRIMITIVE OR &H02
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Request Types (used in SnmpExtensionQueryEx) //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_EXTENSION_GET = %SNMP_PDU_GET
%EQUATE `SNMP_EXTENSION_GET_NEXT = %SNMP_PDU_GETNEXT
%EQUATE `SNMP_EXTENSION_GET_BULK = %SNMP_PDU_GETBULK
%EQUATE `SNMP_EXTENSION_SET_TEST = %ASN_PRIVATE OR %ASN_CONSTRUCTOR OR &H0
%EQUATE `SNMP_EXTENSION_SET_COMMIT = %SNMP_PDU_SET
%EQUATE `SNMP_EXTENSION_SET_UNDO = %ASN_PRIVATE OR %ASN_CONSTRUCTOR OR &H1
%EQUATE `SNMP_EXTENSION_SET_CLEANUP = %ASN_PRIVATE OR %ASN_CONSTRUCTOR OR &H2
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Error Codes //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_ERRORSTATUS_NOERROR = 0
%EQUATE `SNMP_ERRORSTATUS_TOOBIG = 1
%EQUATE `SNMP_ERRORSTATUS_NOSUCHNAME = 2
%EQUATE `SNMP_ERRORSTATUS_BADVALUE = 3
%EQUATE `SNMP_ERRORSTATUS_READONLY = 4
%EQUATE `SNMP_ERRORSTATUS_GENERR = 5
%EQUATE `SNMP_ERRORSTATUS_NOACCESS = 6
%EQUATE `SNMP_ERRORSTATUS_WRONGTYPE = 7
%EQUATE `SNMP_ERRORSTATUS_WRONGLENGTH = 8
%EQUATE `SNMP_ERRORSTATUS_WRONGENCODING = 9
%EQUATE `SNMP_ERRORSTATUS_WRONGVALUE = 10
%EQUATE `SNMP_ERRORSTATUS_NOCREATION = 11
%EQUATE `SNMP_ERRORSTATUS_INCONSISTENTVALUE = 12
%EQUATE `SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE = 13
%EQUATE `SNMP_ERRORSTATUS_COMMITFAILED = 14
%EQUATE `SNMP_ERRORSTATUS_UNDOFAILED = 15
%EQUATE `SNMP_ERRORSTATUS_AUTHORIZATIONERROR = 16
%EQUATE `SNMP_ERRORSTATUS_NOTWRITABLE = 17
%EQUATE `SNMP_ERRORSTATUS_INCONSISTENTNAME = 18
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMPv1 Trap Types //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_GENERICTRAP_COLDSTART = 0
%EQUATE `SNMP_GENERICTRAP_WARMSTART = 1
%EQUATE `SNMP_GENERICTRAP_LINKDOWN = 2
%EQUATE `SNMP_GENERICTRAP_LINKUP = 3
%EQUATE `SNMP_GENERICTRAP_AUTHFAILURE = 4
%EQUATE `SNMP_GENERICTRAP_EGPNEIGHLOSS = 5
%EQUATE `SNMP_GENERICTRAP_ENTERSPECIFIC = 6
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Access Types //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_ACCESS_NONE = 0
%EQUATE `SNMP_ACCESS_NOTIFY = 1
%EQUATE `SNMP_ACCESS_READ_ONLY = 2
%EQUATE `SNMP_ACCESS_READ_WRITE = 3
%EQUATE `SNMP_ACCESS_READ_CREATE = 4
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP API Return Code Definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
'#define SNMPAPI INT
'#define SNMP_FUNC_TYPE WINAPI
%EQUATE `SNMPAPI_NOERROR = 1 ' %TRUE
%EQUATE `SNMPAPI_ERROR = 0 ' %FALSE
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Extension API Prototypes //
'// //
'///////////////////////////////////////////////////////////////////////////////
'DECLARE FUNCTION SnmpExtensionInit LIB "inetmib1.dll" ALIAS "SnmpExtensionInit" ( ' BYVAL dwUptimeReference AS DWORD ' DWORD dwUptimeReference
' , BYREF phSubagentTrapEvent AS DWORD ' HANDLE * phSubagentTrapEvent
' , BYREF pFirstSupportedRegion AS AsnObjectIdentifier ' AsnObjectIdentifier * pFirstSupportedRegion
' ) AS LONG
'DECLARE FUNCTION SnmpExtensionInitEx LIB "inetmib1.dll" ALIAS "SnmpExtensionInitEx" ( ' BYREF pNextSupportedRegion AS AsnObjectIdentifier ' AsnObjectIdentifier * pNextSupportedRegion
' ) AS LONG
'SNMP_FUNC_TYPE
'SnmpExtensionMonitor(
' LPVOID pAgentMgmtData
' );
'DECLARE FUNCTION SnmpExtensionMonitor ( ' BYVAL pAgentMgmtData AS DWORD ' LPVOID pAgentMgmtData
' ) AS LONG
'DECLARE FUNCTION SnmpExtensionQuery LIB "inetmib1.dll" ALIAS "SnmpExtensionQuery" ( ' BYVAL bPduType AS BYTE ' BYTE bPduType
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' , BYREF pErrorStatus AS LONG ' AsnInteger32 * pErrorStatus
' , BYREF pErrorIndex AS LONG ' AsnInteger32 * pErrorIndex
' ) AS LONG
'SNMP_FUNC_TYPE
'SnmpExtensionQueryEx(
' UINT nRequestType,
' UINT nTransactionId,
' SnmpVarBindList * pVarBindList,
' AsnOctetString * pContextInfo,
' AsnInteger32 * pErrorStatus,
' AsnInteger32 * pErrorIndex
' );
' Not exported by INETMIB1.DLL
'DECLARE FUNCTION SnmpExtensionQueryEx ( ' BYVAL nRequestType AS DWORD ' UINT nRequestType
' , BYVAL nTransactionId AS DWORD ' UINT nTransactionId
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' , BYREF pContextInfo AS AsnOctetString ' AsnOctetString * pContextInfo
' , BYREF pErrorStatus AS LONG ' AsnInteger32 * pErrorStatus
' , BYREF pErrorIndex AS LONG ' AsnInteger32 * pErrorIndex
' ) AS LONG
'DECLARE FUNCTION SnmpExtensionTrap LIB "inetmib1.dll" ALIAS "SnmpExtensionTrap" ( ' BYREF pEnterpriseOid AS AsnObjectIdentifier ' AsnObjectIdentifier * pEnterpriseOid
' , BYREF pGenericTrapId AS LONG ' AsnInteger32 * pGenericTrapId
' , BYREF pSpecificTrapId AS LONG ' AsnInteger32 * pSpecificTrapId
' , BYREF pTimeStamp AS DWORD ' AsnTimeticks * pTimeStamp
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' ) AS LONG
'SNMP_FUNC_TYPE
'SnmpExtensionClose(
' );
'DECLARE SUB SnmpExtensionClose ()
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Extension API Type Definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
'FUNCTION PFNSNMPEXTENSIONINIT ( ' BYVAL dwUptimeReference AS DWORD ' DWORD dwUptimeReference
' , BYREF phSubagentTrapEvent AS DWORD ' HANDLE * phSubagentTrapEvent
' , BYREF pFirstSupportedRegion AS AsnObjectIdentifier ' AsnObjectIdentifier * pFirstSupportedRegion
' ) AS LONG
'FUNCTION PFNSNMPEXTENSIONINITEX ( ' BYREF pNextSupportedRegion AS AsnObjectIdentifier ' AsnObjectIdentifier * pNextSupportedRegion
' ) AS LONG
'FUNCTION PFNSNMPEXTENSIONMONITOR ( ' BYVAL pAgentMgmtData AS DWORD ' LPVOID pAgentMgmtData
' ) AS LONG
'FUNCTION PFNSNMPEXTENSIONQUERY ( ' BYVAL bPduType AS BYTE ' BYTE bPduType
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' , BYREF pErrorStatus AS LONG ' AsnInteger32 * pErrorStatus
' , BYREF pErrorIndex AS LONG ' AsnInteger32 * pErrorIndex
' ) AS LONG
'FUNCTION PFNSNMPEXTENSIONQUERYEX ( ' BYVAL nRequestType AS DWORD ' UINT nRequestType
' , BYVAL nTransactionId AS DWORD ' UINT nTransactionId
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' , BYREF pContextInfo AS AsnOctetString ' AsnOctetString * pContextInfo
' , BYREF pErrorStatus AS LONG ' AsnInteger32 * pErrorStatus
' , BYREF pErrorIndex AS LONG ' AsnInteger32 * pErrorIndex
' ) AS LONG
'FUNCTION PFNSNMPEXTENSIONTRAP ( ' BYREF pEnterpriseOid AS AsnObjectIdentifier ' AsnObjectIdentifier * pEnterpriseOid
' , BYREF pGenericTrapId AS LONG ' AsnInteger32 * pGenericTrapId
' , BYREF pSpecificTrapId AS LONG ' AsnInteger32 * pSpecificTrapId
' , BYREF pTimeStamp AS DWORD ' AsnTimeticks * pTimeStamp
' , BYREF pVarBindList AS SnmpVarBindList ' SnmpVarBindList * pVarBindList
' ) AS LONG
'SUB PFNSNMPEXTENSIONCLOSE ()
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP API Prototypes //
'// //
'///////////////////////////////////////////////////////////////////////////////
DECLARE FUNCTION SnmpUtilOidCpy LIB "snmpapi.dll" ALIAS "SnmpUtilOidCpy" ( BYREF pOidDst AS AsnObjectIdentifier , BYREF pOidSrc AS AsnObjectIdentifier ) AS LONG ' INT
DECLARE FUNCTION SnmpUtilOidAppend LIB "snmpapi.dll" ALIAS "SnmpUtilOidAppend" ( BYREF pOidDst AS AsnObjectIdentifier , BYREF pOidSrc AS AsnObjectIdentifier ) AS LONG ' INT
DECLARE FUNCTION SnmpUtilOidNCmp LIB "snmpapi.dll" ALIAS "SnmpUtilOidNCmp" ( BYREF pOid1 AS AsnObjectIdentifier , BYREF pOid2 AS AsnObjectIdentifier , BYVAL nSubIds AS QUAD ) AS LONG ' INT
DECLARE FUNCTION SnmpUtilOidCmp LIB "snmpapi.dll" ALIAS "SnmpUtilOidCmp" ( BYREF pOid1 AS AsnObjectIdentifier , BYREF pOid2 AS AsnObjectIdentifier ) AS LONG ' INT
DECLARE SUB SnmpUtilOidFree LIB "snmpapi.dll" ALIAS "SnmpUtilOidFree" ( BYREF pOid AS AsnObjectIdentifier ) ' void
DECLARE FUNCTION SnmpUtilOctetsCmp LIB "snmpapi.dll" ALIAS "SnmpUtilOctetsCmp" ( BYREF pOctets1 AS AsnOctetString , BYREF pOctets2 AS AsnOctetString ) AS LONG ' INT
DECLARE FUNCTION SnmpUtilOctetsNCmp LIB "snmpapi.dll" ALIAS "SnmpUtilOctetsNCmp" ( BYREF pOctets1 AS AsnOctetString , BYREF pOctets2 AS AsnOctetString , BYVAL nChars AS QUAD ) AS LONG ' INT
DECLARE FUNCTION SnmpUtilOctetsCpy LIB "snmpapi.dll" ALIAS "SnmpUtilOctetsCpy" ( BYREF pOctetsDst AS AsnOctetString , BYREF pOctetsSrc AS AsnOctetString ) AS LONG ' INT
DECLARE SUB SnmpUtilOctetsFree LIB "snmpapi.dll" ALIAS "SnmpUtilOctetsFree" ( BYREF pOctets AS AsnOctetString ) ' void
DECLARE FUNCTION SnmpUtilAsnAnyCpy LIB "snmpapi.dll" ALIAS "SnmpUtilAsnAnyCpy" ( BYREF pAnyDst AS AsnAny , BYREF pAnySrc AS AsnAny ) AS LONG ' INT
DECLARE SUB SnmpUtilAsnAnyFree LIB "snmpapi.dll" ALIAS "SnmpUtilAsnAnyFree" ( BYREF pAny AS AsnAny ) ' void
DECLARE FUNCTION SnmpUtilVarBindCpy LIB "snmpapi.dll" ALIAS "SnmpUtilVarBindCpy" ( BYREF pVbDst AS SnmpVarBind , BYREF pVbSrc AS SnmpVarBind ) AS LONG ' INT
DECLARE SUB SnmpUtilVarBindFree LIB "snmpapi.dll" ALIAS "SnmpUtilVarBindFree" ( BYREF pVb AS SnmpVarBind ) ' void
DECLARE FUNCTION SnmpUtilVarBindListCpy LIB "snmpapi.dll" ALIAS "SnmpUtilVarBindListCpy" ( BYREF pVblDst AS SnmpVarBindList , BYREF pVblSrc AS SnmpVarBindList ) AS LONG ' INT
DECLARE SUB SnmpUtilVarBindListFree LIB "snmpapi.dll" ALIAS "SnmpUtilVarBindListFree" ( BYREF pVbl AS SnmpVarBindList ) ' void
DECLARE SUB SnmpUtilMemFree LIB "snmpapi.dll" ALIAS "SnmpUtilMemFree" ( BYVAL pMem AS QUAD ) ' void
DECLARE FUNCTION SnmpUtilMemAlloc LIB "snmpapi.dll" ALIAS "SnmpUtilMemAlloc" ( BYVAL nBytes AS QUAD ) AS QUAD
DECLARE FUNCTION SnmpUtilMemReAlloc LIB "snmpapi.dll" ALIAS "SnmpUtilMemReAlloc" ( BYVAL pMem AS QUAD
 , BYVAL nBytes AS DWORD
 ) AS DWORD
DECLARE FUNCTION SnmpUtilOidToA LIB "snmpapi.dll" ALIAS "SnmpUtilOidToA" ( BYREF Oid AS AsnObjectIdentifier
 ) AS DWORD
DECLARE FUNCTION SnmpUtilIdsToA LIB "snmpapi.dll" ALIAS "SnmpUtilIdsToA" ( BYREF Ids AS DWORD
 , BYVAL IdLength AS DWORD
 ) AS DWORD
DECLARE SUB SnmpUtilPrintOid LIB "snmpapi.dll" ALIAS "SnmpUtilPrintOid" ( BYREF Oid AS AsnObjectIdentifier
 ) ' void
DECLARE SUB SnmpUtilPrintAsnAny LIB "snmpapi.dll" ALIAS "SnmpUtilPrintAsnAny" ( BYREF pAny AS AsnAny ) ' void
DECLARE FUNCTION SnmpSvcGetUptime LIB "snmpapi.dll" ALIAS "SnmpSvcGetUptime" ( ) AS QUAD
DECLARE SUB SnmpSvcSetLogLevel LIB "snmpapi.dll" ALIAS "SnmpSvcSetLogLevel" ( BYVAL nLogLevel AS LONG
 ) ' void
DECLARE SUB SnmpSvcSetLogType LIB "snmpapi.dll" ALIAS "SnmpSvcSetLogType" ( BYVAL nLogLevel AS LONG ) ' void
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Debugging Definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_LOG_SILENT = &H0
%EQUATE `SNMP_LOG_FATAL = &H1
%EQUATE `SNMP_LOG_ERROR = &H2
%EQUATE `SNMP_LOG_WARNING = &H3
%EQUATE `SNMP_LOG_TRACE = &H4
%EQUATE `SNMP_LOG_VERBOSE = &H5
%EQUATE `SNMP_OUTPUT_TO_CONSOLE = &H1
%EQUATE `SNMP_OUTPUT_TO_LOGFILE = &H2
%EQUATE `SNMP_OUTPUT_TO_EVENTLOG = &H4 ' // no longer supported
%EQUATE `SNMP_OUTPUT_TO_DEBUGGER = &H8
'///////////////////////////////////////////////////////////////////////////////
'// //
'// SNMP Debugging Prototypes //
'// //
'///////////////////////////////////////////////////////////////////////////////
'SNMP_FUNC_TYPE
'SnmpUtilDbgPrint(
' IN INT nLogLevel, // see log levels above...
' IN LPSTR szFormat,
' IN ...
' );
'#if DBG
'#define SNMPDBG(_x_) SnmpUtilDbgPrint _x_
'#else
'#define SNMPDBG(_x_)
'#endif
'///////////////////////////////////////////////////////////////////////////////
'// //
'// Miscellaneous definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
'#define DEFINE_SIZEOF(Array) (sizeof(Array)/sizeof((Array)[0]))
'#define DEFINE_OID(SubIdArray) {DEFINE_SIZEOF(SubIdArray),(SubIdArray)}
'#define DEFINE_NULLOID() {0,NULL}
'#define DEFINE_NULLOCTETS() {NULL,0,FALSE}
%EQUATE `DEFAULT_SNMP_PORT_UDP = 161
%EQUATE `DEFAULT_SNMP_PORT_IPX = 36879
%EQUATE `DEFAULT_SNMPTRAP_PORT_UDP = 162
%EQUATE `DEFAULT_SNMPTRAP_PORT_IPX = 36880
%EQUATE `SNMP_MAX_OID_LEN = 128
'///////////////////////////////////////////////////////////////////////////////
'// //
'// API Error Code Definitions //
'// //
'///////////////////////////////////////////////////////////////////////////////
%EQUATE `SNMP_MEM_ALLOC_ERROR = 1
%EQUATE `SNMP_BERAPI_INVALID_LENGTH = 10
%EQUATE `SNMP_BERAPI_INVALID_TAG = 11
%EQUATE `SNMP_BERAPI_OVERFLOW = 12
%EQUATE `SNMP_BERAPI_SHORT_BUFFER = 13
%EQUATE `SNMP_BERAPI_INVALID_OBJELEM = 14
%EQUATE `SNMP_PDUAPI_UNRECOGNIZED_PDU = 20
%EQUATE `SNMP_PDUAPI_INVALID_ES = 21
%EQUATE `SNMP_PDUAPI_INVALID_GT = 22
%EQUATE `SNMP_AUTHAPI_INVALID_VERSION = 30
%EQUATE `SNMP_AUTHAPI_INVALID_MSG_TYPE = 31
%EQUATE `SNMP_AUTHAPI_TRIV_AUTH_FAILED = 32
'///////////////////////////////////////////////////////////////////////////////
'// //
'// Support for old definitions (support disabled via SNMPSTRICT) //
'// //
'///////////////////////////////////////////////////////////////////////////////
'#IF NOT %DEF(%SNMPSTRICT)
'#define SNMP_oidcpy SnmpUtilOidCpy
'#define SNMP_oidappend SnmpUtilOidAppend
'#define SNMP_oidncmp SnmpUtilOidNCmp
'#define SNMP_oidcmp SnmpUtilOidCmp
'#define SNMP_oidfree SnmpUtilOidFree
'#define SNMP_CopyVarBindList SnmpUtilVarBindListCpy
'#define SNMP_FreeVarBindList SnmpUtilVarBindListFree
'#define SNMP_CopyVarBind SnmpUtilVarBindCpy
'#define SNMP_FreeVarBind SnmpUtilVarBindFree
'#define SNMP_printany SnmpUtilPrintAsnAny
'#define SNMP_free SnmpUtilMemFree
'#define SNMP_malloc SnmpUtilMemAlloc
'#define SNMP_realloc SnmpUtilMemReAlloc
'#define SNMP_DBG_free SnmpUtilMemFree
'#define SNMP_DBG_malloc SnmpUtilMemAlloc
'#define SNMP_DBG_realloc SnmpUtilMemReAlloc
'#define ASN_RFC1155_IPADDRESS ASN_IPADDRESS
'#define ASN_RFC1155_COUNTER ASN_COUNTER32
'#define ASN_RFC1155_GAUGE ASN_GAUGE32
'#define ASN_RFC1155_TIMETICKS ASN_TIMETICKS
'#define ASN_RFC1155_OPAQUE ASN_OPAQUE
'#define ASN_RFC1213_DISPSTRING ASN_OCTETSTRING
'#define ASN_RFC1157_GETREQUEST SNMP_PDU_GET
'#define ASN_RFC1157_GETNEXTREQUEST SNMP_PDU_GETNEXT
'#define ASN_RFC1157_GETRESPONSE SNMP_PDU_RESPONSE
'#define ASN_RFC1157_SETREQUEST SNMP_PDU_SET
'#define ASN_RFC1157_TRAP SNMP_PDU_V1TRAP
'#define ASN_CONTEXTSPECIFIC ASN_CONTEXT
'#define ASN_PRIMATIVE ASN_PRIMITIVE
'#define RFC1157VarBindList SnmpVarBindList
'#define RFC1157VarBind SnmpVarBind
'#define AsnInteger AsnInteger32
'#define AsnCounter AsnCounter32
'#define AsnGauge AsnGauge32
'#define ASN_UNSIGNED32 ASN_UINTEGER32
'#ENDIF ' // SNMPSTRICT
#IF NOT %DEF(%SNMPSTRICT)
%EQUATE `ASN_RFC1155_IPADDRESS = %ASN_IPADDRESS
%EQUATE `ASN_RFC1155_COUNTER = %ASN_COUNTER32
%EQUATE `ASN_RFC1155_GAUGE = %ASN_GAUGE32
%EQUATE `ASN_RFC1155_TIMETICKS = %ASN_TIMETICKS
%EQUATE `ASN_RFC1155_OPAQUE = %ASN_OPAQUE
%EQUATE `ASN_RFC1213_DISPSTRING = %ASN_OCTETSTRING
%EQUATE `ASN_RFC1157_GETREQUEST = %SNMP_PDU_GET
%EQUATE `ASN_RFC1157_GETNEXTREQUEST = %SNMP_PDU_GETNEXT
%EQUATE `ASN_RFC1157_GETRESPONSE = %SNMP_PDU_RESPONSE
%EQUATE `ASN_RFC1157_SETREQUEST = %SNMP_PDU_SET
%EQUATE `ASN_RFC1157_TRAP = %SNMP_PDU_V1TRAP
%EQUATE `ASN_CONTEXTSPECIFIC = %ASN_CONTEXT
%EQUATE `ASN_PRIMATIVE = %ASN_PRIMITIVE
MACRO RFC1157VarBindList = SnmpVarBindList
MACRO RFC1157VarBind = SnmpVarBind
%EQUATE `ASN_UNSIGNED32 = %ASN_UINTEGER32
#ENDIF
#ENDIF
