GLib bindings implementation details

Implementation details of GLib bindings. More...

Data Structures

struct  DBusGMessageQueue
 DBusGMessageQueue: A GSource subclass for dispatching DBusConnection messages. More...
struct  ConnectionSetup
struct  IOHandler
struct  TimeoutHandler
struct  _DBusGProxyPrivate
 Internals of DBusGProxy. More...
struct  DBusGProxyList
 A list of proxies with a given name+path+interface, used to route incoming signals. More...
struct  _DBusGProxyManager
 DBusGProxyManager's primary task is to route signals to the proxies those signals are emitted on. More...
struct  DBusGProxyNameOwnerInfo
struct  DBusGProxyNameOwnerForeachData
struct  DBusGProxyUnassociateData
struct  GPendingNotifyClosure

: any name on the message bus

dbus_g_proxy_new_for_name_owner: : the connection to the remote bus

: name of the object inside the service to call methods on : name of the interface to call methods on : return location for an error

Similar to dbus_g_proxy_new_for_name(), but makes a round-trip request to the message bus to get the current name owner, then binds the proxy to the unique name of the current owner, rather than to the well-known name. As a result, the name owner will not change over time, and the proxy will emit the "destroy" signal when the owner disappears from the message bus.

An example of the difference between dbus_g_proxy_new_for_name() and dbus_g_proxy_new_for_name_owner(): if you provide the well-known name "org.freedesktop.Database" dbus_g_proxy_new_for_name() remains bound to that name as it changes owner. dbus_g_proxy_new_for_name_owner() will fail if the name has no owner. If the name has an owner, dbus_g_proxy_new_for_name_owner() will bind to the unique name of that owner rather than the generic name.

Returns: new proxy object, or NULL on error

DBusGProxydbus_g_proxy_new_for_name_owner (DBusGConnection *connection, const char *name, const char *path_name, const char *interface_name, GError **error)
DBusGProxydbus_g_proxy_new_from_proxy (DBusGProxy *proxy, const char *interface, const char *path)
DBusGProxydbus_g_proxy_new_for_peer (DBusGConnection *connection, const char *path_name, const char *interface_name)
 dbus_g_proxy_new_for_peer: : the connection to the peer : name of the object inside the peer to call methods on : name of the interface to call methods on
const char * dbus_g_proxy_get_bus_name (DBusGProxy *proxy)
 dbus_g_proxy_get_bus_name: : the proxy
const char * dbus_g_proxy_get_interface (DBusGProxy *proxy)
 dbus_g_proxy_get_interface: : the proxy
void dbus_g_proxy_set_interface (DBusGProxy *proxy, const char *interface_name)
 dbus_g_proxy_set_interface: : the proxy : an object interface
const char * dbus_g_proxy_get_path (DBusGProxy *proxy)
 dbus_g_proxy_get_path: Gets the path this proxy is bound to : the proxy
DBusGProxyCall * dbus_g_proxy_begin_call (DBusGProxy *proxy, const char *method, DBusGProxyCallNotify notify, gpointer user_data, GDestroyNotify destroy, GType first_arg_type,...)
 dbus_g_proxy_begin_call: : a proxy for a remote interface : the name of the method to invoke : callback to be invoked when method returns : user data passed to callback : function called to destroy user_data : type of the first argument
DBusGProxyCall * dbus_g_proxy_begin_call_with_timeout (DBusGProxy *proxy, const char *method, DBusGProxyCallNotify notify, gpointer user_data, GDestroyNotify destroy, int timeout, GType first_arg_type,...)
 dbus_g_proxy_begin_call_with_timeout: : a proxy for a remote interface : the name of the method to invoke : callback to be invoked when method returns : user data passed to callback : function called to destroy user_data : specify the timeout in milliseconds : type of the first argument
gboolean dbus_g_proxy_end_call (DBusGProxy *proxy, DBusGProxyCall *call, GError **error, GType first_arg_type,...)
 dbus_g_proxy_end_call: : a proxy for a remote interface : the pending call ID from dbus_g_proxy_begin_call() : return location for an error : type of first "out" argument
gboolean dbus_g_proxy_call (DBusGProxy *proxy, const char *method, GError **error, GType first_arg_type,...)
 dbus_g_proxy_call: : a proxy for a remote interface : method to invoke : return location for an error : type of first "in" argument
