SnmpDeleteVb function (winsnmp.h)

[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]

The WinSNMP SnmpDeleteVb function removes a variable binding entry from a variable bindings list.

Syntax

SNMPAPI_STATUS SNMPAPI_CALL SnmpDeleteVb(
  [in] HSNMP_VBL vbl,
  [in] smiUINT32 index
);

Parameters

[in] vbl

Handle to the variable bindings list to update.

[in] index

Specifies an unsigned long integer variable that identifies the variable binding entry to remove. This variable contains the position of the variable binding entry, within the variable bindings list.

Valid values for this parameter are in the range from 1 to n, where 1 indicates the first variable binding entry in the variable bindings list, and n is the total number of entries in the variable bindings list. For additional information, see the following Remarks section.

Return value

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.

Return code Description
SNMPAPI_NOT_INITIALIZED
The SnmpStartup function did not complete successfully.
SNMPAPI_ALLOC_ERROR
An error occurred during memory allocation.
SNMPAPI_INDEX_INVALID
The index parameter is invalid.
SNMPAPI_VBL_INVALID
The vbl parameter is invalid.
SNMPAPI_OTHER_ERROR
An unknown or undefined error occurred.

Remarks

A WinSNMP application can use the SnmpDeleteVb function to delete invalid variable binding entries. When an SNMP_PDU_RESPONSE protocol data unit (PDU) includes an error that indicates an invalid variable binding entry, the application can call SnmpDeleteVb to delete the entry. Then the application can resubmit the request PDU with a call to the SnmpSendMsg function, without the invalid variable binding entry in the variable bindings list. Request PDUs include the SNMP_PDU_GET, SNMP_PDU_GETNEXT, and SNMP_PDU_GETBULK PDU data types.

After the SnmpDeleteVb function deletes a variable binding entry, the index value of all entries after the deleted entry will decrement by one. A call to the SnmpCountVbl function returns the new total number of entries in the variable bindings list. The new total is one less than the count returned by a call to SnmpCountVbl before the current call to SnmpDeleteVb.

If a WinSNMP application calls the SnmpDeleteVb function and deletes the last variable binding entry in a variable bindings list, the result is an empty variable bindings list. The variable bindings list still has a valid handle and the WinSNMP application must release the handle with a call to the SnmpFreeVbl function.

The following are valid values to use for the index parameter:

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winsnmp.h
Library Wsnmp32.lib
DLL Wsnmp32.dll

See also

SnmpCountVbl

SnmpFreeVbl

SnmpRecvMsg

WinSNMP Functions

WinSNMP API Overview