NEBCALLBACK_SERVICE_STATUS_DATA callback being invoked twice
Andreas Ericsson
ae at op5.se
Wed Dec 3 08:50:58 CET 2008
James King wrote:
> Hello all,
>
> I'm attempting to write a NEB module that will enable forwarding of
> service state transitions to another NMS platform. I'm registering
> for NEBCALLBACK_SERVICE_STATUS_DATA, but my callback is being invoked
> twice for each status update, with identical timestamp, type code and
> identical current_state and last_state in the (service *)
> (data->object_ptr). There's only a single event type associated with
> this hook (NEBTYPE_SERVICESTATUS_UPDATE). Is this normal behavior for
> this hook (and if so, what is the reasoning behind this, or is there
> at least a difference between the 2 invocations that I can use to
> filter on)?
Here's how Merlin does it. Note the first check there, making sure that
if (ds->type != NEBTYPE_SERVICECHECK_PROCESSED), it returns immediately.
--8<--8<--8<--
int hook_service_result(int cb, void *data)
{
nebstruct_service_check_data *ds = (nebstruct_service_check_data *)data;
char buf[MAX_PKT_SIZE];
int len, result;
if (ds->type != NEBTYPE_SERVICECHECK_PROCESSED
|| ds->check_type != SERVICE_CHECK_ACTIVE
|| cb != NEBCALLBACK_SERVICE_CHECK_DATA)
{
return 0;
}
--8<--8<--8<--
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
More information about the Developers
mailing list