gboolean dbus_g_proxy_call_with_timeout (DBusGProxy *proxy, const char *method, int timeout, GError **error, GType first_arg_type,...)
 dbus_g_proxy_call_with_timeout: : a proxy for a remote interface : method to invoke : specify the timeout in milliseconds : return location for an error : type of first "in" argument
void dbus_g_proxy_call_no_reply (DBusGProxy *proxy, const char *method, GType first_arg_type,...)
 dbus_g_proxy_call_no_reply: : a proxy for a remote interface : the name of the method to invoke : type of the first argument
void dbus_g_proxy_cancel_call (DBusGProxy *proxy, DBusGProxyCall *call)
 dbus_g_proxy_cancel_call : a proxy for a remote interface : the pending call ID from dbus_g_proxy_begin_call()
void dbus_g_proxy_send (DBusGProxy *proxy, DBusMessage *message, dbus_uint32_t *client_serial)
 dbus_g_proxy_send: : a proxy for a remote interface : the message to address and send : return location for message's serial, or NULL
void dbus_g_proxy_add_signal (DBusGProxy *proxy, const char *signal_name, GType first_type,...)
 dbus_g_proxy_add_signal: : the proxy for a remote interface : the name of the signal : the first argument type, or G_TYPE_INVALID if none
void dbus_g_proxy_connect_signal (DBusGProxy *proxy, const char *signal_name, GCallback handler, void *data, GClosureNotify free_data_func)
 dbus_g_proxy_connect_signal: : a proxy for a remote interface : the DBus signal name to listen for : the handler to connect : data to pass to handler : callback function to destroy data
void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy, const char *signal_name, GCallback handler, void *data)
 dbus_g_proxy_disconnect_signal: : a proxy for a remote interface : the DBus signal name to disconnect : the handler to disconnect : the data that was registered with handler

: the D-BUS error name

dbus_g_error_get_name: : the GError given from the remote method

: the D-BUS error detailed message

This function may only be invoked on a GError returned from an invocation of a remote method, e.g. via dbus_g_proxy_end_call. Moreover, you must ensure that the error's domain is DBUS_GERROR, and the code is DBUS_GERROR_REMOTE_EXCEPTION.

Returns: the D-BUS name for a remote exception.

const char * dbus_g_error_get_name (GError *error)
GType dbus_connection_get_g_type (void)
 dbus_connection_get_g_type: Get the GLib type ID for a DBusConnection boxed type.
GType dbus_message_get_g_type (void)
 dbus_message_get_g_type: Get the GLib type ID for a DBusMessage boxed type.
GType dbus_g_connection_get_g_type (void)
 dbus_g_connection_get_g_type: Get the GLib type ID for a DBusGConnection boxed type.
GType dbus_g_message_get_g_type (void)
 dbus_g_message_get_g_type: Get the GLib type ID for a DBusGMessage boxed type.
DBusConnection * dbus_g_connection_get_connection (DBusGConnection *gconnection)
 dbus_g_connection_get_connection: : a DBusGConnection
DBusGConnection * dbus_connection_get_g_connection (DBusConnection *connection)
 dbus_connection_get_g_connection: : a DBusConnection
DBusMessage * dbus_g_message_get_message (DBusGMessage *gmessage)
 dbus_g_message_get_message: : a DBusGMessage

Defines

#define LOCK_MANAGER(mgr)   (g_static_mutex_lock (&(mgr)->lock))
 Lock the DBusGProxyManager.
#define UNLOCK_MANAGER(mgr)   (g_static_mutex_unlock (&(mgr)->lock))
 Unlock the DBusGProxyManager.
#define DBUS_G_PROXY_DESTROYED(proxy)   (DBUS_G_PROXY_GET_PRIVATE(proxy)->manager == NULL)
#define DBUS_G_VALUE_ARRAY_COLLECT_ALL(VALARRAY, FIRST_ARG_TYPE, ARGS)

Typedefs

typedef _DBusGProxyManager DBusGProxyManager
 DBusGProxyManager typedef.
typedef _DBusGProxyPrivate DBusGProxyPrivate

Enumerations

enum  {
  PROP_0, PROP_NAME, PROP_PATH, PROP_INTERFACE,
  PROP_CONNECTION
}
enum  { DESTROY, RECEIVED, LAST_SIGNAL }

Variables

dbus_int32_t _dbus_gmain_connection_slot = -1

Detailed Description

Implementation details of GLib bindings.


Define Documentation

