Platform SDK: Network Management |
The WinSNMP SnmpSetTranslateMode function enables a WinSNMP application to change the entity and context translation mode. The entity and context translation mode affects the interpretation and return of WinSNMP input and output string parameters.
SNMPAPI_STATUS SnmpSetTranslateMode( smiUINT32 nTranslateMode // new entity/context translation mode );
Value | Meaning |
---|---|
SNMPAPI_TRANSLATED | The Microsoft WinSNMP implementation uses its database to translate user-friendly names for SNMP entities and managed objects. The implementation translates them into their SNMPv1 or SNMPv2C components. |
SNMPAPI_UNTRANSLATED_V1 | The implementation interprets SNMP entity parameters as SNMP transport addresses, and context parameters as SNMP community strings. For SNMPv2 destination entities, the implementation creates outgoing SNMP messages that contain a value of zero in the version field. |
SNMPAPI_UNTRANSLATED_V2 | The implementation interprets SNMP entity parameters as SNMP transport addresses, and context parameters as SNMP community strings. For SNMPv2 destination entities, the implementation creates outgoing SNMP messages that contain a value of 1 in the version field. |
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 specifying a NULL value in its session parameter. 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_MODE_INVALID | The implementation does not support the requested translation mode. |
SNMPAPI_OTHER_ERROR | An unknown or undefined error occurred. |
The new entity and context translation mode affects subsequent calls to the SnmpStrToEntity, SnmpStrToContext, SnmpContextToStr, and SnmpEntityToStr functions. The WinSNMP application can change the entity and context translation mode again by making another call to SnmpSetTranslateMode with a different nTranslateMode value.
For additional information, see Setting the Entity and Context Translation Mode.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winsnmp.h.
Library: Use Wsnmp32.lib.
WinSNMP API Overview, WinSNMP Functions, SnmpStrToContext, SnmpStrToEntity, SnmpContextToStr, SnmpEntityToStr, SnmpGetTranslateMode