Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Other versions of this page are also available for the following:
Windows Mobile Not Supported Windows Embedded CE Supported
8/28/2008

This function is called by the Microsoft SNMP service to initialize the SNMP extension agent dynamic-link library (DLL). This function is an element of the SNMP Extension Agent API.

Syntax


BOOL SnmpExtensionInit( 
  DWORD 
dwUptimeReference
, 
  Handle 
dwUptimeReference
, 
  AsnObjectIdentifier 
pFirstSupportedRegion

);

Parameters

dwUptimeReference

[in] Specifies a time-zero reference for the extension agent.

Note:
Extension agents should ignore this parameter. The SNMP extension agent DLL should use the SnmpSvcGetUptime, function to retrieve the number of centiseconds the SNMP service has been running. For more information, see the following Remarks section.
phSubagentTrapEvent

[out] Pointer to an event handle the extension agent passes back to the SNMP service. This handle is used to notify the service that the extension agent has one or more traps to send. For additional information about allocating and deallocating the event handle, see the following Remarks section.

pFirstSupportedRegion

[out] Pointer to an AsnObjectIdentifierstructure to receive the first MIB subtree that the extension agent supports. For additional information about allocating and deallocating resources for this structure, see the following Remarks section.

The extension agent can register additional MIB subtrees by implementing the SnmpExtensionInitExentry point function.

Return Value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE

Remarks

Extension agents should ignore the dwUptimeReferenceparameter. Instead, they should call the SnmpSvcGetUptimefunction to retrieve the number of centiseconds that the Microsoft SNMP service has been running. Because the dwUptimeReferenceparameter stores the elapsed time as a DWORDvalue in milliseconds, the time can wrap to zero and reflect an inaccurate time interval.

The extension agent notifies the SNMP service that it needs to send one or more traps by setting the event handle passed back in the phSubagentTrapEventparameter to the signaled state. After this event has been signaled, the SNMP service repeatedly calls the extension agent's SnmpExtensionTrapentry point until the function returns a value of FALSE. This indicates that the extension agent has no more traps to send. If the extension agent does not generate traps, the phSubagentTrapEventparameter should return a value of NULL.

The SNMP extension agent must allocate and deallocate resources for the trap event handle. When the SNMP service calls the SnmpExtensionInitfunction, the extension agent must call the CreateEventfunction to allocate the event handle. The extension agent passes the handle to the SNMP service in the phSubagentTrapEventparameter. When the SNMP service calls the SnmpExtensionClosefunction, the extension agent must deallocate resources for the trap event handle.

The SNMP service makes a copy of the AsnObjectIdentifierstructure the extension agent returns in the pFirstSupportedRegionparameter. The extension agent must allocate and deallocate the resources associated with the original structure. It can do this when the SNMP service calls the SnmpExtensionClosefunction.

Requirements

Header snmp.h
Library snmp.lib
Windows Embedded CE Windows CE 3.0 and later

See Also