2008-05-16 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / droute / droute.h
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2008 Novell, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 #ifndef _DROUTE_H
23 #define _DROUTE_H
24
25 #include <dbus/dbus.h>
26 #include "glib.h"       /* needed for GString */
27
28 #define DROUTE_METHOD   0
29 #define DROUTE_SIGNAL   1
30
31 typedef DBusMessage *(*DRouteFunction)(DBusConnection *, DBusMessage *, void *);
32 typedef dbus_bool_t (*DRoutePropertyFunction)(const char *, DBusMessageIter *, void *);
33
34 typedef struct _DRouteMethod DRouteMethod;
35 struct _DRouteMethod
36 {
37   DRouteFunction func;
38   const char *name;
39   dbus_bool_t wants_droute_data;
40 };
41
42 typedef struct _DRouteProperty DRouteProperty;
43 struct _DRouteProperty
44 {
45   DRoutePropertyFunction get;
46   DRoutePropertyFunction set;
47   const char *name;
48 };
49
50   typedef void *(*DRouteGetDatumFunction)(const char *, void *);
51   typedef void (*DRouteFreeDatumFunction)(void *);
52
53 typedef struct _DRouteInterface DRouteInterface;
54 struct _DRouteInterface
55 {
56   DRouteMethod *methods;
57   DRouteProperty *properties;
58   DRouteGetDatumFunction get_datum;
59   DRouteFreeDatumFunction free_datum;
60   char *name;
61 };
62
63 typedef struct _DRouteData DRouteData;
64 struct _DRouteData
65 {
66   DBusConnection *bus;
67   GSList *interfaces;
68   char (*introspect_children)(const char *, GString *, void *);
69   void *user_data;
70 };
71
72 DBusHandlerResult droute_message(DBusConnection *bus, DBusMessage *message, void *user_data);
73
74 dbus_bool_t droute_return_v_int32(DBusMessageIter *iter, dbus_int32_t val);
75 dbus_bool_t droute_return_v_double(DBusMessageIter *iter, double val);
76 dbus_bool_t droute_return_v_string(DBusMessageIter *iter, const char *val);
77 dbus_int32_t droute_get_v_int32(DBusMessageIter *iter);
78 const char *droute_get_v_string(DBusMessageIter *iter);
79 dbus_bool_t droute_return_v_object(DBusMessageIter *iter, const char *path);
80
81 dbus_bool_t droute_add_interface(DRouteData *data, const char *name, DRouteMethod *methods, DRouteProperty *properties, DRouteGetDatumFunction get_datum, DRouteFreeDatumFunction free_datum);
82 #endif  /* _DROUTE_H */