Top | ![]() |
![]() |
![]() |
![]() |
GTlsCertificate * | certificate | Read / Write |
gboolean | enable-ipv4 | Read / Write |
gboolean | enable-ipv6 | Read / Write |
The DevdBrowser is the toplevel object used by consumers of the libdeviced library. It scan scan the local network segments for nodes implementing the deviced protocol.
After creating a DevdBrowser, use devd_browser_load_async()
to
discover available nodes. “device-added” and
“device-removed” will be emitted in reaction to network
and device changes.
void devd_browser_set_enable_ipv4 (DevdBrowser *self
,gboolean enable_ipv4
);
void devd_browser_set_enable_ipv6 (DevdBrowser *self
,gboolean enable_ipv6
);
GTlsCertificate *
devd_browser_get_certificate (DevdBrowser *self
);
Gets the “certificate” property. This is used as the client TLS certificate when connecting to peers.
If unset, a certificate will be reloaded or generated when
devd_browser_load_async()
is called.
Since: 3.28
gchar *
devd_browser_get_certificate_hash (DevdBrowser *self
);
Gets a SHA256 hash for the “certificate” property.
Since: 3.28
void devd_browser_set_certificate (DevdBrowser *self
,GTlsCertificate *certificate
);
Sets the GTlsCertificate to use for client communication.
To ensure this is being used on all new connnections, you should set this
property before calling devd_browser_load_async()
.
Since: 3.28
void devd_browser_load_async (DevdBrowser *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously loads data needed by the browser and then scans the local network segments for Deviced nodes. The “device-added” and “device-removed” signals will be emitted in reaction to network changes.
Call devd_browser_load_finish()
to get the result of this operation.
If you want to control the GTlsCertificate to use, then call
devd_browser_set_certificate()
before calling this function.
self |
||
cancellable |
a GCancellable, or |
[nullable] |
callback |
a GAsyncReadyCallback to execute upon completion of the asynchronous task. |
[nullable] |
user_data |
closure data for |
Since: 3.28
gboolean devd_browser_load_finish (DevdBrowser *self
,GAsyncResult *result
,GError **error
);
Completes an asynchronous load of the browser. This includes loading the TLS certificate (or generating one) and then scanning the local network segments for mDNS (Avahi) peers advertising Deviced nodes.
Since: 3.28
GPtrArray *
devd_browser_get_devices (DevdBrowser *self
);
Gets a GPtrArray of DevdDevice that have been discovered.
Since: 3.28
struct DevdBrowserClass { GObjectClass parent; void (*device_added) (DevdBrowser *self, DevdDevice *device); void (*device_removed) (DevdBrowser *self, DevdDevice *device); };
“certificate”
property“certificate” GTlsCertificate *
The tls certificate to use when communicating with peers.
Owner: DevdBrowser
Flags: Read / Write
Since: 3.28
“enable-ipv4”
property“enable-ipv4” gboolean
Discover peers from IPv4 addresses.
Owner: DevdBrowser
Flags: Read / Write
Default value: TRUE
“enable-ipv6”
property“enable-ipv6” gboolean
Discover peers from IPv6 addresses.
Owner: DevdBrowser
Flags: Read / Write
Default value: TRUE
“device-added”
signalvoid user_function (DevdBrowser *self, DevdDevice *device, gpointer user_data)
The "device-added" signal is emitted when a device has been discovered.
Flags: Run Last
Since: 3.28
“device-removed”
signalvoid user_function (DevdBrowser *self, DevdDevice *device, gpointer user_data)
The "device-removed" signal is emitted when a device is no longer known to be available.
Flags: Run Last
Since: 3.28