Package ch.bailu.gtk.gio
Klasse DBusServer
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.gio.DBusServer
- Alle implementierten Schnittstellen:
PointerInterface
`GDBusServer` is a helper for listening to and accepting D-Bus
connections. This can be used to create a new D-Bus server, allowing two
peers to use the D-Bus protocol for their own specialized communication.
A server instance provided in this way will not perform message routing or
implement the
[`org.freedesktop.DBus` interface](https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-messages).
To just export an object on a well-known name on a message bus, such as the
session or system bus, you should instead use [func@Gio.bus_own_name].
An example of peer-to-peer communication with GDBus can be found
in [gdbus-example-peer.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).
Note that a minimal `GDBusServer` will accept connections from any
peer. In many use-cases it will be necessary to add a
[class@Gio.DBusAuthObserver] that only accepts connections that have
successfully authenticated as the same user that is running the
`GDBusServer`. Since GLib 2.68 this can be achieved more simply by passing
the `G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER` flag to the
server.
connections. This can be used to create a new D-Bus server, allowing two
peers to use the D-Bus protocol for their own specialized communication.
A server instance provided in this way will not perform message routing or
implement the
[`org.freedesktop.DBus` interface](https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-messages).
To just export an object on a well-known name on a message bus, such as the
session or system bus, you should instead use [func@Gio.bus_own_name].
An example of peer-to-peer communication with GDBus can be found
in [gdbus-example-peer.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).
Note that a minimal `GDBusServer` will accept connections from any
peer. In many use-cases it will be necessary to add a
[class@Gio.DBusAuthObserver] that only accepts connections that have
successfully authenticated as the same user that is running the
`GDBusServer`. Since GLib 2.68 this can be achieved more simply by passing
the `G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER` flag to the
server.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfaceInitable
.static ClassHandler
Gets a
[D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses)
string that can be used by clients to connect to @server.int
getFlags()
Gets the flags for @server.getGuid()
Gets the GUID for @server, as provided to g_dbus_server_new_sync().static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
boolean
isActive()
Gets whether @server is active.static DBusServer
newSyncDBusServer
(Str address, int flags, Str guid, DBusAuthObserver observer, Cancellable cancellable) Creates a new D-Bus server that listens on the first address in
@address that works.static DBusServer
newSyncDBusServer
(String address, int flags, String guid, DBusAuthObserver observer, Cancellable cancellable) Creates a new D-Bus server that listens on the first address in
@address that works.Connect to signal "new-connection".void
start()
Starts @server.void
stop()
Stops @server.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_NEW_CONNECTION
- Siehe auch:
-
-
Konstruktordetails
-
DBusServer
-
-
Methodendetails
-
getClassHandler
-
newSyncDBusServer
public static DBusServer newSyncDBusServer(@Nonnull Str address, int flags, @Nonnull Str guid, @Nullable DBusAuthObserver observer, @Nullable Cancellable cancellable) throws AllocationError Creates a new D-Bus server that listens on the first address in
@address that works.
Once constructed, you can use g_dbus_server_get_client_address() to
get a D-Bus address string that clients can use to connect.
To have control over the available authentication mechanisms and
the users that are authorized to connect, it is strongly recommended
to provide a non-%NULL #GDBusAuthObserver.
Connect to the #GDBusServer::new-connection signal to handle
incoming connections.
The returned #GDBusServer isn't active - you have to start it with
g_dbus_server_start().
#GDBusServer is used in this [example](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).
This is a synchronous failable constructor. There is currently no
asynchronous version.- Parameter:
address
- A D-Bus address.flags
- Flags from the #GDBusServerFlags enumeration.guid
- A D-Bus GUID.observer
- A #GDBusAuthObserver or %NULL.cancellable
- A #GCancellable or %NULL.- Gibt zurück:
- A #GDBusServer or %NULL if @error is set. Free with g_object_unref().
- Löst aus:
AllocationError
-
newSyncDBusServer
public static DBusServer newSyncDBusServer(String address, int flags, String guid, @Nullable DBusAuthObserver observer, @Nullable Cancellable cancellable) throws AllocationError Creates a new D-Bus server that listens on the first address in
@address that works.
Once constructed, you can use g_dbus_server_get_client_address() to
get a D-Bus address string that clients can use to connect.
To have control over the available authentication mechanisms and
the users that are authorized to connect, it is strongly recommended
to provide a non-%NULL #GDBusAuthObserver.
Connect to the #GDBusServer::new-connection signal to handle
incoming connections.
The returned #GDBusServer isn't active - you have to start it with
g_dbus_server_start().
#GDBusServer is used in this [example](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).
This is a synchronous failable constructor. There is currently no
asynchronous version.- Parameter:
address
- A D-Bus address.flags
- Flags from the #GDBusServerFlags enumeration.guid
- A D-Bus GUID.observer
- A #GDBusAuthObserver or %NULL.cancellable
- A #GCancellable or %NULL.- Gibt zurück:
- A #GDBusServer or %NULL if @error is set. Free with g_object_unref().
- Löst aus:
AllocationError
-
getClientAddress
Gets a
[D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses)
string that can be used by clients to connect to @server.
This is valid and non-empty if initializing the #GDBusServer succeeded.- Gibt zurück:
- A D-Bus address string. Do not free, the string is owned by @server.
-
getFlags
public int getFlags()Gets the flags for @server.- Gibt zurück:
- A set of flags from the #GDBusServerFlags enumeration.
-
getGuid
Gets the GUID for @server, as provided to g_dbus_server_new_sync().- Gibt zurück:
- A D-Bus GUID. Do not free this string, it is owned by @server.
-
isActive
public boolean isActive()Gets whether @server is active.- Gibt zurück:
- %TRUE if server is active, %FALSE otherwise.
-
start
public void start()Starts @server. -
stop
public void stop()Stops @server. -
onNewConnection
Connect to signal "new-connection".
SeeDBusServer.OnNewConnection.onNewConnection(ch.bailu.gtk.gio.DBusConnection)
for signal description.
FieldSIGNAL_ON_NEW_CONNECTION
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asInitable
Implements interfaceInitable
. Call this to get access to interface functions.- Gibt zurück:
Initable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-