Platform SDK: Network Management

SnmpDuplicatePdu

The WinSNMP SnmpDuplicatePdu function duplicates the SNMP protocol data unit (PDU) that the PDU parameter identifies, allocating any necessary memory for the duplicate PDU.

HSNMP_PDU SnmpDuplicatePdu(
  HSNMP_SESSION session,      // handle to the WinSNMP session 
  HSNMP_PDU PDU               // handle to the PDU to duplicate 
);

Parameters

session
[in] Handle to the WinSNMP session.
PDU
[in] Handle to the PDU to duplicate. The SnmpDuplicatePdu function provides a unique handle to each PDU within the calling application.

Return Values

If the function succeeds, the return value is a handle that identifies the new duplicate PDU.

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_PDU_INVALID The PDU handle is invalid.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred.

Remarks

To release resources allocated by the SnmpDuplicatePdu function for a new PDU, a WinSNMP application must call the SnmpFreePdu function.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winsnmp.h.
  Library: Use Wsnmp32.lib.

See Also

WinSNMP API Overview, WinSNMP Functions, SnmpFreePdu, SnmpGetPduData