Platform SDK: Network Management |
The WinSNMP SnmpSetVb function changes variable binding entries in a variable bindings list. This function also appends new variable binding entries to an existing variable bindings list.
SNMPAPI_STATUS SnmpSetVb( HSNMP_VBL vbl, // handle to the variable bindings list smiUINT32 index, // position of the variable binding entry // in the list smiLPCOID name, // pointer to the variable name portion // of the entry smiLPCVALUE value // pointer to the variable value portion // of the entry );
If the function succeeds, the return value is the position of the updated or appended variable binding entry in the variable bindings list. For additional information, see the following Remarks section.
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_VBL_INVALID | The vbl parameter is invalid. |
SNMPAPI_INDEX_INVALID | The index parameter is invalid. |
SNMPAPI_OID_INVALID | The name parameter is invalid. |
SNMPAPI_SYNTAX_INVALID | The syntax member of the structure pointed to by the value parameter is invalid. |
SNMPAPI_OTHER_ERROR | An unknown or undefined error occurred. |
Valid values for the index parameter range from zero to n. The value zero indicates an append operation. The value n is the total number of variable binding entries in the variable bindings list. A WinSNMP application should call the SnmpCountVbl function before it calls SnmpSetVb to obtain the total number of variable binding entries.
If the function successfully performs an update operation, the return value equals the value of the index parameter. If the function appends a variable binding entry, the return value is n + 1.
If the name parameter is not NULL, but the value parameter is NULL, the Microsoft WinSNMP implementation initializes the new variable binding entry with the value member set to NULL and with the syntax member set to SNMP_SYNTAX_NULL.
If the index parameter is not equal to zero, and the name parameter is NULL, the Microsoft WinSNMP implementation updates only the value of the variable pointed to by the index parameter.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winsnmp.h.
Library: Use Wsnmp32.lib.
WinSNMP API Overview, WinSNMP Functions, SnmpCountVbl, smiOID, smiVALUE