SnmpGetPduData function (winsnmp.h)
[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 WinSNMP SnmpGetPduData function returns selected data fields from a specified SNMP protocol data unit (PDU).
Syntax
SNMPAPI_STATUS SNMPAPI_CALL SnmpGetPduData(
[in] HSNMP_PDU PDU,
[out] smiLPINT PDU_type,
[out] smiLPINT32 request_id,
[out] smiLPINT error_status,
[out] smiLPINT error_index,
[out] LPHSNMP_VBL varbindlist
);
Parameters
[in] PDU
Handle to the SNMP PDU.
[out] PDU_type
Pointer to a variable that receives the PDU_type field of the specified PDU. This parameter can be NULL, or one of the following values.
[out] request_id
Pointer to a variable that receives the request_id field of the specified PDU. This parameter can be NULL.
[out] error_status
Pointer to a variable that receives the error_status field of the specified PDU. If the PDU_type parameter is equal to SNMP_PDU_GETBULK, this parameter receives the value of the non_repeaters field of the PDU.
This parameter can be NULL, or one of the following values. The first six errors are common to the SNMP version 1 (SNMPv1) and SNMP version 2C frameworks (SNMPv2C). The remaining errors are available under SNMPv2C only.
[out] error_index
Pointer to a variable that receives the error_index field of the specified PDU.
If the PDU_type parameter is equal to SNMP_PDU_GETBULK, this parameter receives the value of the max_repetitions field of the specified PDU. This parameter can be NULL.
[out] varbindlist
Pointer to a variable that receives a handle to the variable bindings list field of the specified PDU. This parameter can be NULL. For additional information, see the following Remarks section.
Return value
If the function succeeds, the return value is SNMPAPI_SUCCESS.
If the function fails, the return value is SNMPAPI_FAILURE. To get extended error information, call SnmpGetLastError. The SnmpGetLastError function can return one of the following errors.
Return code | Description |
---|---|
|
The SnmpStartup function did not complete successfully. |
|
An error occurred during memory allocation. |
|
All output parameters are NULL. The SNMP operation was not performed. |
|
The PDU type is invalid. |
|
An unknown or undefined error occurred. |
Remarks
All parameters of the SnmpGetPduData function are required. However, all parameters, except the PDU parameter, can be NULL. In parameters that the application passes as NULL, the SnmpGetPduData function does not return a value.
The SnmpGetPduData function always returns a handle to a new variable bindings list object if the varbindlist parameter is not NULL. Additionally, if the PDU parameter specifies a new PDU, the function also attaches a handle to the new PDU.
When an application calls SnmpGetPduData with a varbindlist parameter that is not NULL, but the PDU parameter specifies an existing PDU, the function returns a handle to a new duplicate variable bindings list. The function call does not disturb the handle attached to the existing PDU. An existing PDU is one that an application creates with a call to the SnmpCreatePdu function, or one that the application receives and then reads using a call to SnmpGetPduData.
When an application creates a PDU with SnmpCreatePdu, or after the application reads a PDU using SnmpGetPduData, the Microsoft WinSNMP implementation expects that the application "knows" the values of the PDU fields. If an application reads a PDU a second time with SnmpGetPduData, the call results in a copy of the variable bindings list of the specified PDU. This type of call to SnmpGetPduData also duplicates the handle to the PDU.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winsnmp.h |
Library | Wsnmp32.lib |
DLL | Wsnmp32.dll |