SnmpExtensionInit

The extensible agent calls the SnmpExtensionInit function in the extension agent DLL to perform bilateral initialization of both the extension and the extensible agents.

BOOL SnmpExtensionInit(

DWORD dwTimeZeroReference,  
HANDLE *hPollForTrapEvent,  
AsnObjectIdentifier *supportedView  
);  

Parameters

dwTimeZeroReference

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

hPollForTrapEvent

[out] Points to an event handle that will indicate that there are traps available when the extensible agent polls the SnmpExtensionTrap function entry point.

supportedView

[out] Points to an object identifier variable structure that specifies the MIB subtree that the extension agent supports.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Remarks

The dwTimeZeroReference parameter allows all extension agents to report time information from the same reference point. The extension agent can compute elapsed time by subtracting dwTimeZeroReference from the value returned by the GetCurrentTime function. This time reference is necessary to implement traps and initiate some MIB variables.

An extension agent notifies the extensible agent that it needs to send a trap by setting the state of the hPollForTrapEvent parameter that is passed back during the SnmpExtensionInit entry point to signaled. Once this event has been set to the signaled state, the extensible agent repeatedly calls the extension agent's SnmpExtensionTrap entry point until it returns a value of FALSE. This indicates that the extension agent has no more traps to send. An extension agent application typically creates the hPollForTrapEvent event handle with the CreateEvent function during initialization. It typically sets hPollForTrapEvent to the signaled state with the SetEvent function.

If the extension agent does not generate traps, the hPollForTrapEvent parameter should return a value of NULL.

See Also

SnmpExtensionTrap, GetCurrentTime, CreateEvent, SetEvent