Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

DBusWatch
[D-BUS message system public API]

Object representing a file descriptor to be watched. More...

Typedefs

typedef DBusWatch DBusWatch
 Opaque object representing a file descriptor to be watched for changes in readability, writability, or hangup.


Functions

int dbus_watch_get_fd (DBusWatch *watch)
 Gets the file descriptor that should be watched.

unsigned int dbus_watch_get_flags (DBusWatch *watch)
 Gets flags from DBusWatchFlags indicating what conditions should be monitored on the file descriptor.

void * dbus_watch_get_data (DBusWatch *watch)
 Gets data previously set with dbus_watch_set_data() or NULL if none.

void dbus_watch_set_data (DBusWatch *watch, void *data, DBusFreeFunction free_data_function)
 Sets data which can be retrieved with dbus_watch_get_data().

dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch)
 Returns whether a watch is enabled or not.

dbus_bool_t dbus_watch_handle (DBusWatch *watch, unsigned int flags)
 Called to notify the D-BUS library when a previously-added watch is ready for reading or writing, or has an exception such as a hangup.


Detailed Description

Object representing a file descriptor to be watched.

Types and functions related to DBusWatch. A watch represents a file descriptor that the main loop needs to monitor, as in Qt's QSocketNotifier or GLib's g_io_add_watch().


Function Documentation

void* dbus_watch_get_data DBusWatch   watch
 

Gets data previously set with dbus_watch_set_data() or NULL if none.

Parameters:
watch the DBusWatch object.
Returns:
previously-set data.

Definition at line 496 of file dbus-watch.c.

dbus_bool_t dbus_watch_get_enabled DBusWatch   watch
 

Returns whether a watch is enabled or not.

If not enabled, it should not be polled by the main loop.

Parameters:
watch the DBusWatch object
Returns:
TRUE if the watch is enabled

Definition at line 536 of file dbus-watch.c.

References _dbus_assert.

int dbus_watch_get_fd DBusWatch   watch
 

Gets the file descriptor that should be watched.

Parameters:
watch the DBusWatch object.
Returns:
the file descriptor to watch.

Definition at line 462 of file dbus-watch.c.

Referenced by _dbus_transport_handle_watch().

unsigned int dbus_watch_get_flags DBusWatch   watch
 

Gets flags from DBusWatchFlags indicating what conditions should be monitored on the file descriptor.

The flags returned will only contain DBUS_WATCH_READABLE and DBUS_WATCH_WRITABLE, never DBUS_WATCH_HANGUP or DBUS_WATCH_ERROR; all watches implicitly include a watch for hangups, errors, and other exceptional conditions.

Parameters:
watch the DBusWatch object.
Returns:
the conditions to watch.

Definition at line 481 of file dbus-watch.c.

References _dbus_assert.

dbus_bool_t dbus_watch_handle DBusWatch   watch,
unsigned int    flags
 

Called to notify the D-BUS library when a previously-added watch is ready for reading or writing, or has an exception such as a hangup.

If this function returns FALSE, then the file descriptor may still be ready for reading or writing, but more memory is needed in order to do the reading or writing. If you ignore the FALSE return, your application may spin in a busy loop on the file descriptor until memory becomes available, but nothing more catastrophic should happen.

dbus_watch_handle() cannot be called during the DBusAddWatchFunction, as the connection will not be ready to handle that watch yet.

It is not allowed to reference a DBusWatch after it has been passed to remove_function.

Parameters:
watch the DBusWatch object.
flags the poll condition using #DBusWatchFlags values
Returns:
FALSE if there wasn't enough memory

Definition at line 566 of file dbus-watch.c.

References _dbus_warn(), _dbus_watch_sanitize_condition(), and TRUE.

void dbus_watch_set_data DBusWatch   watch,
void *    data,
DBusFreeFunction    free_data_function
 

Sets data which can be retrieved with dbus_watch_get_data().

Intended for use by the DBusAddWatchFunction and DBusRemoveWatchFunction to store their own data. For example with Qt you might store the QSocketNotifier for this watch and with GLib you might store a GSource.

Parameters:
watch the DBusWatch object.
data the data.
free_data_function function to be called to free the data.

Definition at line 513 of file dbus-watch.c.

References NULL.

Referenced by _dbus_watch_unref().


Generated on Wed Oct 22 14:05:10 2003 for D-BUS by doxygen1.3-rc3