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">
6 SPDX-License-Identifier: LGPL-2.1+
9 <refentry id="sd_bus_set_sender">
12 <title>sd_bus_set_sender</title>
13 <productname>elogind</productname>
17 <contrib>Developer</contrib>
18 <firstname>Lennart</firstname>
19 <surname>Poettering</surname>
20 <email>lennart@poettering.net</email>
26 <refentrytitle>sd_bus_set_sender</refentrytitle>
27 <manvolnum>3</manvolnum>
31 <refname>sd_bus_set_sender</refname>
32 <refname>sd_bus_get_sender</refname>
34 <refpurpose>Configure default sender for outgoing messages</refpurpose>
39 <funcsynopsisinfo>#include <elogind/sd-bus.h></funcsynopsisinfo>
42 <funcdef>int <function>sd_bus_set_sender</function></funcdef>
43 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
44 <paramdef>const char* <parameter>name</parameter></paramdef>
48 <funcdef>int <function>sd_bus_get_sender</function></funcdef>
49 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
50 <paramdef>const char** <parameter>name</parameter></paramdef>
57 <title>Description</title>
59 <para><function>sd_bus_set_sender()</function> configures the default sender service name to use for outgoing
60 messages. The service name specified in the <parameter>name</parameter> parameter is set on all outgoing messages
61 that are sent on the connection and have no sender set yet, for example through
62 <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Note
63 that this function is only supported on direct connections, i.e. not on connections to a bus broker as the broker
64 will fill in the sender service name automatically anyway. By default no sender name is configured, and hence
65 messages are sent without sender field set. If the <parameter>name</parameter> parameter is specified as
66 <constant>NULL</constant> the default sender service name is cleared, returning to the default state if a default
67 sender service name was set before. If passed as non-<constant>NULL</constant> the specified name must be a valid
68 unique or well-known service name.</para>
70 <para><function>sd_bus_get_sender()</function> may be used to query the current default service name for outgoing
75 <title>Return Value</title>
77 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
84 <para>Returned errors may indicate the following problems:</para>
88 <term><constant>-ECHILD</constant></term>
90 <listitem><para>The bus connection has been created in a different process.</para></listitem>
94 <term><constant>-EPERM</constant></term>
96 <listitem><para>The specified bus connection object is a not a direct but a brokered connection.</para></listitem>
104 <para><function>sd_bus_set_sender()</function> and <function>sd_bus_get_sender()</function> are available as
105 a shared library, which can be compiled and linked to with the <constant>libelogind</constant> <citerefentry
106 project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
110 <title>See Also</title>
113 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
115 <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>