SnmpSetPduData

[This is preliminary documentation and subject to change.]

The WinSNMP SnmpSetPduData function updates selected data fields in the specified SNMP protocol data unit (PDU).

SNMPAPI_STATUS SnmpSetPduData(
  HSNMP_PDU PDU,                 // handle to the PDU 
  const smiINT *PDU_type,        // pointer to the PDU type 
  const smiINT32 *request_id,    // pointer to the PDU request
                                 // identifier 
  const smiINT *non_repeaters,   // valid only for an
                                 // SNMP_PDU_GETBULK request 
  const smiINT *max_repetitions, // valid only for an
                                 // SNMP_PDU_GETBULK request 
  const HSNMP_VBL *varbindlist   // handle to variable bindings list
);
 

Parameters

PDU
Handle to an SNMP PDU.
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.
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.
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.
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.
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 Values

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.

Error 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 manager 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 manager application calls the SnmpSendMsg or the SnmpEncodeMsg functions. The implementation rejects invalid PDUs.

QuickInfo

  Windows NT: Requires version 5.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winsnmp.h.
  Import Library: Use wsnmp32.lib.

See Also

WinSNMP Manager API Overview, WinSNMP Functions, SnmpSendMsg, SnmpEncodeMsg