ReactOS 0.4.15-dev-7953-g1f49173
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:33
#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:319
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: limits.h:41
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:358
VOID WINAPI SnmpUtilOidFree(AsnObjectIdentifier *oid)
Definition: main.c:344
LPSTR WINAPI SnmpUtilOidToA(AsnObjectIdentifier *oid)
Definition: main.c:534
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 145 of file main.c.

146{
148
149 return (now - startTime) / 10;
150}
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 197 of file main.c.

198{
199 TRACE("(%p, %p)\n", dst, src);
200 return asn_any_copy(dst, src);
201}
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 206 of file main.c.

207{
208 TRACE("(%p)\n", any);
209 asn_any_free(any);
210}
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 162 of file main.c.

163{
164 FIXME("(%d, %s)\n", loglevel, debugstr_a(format));
165}
#define FIXME(fmt,...)
Definition: debug.h:111
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define debugstr_a
Definition: kernel32.h:31

◆ SnmpUtilIdsToA()

LPSTR WINAPI SnmpUtilIdsToA ( UINT Ids,
UINT  IdLength 
)

Definition at line 497 of file main.c.

498{
499 static char one[10], oid[514], null_oid[] = "<null oid>";
500 unsigned int i, len, left = sizeof(oid) - 1;
501
502 TRACE("(%p, %d)\n", ids, length);
503
504 if (!ids || !length) return null_oid;
505
506 *oid = 0;
507 for (i = 0; i < length; i++)
508 {
509 sprintf(one, "%d", ids[i]);
510 len = strlen(one);
511 if (left >= len)
512 {
513 strcat(oid, one);
514 left -= len;
515 }
516 else return oid;
517
518 if (i < length - 1)
519 {
520 if (left > 0)
521 {
522 strcat(oid, ".");
523 left--;
524 }
525 else return oid;
526 }
527 }
528 return oid;
529}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
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
int one
Definition: sehframes.cpp:28

Referenced by SnmpUtilOidToA().

◆ SnmpUtilMemAlloc()

LPVOID WINAPI SnmpUtilMemAlloc ( UINT  nBytes)

Definition at line 170 of file main.c.

171{
172 TRACE("(%d)\n", nbytes);
173 return HeapAlloc(GetProcessHeap(), 0, nbytes);
174}
#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 188 of file main.c.

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

◆ SnmpUtilMemReAlloc()

LPVOID WINAPI SnmpUtilMemReAlloc ( LPVOID  pMem,
UINT  nBytes 
)

Definition at line 179 of file main.c.

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

◆ SnmpUtilOctetsCmp()

INT WINAPI SnmpUtilOctetsCmp ( AsnOctetString pOctets1,
AsnOctetString pOctets2 
)

Definition at line 276 of file main.c.

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

Referenced by InitFunctionPtrs().

◆ SnmpUtilOctetsCpy()

INT WINAPI SnmpUtilOctetsCpy ( AsnOctetString pOctetsDst,
AsnOctetString pOctetsSrc 
)

Definition at line 215 of file main.c.

216{
217 TRACE("(%p, %p)\n", dst, src);
218
219 if (!dst) return SNMPAPI_ERROR;
220 if (!src)
221 {
222 dst->dynamic = FALSE;
223 dst->length = 0;
224 dst->stream = NULL;
225 return SNMPAPI_NOERROR;
226 }
227 if ((dst->stream = HeapAlloc(GetProcessHeap(), 0, src->length)))
228 {
229 unsigned int i;
230
231 dst->dynamic = TRUE;
232 dst->length = src->length;
233 for (i = 0; i < dst->length; i++) dst->stream[i] = src->stream[i];
234 return SNMPAPI_NOERROR;
235 }
236 return SNMPAPI_ERROR;
237}
#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 242 of file main.c.

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

Referenced by InitFunctionPtrs().

◆ SnmpUtilOctetsNCmp()

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

Definition at line 258 of file main.c.

259{
260 INT ret;
261 unsigned int i;
262
263 TRACE("(%p, %p, %d)\n", octets1, octets2, count);
264
265 if (!octets1 || !octets2) return 0;
266
267 for (i = 0; i < count; i++)
268 if ((ret = octets1->stream[i] - octets2->stream[i])) return ret;
269
270 return 0;
271}
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 289 of file main.c.

