SnmpDuplicatePdu 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 SnmpDuplicatePdu function duplicates the SNMP protocol data unit (PDU) that the PDU parameter identifies, allocating any necessary memory for the duplicate PDU.

Syntax

HSNMP_PDU SNMPAPI_CALL SnmpDuplicatePdu(
  [in] HSNMP_SESSION session,
  [in] HSNMP_PDU     PDU
);

Parameters

[in] session

Handle to the WinSNMP session.

[in] PDU

Handle to the PDU to duplicate. The SnmpDuplicatePdu function provides a unique handle to each PDU within the calling application.

Return value

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.

Return 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

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

SnmpFreePdu

SnmpGetPduData

WinSNMP Functions

WinSNMP API Overview