Validating a PDU

When the WinSNMP application calls the SnmpSendMsg function or the SnmpEncodeMsg function, the Microsoft WinSNMP implementation verifies the validity of the PDU and the other function parameters.

The value of one PDU data component (or field) can be valid individually, but it may be invalid in combination with values for other fields. For example, unless the PDU_type field of the PDU is SNMP_PDU_GETBULK or SNMP_PDU_RESPONSE, both the error_status and error_index fields must be equal to zero. Any other value combination constitutes an invalid PDU.

The implementation rejects invalid PDUs and returns the error status SNMPAPI_FAILURE. It sets an extended error code equal to SNMPAPI_PDU_INVALID.