dbus-glib.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-glib.h GLib integration
00003  *
00004  * Copyright (C) 2002, 2003  CodeFactory AB
00005  * Copyright (C) 2003, 2004 Red Hat, Inc.
00006  *
00007  * Licensed under the Academic Free License version 2.1
00008  * 
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  */
00024 #ifndef DBUS_GLIB_H
00025 #define DBUS_GLIB_H
00026 
00027 #include <glib-object.h>
00028 #include <dbus/dbus-shared.h>
00029 
00030 G_BEGIN_DECLS
00031 
00032 #define DBUS_INSIDE_DBUS_GLIB_H 1
00033 
00034 
00038 typedef struct _DBusGConnection DBusGConnection;
00042 typedef struct _DBusGMessage DBusGMessage;
00043 
00044 
00045 #define DBUS_TYPE_G_CONNECTION   (dbus_g_connection_get_g_type ())
00046 #define DBUS_TYPE_G_MESSAGE      (dbus_g_message_get_g_type ())
00047 GType dbus_g_connection_get_g_type   (void) G_GNUC_CONST;
00048 GType dbus_g_message_get_g_type      (void) G_GNUC_CONST;
00049 
00050 
00051 DBusGConnection*  dbus_g_connection_ref          (DBusGConnection        *connection);
00052 void              dbus_g_connection_unref        (DBusGConnection        *connection);
00053 DBusGMessage*     dbus_g_message_ref             (DBusGMessage           *message);
00054 void              dbus_g_message_unref           (DBusGMessage           *message);
00055 
00056 void              dbus_g_connection_flush        (DBusGConnection        *connection);
00057 
00058 GQuark dbus_g_error_quark (void);
00059 #define DBUS_GERROR dbus_g_error_quark ()
00060 
00061 typedef enum
00062 {
00063 #include "dbus-glib-error-enum.h" 
00064 } DBusGError;
00065 
00066 gboolean         dbus_g_error_has_name    (GError      *error,
00067                                            const char  *name);
00068 const char *     dbus_g_error_get_name    (GError      *error);
00069 
00070 void             dbus_g_thread_init (void);
00071 
00072 DBusGConnection* dbus_g_connection_open (const gchar  *address,
00073                                          GError      **error);
00074 DBusGConnection* dbus_g_bus_get         (DBusBusType   type,
00075                                          GError      **error);
00076 
00077 typedef struct _DBusGObjectInfo DBusGObjectInfo;
00078 typedef struct _DBusGMethodInfo DBusGMethodInfo;
00079 
00090 struct _DBusGMethodInfo
00091 {
00092   GCallback                 function;    
00093   GClosureMarshal           marshaller;  
00094   int                       data_offset; 
00095 };
00096 
00110 struct _DBusGObjectInfo
00111 {
00112   int   format_version;
00113                        
00114   const DBusGMethodInfo *method_infos;
00115   int   n_method_infos;                
00116   const char *data; 
00117   const char *exported_signals;  
00118   const char *exported_properties; 
00119 };
00120 
00121 void       dbus_g_object_type_install_info     (GType                 object_type,
00122                                                 const DBusGObjectInfo *info);
00123 
00124 void       dbus_g_error_domain_register        (GQuark                domain,
00125                                                 const char *          default_iface,
00126                                                 GType                 code_enum);
00127 
00128 void       dbus_g_connection_register_g_object (DBusGConnection       *connection,
00129                                                 const char            *at_path,
00130                                                 GObject               *object);
00131 GObject *  dbus_g_connection_lookup_g_object   (DBusGConnection       *connection,
00132                                                 const char            *at_path);
00133 
00134 #ifdef DBUS_COMPILATION
00135 #include "dbus/dbus-gtype-specialized.h"
00136 #else
00137 #include <dbus/dbus-gtype-specialized.h>
00138 #endif
00139 
00140 /* definitions for some basic array types */
00141 #define DBUS_TYPE_G_BOOLEAN_ARRAY  (dbus_g_type_get_collection ("GArray", G_TYPE_BOOLEAN))
00142 #define DBUS_TYPE_G_UCHAR_ARRAY    (dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR))
00143 #define DBUS_TYPE_G_UINT_ARRAY     (dbus_g_type_get_collection ("GArray", G_TYPE_UINT))
00144 #define DBUS_TYPE_G_INT_ARRAY      (dbus_g_type_get_collection ("GArray", G_TYPE_INT))
00145 #define DBUS_TYPE_G_UINT64_ARRAY   (dbus_g_type_get_collection ("GArray", G_TYPE_UINT64))
00146 #define DBUS_TYPE_G_INT64_ARRAY    (dbus_g_type_get_collection ("GArray", G_TYPE_INT64))
00147 #define DBUS_TYPE_G_OBJECT_ARRAY   (dbus_g_type_get_collection ("GPtrArray", G_TYPE_OBJECT))
00148 
00149 #define DBUS_TYPE_G_STRING_STRING_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING))
00150 
00151 GType        dbus_g_object_path_get_g_type         (void) G_GNUC_CONST;
00152 #define DBUS_TYPE_G_OBJECT_PATH (dbus_g_object_path_get_g_type ())
00153 
00154 void         dbus_g_object_register_marshaller      (GClosureMarshal  marshaller,
00155                                                      GType            rettype,
00156                                                      ...);
00157 void         dbus_g_object_register_marshaller_array(GClosureMarshal  marshaller,
00158                                                      GType            rettype,
00159                                                      guint            n_types,
00160                                                      const GType*     types);
00161 
00162 typedef struct _DBusGProxy       DBusGProxy;
00163 typedef struct _DBusGProxyClass  DBusGProxyClass;
00164 
00165 #define DBUS_TYPE_G_PROXY              (dbus_g_proxy_get_type ())
00166 #define DBUS_G_PROXY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_G_PROXY, DBusGProxy))
00167 #define DBUS_G_PROXY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_G_PROXY, DBusGProxyClass))
00168 #define DBUS_IS_G_PROXY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_G_PROXY))
00169 #define DBUS_IS_G_PROXY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_G_PROXY))
00170 #define DBUS_G_PROXY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_G_PROXY, DBusGProxyClass))
00171 
00172 struct _DBusGProxy
00173 {
00174   GObject parent;
00175 };
00176 
00177 struct _DBusGProxyClass
00178 {
00179   GObjectClass parent_class;  
00180 };
00181 
00182 typedef struct _DBusGProxyCall DBusGProxyCall;
00183 typedef void (* DBusGProxyCallNotify) (DBusGProxy       *proxy,
00184                                        DBusGProxyCall   *call_id,
00185                                        void             *user_data);
00186 
00187 GType             dbus_g_proxy_get_type              (void) G_GNUC_CONST;
00188 DBusGProxy*       dbus_g_proxy_new_for_name          (DBusGConnection   *connection,
00189                                                       const char        *name,
00190                                                       const char        *path,
00191                                                       const char        *interface);
00192 DBusGProxy*       dbus_g_proxy_new_for_name_owner    (DBusGConnection   *connection,
00193                                                       const char        *name,
00194                                                       const char        *path,
00195                                                       const char        *interface,
00196                                                       GError           **error);
00197 DBusGProxy*       dbus_g_proxy_new_from_proxy        (DBusGProxy        *proxy,
00198                                                       const char        *interface,
00199                                                       const char        *path_name);
00200 DBusGProxy*       dbus_g_proxy_new_for_peer          (DBusGConnection   *connection,
00201                                                       const char        *path_name,
00202                                                       const char        *interface_name);
00203 
00204 void              dbus_g_proxy_set_interface         (DBusGProxy        *proxy,
00205                                                       const char        *interface_name);
00206 void              dbus_g_proxy_add_signal            (DBusGProxy        *proxy,
00207                                                       const char        *signal_name,
00208                                                       GType              first_type, 
00209                                                       ...);
00210 
00211 void              dbus_g_proxy_connect_signal        (DBusGProxy        *proxy,
00212                                                       const char        *signal_name,
00213                                                       GCallback          handler,
00214                                                       void              *data,
00215                                                       GClosureNotify     free_data_func);
00216 void              dbus_g_proxy_disconnect_signal     (DBusGProxy        *proxy,
00217                                                       const char        *signal_name,
00218                                                       GCallback          handler,
00219                                                       void              *data);
00220 
00221 gboolean          dbus_g_proxy_call                  (DBusGProxy        *proxy,
00222                                                       const char        *method,
00223                                                       GError           **error,
00224                                                       GType              first_arg_type,
00225                                                       ...);
00226 
00227 gboolean          dbus_g_proxy_call_with_timeout     (DBusGProxy        *proxy,
00228                                                       const char       *method,
00229                                                       int timeout,
00230                                                       GError           **error,
00231                                                       GType              first_arg_type,
00232                                                       ...);
00233 
00234 void              dbus_g_proxy_call_no_reply         (DBusGProxy        *proxy,
00235                                                       const char        *method,
00236                                                       GType              first_arg_type,
00237                                                       ...);
00238 
00239 DBusGProxyCall *  dbus_g_proxy_begin_call            (DBusGProxy        *proxy,
00240                                                       const char        *method,
00241                                                       DBusGProxyCallNotify notify,
00242                                                       gpointer           data,
00243                                                       GDestroyNotify     destroy,
00244                                                       GType              first_arg_type,
00245                                                       ...);
00246 DBusGProxyCall * dbus_g_proxy_begin_call_with_timeout (DBusGProxy        *proxy,
00247                                                        const char       *method,
00248                                                        DBusGProxyCallNotify notify,
00249                                                        gpointer       user_data,
00250                                                        GDestroyNotify   destroy,
00251                                                        int timeout,
00252                                                        GType             first_arg_type,
00253                                                        ...);
00254 
00255 gboolean          dbus_g_proxy_end_call              (DBusGProxy        *proxy,
00256                                                       DBusGProxyCall    *call,
00257                                                       GError           **error,
00258                                                       GType              first_arg_type,
00259                                                       ...);
00260 void              dbus_g_proxy_cancel_call           (DBusGProxy        *proxy,
00261                                                       DBusGProxyCall    *call);
00262 
00263 const char*       dbus_g_proxy_get_path              (DBusGProxy        *proxy);
00264 
00265 const char*       dbus_g_proxy_get_bus_name          (DBusGProxy        *proxy);
00266 
00267 const char*       dbus_g_proxy_get_interface         (DBusGProxy        *proxy);
00268 
00269 typedef struct _DBusGMethodInvocation DBusGMethodInvocation;
00270 
00271 void              dbus_g_method_return               (DBusGMethodInvocation *context, ...);
00272 
00273 void              dbus_g_method_return_error         (DBusGMethodInvocation *context, GError *error);
00274 
00275 /* Probably possible to replace this with a closure */
00276 typedef struct {
00277   GCallback cb;
00278   gpointer userdata;
00279 } DBusGAsyncData;
00280 
00281 #undef DBUS_INSIDE_DBUS_GLIB_H
00282 
00283 G_END_DECLS
00284 
00285 #endif /* DBUS_GLIB_H */

Generated on Sat Dec 6 19:56:17 2008 for D-BUSGLibBindings by  doxygen 1.5.1