Change prototype of spi_dbus_get_path to return a gchar
[platform/core/uifw/at-spi2-atk.git] / libspi / 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 typedef char *(*DRoutePropertyStrFunction)(void *);
34
35 typedef struct _DRouteMethod DRouteMethod;
36 struct _DRouteMethod
37 {
38   /* DROUTE_(METHOD|SIGNAL) */
39   int type;
40   DRouteFunction func;
41   const char *name;
42   /* arg_desc contains argument information used for introspection.
43    * It is a colon-delimited string of type,name,dir values */
44   const char *arg_desc;
45   dbus_bool_t wants_droute_data;
46 };
47
48 typedef struct _DRouteProperty DRouteProperty;
49 struct _DRouteProperty
50 {
51   DRoutePropertyFunction get;
52   DRoutePropertyStrFunction get_str;
53   DRoutePropertyFunction set;
54   DRoutePropertyStrFunction set_str;
55   const char *name;
56   const char *type;
57 };
58
59   typedef void *(*DRouteGetDatumFunction)(const char *, void *);
60   typedef void (*DRouteFreeDatumFunction)(void *);
61
62 typedef struct _DRouteInterface DRouteInterface;
63 struct _DRouteInterface
64 {
65   DRouteMethod *methods;
66   DRouteProperty *properties;
67   DRouteGetDatumFunction get_datum;
68   DRouteFreeDatumFunction free_datum;
69   char *name;
70 };
71
72 typedef struct _DRouteData DRouteData;
73 struct _DRouteData
74 {
75   GSList *interfaces;
76   char (*introspect_children)(const char *, GString *, void *);
77   void *user_data;
78 };
79
80 DBusHandlerResult droute_message(DBusConnection *bus, DBusMessage *message, void *user_data);
81
82 dbus_bool_t droute_return_v_int32(DBusMessageIter *iter, dbus_int32_t val);
83 dbus_bool_t droute_return_v_double(DBusMessageIter *iter, double val);
84 dbus_bool_t droute_return_v_string(DBusMessageIter *iter, const char *val);
85 dbus_int32_t droute_get_v_int32(DBusMessageIter *iter);
86 const char *droute_get_v_string(DBusMessageIter *iter);
87 dbus_bool_t droute_return_v_object(DBusMessageIter *iter, const char *path);
88
89 dbus_bool_t droute_add_interface(DRouteData *data, const char *name, DRouteMethod *methods, DRouteProperty *properties, DRouteGetDatumFunction get_datum, DRouteFreeDatumFunction free_datum);
90 #endif  /* _DROUTE_H */