]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_set_sender.xml
512fffcf05e924eed65dc06cdb81f13cda02ea8d
[thirdparty/systemd.git] / man / sd_bus_set_sender.xml
1 <?xml version='1.0'?>
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
9 <refentry id="sd_bus_set_sender">
10
11 <refentryinfo>
12 <title>sd_bus_set_sender</title>
13 <productname>systemd</productname>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>sd_bus_set_sender</refentrytitle>
18 <manvolnum>3</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>sd_bus_set_sender</refname>
23 <refname>sd_bus_get_sender</refname>
24
25 <refpurpose>Configure default sender for outgoing messages</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <funcsynopsis>
30 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
31
32 <funcprototype>
33 <funcdef>int <function>sd_bus_set_sender</function></funcdef>
34 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
35 <paramdef>const char* <parameter>name</parameter></paramdef>
36 </funcprototype>
37
38 <funcprototype>
39 <funcdef>int <function>sd_bus_get_sender</function></funcdef>
40 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
41 <paramdef>const char** <parameter>name</parameter></paramdef>
42 </funcprototype>
43
44 </funcsynopsis>
45 </refsynopsisdiv>
46
47 <refsect1>
48 <title>Description</title>
49
50 <para><function>sd_bus_set_sender()</function> configures the default sender service name to use for outgoing
51 messages. The service name specified in the <parameter>name</parameter> parameter is set on all outgoing messages
52 that are sent on the connection and have no sender set yet, for example through
53 <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Note
54 that this function is only supported on direct connections, i.e. not on connections to a bus broker as the broker
55 will fill in the sender service name automatically anyway. By default no sender name is configured, and hence
56 messages are sent without sender field set. If the <parameter>name</parameter> parameter is specified as
57 <constant>NULL</constant> the default sender service name is cleared, returning to the default state if a default
58 sender service name was set before. If passed as non-<constant>NULL</constant> the specified name must be a valid
59 unique or well-known service name.</para>
60
61 <para><function>sd_bus_get_sender()</function> may be used to query the current default service name for outgoing
62 messages.</para>
63 </refsect1>
64
65 <refsect1>
66 <title>Return Value</title>
67
68 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
69 error code.</para>
70 </refsect1>
71
72 <refsect1>
73 <title>Errors</title>
74
75 <para>Returned errors may indicate the following problems:</para>
76
77 <variablelist>
78 <varlistentry>
79 <term><constant>-ECHILD</constant></term>
80
81 <listitem><para>The bus connection has been created in a different process.</para></listitem>
82 </varlistentry>
83
84 <varlistentry>
85 <term><constant>-EPERM</constant></term>
86
87 <listitem><para>The specified bus connection object is a not a direct but a brokered connection.</para></listitem>
88 </varlistentry>
89 </variablelist>
90 </refsect1>
91
92 <refsect1>
93 <title>Notes</title>
94
95 <para><function>sd_bus_set_sender()</function> and <function>sd_bus_get_sender()</function> are available as
96 a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
97 project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
98 </refsect1>
99
100 <refsect1>
101 <title>See Also</title>
102
103 <para>
104 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
105 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
106 <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>
107 </para>
108 </refsect1>
109
110 </refentry>