SnmpDuplicatePdu

[This is preliminary documentation and subject to change.]

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
Handle to the WinSNMP session.
PDU
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 manager application must call the SnmpFreePdu function.

QuickInfo

  Windows NT: Requires version 5.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winsnmp.h.
  Import Library: Use wsnmp32.lib.

See Also

WinSNMP Manager API Overview, WinSNMP Functions, SnmpFreePdu, SnmpGetPduData