chiark / gitweb /
395a2cd8157e3f294724d65b6f966e7eaa50977a
[elogind.git] / man / sd_bus_set_sender.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_sender">
12
13   <refentryinfo>
14     <title>sd_bus_set_sender</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_sender</refentrytitle>
29     <manvolnum>3</manvolnum>
30   </refmeta>
31
32   <refnamediv>
33     <refname>sd_bus_set_sender</refname>
34     <refname>sd_bus_get_sender</refname>
35
36     <refpurpose>Configure default sender for outgoing messages</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_sender</function></funcdef>
45         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
46         <paramdef>const char* <parameter>name</parameter></paramdef>
47       </funcprototype>
48
49       <funcprototype>
50         <funcdef>int <function>sd_bus_get_sender</function></funcdef>
51         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
52         <paramdef>const char** <parameter>name</parameter></paramdef>
53       </funcprototype>
54
55     </funcsynopsis>
56   </refsynopsisdiv>
57
58   <refsect1>
59     <title>Description</title>
60
61     <para><function>sd_bus_set_sender()</function> configures the default sender service name to use for outgoing
62     messages. The service name specified in the <parameter>name</parameter> parameter is set on all outgoing messages
63     that are sent on the connection and have no sender set yet, for example through
64     <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Note
65     that this function is only supported on direct connections, i.e. not on connections to a bus broker as the broker
66     will fill in the sender service name automatically anyway. By default no sender name is configured, and hence
67     messages are sent without sender field set. If the <parameter>name</parameter> parameter is specified as
68     <constant>NULL</constant> the default sender service name is cleared, returning to the default state if a default
69     sender service name was set before. If passed as non-<constant>NULL</constant> the specified name must be a valid
70     unique or well-known service name.</para>
71
72     <para><function>sd_bus_get_sender()</function> may be used to query the current default service name for outgoing
73     messages.</para>
74   </refsect1>
75
76   <refsect1>
77     <title>Return Value</title>
78
79     <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
80     error code.</para>
81   </refsect1>
82
83   <refsect1>
84     <title>Errors</title>
85
86     <para>Returned errors may indicate the following problems:</para>
87
88     <variablelist>
89       <varlistentry>
90         <term><constant>-ECHILD</constant></term>
91
92         <listitem><para>The bus connection has been created in a different process.</para></listitem>
93       </varlistentry>
94
95       <varlistentry>
96         <term><constant>-EPERM</constant></term>
97
98         <listitem><para>The specified bus connection object is a not a direct but a brokered connection.</para></listitem>
99       </varlistentry>
100     </variablelist>
101   </refsect1>
102
103   <refsect1>
104     <title>Notes</title>
105
106     <para><function>sd_bus_set_sender()</function> and <function>sd_bus_get_sender()</function> are available as
107     a shared library, which can be compiled and linked to with the <constant>libelogind</constant> <citerefentry
108     project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
109   </refsect1>
110
111   <refsect1>
112     <title>See Also</title>
113
114     <para>
115       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
116       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
117       <citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>
118     </para>
119   </refsect1>
120
121 </refentry>