Merge pull request #15517 from DaanDeMeyer/sd-bus-monitor-docs

sd-bus: Add sd_bus_set/is_monitor docs
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-04-22 23:38:37 +02:00
committed by GitHub
3 changed files with 62 additions and 34 deletions

View File

@@ -409,8 +409,10 @@ manpages = [
'3',
['sd_bus_get_bus_id',
'sd_bus_is_bus_client',
'sd_bus_is_monitor',
'sd_bus_is_server',
'sd_bus_set_bus_client'],
'sd_bus_set_bus_client',
'sd_bus_set_monitor'],
''],
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
['sd_bus_slot_get_bus',

View File

@@ -84,6 +84,7 @@
<citerefentry><refentrytitle>sd_bus_get_scope</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_tid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_unique_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_is_monitor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_is_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_is_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_list_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@@ -133,6 +134,7 @@
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_monitor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_propertyv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,

View File

@@ -22,8 +22,10 @@
<refname>sd_bus_get_bus_id</refname>
<refname>sd_bus_set_bus_client</refname>
<refname>sd_bus_is_bus_client</refname>
<refname>sd_bus_set_monitor</refname>
<refname>sd_bus_is_monitor</refname>
<refpurpose>Configure direct connection mode for a bus object</refpurpose>
<refpurpose>Configure connection mode for a bus object</refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -58,61 +60,83 @@
<funcdef>int <function>sd_bus_is_bus_client</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_set_monitor</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_is_monitor</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_set_server()</function> configures the bus object as a server for direct
D-Bus connections. <parameter>b</parameter> enables/disables the server mode. If zero, the
server mode is disabled. Otherwise, the server mode is enabled. Configuring a bus object as a
server is required to allow establishing direct connections between two peers without going via
the D-Bus daemon. <parameter>id</parameter> must contain a 128-bit integer id for the server. If
clients add a guid field to their D-Bus address string, the server id must match this guid or
the D-Bus authentication handshake will fail. If no specific id is defined for the server,
<para><function>sd_bus_set_server()</function> configures the bus object as a server for direct D-Bus
connections. <parameter>b</parameter> enables/disables the server mode. If zero, the server mode is
disabled. Otherwise, the server mode is enabled. Configuring a bus object as a server is required to
allow establishing direct connections between two peers without going via the D-Bus daemon.
<parameter>id</parameter> must contain a 128-bit integer id for the server. If clients add a guid field
to their D-Bus address string, the server id must match this guid or the D-Bus authentication handshake
will fail. If no specific id is defined for the server,
<citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry>
can be used to generate a random id instead.</para>
<para><function>sd_bus_is_server()</function> returns whether the server mode is enabled for
the given bus object.</para>
<para><function>sd_bus_is_server()</function> returns whether the server mode is enabled for the given
bus object.</para>
<para><function>sd_bus_get_bus_id()</function> stores the D-Bus server id configured using
<function>sd_bus_set_server()</function> (for server bus objects) or received during
D-Bus authentication (for client bus objects) in <parameter>id</parameter>.</para>
<function>sd_bus_set_server()</function> (for server bus objects) or received during D-Bus authentication
(for client bus objects) in <parameter>id</parameter>.</para>
<para><function>sd_bus_set_bus_client()</function> configures the bus object as a D-Bus daemon
client. <parameter>b</parameter> enables/disables the client mode. If zero, the client mode is
disabled and the bus object should connect directly to a D-Bus server. Otherwise, the client
mode is enabled and the bus object should connect to a D-Bus daemon. When connecting to an
existing bus using any of the functions in the
<citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<para><function>sd_bus_set_bus_client()</function> configures the bus object as a D-Bus daemon client.
<parameter>b</parameter> enables/disables the client mode. If zero, the client mode is disabled and the
bus object should connect directly to a D-Bus server. Otherwise, the client mode is enabled and the bus
object should connect to a D-Bus daemon. When connecting to an existing bus using any of the functions in
the <citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
family of functions or any of the functions in the
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>
family of functions, the bus object is automatically configured as a bus client. However, when
connecting to a D-Bus daemon by calling
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry> family
of functions, the bus object is automatically configured as a bus client. However, when connecting to a
D-Bus daemon by calling
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
followed by
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
the bus object should be manually configured as a bus client using
<function>sd_bus_set_bus_client()</function>. By default, a bus object is not configured as a
D-Bus daemon client.</para>
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, the bus
object should be manually configured as a bus client using <function>sd_bus_set_bus_client()</function>.
By default, a bus object is not configured as a D-Bus daemon client.</para>
<para><function>sd_bus_is_bus_client()</function> returns whether the client mode is enabled/disabled for
the given bus object.</para>
<para><function>sd_bus_set_monitor()</function> configures the bus object as a D-Bus monitor object.
<parameter>b</parameter> enables/disables the monitor mode. If zero, the monitor mode is disabled. If
non-zero, the monitor mode is enabled. When the monitor mode is enabled, no messages may be sent via the
bus object and it may not expose any objects on the bus. To start monitoring messages, call the
<function>org.freedesktop.DBus.Monitoring.BecomeMonitor</function> method of the D-Bus daemon and pass
a list of matches indicating which messages to intercept. See
<ulink url="https://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-become-monitor">
The D-Bus specification</ulink> for more information.</para>
<para><function>sd_bus_is_monitor()</function> returns whether the monitor mode is enabled/disabled for
the given bus object.</para>
<para><function>sd_bus_is_bus_client()</function> returns whether the client mode is
enabled/disabled for the given bus object.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_bus_set_server()</function>,
<function>sd_bus_get_bus_id()</function> and <function>sd_bus_set_bus_client()</function> return
a non-negative integer. On failure, they return a negative errno-style error code.</para>
<function>sd_bus_get_bus_id()</function>, <function>sd_bus_set_bus_client()</function> and
<function>sd_bus_set_monitor()</function> return a non-negative integer. On failure, they return a
negative errno-style error code.</para>
<para><function>sd_bus_is_server()</function> and <function>sd_bus_is_bus_client()</function>
return a positive integer when the server or client mode is enabled, respectively. Otherwise,
they return zero.
</para>
<para><function>sd_bus_is_server()</function>, <function>sd_bus_is_bus_client()</function> and
<function>sd_bus_is_monitor()</function> return a positive integer when the server or client mode is
enabled, respectively. Otherwise, they return zero.</para>
<refsect2>
<title>Errors</title>