![]() |
![]() |
![]() |
libgdbus Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
void (*GDBusDestroyFunction) (void *user_data
); enum GDBusMethodFlags; DBusMessage * (*GDBusMethodFunction) (DBusConnection *connection
,DBusMessage *message
,void *user_data
); GDBusMethodTable; enum GDBusPropertyFlags; dbus_bool_t (*GDBusPropertyGetFunction) (DBusConnection *connection
,DBusMessageIter *iter
,void *user_data
); dbus_bool_t (*GDBusPropertySetFunction) (DBusConnection *connection
,DBusMessageIter *iter
,void *user_data
); GDBusPropertyTable; enum GDBusSignalFlags; gboolean (*GDBusSignalFunction) (DBusConnection *connection
,DBusMessage *message
,void *user_data
); GDBusSignalTable; void (*GDBusWatchFunction) (void *user_data
); guint g_dbus_add_disconnect_watch (DBusConnection *connection
,const char *name
,GDBusWatchFunction function
,void *user_data
,GDBusDestroyFunction destroy
); guint g_dbus_add_service_watch (DBusConnection *connection
,const char *name
,GDBusWatchFunction connect
,GDBusWatchFunction disconnect
,void *user_data
,GDBusDestroyFunction destroy
); guint g_dbus_add_signal_watch (DBusConnection *connection
,const char *rule
,GDBusSignalFunction function
,void *user_data
,GDBusDestroyFunction destroy
); void g_dbus_cleanup_connection (DBusConnection *connection
); DBusMessage * g_dbus_create_error (DBusMessage *message
,const char *name
,const char *format
,...
); DBusMessage * g_dbus_create_error_valist (DBusMessage *message
,const char *name
,const char *format
,va_list args
); DBusMessage * g_dbus_create_reply (DBusMessage *message
,int type
,...
); DBusMessage * g_dbus_create_reply_valist (DBusMessage *message
,int type
,va_list args
); gboolean g_dbus_emit_signal (DBusConnection *connection
,const char *path
,const char *interface
,const char *name
,int type
,...
); gboolean g_dbus_emit_signal_valist (DBusConnection *connection
,const char *path
,const char *interface
,const char *name
,int type
,va_list args
); gboolean g_dbus_register_interface (DBusConnection *connection
,const char *path
,const char *name
,GDBusMethodTable *methods
,GDBusSignalTable *signals
,GDBusPropertyTable *properties
,void *user_data
,GDBusDestroyFunction destroy
); void g_dbus_remove_all_watches (DBusConnection *connection
); gboolean g_dbus_remove_watch (DBusConnection *connection
,guint tag
); gboolean g_dbus_request_name (DBusConnection *connection
,const char *name
,DBusError *error
); gboolean g_dbus_send_error (DBusConnection *connection
,DBusMessage *message
,const char *name
,const char *format
,...
); gboolean g_dbus_send_message (DBusConnection *connection
,DBusMessage *message
); gboolean g_dbus_send_reply (DBusConnection *connection
,DBusMessage *message
,int type
,...
); gboolean g_dbus_send_reply_valist (DBusConnection *connection
,DBusMessage *message
,int type
,va_list args
); gboolean g_dbus_set_disconnect_function (DBusConnection *connection
,GDBusWatchFunction function
,void *user_data
,GDBusDestroyFunction destroy
); DBusConnection * g_dbus_setup_address (const char *address
,DBusError *error
); DBusConnection * g_dbus_setup_bus (DBusBusType type
,const char *name
,DBusError *error
); void g_dbus_setup_connection (DBusConnection *connection
,GMainContext *context
); gboolean g_dbus_unregister_interface (DBusConnection *connection
,const char *path
,const char *name
);
void (*GDBusDestroyFunction) (void *user_data
);
Destroy function
|
user data to pass to the function |
typedef enum { G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0), G_DBUS_METHOD_FLAG_NOREPLY = (1 << 1), G_DBUS_METHOD_FLAG_ASYNC = (1 << 2), } GDBusMethodFlags;
Method flags
DBusMessage * (*GDBusMethodFunction) (DBusConnection *connection
,DBusMessage *message
,void *user_data
);
Method function
|
a DBusConnection |
|
a DBusMessage |
|
user data to pass to the function |
Returns : |
DBusMessage reply |
typedef struct { const char *name; const char *signature; const char *reply; GDBusMethodFunction function; GDBusMethodFlags flags; } GDBusMethodTable;
Method table
method name | |
method signature | |
reply signature | |
GDBusMethodFunction |
method function |
GDBusMethodFlags |
method flags |
typedef enum { G_DBUS_PROPERTY_FLAG_DEPRECATED = (1 << 0), } GDBusPropertyFlags;
Property flags
dbus_bool_t (*GDBusPropertyGetFunction) (DBusConnection *connection
,DBusMessageIter *iter
,void *user_data
);
Property get function
|
a DBusConnection |
|
a DBusMessageIter |
|
user data to pass to the function |
Returns : |
TRUE on success |
dbus_bool_t (*GDBusPropertySetFunction) (DBusConnection *connection
,DBusMessageIter *iter
,void *user_data
);
Property set function
|
a DBusConnection |
|
a DBusMessageIter |
|
user data to pass to the function |
Returns : |
TRUE on success |
typedef struct { const char *name; const char *type; GDBusPropertyGetFunction get; GDBusPropertyGetFunction set; GDBusPropertyFlags flags; } GDBusPropertyTable;
Property table
property name | |
property value type | |
property get function | |
property set function | |
GDBusPropertyFlags |
property flags |
typedef enum { G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0), } GDBusSignalFlags;
Signal flags
gboolean (*GDBusSignalFunction) (DBusConnection *connection
,DBusMessage *message
,void *user_data
);
Signal function
|
a DBusConnection |
|
a DBusMessage |
|
user data to pass to the function |
Returns : |
FALSE to remove this watch |
typedef struct { const char *name; const char *signature; GDBusSignalFlags flags; } GDBusSignalTable;
Signal table
signal name | |
signal signature | |
GDBusSignalFlags |
signal flags |
void (*GDBusWatchFunction) (void *user_data
);
Watch function
|
user data to pass to the function |
guint g_dbus_add_disconnect_watch (DBusConnection *connection
,const char *name
,GDBusWatchFunction function
,void *user_data
,GDBusDestroyFunction destroy
);
Add new watch to listen for disconnect of a client for the given connection.
After the callback has been called, this watch will be automatically removed.
|
the connection |
|
unique or well known name |
|
function called on name disconnect |
|
user data to pass to the function |
|
function called to destroy user_data |
Returns : |
identifier of the watch |
guint g_dbus_add_service_watch (DBusConnection *connection
,const char *name
,GDBusWatchFunction connect
,GDBusWatchFunction disconnect
,void *user_data
,GDBusDestroyFunction destroy
);
Add new watch to listen for connects and/or disconnects of a client for the given connection.
|
the connection |
|
unique or well known name |
|
function called on name connect |
|
function called on name disconnect |
|
user data to pass to the function |
|
function called to destroy user_data |
Returns : |
identifier of the watch |
guint g_dbus_add_signal_watch (DBusConnection *connection
,const char *rule
,GDBusSignalFunction function
,void *user_data
,GDBusDestroyFunction destroy
);
Add new watch to listen for specific signals of a client for the given connection.
If the callback returns FALSE this watch will be automatically removed.
|
the connection |
|
matching rule for this signal |
|
function called when signal arrives |
|
user data to pass to the function |
|
function called to destroy user_data |
Returns : |
identifier of the watch |
void g_dbus_cleanup_connection (DBusConnection *connection
);
Cleanup the setup of DBusConnection and free the allocated memory.
|
a DBusConnection |
DBusMessage * g_dbus_create_error (DBusMessage *message
,const char *name
,const char *format
,...
);
Create error reply for the given message.
|
the originating message |
|
the error name |
|
the error description |
Returns : |
reply message on success |
DBusMessage * g_dbus_create_error_valist (DBusMessage *message
,const char *name
,const char *format
,va_list args
);
Create error reply for the given message.
|
the originating message |
|
the error name |
|
the error description |
|
argument list |
Returns : |
reply message on success |
DBusMessage * g_dbus_create_reply (DBusMessage *message
,int type
,...
);
Create reply for the given message.
|
the originating message |
|
first argument type |
Returns : |
reply message on success |
DBusMessage * g_dbus_create_reply_valist (DBusMessage *message
,int type
,va_list args
);
Create reply for the given message.
|
the originating message |
|
first argument type |
|
argument list |
Returns : |
reply message on success |
gboolean g_dbus_emit_signal (DBusConnection *connection
,const char *path
,const char *interface
,const char *name
,int type
,...
);
Emit a signal for the given path and interface with the given signal name.
The signal signature will be check against the registered signal table.
|
the connection |
|
object path |
|
interface name |
|
signal name |
|
first argument type |
Returns : |
TRUE on success |
gboolean g_dbus_emit_signal_valist (DBusConnection *connection
,const char *path
,const char *interface
,const char *name
,int type
,va_list args
);
Emit a signal for the given path and interface with the given signal name.
The signal signature will be check against the registered signal table.
|
the connection |
|
object path |
|
interface name |
|
signal name |
|
first argument type |
|
argument list |
Returns : |
TRUE on success |
gboolean g_dbus_register_interface (DBusConnection *connection
,const char *path
,const char *name
,GDBusMethodTable *methods
,GDBusSignalTable *signals
,GDBusPropertyTable *properties
,void *user_data
,GDBusDestroyFunction destroy
);
Registers an interface for the given path in the object hierarchy with the given methods, signals and/or properties.
|
the connection |
|
object path |
|
interface name |
|
method table |
|
signal table |
|
property table |
|
user data to assign to interface |
|
function called to destroy user_data |
Returns : |
TRUE on success |
void g_dbus_remove_all_watches (DBusConnection *connection
);
Removes all registered watches.
|
the connection |
gboolean g_dbus_remove_watch (DBusConnection *connection
,guint tag
);
Removes the watch for the given identifier.
|
the connection |
|
watch identifier |
Returns : |
TRUE on success |
gboolean g_dbus_request_name (DBusConnection *connection
,const char *name
,DBusError *error
);
Requests a well known name for connection.
|
a DBusConnection |
|
well known name |
|
a DBusError |
Returns : |
TRUE on success |
gboolean g_dbus_send_error (DBusConnection *connection
,DBusMessage *message
,const char *name
,const char *format
,...
);
Send error reply for the given message and via the given D-Bus connection.
|
the connection |
|
the originating message |
|
the error name |
|
the error description |
Returns : |
TRUE on success |
gboolean g_dbus_send_message (DBusConnection *connection
,DBusMessage *message
);
Send message via the given D-Bus connection.
The reference count for the message will be decremented by this function.
|
the connection |
|
the message to send |
Returns : |
TRUE on success |
gboolean g_dbus_send_reply (DBusConnection *connection
,DBusMessage *message
,int type
,...
);
Send reply for the given message and via the given D-Bus connection.
|
the connection |
|
the originating message |
|
first argument type |
Returns : |
TRUE on success |
gboolean g_dbus_send_reply_valist (DBusConnection *connection
,DBusMessage *message
,int type
,va_list args
);
Send reply for the given message and via the given D-Bus connection.
|
the connection |
|
the originating message |
|
first argument type |
|
argument list |
Returns : |
TRUE on success |
gboolean g_dbus_set_disconnect_function (DBusConnection *connection
,GDBusWatchFunction function
,void *user_data
,GDBusDestroyFunction destroy
);
Set a callback function that will be called when the D-Bus message bus exits.
|
a DBusConnection |
|
a GDBusWatchFunction |
|
user data to pass to the function |
|
a GDBusDestroyFunction |
Returns : |
TRUE on success |
DBusConnection * g_dbus_setup_address (const char *address
,DBusError *error
);
Connect to bus and setup connection
Returns a connection to the bus specified via the given address and sets the watch and timeout functions for it.
|
bus address |
|
a DBusError |
Returns : |
newly setup DBusConnection |
DBusConnection * g_dbus_setup_bus (DBusBusType type
,const char *name
,DBusError *error
);
Connect to bus and setup connection
Returns a connection to the given bus and requests a well known name for it. Sets the watch and timeout functions for it.
|
a DBusBusType |
|
well known name |
|
a DBusError |
Returns : |
newly setup DBusConnection |
void g_dbus_setup_connection (DBusConnection *connection
,GMainContext *context
);
Setup connection with main 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.
|
a DBusConnection |
|
a GMainContext or NULL for default context |
gboolean g_dbus_unregister_interface (DBusConnection *connection
,const char *path
,const char *name
);
Unregister the given interface for the given path in the object hierarchy.
|
the connection |
|
object path |
|
interface name |
Returns : |
TRUE on success |