Platform SDK: Network Management |
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 );
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. |
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.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winsnmp.h.
Library: Use Wsnmp32.lib.
WinSNMP API Overview, WinSNMP Functions, SnmpSendMsg, SnmpEncodeMsg