290{
291 UINT *ids, i, size;
292
293 TRACE("(%p, %p)\n", dst, src);
294
295 if (!dst) return SNMPAPI_ERROR;
296 if (!src) return SNMPAPI_NOERROR;
297
298 size = (src->idLength + dst->idLength) * sizeof(UINT);
299 if (!(ids = HeapReAlloc(GetProcessHeap(), 0, dst->ids, size)))
300 {
301 if (!(ids = HeapAlloc(GetProcessHeap(), 0, size)))
302 {
304 return SNMPAPI_ERROR;
305 }
306 else memcpy(ids, dst->ids, dst->idLength * sizeof(UINT));
307 }
308
309 for (i = 0; i < src->idLength; i++) ids[i + dst->idLength] = src->ids[i];
310 dst->idLength = dst->idLength + src->idLength;
311 dst->ids = ids;
312
313 return SNMPAPI_NOERROR;
314}
#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 382 of file main.c.

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

Referenced by test_SnmpUtilOidCmp(), and testQuery().

◆ SnmpUtilOidCpy()

INT WINAPI SnmpUtilOidCpy ( AsnObjectIdentifier pOidDst,
AsnObjectIdentifier pOidSrc 
)

Definition at line 319 of file main.c.

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

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

◆ SnmpUtilOidFree()

VOID WINAPI SnmpUtilOidFree ( AsnObjectIdentifier pOid)

Definition at line 344 of file main.c.

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

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

◆ SnmpUtilOidNCmp()

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

Definition at line 358 of file main.c.

359{
360 unsigned int i, len;
361
362 TRACE("(%p, %p, %d)\n", oid1, oid2, count);
363
364 if (!oid1 || !oid2) return 0;
365
366 len = min(count, oid1->idLength);
367 len = min(len, oid2->idLength);
368 for (i = 0; i < len; i++)
369 {
370 if (oid1->ids[i] > oid2->ids[i]) return 1;
371 if (oid1->ids[i] < oid2->ids[i]) return -1;
372 }
373 if (i == count) return 0;
374 if (oid1->idLength < oid2->idLength) return -1;
375 if (oid1->idLength > oid2->idLength) return 1;
376 return 0;
377}
#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 534 of file main.c.

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

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 568 of file main.c.

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

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

◆ SnmpUtilVarBindCpy()

INT WINAPI SnmpUtilVarBindCpy ( SnmpVarBind pVbDst,
SnmpVarBind pVbSrc 
)

Definition at line 395 of file main.c.

396{
397 unsigned int i, size;
398
399 TRACE("(%p, %p)\n", dst, src);
400
401 if (!dst) return SNMPAPI_ERROR;
402 if (!src)
403 {
404 dst->value.asnType = ASN_NULL;
405 return SNMPAPI_NOERROR;
406 }
407
408 size = src->name.idLength * sizeof(UINT);
409 if (!(dst->name.ids = HeapAlloc(GetProcessHeap(), 0, size))) return SNMPAPI_ERROR;
410
411 for (i = 0; i < src->name.idLength; i++) dst->name.ids[i] = src->name.ids[i];
412 dst->name.idLength = src->name.idLength;
413
414 if (!asn_any_copy(&dst->value, &src->value))
415 {
416 HeapFree(GetProcessHeap(), 0, dst->name.ids);
417 return SNMPAPI_ERROR;
418 }
419 return SNMPAPI_NOERROR;
420}
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 425 of file main.c.

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

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

◆ SnmpUtilVarBindListCpy()

INT WINAPI SnmpUtilVarBindListCpy ( SnmpVarBindList pVblDst,
SnmpVarBindList pVblSrc 
)

Definition at line 440 of file main.c.

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

Referenced by test_SnmpUtilVarBindListCpyFree().

◆ SnmpUtilVarBindListFree()

VOID WINAPI SnmpUtilVarBindListFree ( SnmpVarBindList pVbl)

Definition at line 480 of file main.c.

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

Referenced by test_SnmpUtilVarBindListCpyFree().