Registers an operation to be called when the specified event occurs.
#include <event.h> event_handle_t RegisterForEventNotification ( rtag_t rtag, int type, int priority, Warn_t warn, Report_t report, void *userParm);
(IN) Specifies a resource tag. See AllocateResourceTag.
(IN) Specifies the event type. See Event Types.
(IN) Specifies the priority for the operation and uses one of the following:
(IN) Specifies the warning routine. This can be NULL if the report parameter is not also NULL.
(IN) Specifies the reporting routine. This can be NULL if the warn parameter is not also NULL.
(IN) Points to an optional parameter, which you define for your use.
If successful, returns an event handle. Otherwise, returns 0.
If your application is multiprocessor safe, you must OR the EVENT_CONSUMER_MT_SAFE flag with the type parameter when registering for a nonblocking event.
You do not have to supply both a warn routine and a report routine, but to register for event notification you must supply one or other. If both are NULL, you fail to register for the event. The function pointer to these callback routines must be wrappered with the NX_WRAP_INTERFACE macro to ensure accurate library context is established.
The warn routine notifies you before the event occurs, and the report routine notifies you after the event has occurred. The type of routine must correlate with the event. For example, if the event type is server down, then the routine needs to be a warn routine because the server cannot process a report routine after it is down.
The report routine has the following syntax:
typedef void (*Report_t)( void *parm, void *userParm);
Points to the data type or structure associated with the event type. For list of these data types, see Event Types.
Points to an optional parameter, which you define for your use.
The warn routine has the following syntax:
typedef int (*Warn_t)( void *printf, void *parm, void *userParm);
Points to a print format command.
Points to the data type or structure associated with the event type. For list of these data types, see Event Types.
Points to an optional parameter, which you define for your use.
#include <event.h> rtag_t eventRTag; event_handle_t downEvent; eventRTag = AllocateResourceTag(NLMHandle, "Server down event", EventSignature); downEvent = RegisterForEventNotification(eventRTag, EVENT_DOWN_SERVER | EVENT_CONSUMER_MT_SAFE , EVENT_PRIORITY_APPLICATION, warnFunc, (void *) NULL, NULL); . . . UnRegisterEventNotification(downEvent);