SnmpMgrRequest

The SnmpMgrRequest function requests the specified operation be performed with the specified agent.

SNMPAPI SnmpMgrRequest(

LPSNMP_MGR_SESSION session, // SNMP session pointer
BYTE requestType, // Get, GetNext, or Set
RFC1157VarBindList *variableBindings, // variable bindings
AsnInteger *errorStatus, // result error status
AsnInteger *errorIndex // result error index
);  

Parameters

session

[in] Points to an internal structure that specifies the session that will perform the request.

requestType

[in] Specifies the SNMP request type. This parameter can be one of the following values:

Value Meaning
ASN_RFC1157_GETREQUEST Search and receive a value from a specified variable.
ASN_RFC1157_GETNEXTREQUEST Search and receive a value from a variable without knowing the name of the variable.
ASN_RFC1157_SETREQUEST Store a value within a specific variable.

variableBindings

[in/out] Points to the variable bindings list.

errorStatus

[out] Points to a variable in which the error status result will be returned. This parameter can be one of the following values:

Value Meaning
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] Points to a variable in which the error index result will be returned.

Return Values

If the function succeeds, the return value is TRUE.

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

Error Code Meaning
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.

For more information, see RFC 1157.

See Also

SnmpMgrOpen, SnmpMgrClose