Class: Gio::DBusServer
- Inherits:
-
Object
- Object
- Gio::DBusServer
- Defined in:
- (unknown)
Overview
GDBus::Server 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.
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 g_bus_own_name().
An example of peer-to-peer communication with G-DBus can be found in [gdbus-example-peer.c](git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-peer.c).
Note that a minimal GDBus::Server will accept connections from any peer. In many use-cases it will be necessary to add a GDBus::AuthObserver that only accepts connections that have successfully authenticated as the same user that is running the GDBus::Server.
Instance Method Summary collapse
-
#active=(active) ⇒ TrueClass
Whether the server is currently active.
-
#active? ⇒ TrueClass
Whether the server is currently active.
-
#address ⇒ String
The D-Bus address to listen on.
-
#address=(address) ⇒ String
The D-Bus address to listen on.
-
#authentication_observer ⇒ Gio::DBusAuthObserver
A GDBus::AuthObserver object to assist in the authentication process or nil.
-
#authentication_observer=(authentication_observer) ⇒ Gio::DBusAuthObserver
A GDBus::AuthObserver object to assist in the authentication process or nil.
-
#client_address ⇒ String
The D-Bus address that clients can use.
-
#client_address=(client_address) ⇒ String
The D-Bus address that clients can use.
-
#flags ⇒ Gio::DBusServerFlags
Flags from the GDBus::ServerFlags enumeration.
-
#flags=(flags) ⇒ Gio::DBusServerFlags
Flags from the GDBus::ServerFlags enumeration.
-
#guid ⇒ String
The guid of the server.
-
#guid=(guid) ⇒ String
The guid of the server.
-
#is_active ⇒ TrueClass
Gets whether server is active.
-
#new_sync(address, flags, guid, observer, cancellable) ⇒ Gio::DBusServer
Creates a new D-Bus server that listens on the first address in address that works.
-
#start ⇒ nil
Starts server.
-
#stop ⇒ nil
Stops server.
Instance Method Details
#active=(active) ⇒ TrueClass
Whether the server is currently active.
#active? ⇒ TrueClass
Whether the server is currently active.
#address ⇒ String
The D-Bus address to listen on.
#address=(address) ⇒ String
The D-Bus address to listen on.
#authentication_observer ⇒ Gio::DBusAuthObserver
A GDBus::AuthObserver object to assist in the authentication process or nil.
#authentication_observer=(authentication_observer) ⇒ Gio::DBusAuthObserver
A GDBus::AuthObserver object to assist in the authentication process or nil.
#client_address ⇒ String
The D-Bus address that clients can use.
#client_address=(client_address) ⇒ String
The D-Bus address that clients can use.
#flags ⇒ Gio::DBusServerFlags
Flags from the GDBus::ServerFlags enumeration.
#flags=(flags) ⇒ Gio::DBusServerFlags
Flags from the GDBus::ServerFlags enumeration.
#guid ⇒ String
The guid of the server.
#guid=(guid) ⇒ String
The guid of the server.
#is_active ⇒ TrueClass
Gets whether server is active.
#new_sync(address, flags, guid, observer, cancellable) ⇒ Gio::DBusServer
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-nil GDBus::AuthObserver.
Connect to the GDBus::Server::new-connection signal to handle incoming connections.
The returned GDBus::Server isn’t active - you have to start it with g_dbus_server_start().
GDBus::Server is used in this [example].
This is a synchronous failable constructor. There is currently no asynchronous version. g_object_unref().
#start ⇒ nil
Starts server.
#stop ⇒ nil
Stops server.