DBusGLib


Data Structures

interface  name
 dbus_g_proxy_new_from_proxy: : the proxy to use as a template : of the object inside the peer to call methods on interface to call methods on More...

: any name on the message bus

dbus_g_proxy_new_for_name: : the connection to the remote bus

: name of the object instance to call methods on : name of the interface to call methods on

Creates a new proxy for a remote interface exported by a connection on a message bus. Method calls and signal connections over this proxy will go to the name owner; the name's owner is expected to support the given interface name. THE NAME OWNER MAY CHANGE OVER TIME, for example between two different method calls, unless the name is a unique name. If you need a fixed owner, you need to request the current owner and bind a proxy to its unique name rather than to the generic name; see dbus_g_proxy_new_for_name_owner().

A name-associated proxy only makes sense with a message bus, not for app-to-app direct dbus connections.

This proxy will only emit the "destroy" signal if the DBusConnection is disconnected, the proxy has no remaining references, or the name is a unique name and its owner disappears. If a well-known name changes owner, the proxy will still be alive.

Returns: new proxy object

DBusGProxy * dbus_g_proxy_new_for_name (DBusGConnection *connection, const char *name, const char *path_name, const char *interface_name)

: 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

DBusGProxy * dbus_g_proxy_new_for_name_owner (DBusGConnection *connection, const char *name, const char *path_name, const char *interface_name, GError **error)
DBusGProxy * dbus_g_proxy_new_from_proxy (DBusGProxy *proxy, const char *interface, const char *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
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
void dbus_g_proxy_set_default_timeout (DBusGProxy *proxy, int timeout)
 dbus_g_proxy_set_default_timeout: : a proxy for a remote interface : specify the timeout in milliseconds

Functions

void dbus_connection_setup_with_g_main (DBusConnection *connection, GMainContext *context)
 dbus_connection_setup_with_g_main: : the connection : the GMainContext or NULL for default context
void dbus_server_setup_with_g_main (DBusServer *server, GMainContext *context)
 dbus_server_setup_with_g_main: : the server : the GMainContext or NULL for default
DBusGConnection * dbus_g_connection_open (const gchar *address, GError **error)
 dbus_g_connection_open: : address of the connection to open : address where an error can be returned.
DBusGConnection * dbus_g_bus_get (DBusBusType type, GError **error)
 dbus_g_bus_get: : bus type : address where an error can be returned.
GType dbus_g_proxy_get_type (void)
 SECTION:dbus-gproxy : DBus Proxy : DBusProxy : Stable.
void dbus_g_thread_init (void)
 dbus_g_thread_init:

Variables

char * _DBusGProxyPrivate::name
 Name messages go to or NULL.
char * _DBusGProxyPrivate::path
 Path messages go to or NULL.
char * _DBusGProxyPrivate::interface
 Interface messages go to or NULL.
DBusGProxyCall * _DBusGProxyPrivate::name_call
 Pending call id to retrieve name owner.
guint _DBusGProxyPrivate::for_owner: 1
 Whether or not this proxy is for a name owner.
guint _DBusGProxyPrivate::associated: 1
 Whether or not this proxy is associated (for name proxies).
guint _DBusGProxyPrivate::call_id_counter
 Integer counter for pending calls.
GData * _DBusGProxyPrivate::signal_signatures
 D-BUS signatures for each signal.
GHashTable * _DBusGProxyPrivate::pending_calls
 Calls made on this proxy which have not yet returned.
int _DBusGProxyPrivate::default_timeout
 Default timeout to use, see dbus_g_proxy_set_default_timeout.
GHashTable * DBusGProxyList::signal_subscribed
 Set of signals with the DBusGProxy which subscribes to the signals gchar *signal_name -> GHashTable* of (DBusGProxy *proxy -> guint count).
char DBusGProxyList::name [4]
 name (empty string for none), nul byte, path, nul byte, interface, nul byte
int _DBusGProxyManager::refcount
 Reference count.
DBusConnection * _DBusGProxyManager::connection
 Connection we're associated with.
DBusGProxy * _DBusGProxyManager::bus_proxy
 Special internal proxy used to talk to the bus.
GHashTable * _DBusGProxyManager::proxy_lists
 Hash used to route incoming signals and iterate over proxies tristring -> DBusGProxyList.
GHashTable * _DBusGProxyManager::owner_match_rule
 Hash to keep trace of match rules of NameOwnerChanged.
GHashTable * _DBusGProxyManager::owner_names
 Hash to keep track of mapping from char * -> GSList of DBusGProxyNameOwnerInfo base name -> [name,name,.
GSList * _DBusGProxyManager::unassociated_proxies
 List of name proxies for which there was no result for GetNameOwner.
guint DBusGProxyNameOwnerInfo::refcount
const char * DBusGProxyNameOwnerForeachData::owner
DBusGProxyNameOwnerInfo * DBusGProxyNameOwnerForeachData::info
GSList * DBusGProxyUnassociateData::destroyed
guint GPendingNotifyClosure::call_id
DBusGProxyCallNotify GPendingNotifyClosure::func
void * GPendingNotifyClosure::data
GDestroyNotify GPendingNotifyClosure::free_data_func

Function Documentation

void dbus_connection_setup_with_g_main ( DBusConnection *  connection,
GMainContext *  context 
)

dbus_connection_setup_with_g_main: : the connection : the GMainContext or NULL for default context

Sets the watch and timeout functions of a DBusConnection to integrate the connection with the GLib main loop. Pass in NULL for the GMainContext unless you're doing something specialized.

If called twice for the same context, does nothing the second time. If called once with context A and once with context B, context B replaces context A as the context monitoring the connection.

Definition at line 554 of file dbus-gmain.c.

Referenced by dbus_g_bus_get(), and dbus_g_connection_open().

DBusGConnection* dbus_g_bus_get ( DBusBusType  type,
GError **  error 
)

dbus_g_bus_get: : bus type : address where an error can be returned.

Returns a connection to the given bus. The connection is a global variable shared with other callers of this function.

(Internally, calls dbus_bus_get() then calls dbus_connection_setup_with_g_main() on the result.)

Returns: a DBusConnection

Definition at line 742 of file dbus-gmain.c.

References dbus_connection_setup_with_g_main().

DBusGConnection* dbus_g_connection_open ( const gchar *  address,
GError **  error 
)

dbus_g_connection_open: : address of the connection to open : address where an error can be returned.

Returns a connection to the given address.

(Internally, calls dbus_connection_open() then calls dbus_connection_setup_with_g_main() on the result.)

Returns: a DBusConnection

Definition at line 702 of file dbus-gmain.c.

References dbus_connection_setup_with_g_main().

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 2911 of file dbus-gproxy.c.

References _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 2523 of file dbus-gproxy.c.

References _DBusGProxyPrivate::default_timeout.

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 2576 of file dbus-gproxy.c.

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 2663 of file dbus-gproxy.c.

References _DBusGProxyPrivate::default_timeout.

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 2770 of file dbus-gproxy.c.

References _DBusGProxyManager::connection, 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 2724 of file dbus-gproxy.c.

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 2820 of file dbus-gproxy.c.

References _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 2972 of file dbus-gproxy.c.

References _DBusGProxyManager::connection, _DBusGProxyPrivate::interface, _DBusGProxyPrivate::manager, _DBusGProxyPrivate::name, _DBusGProxyManager::proxy_lists, _DBusGProxyPrivate::signal_signatures, and DBusGProxyList::signal_subscribed.

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 3076 of file dbus-gproxy.c.

References _DBusGProxyManager::connection, _DBusGProxyPrivate::interface, _DBusGProxyPrivate::manager, _DBusGProxyManager::proxy_lists, and DBusGProxyList::signal_subscribed.

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 2628 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 2170 of file dbus-gproxy.c.

References _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 2191 of file dbus-gproxy.c.

References _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 2232 of file dbus-gproxy.c.

References _DBusGProxyPrivate::path.

GType dbus_g_proxy_get_type ( void   ) 

SECTION:dbus-gproxy : DBus Proxy : DBusProxy : Stable.

A DBusGProxy is a boxed type abstracting a DBusProxy. dbus_g_proxy_get_type: Standard GObject get_type() function for DBusGProxy.

Returns: type ID for DBusGProxy class

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

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 2140 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 2863 of file dbus-gproxy.c.

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

void dbus_g_proxy_set_default_timeout ( DBusGProxy *  proxy,
int  timeout 
)

dbus_g_proxy_set_default_timeout: : a proxy for a remote interface : specify the timeout in milliseconds

Sets the default timeout to use for a proxy. This timeout will be used in calls where the timeout is not specified.

This is useful for long-running operations that takes longer than the default timeout (which is a on the order of magnitude of tens of seconds). For some applications, consider using a pattern where the method returns once the operation is underway (e.g. immediately) and emits a signal when the operation terminates (though beware of leaking information with/in the signal return value).

Since: 0.75

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

References _DBusGProxyPrivate::default_timeout.

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 2211 of file dbus-gproxy.c.

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

void dbus_g_thread_init ( void   ) 

dbus_g_thread_init:

Initializes the D-BUS thread system. This function may only be called once and must be called prior to calling any other function in the D-BUS API.

Definition at line 43 of file dbus-gthread.c.

void dbus_server_setup_with_g_main ( DBusServer *  server,
GMainContext *  context 
)

dbus_server_setup_with_g_main: : the server : the GMainContext or NULL for default

Sets the watch and timeout functions of a DBusServer to integrate the server with the GLib main loop. In most cases the context argument should be NULL.

If called twice for the same context, does nothing the second time. If called once with context A and once with context B, context B replaces context A as the context monitoring the connection.

Definition at line 631 of file dbus-gmain.c.


Variable Documentation

DBusConnection* _DBusGProxyManager::connection [inherited]

Connection we're associated with.

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

Referenced by dbus_g_proxy_call_no_reply(), dbus_g_proxy_connect_signal(), dbus_g_proxy_disconnect_signal(), and dbus_g_proxy_send().

GHashTable* _DBusGProxyManager::owner_match_rule [inherited]

Hash to keep trace of match rules of NameOwnerChanged.

gchar *name -> guint refcount

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

GHashTable* _DBusGProxyManager::owner_names [inherited]

Hash to keep track of mapping from char * -> GSList of DBusGProxyNameOwnerInfo base name -> [name,name,.

..] for proxies which are for names.

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


Generated on Mon Oct 19 12:36:05 2009 for D-BUSGLibBindings by  doxygen 1.5.6