2
* @file geis_dbus_dispatcher.h
3
* @brief Interface for the GEIS DBus dispatcher.
5
* The GEIS DBus dispatcher provides a central dispatch point for all DBus
6
* events used internally by GEIS.
8
* This header is for internal GEIS use only and contains no client
9
* (externally-visible) symbols.
13
* Copyright 2011 Canonical Ltd.
15
* This library is free software; you can redistribute it and/or modify it under
16
* the terms of the GNU Lesser General Public License as published by the Free
17
* Software Foundation; either version 3 of the License, or (at your option) any
20
* This library is distributed in the hope that it will be useful, but WITHOUT
21
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
25
* You should have received a copy of the GNU General Public License
26
* along with this program. If not, see <http://www.gnu.org/licenses/>.
28
#ifndef GEIS_DBUS_DISPATCHER_H_
29
#define GEIS_DBUS_DISPATCHER_H_
31
#include <dbus/dbus.h>
32
#include "geis/geis.h"
36
* The %GeisDBusDispatcher centralizes all dispatch for all DBus events used
37
* internally by the GEIS client-server mechanism.
39
* Geis implements single-threaded ansynchronous dispatch for DBus events, in
40
* case a single-threaded client is making use of GEIS. This also simplifies a
41
* lot of the internal design of the GEIS DBus service, since no locking or
42
* other forms of synchronization are required.
44
typedef struct GeisDBusDispatcher *GeisDBusDispatcher;
47
* A callback type for the handler function dispatched on DBus events.
49
* @todo the parameters of the GeisDispatchCallback must be defined.
51
typedef void (*GeisDispatchCallback)(void *context);
55
* Creates a new GEIS DBus dispatcher.
57
* @param[in] geis A GEIS instance.
59
* Creates a new %GeisDBusDispatcher and registers it with the GEIS API instance
60
* so it will be multiplexed and receive event notification.
62
* @returns a new %GeisDBusDispatcher object or NULL on failure.
65
geis_dbus_dispatcher_new(Geis geis);
68
* Destroys an existing %GeisDBusDispatcher object.
70
* @param[in] dispatcher A %GeisDBusDispatcher object.
73
geis_dbus_dispatcher_delete(GeisDBusDispatcher dispatcher);
76
* Registers a new DBusWatch with a %GeisDBusDispatcher object.
78
* @param[in] dispatcher A %GeisDBusDispatcher object.
79
* @param[in] connection A DBus connection.
80
* @param[in] watch A DBusWatch om the connection.
82
* The @p watch will be registered with the @p dispatcher for future DBus
83
* events. The @p watch may or may not be activated, depending on its @a
84
* enabled state at the time of registration.
87
geis_dbus_dispatcher_register(GeisDBusDispatcher dispatcher,
88
DBusConnection *connection,
92
* Unregisters a DBusWatch for events.
94
* @param[in] dispatcher A %GeisDBusDispatcher object.
95
* @param[in] watch A DBusWatch.
98
geis_dbus_dispatcher_unregister(GeisDBusDispatcher dispatcher,
102
* Marks a DBusWatch as active or not, depending on its state.
104
* @param[in] dispatcher A %GeisDBusDispatcher object.
105
* @param[in] watch A pointer to a DBusWatch object.
107
* The @p dispatcher will listen for events on the @p watch if its @a is_enabled
108
* state is true or not.
111
geis_dbus_dispatcher_toggle_watch(GeisDBusDispatcher dispatcher,
116
#endif /* GEIS_DBUS_DISPATCHER_H_ */