SnmpCleanup

[This is preliminary documentation and subject to change.]

The SnmpCleanup function informs the Microsoft WinSNMP implementation that the calling WinSNMP manager application no longer requires the implementation's services.

Note  A WinSNMP manager application must call the SnmpCleanup function as the last WinSNMP function before it terminates.

SNMPAPI_STATUS SnmpCleanup(VOID)
 

Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is SNMPAPI_SUCCESS. Until the WinSNMP manager application successfully recalls the SnmpStartup function, any other call to a WinSNMP function returns SNMPAPI_FAILURE, with an extended error code of SNMPAPI_NOT_INITIALIZED.

If the function fails, the return value is SNMPAPI_FAILURE, but the WinSNMP manager application does not need to retry the call to SnmpCleanup. 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_OTHER_ERROR An unknown or undefined error occurred.

Remarks

Before the WinSNMP manager application calls SnmpCleanup, it should call the SnmpClose function once for each session the implementation opens as a result of a call to the SnmpOpen function.

When a WinSNMP manager application calls the SnmpCleanup function, the implementation deallocates all resources allocated to the application. However, it is recommended that a WinSNMP manager application free the specific resources that the implementation allocates for it with the WinSNMP function that corresponds to the resource. For additional information about freeing individual resources, see SnmpFreeEntity, SnmpFreeVbl, SnmpFreeDescriptor, SnmpFreeContext, and SnmpFreePdu.

If a WinSNMP manager application must perform an emergency exit, and it calls SnmpCleanup without freeing individual resources and without calling SnmpClose for every open session, the implementation deallocates all resources allocated to the WinSNMP manager application. However, to enable this functionality in the implementation, the application must still call SnmpCleanup.

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, SnmpOpen, SnmpStartup, SnmpClose, SnmpFreeEntity, SnmpFreeVbl, SnmpFreeDescriptor, SnmpFreeContext, SnmpFreePdu