bps_set_domain_data()

Set domain specific data for the active channel.

Synopsis:

#include <bps/bps.h>
 
BPS_API int bps_set_domain_data(int domain_id,
                                void *new_data,
                                void **old_data)

Since:

BlackBerry 10.0.0

Arguments:

domain_id

The domain ID to associate new_data with.

new_data

The service user data that should be stored in the active channel.

old_data

If a value of NULL is not provided, it is set to the previous data for the domain_id argument.

Library:

libbps (For the qcc command, use the -l bps option to link against this library)

Description:

Call the function when a service wants to set specific user data for the active channel. Often, a service has data that is particular to a channel. Since each service needs to call the bps_register_domain() function to create events, the same domain ID is used for a service to reference its data. The specifics of the type of data to store, however, is dependent on the implementation of each service.

At minimum, most services pass a structure that contains a file descriptor. In most cases, this is the same file descriptor that was added using the bps_add_fd() function.

Channels are thread-specific and a channel on one thread cannot be used by another thread. In addition, only active channels can retrieve data.

To clear domain data from the channel, call this function with the new_data argument set to a value of NULL.

If old_data is not a NULL value, it is set to the previous data that was associated with same value of the domain_id argument. If no data was previously set, it is set to a value of NULL.

Returns:

BPS_SUCCESS if the file descriptor was successfully removed from the channel, BPS_FAILURE with errno value set otherwise.

See also:

bps_get_domain_data

bps_register_domain