SnmpMgrRequest function

[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]

The SnmpMgrRequest function requests the specified operation be performed with the specified agent. This function is an element of the SNMP Management API.

Syntax


SNMPAPI SnmpMgrRequest(
  _In_    LPSNMP_MGR_SESSION session,
  _In_    BYTE               requestType,
  _Inout_ SnmpVarBindList    *variableBindings,
  _Out_   AsnInteger         *errorStatus,
  _Out_   AsnInteger         *errorIndex
);

Parameters

session [in]

Pointer to an internal structure that specifies the session that will perform the request.

Applications should not specify the LPSNMP_MGR_SESSION pointer returned by this function in a different thread. You can specify a pointer returned by SnmpMgrOpen, but only if the calls to SnmpMgrOpen and SnmpMgrRequest originate in the context of the same thread.

requestType [in]

Specifies the SNMP request type. This parameter can be one of the following values defined by SNMPv1.

ValueMeaning
SNMP_PDU_GET

Retrieve the value or values of the specified variables.

SNMP_PDU_GETNEXT

Retrieve the value or values of the lexicographic successor of the specified variable.

SNMP_PDU_SET

Write a value within a specific variable.

 

Note that PDU request types have been renamed. For additional information, see SNMP Variable Types and Request PDU Types.

variableBindings [in, out]

Pointer to the variable bindings list.

Note  The SnmpVarBind array pointed to by the SnmpVarBindList structure must be allocated using the SnmpUtilMemAlloc function.
 
errorStatus [out]

Pointer to a variable in which the error status result will be returned. This parameter can be one of the following values defined by SNMPv1.

ValueMeaning
SNMP_ERRORSTATUS_NOERROR

The agent reports that no errors occurred during transmission.

SNMP_ERRORSTATUS_TOOBIG

The agent could not place the results of the requested operation into a single SNMP message.

SNMP_ERRORSTATUS_NOSUCHNAME

The requested operation identified an unknown variable.

SNMP_ERRORSTATUS_BADVALUE

The requested operation tried to change a variable but it specified either a syntax or value error.

SNMP_ERRORSTATUS_READONLY

The requested operation tried to change a variable that was not allowed to change according to the community profile of the variable.

SNMP_ERRORSTATUS_GENERR

An error other than one of those listed here occurred during the requested operation.

 

errorIndex [out]

Pointer to a variable in which the error index result will be returned.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is NULL. To get extended error information, call GetLastError, which may return one of the following error codes.

Return codeDescription
SNMP_MGMTAPI_TIMEOUT

The request timed-out.

SNMP_MGMTAPI_SELECT_FDERRORS

Unexpected error file descriptors indicated by the Windows Sockets select function.

 

Remarks

Retries and time-outs are supplied to the SnmpMgrOpen function. Each variable in the variable bindings list must be initialized to type ASN_NULL for Get and Get Next requests.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Mgmtapi.h

Library

Mgmtapi.lib

DLL

Mgmtapi.dll

See also

Simple Network Management Protocol (SNMP) Overview
SNMP Functions
SnmpMgrOpen
SnmpMgrClose

 

 

Community Additions

ADD
Show: