1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6<refentry id="sd_bus_set_sender"
7          xmlns:xi="http://www.w3.org/2001/XInclude">
8
9  <refentryinfo>
10    <title>sd_bus_set_sender</title>
11    <productname>systemd</productname>
12  </refentryinfo>
13
14  <refmeta>
15    <refentrytitle>sd_bus_set_sender</refentrytitle>
16    <manvolnum>3</manvolnum>
17  </refmeta>
18
19  <refnamediv>
20    <refname>sd_bus_set_sender</refname>
21    <refname>sd_bus_get_sender</refname>
22
23    <refpurpose>Configure default sender for outgoing messages</refpurpose>
24  </refnamediv>
25
26  <refsynopsisdiv>
27    <funcsynopsis>
28      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
29
30      <funcprototype>
31        <funcdef>int <function>sd_bus_set_sender</function></funcdef>
32        <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
33        <paramdef>const char* <parameter>name</parameter></paramdef>
34      </funcprototype>
35
36      <funcprototype>
37        <funcdef>int <function>sd_bus_get_sender</function></funcdef>
38        <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
39        <paramdef>const char** <parameter>name</parameter></paramdef>
40      </funcprototype>
41
42    </funcsynopsis>
43  </refsynopsisdiv>
44
45  <refsect1>
46    <title>Description</title>
47
48    <para><function>sd_bus_set_sender()</function> configures the default sender service name to use for outgoing
49    messages. The service name specified in the <parameter>name</parameter> parameter is set on all outgoing messages
50    that are sent on the connection and have no sender set yet, for example through
51    <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Note
52    that this function is only supported on direct connections, i.e. not on connections to a bus broker as the broker
53    will fill in the sender service name automatically anyway. By default no sender name is configured, and hence
54    messages are sent without sender field set. If the <parameter>name</parameter> parameter is specified as
55    <constant>NULL</constant> the default sender service name is cleared, returning to the default state if a default
56    sender service name was set before. If passed as non-<constant>NULL</constant> the specified name must be a valid
57    unique or well-known service name.</para>
58
59    <para><function>sd_bus_get_sender()</function> may be used to query the current default service name for outgoing
60    messages.</para>
61  </refsect1>
62
63  <refsect1>
64    <title>Return Value</title>
65
66    <para>On success, these functions return 0 or a positive integer. On failure, they return a negative
67    errno-style error code.</para>
68
69    <refsect2>
70      <title>Errors</title>
71
72      <para>Returned errors may indicate the following problems:</para>
73
74      <variablelist>
75        <varlistentry>
76          <term><constant>-ECHILD</constant></term>
77
78          <listitem><para>The bus connection has been created in a different process.</para></listitem>
79        </varlistentry>
80
81        <varlistentry>
82          <term><constant>-EPERM</constant></term>
83
84          <listitem><para>The specified bus connection object is a not a direct but a brokered
85          connection.</para></listitem>
86        </varlistentry>
87      </variablelist>
88    </refsect2>
89  </refsect1>
90
91  <xi:include href="libsystemd-pkgconfig.xml" />
92
93  <refsect1>
94    <title>See Also</title>
95
96    <para>
97      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
98      <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
99      <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>
100    </para>
101  </refsect1>
102
103</refentry>
104