chiark / gitweb /
360ae5095e768edf8e47cabb203a832b529bea46
[elogind.git] / man / sd_bus_set_connected_signal.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   SPDX-License-Identifier: LGPL-2.1+
7
8   Copyright 2017 Lennart Poettering
9 -->
10
11 <refentry id="sd_bus_set_connected_signal">
12
13   <refentryinfo>
14     <title>sd_bus_set_connected_signal</title>
15     <productname>elogind</productname>
16
17     <authorgroup>
18       <author>
19         <contrib>Developer</contrib>
20         <firstname>Lennart</firstname>
21         <surname>Poettering</surname>
22         <email>lennart@poettering.net</email>
23       </author>
24     </authorgroup>
25   </refentryinfo>
26
27   <refmeta>
28     <refentrytitle>sd_bus_set_connected_signal</refentrytitle>
29     <manvolnum>3</manvolnum>
30   </refmeta>
31
32   <refnamediv>
33     <refname>sd_bus_set_connected_signal</refname>
34     <refname>sd_bus_get_connected_signal</refname>
35
36     <refpurpose>Control emmission of local connection establishment signal on bus connections</refpurpose>
37   </refnamediv>
38
39   <refsynopsisdiv>
40     <funcsynopsis>
41       <funcsynopsisinfo>#include &lt;elogind/sd-bus.h&gt;</funcsynopsisinfo>
42
43       <funcprototype>
44         <funcdef>int <function>sd_bus_set_connected_signal</function></funcdef>
45         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
46         <paramdef>int <parameter>b</parameter></paramdef>
47       </funcprototype>
48
49       <funcprototype>
50         <funcdef>int <function>sd_bus_get_connected_signal</function></funcdef>
51         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
52       </funcprototype>
53
54     </funcsynopsis>
55   </refsynopsisdiv>
56
57   <refsect1>
58     <title>Description</title>
59
60     <para><function>sd_bus_set_connected_signal()</function> may be used to control whether a local, synthetic
61     <function>Connected()</function> signal message shall be generated and enqueued for dispatching when the connection
62     is fully established. If the <parameter>b</parameter> parameter is zero the message is not generated (the default),
63     otherwise it is generated.</para>
64
65     <para><function>sd_bus_get_connected_signal()</function> may be used to query whether this feature is enabled. It
66     returns zero if not, positive otherwise.</para>
67
68     <para>The <function>Connected()</function> signal message is generated from the
69     <literal>org.freedesktop.DBus.Local</literal> service and interface, and
70     <literal>/org/freedesktop/DBus/Local</literal> object path. Use
71     <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
72     match on this signal.</para>
73
74     <para>This message is particularly useful on slow transports where connections take a long time to be
75     established. This is especially the case when
76     <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry> is
77     used. The signal is generated when the
78     <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> returns
79     positive for the first time.</para>
80
81     <para>The <function>Connected()</function> signal corresponds with the <function>Disconnected()</function> signal
82     that is synthesized locally when the connection is terminated. The latter is generated unconditionally however,
83     unlike the former which needs to be enabled explicitly before it is generated, with
84     <function>sd_bus_set_connected_signal()</function>.</para>
85   </refsect1>
86
87   <refsect1>
88     <title>Return Value</title>
89
90     <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
91     error code.</para>
92   </refsect1>
93
94   <refsect1>
95     <title>Errors</title>
96
97     <para>Returned errors may indicate the following problems:</para>
98
99     <variablelist>
100       <varlistentry>
101         <term><constant>-ECHILD</constant></term>
102
103         <listitem><para>The bus connection has been created in a different process.</para></listitem>
104       </varlistentry>
105     </variablelist>
106   </refsect1>
107
108   <refsect1>
109     <title>Notes</title>
110
111     <para><function>sd_bus_set_connected_signal()</function> and <function>sd_bus_get_connected_signal()</function> are available as
112     a shared library, which can be compiled and linked to with the <constant>libelogind</constant> <citerefentry
113     project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
114   </refsect1>
115
116   <refsect1>
117     <title>See Also</title>
118
119     <para>
120       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
121       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
122       <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
123       <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
124       <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry>
125     </para>
126   </refsect1>
127
128 </refentry>