Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

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 Red Hat, Inc.
00006  *
00007  * Licensed under the Academic Free License version 2.0
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 <dbus/dbus.h>
00028 #include <glib-object.h>
00029 
00030 G_BEGIN_DECLS
00031 
00032 #define DBUS_INSIDE_DBUS_GLIB_H 1
00033 
00034 GQuark dbus_g_error_quark (void);
00035 #define DBUS_GERROR dbus_g_error_quark ()
00036 
00037 #define DBUS_TYPE_CONNECTION (dbus_connection_get_g_type ())
00038 #define DBUS_TYPE_MESSAGE    (dbus_message_get_g_type ())
00039 GType dbus_connection_get_g_type (void) G_GNUC_CONST;
00040 GType dbus_message_get_g_type    (void) G_GNUC_CONST;
00041 
00042 typedef enum
00043 {
00044   /* FIXME map all the DBUS_ERROR to DBUS_GERROR, should
00045    * probably be automated in some way, perhaps
00046    * via lame perl script
00047    */
00048   DBUS_GERROR_FAILED
00049 } DBusGError;
00050 
00051 void dbus_set_g_error (GError   **gerror,
00052                        DBusError *derror);
00053 
00054 void            dbus_g_thread_init                (void);
00055 void            dbus_connection_setup_with_g_main (DBusConnection  *connection,
00056                                                    GMainContext    *context);
00057 void            dbus_server_setup_with_g_main     (DBusServer      *server,
00058                                                    GMainContext    *context);
00059 DBusConnection* dbus_bus_get_with_g_main          (DBusBusType      type,
00060                                                    GError         **error);
00061 
00062 typedef struct DBusGObjectInfo DBusGObjectInfo;
00063 typedef struct DBusGMethodInfo DBusGMethodInfo;
00064 
00070 struct DBusGMethodInfo
00071 {
00072   GCallback                 function;    
00073   DBusHandleMessageFunction marshaller;  
00074   int                       data_offset; 
00075 };
00076 
00081 struct DBusGObjectInfo
00082 {
00083   const DBusGMethodInfo *infos; 
00084   const unsigned char *data;    
00085   void *dbus_internal_padding1; 
00086   void *dbus_internal_padding2; 
00087 };
00088 
00089 void dbus_g_object_class_install_info  (GObjectClass          *object_class,
00090                                         const DBusGObjectInfo *info);
00091 void dbus_connection_register_g_object (DBusConnection        *connection,
00092                                         const char            *at_path,
00093                                         GObject               *object);
00094 
00095 
00096 typedef struct DBusGProxy       DBusGProxy;
00097 typedef struct DBusGProxyClass  DBusGProxyClass;
00098 
00099 typedef void (* DBusGProxySignalHandler) (DBusGProxy  *proxy,
00100                                           DBusMessage *signal,
00101                                           void        *user_data);
00102 
00103 #define DBUS_TYPE_GPROXY              (dbus_gproxy_get_type ())
00104 #define DBUS_GPROXY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_GPROXY, DBusGProxy))
00105 #define DBUS_GPROXY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_GPROXY, DBusGProxyClass))
00106 #define DBUS_IS_GPROXY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_GPROXY))
00107 #define DBUS_IS_GPROXY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_GPROXY))
00108 #define DBUS_GPROXY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_GPROXY, DBusGProxyClass))
00109 
00110 
00111 GType            dbus_gproxy_get_type              (void) G_GNUC_CONST;
00112 DBusGProxy*      dbus_gproxy_new_for_service       (DBusConnection           *connection,
00113                                                     const char               *service_name,
00114                                                     const char               *path_name,
00115                                                     const char               *interface_name);
00116 DBusGProxy*      dbus_gproxy_new_for_service_owner (DBusConnection           *connection,
00117                                                     const char               *service_name,
00118                                                     const char               *path_name,
00119                                                     const char               *interface_name,
00120                                                     GError                  **error);
00121 DBusGProxy*      dbus_gproxy_new_for_peer          (DBusConnection           *connection,
00122                                                     const char               *path_name,
00123                                                     const char               *interface_name);
00124 void             dbus_gproxy_connect_signal        (DBusGProxy               *proxy,
00125                                                     const char               *signal_name,
00126                                                     DBusGProxySignalHandler   handler,
00127                                                     void                     *data,
00128                                                     GClosureNotify            free_data_func);
00129 void             dbus_gproxy_disconnect_signal     (DBusGProxy               *proxy,
00130                                                     const char               *signal_name,
00131                                                     DBusGProxySignalHandler   handler,
00132                                                     void                     *data);
00133 DBusPendingCall* dbus_gproxy_begin_call            (DBusGProxy               *proxy,
00134                                                     const char               *method,
00135                                                     int                       first_arg_type,
00136                                                     ...);
00137 gboolean         dbus_gproxy_end_call              (DBusGProxy               *proxy,
00138                                                     DBusPendingCall          *pending,
00139                                                     GError                  **error,
00140                                                     int                       first_arg_type,
00141                                                     ...);
00142 void             dbus_gproxy_call_no_reply         (DBusGProxy               *proxy,
00143                                                     const char               *method,
00144                                                     int                       first_arg_type,
00145                                                     ...);
00146 void             dbus_gproxy_send                  (DBusGProxy               *proxy,
00147                                                     DBusMessage              *message,
00148                                                     dbus_uint32_t            *client_serial);
00149 
00150 
00151 #undef DBUS_INSIDE_DBUS_GLIB_H
00152 
00153 G_END_DECLS
00154 
00155 #endif /* DBUS_GLIB_H */
00156 
00157 
00158 

Generated on Sun Mar 21 03:52:04 2004 for D-BUS by doxygen 1.3.6-20040222