SnmpSetPduData 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 SnmpSetPduData function updates selected data fields in the specified SNMP protocol data unit (PDU).

Syntax

SNMPAPI_STATUS SNMPAPI_CALL SnmpSetPduData(
  [in] HSNMP_PDU       PDU,
  [in] const smiINT    *PDU_type,
  [in] const smiINT32  *request_id,
  [in] const smiINT    *non_repeaters,
  [in] const smiINT    *max_repetitions,
  [in] const HSNMP_VBL *varbindlist
);

Parameters

[in] PDU

Handle to an SNMP PDU.

[in] PDU_type

Pointer to a variable with a value to update the PDU_type field of the specified PDU. This parameter can also be NULL.

[in] request_id

Pointer to a variable with a value to update the request_id field of the specified PDU. This parameter can also be NULL.

[in] non_repeaters

If the PDU_type parameter is equal to SNMP_PDU_GETBULK, this parameter points to a variable with a value to update the non_repeaters field of the specified PDU. The Microsoft WinSNMP implementation ignores this parameter for other PDU types. This parameter can also be NULL.

[in] max_repetitions

If the PDU_type parameter is equal to SNMP_PDU_GETBULK, this parameter points to a variable with a value to update the max_repetitions field of the specified PDU. The implementation ignores this parameter for other PDU types. This parameter can also be NULL.

[in] varbindlist

Pointer to a variable with a value that updates the handle to the variable bindings list field of the specified PDU. This parameter can also be NULL.

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
SNMPAPI_NOT_INITIALIZED
The SnmpStartup function did not complete successfully.
SNMPAPI_ALLOC_ERROR
An error occurred during memory allocation.
SNMPAPI_PDU_INVALID
The PDU type is invalid.
SNMPAPI_VBL_INVALID
The variable bindings list is invalid.
SNMPAPI_NOOP
All input parameters are NULL. The SNMP operation was not performed.
SNMPAPI_OTHER_ERROR
An unknown or undefined error occurred.

Remarks

All parameters of the SnmpSetPduData function are required. However, all parameters, except the PDU parameter, can be NULL. If the WinSNMP application passes NULL in a parameter, SnmpSetPduData does not update the corresponding field in the PDU. Because SnmpSetPduData passes parameters as pointers to values, an application can still update a PDU field with NULL.

The value of one PDU field can be valid alone, but may be invalidated in combination with values for other fields. The implementation validates the PDU and the other message elements when the application calls the SnmpSendMsg or the SnmpEncodeMsg functions. The implementation rejects invalid PDUs.

The only type of trap PDU you can update with a call to the SnmpSetPduData function is an SNMPv2C trap 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

See also

SnmpEncodeMsg

SnmpSendMsg

WinSNMP Functions

WinSNMP API Overview