ReactOS 0.4.16-dev-983-g23ad936
snmp.h File Reference
#include <windows.h>
#include <pshpack4.h>
#include <poppack.h>
Include dependency graph for snmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AsnOctetString
 
struct  AsnObjectIdentifier
 
struct  AsnAny
 
struct  SnmpVarBind
 
struct  SnmpVarBindList
 

Macros

#define ASN_UNIVERSAL   0x00
 
#define ASN_APPLICATION   0x40
 
#define ASN_CONTEXT   0x80
 
#define ASN_PRIVATE   0xc0
 
#define ASN_PRIMITIVE   0x00
 
#define ASN_CONSTRUCTOR   0x20
 
#define SNMP_PDU_GET   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x00)
 
#define SNMP_PDU_GETNEXT   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x01)
 
#define SNMP_PDU_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x02)
 
#define SNMP_PDU_SET   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x03)
 
#define SNMP_PDU_V1TRAP   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x04)
 
#define SNMP_PDU_GETBULK   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x05)
 
#define SNMP_PDU_INFORM   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x06)
 
#define SNMP_PDU_TRAP   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x07)
 
#define ASN_INTEGER   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02)
 
#define ASN_BITS   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
 
#define ASN_OCTETSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
 
#define ASN_NULL   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05)
 
#define ASN_OBJECTIDENTIFIER   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06)
 
#define ASN_INTEGER32   ASN_INTEGER
 
#define ASN_SEQUENCE   (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)
 
#define ASN_SEQUENCEOF   ASN_SEQUENCE
 
#define ASN_IPADDRESS   (ASN_APPLICATION | ASN_PRIMITIVE | 0x00)
 
#define ASN_COUNTER32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x01)
 
#define ASN_GAUGE32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x02)
 
#define ASN_TIMETICKS   (ASN_APPLICATION | ASN_PRIMITIVE | 0x03)
 
#define ASN_OPAQUE   (ASN_APPLICATION | ASN_PRIMITIVE | 0x04)
 
#define ASN_COUNTER64   (ASN_APPLICATION | ASN_PRIMITIVE | 0x06)
 
#define ASN_UNSIGNED32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x07)
 
#define SNMP_EXCEPTION_NOSUCHOBJECT   (ASN_CONTEXT | ASN_PRIMITIVE | 0x00)
 
#define SNMP_EXCEPTION_NOSUCHINSTANCE   (ASN_CONTEXT | ASN_PRIMITIVE | 0x01)
 
#define SNMP_EXCEPTION_ENDOFMIBVIEW   (ASN_CONTEXT | ASN_PRIMITIVE | 0x02)
 
#define SNMP_EXTENSION_GET   SNMP_PDU_GET
 
#define SNMP_EXTENSION_GET_NEXT   SNMP_PDU_GETNEXT
 
#define SNMP_EXTENSION_GET_BULK   SNMP_PDU_GETBULK
 
#define SNMP_EXTENSION_SET_TEST   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0)
 
#define SNMP_EXTENSION_SET_COMMIT   SNMP_PDU_SET
 
#define SNMP_EXTENSION_SET_UNDO   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x1)
 
#define SNMP_EXTENSION_SET_CLEANUP   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x2)
 
#define SNMP_ERRORSTATUS_NOERROR   0
 
#define SNMP_ERRORSTATUS_TOOBIG   1
 
#define SNMP_ERRORSTATUS_NOSUCHNAME   2
 
#define SNMP_ERRORSTATUS_BADVALUE   3
 
#define SNMP_ERRORSTATUS_READONLY   4
 
#define SNMP_ERRORSTATUS_GENERR   5
 
#define SNMP_ERRORSTATUS_NOACCESS   6
 
#define SNMP_ERRORSTATUS_WRONGTYPE   7
 
#define SNMP_ERRORSTATUS_WRONGLENGTH   8
 
#define SNMP_ERRORSTATUS_WRONGENCODING   9
 
#define SNMP_ERRORSTATUS_WRONGVALUE   10
 
#define SNMP_ERRORSTATUS_NOCREATION   11
 
#define SNMP_ERRORSTATUS_INCONSISTENTVALUE   12
 
#define SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE   13
 
#define SNMP_ERRORSTATUS_COMMITFAILED   14
 
#define SNMP_ERRORSTATUS_UNDOFAILED   15
 
#define SNMP_ERRORSTATUS_AUTHORIZATIONERROR   16
 
#define SNMP_ERRORSTATUS_NOTWRITABLE   17
 
#define SNMP_ERRORSTATUS_INCONSISTENTNAME   18
 
#define SNMP_GENERICTRAP_COLDSTART   0
 
#define SNMP_GENERICTRAP_WARMSTART   1
 
#define SNMP_GENERICTRAP_LINKDOWN   2
 
#define SNMP_GENERICTRAP_LINKUP   3
 
#define SNMP_GENERICTRAP_AUTHFAILURE   4
 
#define SNMP_GENERICTRAP_EGPNEIGHLOSS   5
 
#define SNMP_GENERICTRAP_ENTERSPECIFIC   6
 
#define SNMP_ACCESS_NONE   0
 
#define SNMP_ACCESS_NOTIFY   1
 
#define SNMP_ACCESS_READ_ONLY   2
 
#define SNMP_ACCESS_READ_WRITE   3
 
#define SNMP_ACCESS_READ_CREATE   4
 
#define SNMP_LOG_SILENT   0
 
#define SNMP_LOG_FATAL   1
 
#define SNMP_LOG_ERROR   2
 
#define SNMP_LOG_WARNING   3
 
#define SNMP_LOG_TRACE   4
 
#define SNMP_LOG_VERBOSE   5
 
#define SNMP_OUTPUT_TO_CONSOLE   1
 
#define SNMP_OUTPUT_TO_LOGFILE   2
 
#define SNMP_OUTPUT_TO_EVENTLOG   4
 
#define SNMP_OUTPUT_TO_DEBUGGER   8
 
#define DEFINE_SIZEOF(x)   (sizeof(x)/sizeof((x)[0]))
 
#define DEFINE_OID(x)   { DEFINE_SIZEOF(x),(x) }
 
#define DEFINE_NULLOID()   { 0, NULL }
 
#define DEFINE_NULLOCTENTS()   { NULL, 0, FALSE }
 
#define DEFAULT_SNMP_PORT_UDP   161
 
#define DEFAULT_SNMP_PORT_IPX   36879
 
#define DEFAULT_SNMPTRAP_PORT_UDP   162
 
#define DEFAULT_SNMPTRAP_PORT_IPX   36880
 
#define SNMP_MAX_OID_LEN   128
 
#define SNMP_MEM_ALLOC_ERROR   0
 
#define SNMP_BERAPI_INVALID_LENGTH   10
 
#define SNMP_BERAPI_INVALID_TAG   11
 
#define SNMP_BERAPI_OVERFLOW   12
 
#define SNMP_BERAPI_SHORT_BUFFER   13
 
#define SNMP_BERAPI_INVALID_OBJELEM   14
 
#define SNMP_PDUAPI_UNRECOGNIZED_PDU   20
 
#define SNMP_PDUAPI_INVALID_ES   21
 
#define SNMP_PDUAPI_INVALID_GT   22
 
#define SNMP_AUTHAPI_INVALID_VERSION   30
 
#define SNMP_AUTHAPI_INVALID_MSG_TYPE   31
 
#define SNMP_AUTHAPI_TRIV_AUTH_FAILED   32
 
