bps_register_domain()

Reserves a unique domain ID for identifying a service's events.

Synopsis:

#include <bps/bps.h>
 
BPS_API int bps_register_domain(void)

Arguments:

Library:

libbps

Description:

The bps_register_domain() function reserves a unique domain ID for use in a service's events. Services should cache this value. When this function is called again, it yields a new domain ID.

The domain ID is used on calls to the bps_event_create() function. Typically, an application determines which service generated the event prior to handling it. For example, the code as follows shows a service called "myservice" that defines two functions: myservice_get_domain() and myservice_event_handle():

 bps_event_t *event;
 bps_get_event(&event, -1);

 if (event) {
      if (bps_event_get_domain(event) == myservice_get_domain()) {
          myservice_event_handle(event);
      }
 }

Returns:

A domain ID for a service. A value of -1 indicates an error and the errno value is set.