Platform SDK: Network Management |
The WinSNMP SnmpDuplicateVbl function copies a variable bindings list for the specified WinSNMP session. This function returns a handle to the copied variable bindings list and allocates any necessary memory for it.
HSNMP_VBL SnmpDuplicateVbl( HSNMP_SESSION session, // handle to the WinSNMP session HSNMP_VBL vbl // handle to the variable bindings // list to duplicate );
If the function succeeds, the return value is a handle to a new variable bindings list.
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_SESSION_INVALID | The session handle is invalid. |
SNMPAPI_VBL_INVALID | The vbl parameter is invalid. |
SNMPAPI_OTHER_ERROR | An unknown or undefined error occurred. |
The SnmpDuplicateVbl function creates a new variable bindings list for the specified WinSNMP session. This function initializes the new list with a copy of the data in the source variable bindings list.
The handle the SnmpDuplicateVbl function returns is unique among the variable bindings list handles that are active within the WinSNMP application.
The WinSNMP application must release the resources associated with each variable bindings list. It should do this by matching each call to the SnmpCreateVbl and SnmpDuplicateVbl functions with a corresponding call to the SnmpFreeVbl function. To avoid memory leaks, a WinSNMP application must call SnmpFreeVbl before it reuses the handle to a variable bindings list in a subsequent call to SnmpCreateVbl or SnmpDuplicateVbl. For additional information, see WinSNMP Data Management Concepts.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winsnmp.h.
Library: Use Wsnmp32.lib.
WinSNMP API Overview, WinSNMP Functions, SnmpFreeVbl, SnmpCreateVbl