#define SNMPAPI_NOERROR   TRUE
 
#define SNMPAPI_ERROR   FALSE
 

Typedefs

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
 
typedef AsnObjectIdentifier AsnObjectName
 
typedef AsnAny AsnObjectSyntax
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONINIT) (DWORD dwUptimeReference, HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion)
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONINITEX) (AsnObjectIdentifier *pNextSupportedRegion)
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONMONITOR) (LPVOID pAgentMgmtData)
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONQUERY) (BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONQUERYEX) (UINT nRequestType, UINT nTransactionId, SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
 
typedef BOOL(WINAPIPFNSNMPEXTENSIONTRAP) (AsnObjectIdentifier *pEnterpriseOid, AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId, AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList)
 
typedef VOID(WINAPIPFNSNMPEXTENSIONCLOSE) (VOID)
 

Functions

BOOL WINAPI SnmpExtensionInit (DWORD dwUptimeReference, HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion)
 
BOOL WINAPI SnmpExtensionInitEx (AsnObjectIdentifier *pNextSupportedRegion)
 
BOOL WINAPI SnmpExtensionMonitor (LPVOID pAgentMgmtData)
 
BOOL WINAPI SnmpExtensionQuery (BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
 
BOOL WINAPI SnmpExtensionQueryEx (UINT nRequestType, UINT nTransactionId, SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
 
BOOL WINAPI SnmpExtensionTrap (AsnObjectIdentifier *pEnterpriseOid, AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId, AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList)
 
VOID WINAPI SnmpExtensionClose (VOID)
 
INT WINAPI SnmpUtilOidCpy (AsnObjectIdentifier *pOidDst, AsnObjectIdentifier *pOidSrc)
 
INT WINAPI SnmpUtilOidAppend (AsnObjectIdentifier *pOidDst, AsnObjectIdentifier *pOidSrc)
 
INT WINAPI SnmpUtilOidCmp (AsnObjectIdentifier *pOid1, AsnObjectIdentifier *pOid2)
 
INT WINAPI SnmpUtilOidNCmp (AsnObjectIdentifier *pOid1, AsnObjectIdentifier *pOid2, UINT nSubIds)
 
VOID WINAPI SnmpUtilOidFree (AsnObjectIdentifier *pOid)
 
INT WINAPI SnmpUtilOctetsCmp (AsnOctetString *pOctets1, AsnOctetString *pOctets2)
 
INT WINAPI SnmpUtilOctetsNCmp (AsnOctetString *pOctets1, AsnOctetString *pOctets2, UINT nChars)
 
INT WINAPI SnmpUtilOctetsCpy (AsnOctetString *pOctetsDst, AsnOctetString *pOctetsSrc)
 
VOID WINAPI SnmpUtilOctetsFree (AsnOctetString *pOctets)
 
INT WINAPI SnmpUtilAsnAnyCpy (AsnAny *pAnyDst, AsnAny *pAnySrc)
 
VOID WINAPI SnmpUtilAsnAnyFree (AsnAny *pAny)
 
INT WINAPI SnmpUtilVarBindCpy (SnmpVarBind *pVbDst, SnmpVarBind *pVbSrc)
 
VOID WINAPI SnmpUtilVarBindFree (SnmpVarBind *pVb)
 
INT WINAPI SnmpUtilVarBindListCpy (SnmpVarBindList *pVblDst, SnmpVarBindList *pVblSrc)
 
VOID WINAPI SnmpUtilVarBindListFree (SnmpVarBindList *pVbl)
 
LPVOID WINAPI SnmpUtilMemAlloc (UINT nBytes) __WINE_ALLOC_SIZE(1)
 
LPVOID WINAPI SnmpUtilMemReAlloc (LPVOID pMem, UINT nBytes) __WINE_ALLOC_SIZE(2)
 
VOID WINAPI SnmpUtilMemFree (LPVOID pMem)
 
LPSTR WINAPI SnmpUtilOidToA (AsnObjectIdentifier *Oid)
 
LPSTR WINAPI SnmpUtilIdsToA (UINT *Ids, UINT IdLength)
 
VOID WINAPI SnmpUtilPrintOid (AsnObjectIdentifier *Oid)
 
VOID WINAPI SnmpUtilPrintAsnAny (AsnAny *pAny)
 
DWORD WINAPI SnmpSvcGetUptime (VOID)
 
VOID WINAPI SnmpSvcSetLogLevel (INT nLogLevel)
 
VOID WINAPI SnmpSvcSetLogType (INT nLogType)
 
VOID WINAPIV SnmpUtilDbgPrint (INT nLogLevel, LPSTR szFormat,...)
 

Macro Definition Documentation

◆ ASN_APPLICATION

#define ASN_APPLICATION   0x40

Definition at line 88 of file snmp.h.

◆ ASN_BITS

#define ASN_BITS   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)

Definition at line 104 of file snmp.h.

◆ ASN_CONSTRUCTOR

#define ASN_CONSTRUCTOR   0x20

Definition at line 92 of file snmp.h.

◆ ASN_CONTEXT

#define ASN_CONTEXT   0x80

Definition at line 89 of file snmp.h.

◆ ASN_COUNTER32

#define ASN_COUNTER32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x01)

Definition at line 114 of file snmp.h.

◆ ASN_COUNTER64

#define ASN_COUNTER64   (ASN_APPLICATION | ASN_PRIMITIVE | 0x06)

Definition at line 118 of file snmp.h.

◆ ASN_GAUGE32

#define ASN_GAUGE32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x02)

Definition at line 115 of file snmp.h.

◆ ASN_INTEGER

#define ASN_INTEGER   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02)

Definition at line 103 of file snmp.h.

◆ ASN_INTEGER32

#define ASN_INTEGER32   ASN_INTEGER

Definition at line 108 of file snmp.h.

◆ ASN_IPADDRESS

#define ASN_IPADDRESS   (ASN_APPLICATION | ASN_PRIMITIVE | 0x00)

Definition at line 113 of file snmp.h.

◆ ASN_NULL

#define ASN_NULL   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05)

Definition at line 106 of file snmp.h.

◆ ASN_OBJECTIDENTIFIER

#define ASN_OBJECTIDENTIFIER   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06)

Definition at line 107 of file snmp.h.

◆ ASN_OCTETSTRING

#define ASN_OCTETSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)

Definition at line 105 of file snmp.h.

◆ ASN_OPAQUE

#define ASN_OPAQUE   (ASN_APPLICATION | ASN_PRIMITIVE | 0x04)

Definition at line 117 of file snmp.h.

◆ ASN_PRIMITIVE

#define ASN_PRIMITIVE   0x00

Definition at line 91 of file snmp.h.

◆ ASN_PRIVATE

#define ASN_PRIVATE   0xc0

Definition at line 90 of file snmp.h.

◆ ASN_SEQUENCE

#define ASN_SEQUENCE   (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)

Definition at line 110 of file snmp.h.

◆ ASN_SEQUENCEOF

#define ASN_SEQUENCEOF   ASN_SEQUENCE

Definition at line 111 of file snmp.h.

◆ ASN_TIMETICKS

#define ASN_TIMETICKS   (ASN_APPLICATION | ASN_PRIMITIVE | 0x03)

Definition at line 116 of file snmp.h.

◆ ASN_UNIVERSAL

#define ASN_UNIVERSAL   0x00

Definition at line 87 of file snmp.h.

◆ ASN_UNSIGNED32

#define ASN_UNSIGNED32   (ASN_APPLICATION | ASN_PRIMITIVE | 0x07)

Definition at line 119 of file snmp.h.

◆ DEFAULT_SNMP_PORT_IPX

#define DEFAULT_SNMP_PORT_IPX   36879

Definition at line 185 of file snmp.h.

◆ DEFAULT_SNMP_PORT_UDP

#define DEFAULT_SNMP_PORT_UDP   161

Definition at line 184 of file snmp.h.

◆ DEFAULT_SNMPTRAP_PORT_IPX

#define DEFAULT_SNMPTRAP_PORT_IPX   36880

Definition at line 187 of file snmp.h.

◆ DEFAULT_SNMPTRAP_PORT_UDP

#define DEFAULT_SNMPTRAP_PORT_UDP   162

Definition at line 186 of file snmp.h.

◆ DEFINE_NULLOCTENTS

#define DEFINE_NULLOCTENTS ( )    { NULL, 0, FALSE }

Definition at line 182 of file snmp.h.

◆ DEFINE_NULLOID

#define DEFINE_NULLOID ( )    { 0, NULL }

Definition at line 181 of file snmp.h.

◆ DEFINE_OID

#define DEFINE_OID (   x)    { DEFINE_SIZEOF(x),(x) }

Definition at line 180 of file snmp.h.

◆ DEFINE_SIZEOF

#define DEFINE_SIZEOF (   x)    (sizeof(x)/sizeof((x)[0]))

Definition at line 179 of file snmp.h.

◆ SNMP_ACCESS_NONE

#define SNMP_ACCESS_NONE   0

Definition at line 161 of file snmp.h.

◆ SNMP_ACCESS_NOTIFY

#define SNMP_ACCESS_NOTIFY   1

Definition at line 162 of file snmp.h.

◆ SNMP_ACCESS_READ_CREATE

#define SNMP_ACCESS_READ_CREATE   4

Definition at line 165 of file snmp.h.

◆ SNMP_ACCESS_READ_ONLY

#define SNMP_ACCESS_READ_ONLY   2

Definition at line 163 of file snmp.h.

◆ SNMP_ACCESS_READ_WRITE

#define SNMP_ACCESS_READ_WRITE   3

Definition at line 164 of file snmp.h.

◆ SNMP_AUTHAPI_INVALID_MSG_TYPE

#define SNMP_AUTHAPI_INVALID_MSG_TYPE   31

Definition at line 201 of file snmp.h.

◆ SNMP_AUTHAPI_INVALID_VERSION

#define SNMP_AUTHAPI_INVALID_VERSION   30

Definition at line 200 of file snmp.h.

◆ SNMP_AUTHAPI_TRIV_AUTH_FAILED

#define SNMP_AUTHAPI_TRIV_AUTH_FAILED   32

Definition at line 202 of file snmp.h.

◆ SNMP_BERAPI_INVALID_LENGTH

#define SNMP_BERAPI_INVALID_LENGTH   10

Definition at line 192 of file snmp.h.

◆ SNMP_BERAPI_INVALID_OBJELEM

#define SNMP_BERAPI_INVALID_OBJELEM   14

Definition at line 196 of file snmp.h.

◆ SNMP_BERAPI_INVALID_TAG

#define SNMP_BERAPI_INVALID_TAG   11

Definition at line 193 of file snmp.h.

◆ SNMP_BERAPI_OVERFLOW

#define SNMP_BERAPI_OVERFLOW   12

Definition at line 194 of file snmp.h.

◆ SNMP_BERAPI_SHORT_BUFFER

#define SNMP_BERAPI_SHORT_BUFFER   13

Definition at line 195 of file snmp.h.

◆ SNMP_ERRORSTATUS_AUTHORIZATIONERROR

#define SNMP_ERRORSTATUS_AUTHORIZATIONERROR   16

Definition at line 149 of file snmp.h.

◆ SNMP_ERRORSTATUS_BADVALUE

#define SNMP_ERRORSTATUS_BADVALUE   3

Definition at line 136 of file snmp.h.

◆ SNMP_ERRORSTATUS_COMMITFAILED

#define SNMP_ERRORSTATUS_COMMITFAILED   14

Definition at line 147 of file snmp.h.

◆ SNMP_ERRORSTATUS_GENERR

#define SNMP_ERRORSTATUS_GENERR   5

Definition at line 138 of file snmp.h.

◆ SNMP_ERRORSTATUS_INCONSISTENTNAME

#define SNMP_ERRORSTATUS_INCONSISTENTNAME   18

Definition at line 151 of file snmp.h.

◆ SNMP_ERRORSTATUS_INCONSISTENTVALUE

#define SNMP_ERRORSTATUS_INCONSISTENTVALUE   12

Definition at line 145 of file snmp.h.

◆ SNMP_ERRORSTATUS_NOACCESS

#define SNMP_ERRORSTATUS_NOACCESS   6

Definition at line 139 of file snmp.h.

◆ SNMP_ERRORSTATUS_NOCREATION

#define SNMP_ERRORSTATUS_NOCREATION   11

Definition at line 144 of file snmp.h.

◆ SNMP_ERRORSTATUS_NOERROR

#define SNMP_ERRORSTATUS_NOERROR   0

Definition at line 133 of file snmp.h.

◆ SNMP_ERRORSTATUS_NOSUCHNAME

#define SNMP_ERRORSTATUS_NOSUCHNAME   2

Definition at line 135 of file snmp.h.

◆ SNMP_ERRORSTATUS_NOTWRITABLE

#define SNMP_ERRORSTATUS_NOTWRITABLE   17

Definition at line 150 of file snmp.h.

◆ SNMP_ERRORSTATUS_READONLY

#define SNMP_ERRORSTATUS_READONLY   4

Definition at line 137 of file snmp.h.

◆ SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE

#define SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE   13

Definition at line 146 of file snmp.h.

◆ SNMP_ERRORSTATUS_TOOBIG

#define SNMP_ERRORSTATUS_TOOBIG   1

Definition at line 134 of file snmp.h.

◆ SNMP_ERRORSTATUS_UNDOFAILED

#define SNMP_ERRORSTATUS_UNDOFAILED   15

Definition at line 148 of file snmp.h.

◆ SNMP_ERRORSTATUS_WRONGENCODING

#define SNMP_ERRORSTATUS_WRONGENCODING   9

Definition at line 142 of file snmp.h.

◆ SNMP_ERRORSTATUS_WRONGLENGTH

#define SNMP_ERRORSTATUS_WRONGLENGTH   8

Definition at line 141 of file snmp.h.

◆ SNMP_ERRORSTATUS_WRONGTYPE

#define SNMP_ERRORSTATUS_WRONGTYPE   7

Definition at line 140 of file snmp.h.

◆ SNMP_ERRORSTATUS_WRONGVALUE

#define SNMP_ERRORSTATUS_WRONGVALUE   10

Definition at line 143 of file snmp.h.

◆ SNMP_EXCEPTION_ENDOFMIBVIEW

#define SNMP_EXCEPTION_ENDOFMIBVIEW   (ASN_CONTEXT | ASN_PRIMITIVE | 0x02)

Definition at line 123 of file snmp.h.

◆ SNMP_EXCEPTION_NOSUCHINSTANCE

#define SNMP_EXCEPTION_NOSUCHINSTANCE   (ASN_CONTEXT | ASN_PRIMITIVE | 0x01)

Definition at line 122 of file snmp.h.

◆ SNMP_EXCEPTION_NOSUCHOBJECT

#define SNMP_EXCEPTION_NOSUCHOBJECT   (ASN_CONTEXT | ASN_PRIMITIVE | 0x00)

Definition at line 121 of file snmp.h.

◆ SNMP_EXTENSION_GET

#define SNMP_EXTENSION_GET   SNMP_PDU_GET

Definition at line 125 of file snmp.h.

◆ SNMP_EXTENSION_GET_BULK

#define SNMP_EXTENSION_GET_BULK   SNMP_PDU_GETBULK

Definition at line 127 of file snmp.h.

◆ SNMP_EXTENSION_GET_NEXT

#define SNMP_EXTENSION_GET_NEXT   SNMP_PDU_GETNEXT

Definition at line 126 of file snmp.h.

◆ SNMP_EXTENSION_SET_CLEANUP

#define SNMP_EXTENSION_SET_CLEANUP   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x2)

Definition at line 131 of file snmp.h.

◆ SNMP_EXTENSION_SET_COMMIT

#define SNMP_EXTENSION_SET_COMMIT   SNMP_PDU_SET

Definition at line 129 of file snmp.h.

◆ SNMP_EXTENSION_SET_TEST

#define SNMP_EXTENSION_SET_TEST   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0)

Definition at line 128 of file snmp.h.

◆ SNMP_EXTENSION_SET_UNDO

#define SNMP_EXTENSION_SET_UNDO   (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x1)

Definition at line 130 of file snmp.h.

◆ SNMP_GENERICTRAP_AUTHFAILURE

#define SNMP_GENERICTRAP_AUTHFAILURE   4

Definition at line 157 of file snmp.h.

◆ SNMP_GENERICTRAP_COLDSTART

#define SNMP_GENERICTRAP_COLDSTART   0

Definition at line 153 of file snmp.h.

◆ SNMP_GENERICTRAP_EGPNEIGHLOSS

#define SNMP_GENERICTRAP_EGPNEIGHLOSS   5

Definition at line 158 of file snmp.h.

◆ SNMP_GENERICTRAP_ENTERSPECIFIC

#define SNMP_GENERICTRAP_ENTERSPECIFIC   6

Definition at line 159 of file snmp.h.

◆ SNMP_GENERICTRAP_LINKDOWN

#define SNMP_GENERICTRAP_LINKDOWN   2

Definition at line 155 of file snmp.h.

◆ SNMP_GENERICTRAP_LINKUP

#define SNMP_GENERICTRAP_LINKUP   3

Definition at line 156 of file snmp.h.

◆ SNMP_GENERICTRAP_WARMSTART

#define SNMP_GENERICTRAP_WARMSTART   1

Definition at line 154 of file snmp.h.

◆ SNMP_LOG_ERROR

#define SNMP_LOG_ERROR   2

Definition at line 169 of file snmp.h.

◆ SNMP_LOG_FATAL

#define SNMP_LOG_FATAL   1

Definition at line 168 of file snmp.h.

◆ SNMP_LOG_SILENT

#define SNMP_LOG_SILENT   0

Definition at line 167 of file snmp.h.

◆ SNMP_LOG_TRACE

#define SNMP_LOG_TRACE   4

Definition at line 171 of file snmp.h.

◆ SNMP_LOG_VERBOSE

#define SNMP_LOG_VERBOSE   5

Definition at line 172 of file snmp.h.

◆ SNMP_LOG_WARNING

#define SNMP_LOG_WARNING   3

Definition at line 170 of file snmp.h.

◆ SNMP_MAX_OID_LEN

#define SNMP_MAX_OID_LEN   128

Definition at line 189 of file snmp.h.

◆ SNMP_MEM_ALLOC_ERROR

#define SNMP_MEM_ALLOC_ERROR   0

Definition at line 191 of file snmp.h.

◆ SNMP_OUTPUT_TO_CONSOLE

#define SNMP_OUTPUT_TO_CONSOLE   1

Definition at line 174 of file snmp.h.

◆ SNMP_OUTPUT_TO_DEBUGGER

#define SNMP_OUTPUT_TO_DEBUGGER   8

Definition at line 177 of file snmp.h.

◆ SNMP_OUTPUT_TO_EVENTLOG

#define SNMP_OUTPUT_TO_EVENTLOG   4

Definition at line 176 of file snmp.h.

◆ SNMP_OUTPUT_TO_LOGFILE

#define SNMP_OUTPUT_TO_LOGFILE   2

Definition at line 175 of file snmp.h.

◆ SNMP_PDU_GET

#define SNMP_PDU_GET   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x00)

Definition at line 94 of file snmp.h.

◆ SNMP_PDU_GETBULK

#define SNMP_PDU_GETBULK   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x05)

Definition at line 99 of file snmp.h.

◆ SNMP_PDU_GETNEXT

#define SNMP_PDU_GETNEXT   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x01)

Definition at line 95 of file snmp.h.

◆ SNMP_PDU_INFORM

#define SNMP_PDU_INFORM   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x06)

Definition at line 100 of file snmp.h.

◆ SNMP_PDU_RESPONSE

#define SNMP_PDU_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x02)

Definition at line 96 of file snmp.h.

◆ SNMP_PDU_SET

#define SNMP_PDU_SET   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x03)

Definition at line 97 of file snmp.h.

◆ SNMP_PDU_TRAP

#define SNMP_PDU_TRAP   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x07)

Definition at line 101 of file snmp.h.

◆ SNMP_PDU_V1TRAP

#define SNMP_PDU_V1TRAP   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x04)

Definition at line 98 of file snmp.h.

◆ SNMP_PDUAPI_INVALID_ES

#define SNMP_PDUAPI_INVALID_ES   21

Definition at line 198 of file snmp.h.

◆ SNMP_PDUAPI_INVALID_GT

#define SNMP_PDUAPI_INVALID_GT   22

Definition at line 199 of file snmp.h.

◆ SNMP_PDUAPI_UNRECOGNIZED_PDU

#define SNMP_PDUAPI_UNRECOGNIZED_PDU   20

Definition at line 197 of file snmp.h.

◆ SNMPAPI_ERROR

#define SNMPAPI_ERROR   FALSE

Definition at line 205 of file snmp.h.

◆ SNMPAPI_NOERROR

#define SNMPAPI_NOERROR   TRUE

Definition at line 204 of file snmp.h.

Typedef Documentation

◆ AsnBits

Definition at line 46 of file snmp.h.

◆ AsnCounter32

Definition at line 43 of file snmp.h.

◆ AsnCounter64

Definition at line 42 of file snmp.h.

◆ AsnDisplayString

Definition at line 51 of file snmp.h.

◆ AsnGauge32

Definition at line 44 of file snmp.h.

◆ AsnImplicitSequence

Definition at line 48 of file snmp.h.

◆ AsnInteger32

typedef LONG AsnInteger32

Definition at line 40 of file snmp.h.

◆ AsnIPAddress

Definition at line 49 of file snmp.h.

◆ AsnNetworkAddress

Definition at line 50 of file snmp.h.

◆ AsnObjectName

Definition at line 72 of file snmp.h.

◆ AsnObjectSyntax

Definition at line 73 of file snmp.h.

◆ AsnOpaque

Definition at line 52 of file snmp.h.

◆ AsnSequence

Definition at line 47 of file snmp.h.

◆ AsnTimeticks

Definition at line 45 of file snmp.h.

◆ AsnUnsigned32

Definition at line 41 of file snmp.h.

◆ PFNSNMPEXTENSIONCLOSE

typedef VOID(WINAPI * PFNSNMPEXTENSIONCLOSE) (VOID)

Definition at line 248 of file snmp.h.

◆ PFNSNMPEXTENSIONINIT

typedef BOOL(WINAPI * PFNSNMPEXTENSIONINIT) (DWORD dwUptimeReference, HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion)

Definition at line 229 of file snmp.h.

◆ PFNSNMPEXTENSIONINITEX

typedef BOOL(WINAPI * PFNSNMPEXTENSIONINITEX) (AsnObjectIdentifier *pNextSupportedRegion)

Definition at line 231 of file snmp.h.

◆ PFNSNMPEXTENSIONMONITOR

typedef BOOL(WINAPI * PFNSNMPEXTENSIONMONITOR) (LPVOID pAgentMgmtData)

Definition at line 234 of file snmp.h.

◆ PFNSNMPEXTENSIONQUERY

typedef BOOL(WINAPI * PFNSNMPEXTENSIONQUERY) (BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)

Definition at line 236 of file snmp.h.

◆ PFNSNMPEXTENSIONQUERYEX

typedef BOOL(WINAPI * PFNSNMPEXTENSIONQUERYEX) (UINT nRequestType, UINT nTransactionId, SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)

Definition at line 239 of file snmp.h.

◆ PFNSNMPEXTENSIONTRAP

typedef BOOL(WINAPI * PFNSNMPEXTENSIONTRAP) (AsnObjectIdentifier *pEnterpriseOid, AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId, AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList)

Definition at line 244 of file snmp.h.

Function Documentation

◆ SnmpExtensionClose()

VOID WINAPI SnmpExtensionClose ( VOID  )

◆ SnmpExtensionInit()

BOOL WINAPI SnmpExtensionInit ( DWORD  dwUptimeReference,
HANDLE phSubagentTrapEvent,
AsnObjectIdentifier pFirstSupportedRegion 
)

Definition at line 1313 of file main.c.

1315{
1317 UINT i;
1318
1319 TRACE("(%d, %p, %p)\n", dwUptimeReference, phSubagentTrapEvent,
1320 pFirstSupportedRegion);
1321
1323 for (i = 0; i < ARRAY_SIZE(supportedIDs); i++)
1324 {
1325 if (supportedIDs[i].init)
1326 supportedIDs[i].init();
1327 if (supportedIDs[i].name.idLength < minSupportedIDLength)
1328 minSupportedIDLength = supportedIDs[i].name.idLength;
1329 }
1330 *phSubagentTrapEvent = NULL;
1331 SnmpUtilOidCpy(pFirstSupportedRegion, &myOid);
1332 return TRUE;
1333}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static UINT minSupportedIDLength
Definition: main.c:1308
static struct mibImplementation supportedIDs[]
Definition: main.c:1292
static UINT mib2System[]
Definition: main.c:84
INT WINAPI SnmpUtilOidCpy(AsnObjectIdentifier *dst, AsnObjectIdentifier *src)
Definition: main.c:321
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UINT_MAX
Definition: intsafe.h:152
unsigned int UINT
Definition: ndis.h:50
#define DEFINE_OID(x)
Definition: snmp.h:180
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39
static int init
Definition: wintirpc.c:33

◆ SnmpExtensionInitEx()

BOOL WINAPI SnmpExtensionInitEx ( AsnObjectIdentifier pNextSupportedRegion)

◆ SnmpExtensionMonitor()

BOOL WINAPI SnmpExtensionMonitor ( LPVOID  pAgentMgmtData)

◆ SnmpExtensionQuery()

BOOL WINAPI SnmpExtensionQuery ( BYTE  bPduType,
SnmpVarBindList pVarBindList,
AsnInteger32 pErrorStatus,
AsnInteger32 pErrorIndex 
)

Definition at line 1372 of file main.c.

1374{
1377 UINT i;
1378 BOOL ret = TRUE;
1379
1380 TRACE("(0x%02x, %p, %p, %p)\n", bPduType, pVarBindList,
1381 pErrorStatus, pErrorIndex);
1382
1383 for (i = 0; !error && i < pVarBindList->len; i++)
1384 {
1385 /* Ignore any OIDs not in MIB2 */
1386 if (!SnmpUtilOidNCmp(&pVarBindList->list[i].name, &mib2oid,
1387 mib2oid.idLength))
1388 {
1389 struct mibImplementation *impl = NULL;
1390 UINT len, matchingIndex = 0;
1391
1392 TRACE("%s\n", SnmpUtilOidToA(&pVarBindList->list[i].name));
1393 /* Search for an implementation matching as many octets as possible
1394 */
1395 for (len = pVarBindList->list[i].name.idLength;
1396 len >= minSupportedIDLength && !impl; len--)
1397 impl = findSupportedQuery(pVarBindList->list[i].name.ids, len,
1398 &matchingIndex);
1399 if (impl && impl->query)
1400 ret = impl->query(bPduType, &pVarBindList->list[i], &error);
1401 else
1404 bPduType == SNMP_PDU_GETNEXT)
1405 {
1406 /* GetNext is special: it finds the successor to the given OID,
1407 * so we have to continue until an implementation handles the
1408 * query or we exhaust the table of supported OIDs.
1409 */
1410 for (matchingIndex++; error == SNMP_ERRORSTATUS_NOSUCHNAME &&
1411 matchingIndex < DEFINE_SIZEOF(supportedIDs);
1412 matchingIndex++)
1413 {
1415 impl = &supportedIDs[matchingIndex];
1416 if (impl->query)
1417 ret = impl->query(bPduType, &pVarBindList->list[i],
1418 &error);
1419 else
1421 }
1422 /* If the query still isn't resolved, set the OID to the
1423 * successor to the last entry in the table.
1424 */
1426 {
1427 SnmpUtilOidFree(&pVarBindList->list[i].name);
1428 ret = SnmpUtilOidCpy(&pVarBindList->list[i].name,
1429 &supportedIDs[matchingIndex - 1].name);
1430 pVarBindList->list[i].name.ids[
1431 pVarBindList->list[i].name.idLength - 1] += 1;
1432 }
1433 }
1434 if (error)
1435 errorIndex = i + 1;
1436 }
1437 }
1438 *pErrorStatus = error;
1439 *pErrorIndex = errorIndex;
1440 return ret;
1441}
static UINT mib2[]
Definition: main.c:83
static struct mibImplementation * findSupportedQuery(UINT *ids, UINT idLength, UINT *matchingIndex)
Definition: main.c:1344
INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *oid1, AsnObjectIdentifier *oid2, UINT count)
Definition: main.c:360
VOID WINAPI SnmpUtilOidFree(AsnObjectIdentifier *oid)
Definition: main.c:346
LPSTR WINAPI SnmpUtilOidToA(AsnObjectIdentifier *oid)
Definition: main.c:536
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
#define error(str)
Definition: mkdosfs.c:1605
#define SNMP_ERRORSTATUS_NOSUCHNAME
Definition: snmp.h:135
#define SNMP_PDU_GETNEXT
Definition: snmp.h:95
LONG AsnInteger32
Definition: snmp.h:40
#define SNMP_ERRORSTATUS_NOERROR
Definition: snmp.h:133
#define DEFINE_SIZEOF(x)
Definition: snmp.h:179
UINT * ids
Definition: snmp.h:37
SnmpVarBind * list
Definition: snmp.h:81
UINT len
Definition: snmp.h:82
AsnObjectName name
Definition: snmp.h:76
varqueryfunc query
Definition: main.c:93
int ret

◆ SnmpExtensionQueryEx()

BOOL WINAPI SnmpExtensionQueryEx ( UINT  nRequestType,
UINT  nTransactionId,
SnmpVarBindList pVarBindList,
AsnOctetString pContextInfo,
AsnInteger32 pErrorStatus,
AsnInteger32 pErrorIndex 
)

◆ SnmpExtensionTrap()

BOOL WINAPI SnmpExtensionTrap ( AsnObjectIdentifier pEnterpriseOid,
AsnInteger32 pGenericTrapId,
AsnInteger32 pSpecificTrapId,
AsnTimeticks pTimeStamp,
SnmpVarBindList pVarBindList 
)

◆ SnmpSvcGetUptime()

DWORD WINAPI SnmpSvcGetUptime ( VOID  )

Definition at line 147 of file main.c.

148{
150
151 return (now - startTime) / 10;
152}
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
static ULONGLONG startTime
Definition: main.c:113
time_t now
Definition: finger.c:65
uint64_t ULONGLONG
Definition: typedefs.h:67

◆ SnmpSvcSetLogLevel()

VOID WINAPI SnmpSvcSetLogLevel ( INT  nLogLevel)

◆ SnmpSvcSetLogType()

VOID WINAPI SnmpSvcSetLogType ( INT  nLogType)

◆ SnmpUtilAsnAnyCpy()

INT WINAPI SnmpUtilAsnAnyCpy ( AsnAny pAnyDst,
AsnAny pAnySrc 
)

Definition at line 199 of file main.c.

200{
201 TRACE("(%p, %p)\n", dst, src);
202 return asn_any_copy(dst, src);
203}
static INT asn_any_copy(AsnAny *dst, const AsnAny *src)
Definition: main.c:33
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by InitFunctionPtrs(), and setStringValue().

◆ SnmpUtilAsnAnyFree()

VOID WINAPI SnmpUtilAsnAnyFree ( AsnAny pAny)

Definition at line 208 of file main.c.

209{
210 TRACE("(%p)\n", any);
211 asn_any_free(any);
212}
static void asn_any_free(AsnAny *any)
Definition: main.c:85

Referenced by InitFunctionPtrs().

◆ SnmpUtilDbgPrint()

VOID WINAPIV SnmpUtilDbgPrint ( INT  nLogLevel,
LPSTR  szFormat,
  ... 
)

Definition at line 164 of file main.c.

165{
166 FIXME("(%d, %s)\n", loglevel, debugstr_a(format));
167}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define debugstr_a
Definition: kernel32.h:31
Definition: format.c:58

◆ SnmpUtilIdsToA()

LPSTR WINAPI SnmpUtilIdsToA ( UINT Ids,
UINT  IdLength 
)

Definition at line 499 of file main.c.

500{
501 static char one[10], oid[514], null_oid[] = "<null oid>";
502 unsigned int i, len, left = sizeof(oid) - 1;
503
504 TRACE("(%p, %d)\n", ids, length);
505
506 if (!ids || !length) return null_oid;
507
508 *oid = 0;
509 for (i = 0; i < length; i++)
510 {
511 sprintf(one, "%d", ids[i]);
512 len = strlen(one);
513 if (left >= len)
514 {
515 strcat(oid, one);
516 left -= len;
517 }
518 else return oid;
519
520 if (i < length - 1)
521 {
522 if (left > 0)
523 {
524 strcat(oid, ".");
525 left--;
526 }
527 else return oid;
528 }
529 }
530 return oid;
531}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint * ids
Definition: glext.h:5907
GLint left
Definition: glext.h:7726
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define sprintf(buf, format,...)
Definition: sprintf.c:55
strcat
Definition: string.h:92
int one
Definition: sehframes.cpp:28

Referenced by SnmpUtilOidToA().

◆ SnmpUtilMemAlloc()

LPVOID WINAPI SnmpUtilMemAlloc ( UINT  nBytes)

Definition at line 172 of file main.c.

173{
174 TRACE("(%d)\n", nbytes);
175 return HeapAlloc(GetProcessHeap(), 0, nbytes);
176}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733

Referenced by test_SnmpUtilOidAppend().

◆ SnmpUtilMemFree()

VOID WINAPI SnmpUtilMemFree ( LPVOID  pMem)

Definition at line 190 of file main.c.

191{
192 TRACE("(%p)\n", mem);
194}
#define HeapFree(x, y, z)
Definition: compat.h:735
Definition: mem.c:349

◆ SnmpUtilMemReAlloc()

LPVOID WINAPI SnmpUtilMemReAlloc ( LPVOID  pMem,
UINT  nBytes 
)

Definition at line 181 of file main.c.

182{
183 TRACE("(%p, %d)\n", mem, nbytes);
184 return HeapReAlloc(GetProcessHeap(), 0, mem, nbytes);
185}
#define HeapReAlloc
Definition: compat.h:734

◆ SnmpUtilOctetsCmp()

INT WINAPI SnmpUtilOctetsCmp ( AsnOctetString pOctets1,
AsnOctetString pOctets2 
)

Definition at line 278 of file main.c.

279{
280 TRACE("(%p, %p)\n", octets1, octets2);
281
282 if (octets1->length < octets2->length) return -1;
283 if (octets1->length > octets2->length) return 1;
284
285 return SnmpUtilOctetsNCmp(octets1, octets2, octets1->length);
286}
INT WINAPI SnmpUtilOctetsNCmp(AsnOctetString *octets1, AsnOctetString *octets2, UINT count)
Definition: main.c:260

Referenced by InitFunctionPtrs().

◆ SnmpUtilOctetsCpy()

INT WINAPI SnmpUtilOctetsCpy ( AsnOctetString pOctetsDst,
AsnOctetString pOctetsSrc 
)

Definition at line 217 of file main.c.

218{
219 TRACE("(%p, %p)\n", dst, src);
220
221 if (!dst) return SNMPAPI_ERROR;
222 if (!src)
223 {
224 dst->dynamic = FALSE;
225 dst->length = 0;
226 dst->stream = NULL;
227 return SNMPAPI_NOERROR;
228 }
229 if ((dst->stream = HeapAlloc(GetProcessHeap(), 0, src->length)))
230 {
231 unsigned int i;
232
233 dst->dynamic = TRUE;
234 dst->length = src->length;
235 for (i = 0; i < dst->length; i++) dst->stream[i] = src->stream[i];
236 return SNMPAPI_NOERROR;
237 }
238 return SNMPAPI_ERROR;
239}
#define FALSE
Definition: types.h:117
#define SNMPAPI_ERROR
Definition: snmp.h:205
#define SNMPAPI_NOERROR
Definition: snmp.h:204

Referenced by InitFunctionPtrs().

◆ SnmpUtilOctetsFree()

VOID WINAPI SnmpUtilOctetsFree ( AsnOctetString pOctets)

Definition at line 244 of file main.c.

245{
246 TRACE("(%p)\n", octets);
247
248 if (octets)
249 {
250 octets->length = 0;
251 if (octets->dynamic) HeapFree(GetProcessHeap(), 0, octets->stream);
252 octets->stream = NULL;
253 octets->dynamic = FALSE;
254 }
255}

Referenced by InitFunctionPtrs().

◆ SnmpUtilOctetsNCmp()

INT WINAPI SnmpUtilOctetsNCmp ( AsnOctetString pOctets1,
AsnOctetString pOctets2,
UINT  nChars 
)

Definition at line 260 of file main.c.

261{
262 INT ret;
263 unsigned int i;
264
265 TRACE("(%p, %p, %d)\n", octets1, octets2, count);
266
267 if (!octets1 || !octets2) return 0;
268
269 for (i = 0; i < count; i++)
270 if ((ret = octets1->stream[i] - octets2->stream[i])) return ret;
271
272 return 0;
273}
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:58

Referenced by InitFunctionPtrs(), and SnmpUtilOctetsCmp().

◆ SnmpUtilOidAppend()

INT WINAPI SnmpUtilOidAppend ( AsnObjectIdentifier pOidDst,
AsnObjectIdentifier pOidSrc 
)

Definition at line 291 of file main.c.

292{
293 UINT *ids, i, size;
294
295 TRACE("(%p, %p)\n", dst, src);
296
297 if (!dst) return SNMPAPI_ERROR;
298 if (!src) return SNMPAPI_NOERROR;
299
300 size = (src->idLength + dst->idLength) * sizeof(UINT);
301 if (!(ids = HeapReAlloc(GetProcessHeap(), 0, dst->ids, size)))
302 {
303 if (!(ids = HeapAlloc(GetProcessHeap(), 0, size)))
304 {
306 return SNMPAPI_ERROR;
307 }
308 else memcpy(ids, dst->ids, dst->idLength * sizeof(UINT));
309 }
310
311 for (i = 0; i < src->idLength; i++) ids[i + dst->idLength] = src->ids[i];
312 dst->idLength = dst->idLength + src->idLength;
313 dst->ids = ids;
314
315 return SNMPAPI_NOERROR;
316}
#define SetLastError(x)
Definition: compat.h:752
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define SNMP_MEM_ALLOC_ERROR
Definition: snmp.h:191

Referenced by mib2UdpEntryQuery(), setOidWithItem(), setOidWithItemAndInteger(), setOidWithItemAndIpAddr(), and test_SnmpUtilOidAppend().

◆ SnmpUtilOidCmp()

INT WINAPI SnmpUtilOidCmp ( AsnObjectIdentifier pOid1,
AsnObjectIdentifier pOid2 
)

Definition at line 384 of file main.c.

385{
386 TRACE("(%p, %p)\n", oid1, oid2);
387
388 if (oid1->idLength < oid2->idLength) return -1;
389 if (oid1->idLength > oid2->idLength) return 1;
390
391 return SnmpUtilOidNCmp(oid1, oid2, oid1->idLength);
392}
static char oid1[]
Definition: encode.c:7583

Referenced by test_SnmpUtilOidCmp(), and testQuery().

◆ SnmpUtilOidCpy()

INT WINAPI SnmpUtilOidCpy ( AsnObjectIdentifier pOidDst,
AsnObjectIdentifier pOidSrc 
)

Definition at line 321 of file main.c.

322{
323 TRACE("(%p, %p)\n", dst, src);
324
325 if (!dst) return SNMPAPI_ERROR;
326 if (!src)
327 {
328 dst->idLength = 0;
329 dst->ids = NULL;
330 return SNMPAPI_NOERROR;
331 }
332 if ((dst->ids = HeapAlloc(GetProcessHeap(), 0, src->idLength * sizeof(UINT))))
333 {
334 unsigned int i;
335
336 dst->idLength = src->idLength;
337 for (i = 0; i < dst->idLength; i++) dst->ids[i] = src->ids[i];
338 return SNMPAPI_NOERROR;
339 }
340 return SNMPAPI_ERROR;
341}

Referenced by mib2IfNumberQuery(), setOidWithItem(), SnmpExtensionInit(), SnmpExtensionQuery(), test_SnmpUtilOidCpyFree(), and testQuery().

◆ SnmpUtilOidFree()

VOID WINAPI SnmpUtilOidFree ( AsnObjectIdentifier pOid)

Definition at line 346 of file main.c.

347{
348 TRACE("(%p)\n", oid);
349
350 if (!oid) return;
351
352 oid->idLength = 0;
353 HeapFree(GetProcessHeap(), 0, oid->ids);
354 oid->ids = NULL;
355}

Referenced by mib2IfNumberQuery(), setOidWithItem(), SnmpExtensionQuery(), test_SnmpUtilOidAppend(), test_SnmpUtilOidCpyFree(), and testInit().

◆ SnmpUtilOidNCmp()

INT WINAPI SnmpUtilOidNCmp ( AsnObjectIdentifier pOid1,
AsnObjectIdentifier pOid2,
UINT  nSubIds 
)

Definition at line 360 of file main.c.

361{
362 unsigned int i, len;
363
364 TRACE("(%p, %p, %d)\n", oid1, oid2, count);
365
366 if (!oid1 || !oid2) return 0;
367
368 len = min(count, oid1->idLength);
369 len = min(len, oid2->idLength);
370 for (i = 0; i < len; i++)
371 {
372 if (oid1->ids[i] > oid2->ids[i]) return 1;
373 if (oid1->ids[i] < oid2->ids[i]) return -1;
374 }
375 if (i == count) return 0;
376 if (oid1->idLength < oid2->idLength) return -1;
377 if (oid1->idLength > oid2->idLength) return 1;
378 return 0;
379}
#define min(a, b)
Definition: monoChain.cc:55

Referenced by findSupportedQuery(), getItemAndInstanceFromTable(), getItemAndIntegerInstanceFromOid(), getItemFromOid(), mib2IfNumberQuery(), SnmpExtensionQuery(), SnmpUtilOidCmp(), test_SnmpUtilOidNCmp(), and testQuery().

◆ SnmpUtilOidToA()

LPSTR WINAPI SnmpUtilOidToA ( AsnObjectIdentifier Oid)

Definition at line 536 of file main.c.

537{
538 static char null_oid[] = "<null oid>";
539
540 TRACE("(%p)\n", oid);
541
542 if (oid)
543 return SnmpUtilIdsToA(oid->ids, oid->idLength);
544 else
545 return null_oid;
546}
LPSTR WINAPI SnmpUtilIdsToA(UINT *ids, UINT length)
Definition: main.c:499

Referenced by mib2IcmpQuery(), mib2IfEntryQuery(), mib2IfNumberQuery(), mib2IpAddrQuery(), mib2IpNetQuery(), mib2IpRouteQuery(), mib2IpStatsQuery(), mib2TcpQuery(), mib2UdpEntryQuery(), mib2UdpQuery(), SnmpExtensionQuery(), test_SnmpUtilOidToA(), testInit(), and testQuery().

◆ SnmpUtilPrintAsnAny()

VOID WINAPI SnmpUtilPrintAsnAny ( AsnAny pAny)

Definition at line 570 of file main.c.

571{
572 unsigned int i;
573
574 TRACE("(%p)\n", any);
575
576 switch (any->asnType)
577 {
578 case ASN_NULL: TRACE("Null value\n"); return;
579 case ASN_INTEGER32: TRACE("Integer32 %d\n", any->asnValue.number); return;
580 case ASN_UNSIGNED32: TRACE("Unsigned32 %u\n", any->asnValue.unsigned32); return;
581 case ASN_COUNTER32: TRACE("Counter32 %u\n", any->asnValue.counter); return;
582 case ASN_GAUGE32: TRACE("Gauge32 %u\n", any->asnValue.gauge); return;
583 case ASN_TIMETICKS: TRACE("Timeticks %u\n", any->asnValue.ticks); return;
584 case ASN_COUNTER64:
585 {
586 TRACE("Counter64 %x%08x\n", (DWORD)(any->asnValue.counter64.QuadPart>>32),(DWORD)any->asnValue.counter64.QuadPart);
587 return;
588 }
589 case ASN_OCTETSTRING:
590 {
591 TRACE("String ");
592 for (i = 0; i < any->asnValue.string.length; i++)
593 TRACE("%c", any->asnValue.string.stream[i]);
594 TRACE("\n");
595 return;
596 }
597 case ASN_IPADDRESS:
598 {
599 TRACE("IpAddress ");
600 if (any->asnValue.string.length < 4)
601 {
602 TRACE("Invalid\n");
603 return;
604 }
605 for (i = 0; i < 4; i++)
606 {
607 TRACE("%u", any->asnValue.string.stream[i]);
608 if (i < 3) TRACE(".");
609 }
610 TRACE("\n");
611 return;
612 }
613 case ASN_BITS:
614 {
615 TRACE("Bits ");
616 for (i = 0; i < any->asnValue.string.length; i++)
617 {
618 TRACE("0x%02x", any->asnValue.string.stream[i]);
619 if (i < any->asnValue.object.idLength - 1) TRACE(" ");
620 }
621 TRACE("\n");
622 return;
623 }
624 case ASN_OPAQUE:
625 {
626 TRACE("Opaque ");
627 for (i = 0; i < any->asnValue.string.length; i++)
628 {
629 TRACE("0x%02x", any->asnValue.string.stream[i]);
630 if (i < any->asnValue.object.idLength - 1) TRACE(" ");
631 }
632 TRACE("\n");
633 return;
634 }
636 {
637 TRACE("ObjectID ");
638 for (i = 0; i < any->asnValue.object.idLength; i++)
639 {
640 TRACE("%u", any->asnValue.object.ids[i]);
641 if (i < any->asnValue.object.idLength - 1) TRACE(".");
642 }
643 TRACE("\n");
644 return;
645 }
646 default:
647 {
648 TRACE("Invalid type %d\n", any->asnType);
649 return;
650 }
651 }
652}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ASN_BITS
Definition: snmp.h:104
#define ASN_TIMETICKS
Definition: snmp.h:116
#define ASN_OCTETSTRING
Definition: snmp.h:105
#define ASN_UNSIGNED32
Definition: snmp.h:119
#define ASN_NULL
Definition: snmp.h:106
#define ASN_OPAQUE
Definition: snmp.h:117
#define ASN_COUNTER32
Definition: snmp.h:114
#define ASN_COUNTER64
Definition: snmp.h:118
#define ASN_GAUGE32
Definition: snmp.h:115
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define ASN_INTEGER32
Definition: snmp.h:108
#define ASN_IPADDRESS
Definition: snmp.h:113

◆ SnmpUtilPrintOid()

VOID WINAPI SnmpUtilPrintOid ( AsnObjectIdentifier Oid)

Definition at line 551 of file main.c.

552{
553 unsigned int i;
554
555 TRACE("(%p)\n", oid);
556
557 if (!oid) return;
558
559 for (i = 0; i < oid->idLength; i++)
560 {
561 TRACE("%u", oid->ids[i]);
562 if (i < oid->idLength - 1) TRACE(".");
563 }
564 TRACE("\n");
565}

◆ SnmpUtilVarBindCpy()

INT WINAPI SnmpUtilVarBindCpy ( SnmpVarBind pVbDst,
SnmpVarBind pVbSrc 
)

Definition at line 397 of file main.c.

398{
399 unsigned int i, size;
400
401 TRACE("(%p, %p)\n", dst, src);
402
403 if (!dst) return SNMPAPI_ERROR;
404 if (!src)
405 {
406 dst->value.asnType = ASN_NULL;
407 return SNMPAPI_NOERROR;
408 }
409
410 size = src->name.idLength * sizeof(UINT);
411 if (!(dst->name.ids = HeapAlloc(GetProcessHeap(), 0, size))) return SNMPAPI_ERROR;
412
413 for (i = 0; i < src->name.idLength; i++) dst->name.ids[i] = src->name.ids[i];
414 dst->name.idLength = src->name.idLength;
415
416 if (!asn_any_copy(&dst->value, &src->value))
417 {
418 HeapFree(GetProcessHeap(), 0, dst->name.ids);
419 return SNMPAPI_ERROR;
420 }
421 return SNMPAPI_NOERROR;
422}
if(dx< 0)
Definition: linetemp.h:194
char * value
Definition: compiler.c:67
char * name
Definition: compiler.c:66

Referenced by SnmpUtilVarBindListCpy(), and test_SnmpUtilVarBindCpyFree().

◆ SnmpUtilVarBindFree()

VOID WINAPI SnmpUtilVarBindFree ( SnmpVarBind pVb)

Definition at line 427 of file main.c.

428{
429 TRACE("(%p)\n", vb);
430
431 if (!vb) return;
432
433 asn_any_free(&vb->value);
434 HeapFree(GetProcessHeap(), 0, vb->name.ids);
435 vb->name.idLength = 0;
436 vb->name.ids = NULL;
437}

Referenced by SnmpUtilVarBindListCpy(), SnmpUtilVarBindListFree(), test_SnmpUtilVarBindCpyFree(), and testQuery().

◆ SnmpUtilVarBindListCpy()

INT WINAPI SnmpUtilVarBindListCpy ( SnmpVarBindList pVblDst,
SnmpVarBindList pVblSrc 
)

Definition at line 442 of file main.c.

443{
444 unsigned int i, size;
445 SnmpVarBind *src_entry, *dst_entry;
446
447 TRACE("(%p, %p)\n", dst, src);
448
449 if (!src)
450 {
451 dst->list = NULL;
452 dst->len = 0;
453 return SNMPAPI_NOERROR;
454 }
455 size = src->len * sizeof(SnmpVarBind);
456 if (!(dst->list = HeapAlloc(GetProcessHeap(), 0, size)))
457 return SNMPAPI_ERROR;
458
459 src_entry = src->list;
460 dst_entry = dst->list;
461 for (i = 0; i < src->len; i++)
462 {
463 if (SnmpUtilVarBindCpy(dst_entry, src_entry))
464 {
465 src_entry++;
466 dst_entry++;
467 }
468 else
469 {
470 for (--i; i > 0; i--) SnmpUtilVarBindFree(--dst_entry);
471 HeapFree(GetProcessHeap(), 0, dst->list);
472 return SNMPAPI_ERROR;
473 }
474 }
475 dst->len = src->len;
476 return SNMPAPI_NOERROR;
477}
INT WINAPI SnmpUtilVarBindCpy(SnmpVarBind *dst, SnmpVarBind *src)
Definition: main.c:397
VOID WINAPI SnmpUtilVarBindFree(SnmpVarBind *vb)
Definition: main.c:427
Definition: tcpcore.h:1673

Referenced by test_SnmpUtilVarBindListCpyFree().

◆ SnmpUtilVarBindListFree()

VOID WINAPI SnmpUtilVarBindListFree ( SnmpVarBindList pVbl)

Definition at line 482 of file main.c.

483{
484 unsigned int i;
486
487 TRACE("(%p)\n", vb);
488
489 entry = vb->list;
490 for (i = 0; i < vb->len; i++) SnmpUtilVarBindFree(entry++);
491 HeapFree(GetProcessHeap(), 0, vb->list);
492 vb->list = NULL;
493 vb->len = 0;
494}
uint32_t entry
Definition: isohybrid.c:63

Referenced by test_SnmpUtilVarBindListCpyFree().