GDBusInterfaceSkeleton

GDBusInterfaceSkeleton — Service-side D-Bus interface

Synopsis

#include <gio/gio.h>

                    GDBusInterfaceSkeleton;
struct              GDBusInterfaceSkeletonClass;
void                g_dbus_interface_skeleton_flush     (GDBusInterfaceSkeleton *interface_);
GDBusInterfaceInfo * g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_);
GDBusInterfaceVTable * g_dbus_interface_skeleton_get_vtable
                                                        (GDBusInterfaceSkeleton *interface_);
GVariant *          g_dbus_interface_skeleton_get_properties
                                                        (GDBusInterfaceSkeleton *interface_);
gboolean            g_dbus_interface_skeleton_export    (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection,
                                                         const gchar *object_path,
                                                         GError **error);
void                g_dbus_interface_skeleton_unexport  (GDBusInterfaceSkeleton *interface_);
void                g_dbus_interface_skeleton_unexport_from_connection
                                                        (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection);
GDBusConnection *   g_dbus_interface_skeleton_get_connection
                                                        (GDBusInterfaceSkeleton *interface_);
GList *             g_dbus_interface_skeleton_get_connections
                                                        (GDBusInterfaceSkeleton *interface_);
gboolean            g_dbus_interface_skeleton_has_connection
                                                        (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection);
const gchar *       g_dbus_interface_skeleton_get_object_path
                                                        (GDBusInterfaceSkeleton *interface_);
enum                GDBusInterfaceSkeletonFlags;
GDBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags
                                                        (GDBusInterfaceSkeleton *interface_);
void                g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_,
                                                         GDBusInterfaceSkeletonFlags flags);

Object Hierarchy

  GObject
   +----GDBusInterfaceSkeleton

Implemented Interfaces

GDBusInterfaceSkeleton implements GDBusInterface.

Properties

  "g-flags"                  GDBusInterfaceSkeletonFlags  : Read / Write

Signals

  "g-authorize-method"                             : Run Last

Description

Abstract base class for D-Bus interfaces on the service side.

Details

GDBusInterfaceSkeleton

typedef struct _GDBusInterfaceSkeleton GDBusInterfaceSkeleton;

The GDBusInterfaceSkeleton structure contains private data and should only be accessed using the provided API.

Since 2.30


struct GDBusInterfaceSkeletonClass

struct GDBusInterfaceSkeletonClass {
  GObjectClass parent_class;

  /* Virtual Functions */
  GDBusInterfaceInfo   *(*get_info)       (GDBusInterfaceSkeleton  *interface_);
  GDBusInterfaceVTable *(*get_vtable)     (GDBusInterfaceSkeleton  *interface_);
  GVariant             *(*get_properties) (GDBusInterfaceSkeleton  *interface_);
  void                  (*flush)          (GDBusInterfaceSkeleton  *interface_);


  /* Signals */
  gboolean (*g_authorize_method) (GDBusInterfaceSkeleton  *interface_,
                                  GDBusMethodInvocation   *invocation);
};

Class structure for GDBusInterfaceSkeleton.

GObjectClass parent_class;

The parent class.

get_info ()

Returns a GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.

get_vtable ()

Returns a GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.

get_properties ()

Returns a GVariant with all properties. See g_dbus_interface_skeleton_get_properties().

flush ()

Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().

g_authorize_method ()

Signal class handler for the "g-authorize-method" signal.

Since 2.30


g_dbus_interface_skeleton_flush ()

void                g_dbus_interface_skeleton_flush     (GDBusInterfaceSkeleton *interface_);

If interface_ has outstanding changes, request for these changes to be emitted immediately.

For example, an exported D-Bus interface may queue up property changes and emit the org.freedesktop.DBus.Properties::PropertiesChanged signal later (e.g. in an idle handler). This technique is useful for collapsing multiple property changes into one.

interface_ :

A GDBusInterfaceSkeleton.

Since 2.30


g_dbus_interface_skeleton_get_info ()

GDBusInterfaceInfo * g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_);

Gets D-Bus introspection information for the D-Bus interface implemented by interface_.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A GDBusInterfaceInfo (never NULL). Do not free. [transfer none]

Since 2.30


g_dbus_interface_skeleton_get_vtable ()

GDBusInterfaceVTable * g_dbus_interface_skeleton_get_vtable
                                                        (GDBusInterfaceSkeleton *interface_);

Gets the interface vtable for the D-Bus interface implemented by interface_. The returned function pointers should expect interface_ itself to be passed as user_data.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A GDBusInterfaceVTable (never NULL).

Since 2.30


g_dbus_interface_skeleton_get_properties ()

GVariant *          g_dbus_interface_skeleton_get_properties
                                                        (GDBusInterfaceSkeleton *interface_);

Gets all D-Bus properties for interface_.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A GVariant of type 'a{sv}'. Free with g_variant_unref(). [transfer full]

Since 2.30


g_dbus_interface_skeleton_export ()

gboolean            g_dbus_interface_skeleton_export    (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection,
                                                         const gchar *object_path,
                                                         GError **error);

Exports interface_ at object_path on connection.

This can be called multiple times to export the same interface_ onto multiple connections however the object_path provided must be the same for all connections.

Use g_dbus_interface_skeleton_unexport() to unexport the object.

interface_ :

The D-Bus interface to export.

connection :

A GDBusConnection to export interface_ on.

object_path :

The path to export the interface at.

error :

