The SnmpMgrRequest function requests the specified operation be performed with the specified agent. This function is an element of the SNMP Management API.
SNMPAPI SnmpMgrRequest(
LPSNMP_MGR_SESSION session, // SNMP session pointer
BYTE requestType, // Get, GetNext, or Set
SnmpVarBindList *variableBindings, // variable bindings
AsnInteger *errorStatus, // SNMPv1 error status
AsnInteger *errorIndex // error index
);
Value | Meaning |
---|---|
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 Modified SNMP PDU Request Types.
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. |
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. 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. |
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.
Windows NT: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in mgmtapi.h.
Import Library: Use mgmtapi.lib.
Simple Network Management Protocol (SNMP) Overview, SNMP Functions, SnmpMgrOpen, SnmpMgrClose