#define DBUS_G_VALUE_ARRAY_COLLECT_ALL ( VALARRAY,
FIRST_ARG_TYPE,
ARGS   ) 

Value:

do { \
  GType valtype; \
  int i = 0; \
  VALARRAY = g_value_array_new (6); \
  valtype = FIRST_ARG_TYPE; \
  while (valtype != G_TYPE_INVALID) \
    { \
      const char *collect_err; \
      GValue *val; \
      g_value_array_append (VALARRAY, NULL); \
      val = g_value_array_get_nth (VALARRAY, i); \
      g_value_init (val, valtype); \
      collect_err = NULL; \
      G_VALUE_COLLECT (val, ARGS, G_VALUE_NOCOPY_CONTENTS, &collect_err); \
      valtype = va_arg (ARGS, GType); \
      i++; \
    } \
} while (0)

Definition at line 1742 of file dbus-gproxy.c.

Referenced by dbus_g_proxy_begin_call(), dbus_g_proxy_begin_call_with_timeout(), dbus_g_proxy_call(), dbus_g_proxy_call_no_reply(), and dbus_g_proxy_call_with_timeout().


Function Documentation

DBusGConnection* dbus_connection_get_g_connection ( DBusConnection *  connection  ) 

dbus_connection_get_g_connection: : a DBusConnection

Get the DBusGConnection corresponding to this DBusConnection. This only makes sense if the DBusConnection was originally a DBusGConnection that was registered with the GLib main loop. The return value does not have its refcount incremented.

Returns: DBusGConnection

Definition at line 326 of file dbus-glib.c.

GType dbus_connection_get_g_type ( void   ) 

dbus_connection_get_g_type: Get the GLib type ID for a DBusConnection boxed type.

Returns: the GLib type

Definition at line 219 of file dbus-glib.c.

DBusConnection* dbus_g_connection_get_connection ( DBusGConnection *  gconnection  ) 

dbus_g_connection_get_connection: : a DBusGConnection

Get the DBusConnection corresponding to this DBusGConnection. The return value does not have its refcount incremented.

Returns: DBusConnection

Definition at line 306 of file dbus-glib.c.

GType dbus_g_connection_get_g_type ( void   ) 

dbus_g_connection_get_g_type: Get the GLib type ID for a DBusGConnection boxed type.

Returns: the GLib type

Definition at line 257 of file dbus-glib.c.

GType dbus_g_message_get_g_type ( void   ) 

dbus_g_message_get_g_type: Get the GLib type ID for a DBusGMessage boxed type.

Returns: the GLib type

Definition at line 276 of file dbus-glib.c.

DBusMessage* dbus_g_message_get_message ( DBusGMessage *  gmessage  ) 

dbus_g_message_get_message: : a DBusGMessage

Get the DBusMessage corresponding to this DBusGMessage. The return value does not have its refcount incremented.

Returns: DBusMessage

Definition at line 345 of file dbus-glib.c.

void dbus_g_proxy_add_signal ( DBusGProxy proxy,
const char *  signal_name,
GType  first_type,
  ... 
)

dbus_g_proxy_add_signal: : the proxy for a remote interface : the name of the signal : the first argument type, or G_TYPE_INVALID if none

Specifies the argument signature of a signal;.only necessary if the remote object does not support introspection. The arguments specified are the GLib types expected.

Definition at line 2740 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, _DBusGProxyPrivate::interface, and _DBusGProxyPrivate::signal_signatures.