Return location for error or NULL.

Returns :

TRUE if the interface was exported on connection, otherwise FALSE with error set.

Since 2.30


g_dbus_interface_skeleton_unexport ()

void                g_dbus_interface_skeleton_unexport  (GDBusInterfaceSkeleton *interface_);

Stops exporting interface_ on all connections it is exported on.

To unexport interface_ from only a single connection, use g_dbus_interface_skeleton_unexport_from_connection()

interface_ :

A GDBusInterfaceSkeleton.

Since 2.30


g_dbus_interface_skeleton_unexport_from_connection ()

void                g_dbus_interface_skeleton_unexport_from_connection
                                                        (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection);

Stops exporting interface_ on connection.

To stop exporting on all connections the interface is exported on, use g_dbus_interface_skeleton_unexport().

interface_ :

A GDBusInterfaceSkeleton.

connection :

A GDBusConnection.

Since 2.32


g_dbus_interface_skeleton_get_connection ()

GDBusConnection *   g_dbus_interface_skeleton_get_connection
                                                        (GDBusInterfaceSkeleton *interface_);

Gets the first connection that interface_ is exported on, if any.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A GDBusConnection or NULL if interface_ is not exported anywhere. Do not free, the object belongs to interface_. [transfer none]

Since 2.30


g_dbus_interface_skeleton_get_connections ()

GList *             g_dbus_interface_skeleton_get_connections
                                                        (GDBusInterfaceSkeleton *interface_);

Gets a list of the connections that interface_ is exported on.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A list of all the connections that interface_ is exported on. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref(). [element-type GDBusConnection][transfer full]

Since 2.32


g_dbus_interface_skeleton_has_connection ()

gboolean            g_dbus_interface_skeleton_has_connection
                                                        (GDBusInterfaceSkeleton *interface_,
                                                         GDBusConnection *connection);

Checks if interface_ is export on connection.

interface_ :

A GDBusInterfaceSkeleton.

connection :

A GDBusConnection.

Returns :

TRUE if interface_ is exported on connection, FALSE otherwise.

Since 2.32


g_dbus_interface_skeleton_get_object_path ()

const gchar *       g_dbus_interface_skeleton_get_object_path
                                                        (GDBusInterfaceSkeleton *interface_);

Gets the object path that interface_ is exported on, if any.

interface_ :

A GDBusInterfaceSkeleton.

Returns :

A string owned by interface_ or NULL if interface_ is not exported anywhere. Do not free, the string belongs to interface_.

Since 2.30


enum GDBusInterfaceSkeletonFlags

typedef enum {
  G_DBUS_INTERFACE_SKELETON_FLAGS_NONE = 0,
  G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD = (1<<0)
} GDBusInterfaceSkeletonFlags;

Flags describing the behavior of a GDBusInterfaceSkeleton instance.

G_DBUS_INTERFACE_SKELETON_FLAGS_NONE

No flags set.

G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD

Each method invocation is handled in a thread dedicated to the invocation. This means that the method implementation can use blocking IO without blocking any other part of the process. It also means that the method implementation must use locking to access data structures used by other threads.

Since 2.30


g_dbus_interface_skeleton_get_flags ()

GDBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags
                                                        (GDBusInterfaceSkeleton *interface_);

Gets the GDBusInterfaceSkeletonFlags that describes what the behavior of interface_

interface_ :

A GDBusInterfaceSkeleton.

Returns :

One or more flags from the GDBusInterfaceSkeletonFlags enumeration.

Since 2.30


g_dbus_interface_skeleton_set_flags ()

void                g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_,
                                                         GDBusInterfaceSkeletonFlags flags);

Sets flags describing what the behavior of skeleton should be.

interface_ :

A GDBusInterfaceSkeleton.

flags :

Flags from the GDBusInterfaceSkeletonFlags enumeration.

Since 2.30

Property Details

The "g-flags" property

  "g-flags"                  GDBusInterfaceSkeletonFlags  : Read / Write

Flags from the GDBusInterfaceSkeletonFlags enumeration.

Since 2.30

Signal Details

The "g-authorize-method" signal

gboolean            user_function                      (GDBusInterfaceSkeleton *interface,
                                                        GDBusMethodInvocation  *invocation,
                                                        gpointer                user_data)       : Run Last

Emitted when a method is invoked by a remote caller and used to determine if the method call is authorized.

Note that this signal is emitted in a thread dedicated to handling the method call so handlers are allowed to perform blocking IO. This means that it is appropriate to call e.g. polkit_authority_check_authorization_sync() with the POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION flag set.

If FALSE is returned then no further handlers are run and the signal handler must take a reference to invocation and finish handling the call (e.g. return an error via g_dbus_method_invocation_return_error()).

Otherwise, if TRUE is returned, signal emission continues. If no handlers return FALSE, then the method is dispatched. If interface has an enclosing GDBusObjectSkeleton, then the "authorize-method" signal handlers run before the handlers for this signal.

The default class handler just returns TRUE.

Please note that the common case is optimized: if no signals handlers are connected and the default class handler isn't overridden (for both interface and the enclosing GDBusObjectSkeleton, if any) and "g-flags" does not have the G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD flags set, no dedicated thread is ever used and the call will be handled in the same thread as the object that interface belongs to was exported in.

interface :

The GDBusInterfaceSkeleton emitting the signal.

invocation :

A GDBusMethodInvocation.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE if the call is authorized, FALSE otherwise.

Since 2.30