DBusGProxyCall* dbus_g_proxy_begin_call ( DBusGProxy proxy,
const char *  method,
DBusGProxyCallNotify  notify,
gpointer  user_data,
GDestroyNotify  destroy,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_begin_call: : a proxy for a remote interface : the name of the method to invoke : callback to be invoked when method returns : user data passed to callback : function called to destroy user_data : type of the first argument

Asynchronously invokes a method on a remote interface. The method call will not be sent over the wire until the application returns to the main loop, or blocks in dbus_connection_flush() to write out pending data. The call will be completed after a timeout, or when a reply is received. When the call returns, the callback specified will be invoked; you can then collect the results of the call (which may be an error, or a reply), use dbus_g_proxy_end_call().

TODO this particular function shouldn't die on out of memory, since you should be able to do a call with large arguments.

Returns: call identifier.

Definition at line 2368 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and DBUS_G_VALUE_ARRAY_COLLECT_ALL.

DBusGProxyCall* dbus_g_proxy_begin_call_with_timeout ( DBusGProxy proxy,
const char *  method,
DBusGProxyCallNotify  notify,
gpointer  user_data,
GDestroyNotify  destroy,
int  timeout,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_begin_call_with_timeout: : a proxy for a remote interface : the name of the method to invoke : callback to be invoked when method returns : user data passed to callback : function called to destroy user_data : specify the timeout in milliseconds : type of the first argument

Asynchronously invokes a method on a remote interface. The method call will not be sent over the wire until the application returns to the main loop, or blocks in dbus_connection_flush() to write out pending data. The call will be completed after a timeout, or when a reply is received. When the call returns, the callback specified will be invoked; you can then collect the results of the call (which may be an error, or a reply), use dbus_g_proxy_end_call().

TODO this particular function shouldn't die on out of memory, since you should be able to do a call with large arguments.

Returns: call identifier.

Definition at line 2420 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and DBUS_G_VALUE_ARRAY_COLLECT_ALL.

gboolean dbus_g_proxy_call ( DBusGProxy proxy,
const char *  method,
GError **  error,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_call: : a proxy for a remote interface : method to invoke : return location for an error : type of first "in" argument

Function for synchronously invoking a method and receiving reply values. This function is equivalent to dbus_g_proxy_begin_call followed by dbus_g_proxy_end_call. All of the input arguments are specified first, followed by G_TYPE_INVALID, followed by all of the output values, followed by a second G_TYPE_INVALID. Note that this means you must always specify G_TYPE_INVALID twice.

Returns: FALSE if an error is set, TRUE otherwise.

Definition at line 2507 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and DBUS_G_VALUE_ARRAY_COLLECT_ALL.

void dbus_g_proxy_call_no_reply ( DBusGProxy proxy,
const char *  method,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_call_no_reply: : a proxy for a remote interface : the name of the method to invoke : type of the first argument

Sends a method call message as with dbus_g_proxy_begin_call(), but does not ask for a reply or allow you to receive one.

TODO: this particular function shouldn't die on out of memory, since you should be able to do a call with large arguments.

Definition at line 2599 of file dbus-gproxy.c.

References _DBusGProxyManager::connection, DBUS_G_PROXY_DESTROYED, DBUS_G_VALUE_ARRAY_COLLECT_ALL, and _DBusGProxyPrivate::manager.

gboolean dbus_g_proxy_call_with_timeout ( DBusGProxy proxy,
const char *  method,
int  timeout,
GError **  error,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_call_with_timeout: : a proxy for a remote interface : method to invoke : specify the timeout in milliseconds : return location for an error : type of first "in" argument

Function for synchronously invoking a method and receiving reply values. This function is equivalent to dbus_g_proxy_begin_call followed by dbus_g_proxy_end_call. All of the input arguments are specified first, followed by G_TYPE_INVALID, followed by all of the output values, followed by a second G_TYPE_INVALID. Note that this means you must always specify G_TYPE_INVALID twice.

Returns: FALSE if an error is set, TRUE otherwise.

Definition at line 2555 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and DBUS_G_VALUE_ARRAY_COLLECT_ALL.

void dbus_g_proxy_cancel_call ( DBusGProxy proxy,
DBusGProxyCall *  call 
)

dbus_g_proxy_cancel_call : a proxy for a remote interface : the pending call ID from dbus_g_proxy_begin_call()

Cancels a pending method call. The method call was normally initiated with dbus_g_proxy_begin_call(). This function may not be used on pending calls that have already been ended with dbus_g_proxy_end_call.

Definition at line 2649 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and _DBusGProxyPrivate::pending_calls.

void dbus_g_proxy_connect_signal ( DBusGProxy proxy,
const char *  signal_name,
GCallback  handler,
void *  data,
GClosureNotify  free_data_func 
)

dbus_g_proxy_connect_signal: : a proxy for a remote interface : the DBus signal name to listen for : the handler to connect : data to pass to handler : callback function to destroy data

Connect a signal handler to a proxy for a remote interface. When the remote interface emits the specified signal, the proxy will emit a corresponding GLib signal.

Definition at line 2801 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, _DBusGProxyPrivate::interface, and _DBusGProxyPrivate::signal_signatures.

void dbus_g_proxy_disconnect_signal ( DBusGProxy proxy,
const char *  signal_name,
GCallback  handler,
void *  data 
)

dbus_g_proxy_disconnect_signal: : a proxy for a remote interface : the DBus signal name to disconnect : the handler to disconnect : the data that was registered with handler

Disconnect all signal handlers from a proxy that match the given criteria.

Definition at line 2852 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and _DBusGProxyPrivate::interface.

gboolean dbus_g_proxy_end_call ( DBusGProxy proxy,
DBusGProxyCall *  call,
GError **  error,
GType  first_arg_type,
  ... 
)

dbus_g_proxy_end_call: : a proxy for a remote interface : the pending call ID from dbus_g_proxy_begin_call() : return location for an error : type of first "out" argument

Collects the results of a method call. The method call was normally initiated with dbus_g_proxy_end_call(). You may use this function outside of the callback given to dbus_g_proxy_begin_call; in that case this function will block if the results haven't yet been received.

If the call results in an error, the error is set as normal for GError and the function returns FALSE.

Otherwise, the "out" parameters and return value of the method are stored in the provided varargs list. The list should be terminated with G_TYPE_INVALID.

Returns: FALSE if an error is set.

Definition at line 2472 of file dbus-gproxy.c.

const char* dbus_g_proxy_get_bus_name ( DBusGProxy proxy  ) 

dbus_g_proxy_get_bus_name: : the proxy

Gets the bus name a proxy is bound to (may be NULL in some cases). If you created the proxy with dbus_g_proxy_new_for_name(), then the name you passed to that will be returned. If you created it with dbus_g_proxy_new_for_name_owner(), then the unique connection name will be returned. If you created it with dbus_g_proxy_new_for_peer() then NULL will be returned.

Returns: the bus name the proxy sends messages to

Definition at line 2037 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and _DBusGProxyPrivate::name.

const char* dbus_g_proxy_get_interface ( DBusGProxy proxy  ) 

dbus_g_proxy_get_interface: : the proxy

Gets the object interface proxy is bound to (may be NULL in some cases).

Returns: an object interface

Definition at line 2058 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and _DBusGProxyPrivate::interface.

const char* dbus_g_proxy_get_path ( DBusGProxy proxy  ) 

dbus_g_proxy_get_path: Gets the path this proxy is bound to : the proxy

Returns: an object path

Definition at line 2099 of file dbus-gproxy.c.

References DBUS_G_PROXY_DESTROYED, and _DBusGProxyPrivate::path.

DBusGProxy* dbus_g_proxy_new_for_peer ( DBusGConnection *  connection,
const char *  path_name,
const char *  interface_name 
)

dbus_g_proxy_new_for_peer: : the connection to the peer : name of the object inside the peer to call methods on : name of the interface to call methods on

Creates a proxy for an object in peer application (one we're directly connected to). That is, this function is intended for use when there's no message bus involved, we're doing a simple 1-to-1 communication between two applications.

Returns: new proxy object

Definition at line 2007 of file dbus-gproxy.c.

void dbus_g_proxy_send ( DBusGProxy proxy,
DBusMessage *  message,
dbus_uint32_t *  client_serial 
)

dbus_g_proxy_send: : a proxy for a remote interface : the message to address and send : return location for message's serial, or NULL

Sends a message to the interface we're proxying for. Does not block or wait for a reply. The message is only actually written out when you return to the main loop or block in dbus_connection_flush().

The message is modified to be addressed to the target interface. That is, a destination name field or whatever is needed will be added to the message. The basic point of this function is to add the necessary header fields, otherwise it's equivalent to dbus_connection_send().

This function adds a reference to the message, so the caller still owns its original reference.

Definition at line 2692 of file dbus-gproxy.c.

References _DBusGProxyManager::connection, DBUS_G_PROXY_DESTROYED, _DBusGProxyPrivate::interface, _DBusGProxyPrivate::manager, _DBusGProxyPrivate::name, and _DBusGProxyPrivate::path.

void dbus_g_proxy_set_interface ( DBusGProxy proxy,
const char *  interface_name 
)

dbus_g_proxy_set_interface: : the proxy : an object interface

Sets the object interface proxy is bound to

Definition at line 2078 of file dbus-gproxy.c.

References _DBusGProxyPrivate::interface, and _DBusGProxyPrivate::manager.

GType dbus_message_get_g_type ( void   ) 

dbus_message_get_g_type: Get the GLib type ID for a DBusMessage boxed type.

Returns: the GLib type

Definition at line 238 of file dbus-glib.c.


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