]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_negotiate_fds.xml
man: use <simplelist> for 'See also' sections
[thirdparty/systemd.git] / man / sd_bus_negotiate_fds.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157
ZJS
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
ce236b57 5
7d6b2723 6<refentry id="sd_bus_negotiate_fds" xmlns:xi="http://www.w3.org/2001/XInclude">
ce236b57
LP
7
8 <refentryinfo>
faae655d 9 <title>sd_bus_negotiate_fds</title>
ce236b57 10 <productname>systemd</productname>
ce236b57
LP
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_negotiate_fds</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_bus_negotiate_fds</refname>
02855643 20 <refname>sd_bus_negotiate_timestamp</refname>
ce236b57 21 <refname>sd_bus_negotiate_creds</refname>
8653422b 22 <refname>sd_bus_get_creds_mask</refname>
ce236b57
LP
23
24 <refpurpose>Control feature negotiation on bus connections</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
30
31 <funcprototype>
32 <funcdef>int <function>sd_bus_negotiate_fds</function></funcdef>
33 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
34 <paramdef>int <parameter>b</parameter></paramdef>
35 </funcprototype>
36
37 <funcprototype>
38 <funcdef>int <function>sd_bus_negotiate_timestamp</function></funcdef>
39 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
40 <paramdef>int <parameter>b</parameter></paramdef>
41 </funcprototype>
42
43 <funcprototype>
44 <funcdef>int <function>sd_bus_negotiate_creds</function></funcdef>
45 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
46 <paramdef>int <parameter>b</parameter></paramdef>
850df10a 47 <paramdef>uint64_t <parameter>mask</parameter></paramdef>
ce236b57 48 </funcprototype>
8653422b
DDM
49
50 <funcprototype>
51 <funcdef>int <function>sd_bus_get_creds_mask</function></funcdef>
52 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
53 <paramdef>uint64_t *<parameter>mask</parameter></paramdef>
54 </funcprototype>
ce236b57
LP
55 </funcsynopsis>
56 </refsynopsisdiv>
57
58 <refsect1>
59 <title>Description</title>
60
8653422b
DDM
61 <para><function>sd_bus_negotiate_fds()</function> controls whether file descriptor passing shall be
62 negotiated for the specified bus connection. It takes a bus object and a boolean, which, when true,
63 enables file descriptor passing, and, when false, disables it. Note that not all transports and servers
64 support file descriptor passing. In particular, networked transports generally do not support file
65 descriptor passing. To find out whether file descriptor passing is available after negotiation, use
ce236b57 66 <citerefentry><refentrytitle>sd_bus_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>
8653422b
DDM
67 and pass <constant>SD_BUS_TYPE_UNIX_FD</constant>. Note that file descriptor passing is always enabled
68 for both sending and receiving or for neither, but never only in one direction. By default, file
69 descriptor passing is negotiated for all connections.</para>
70
71 <para><function>sd_bus_negotiate_timestamp()</function> controls whether implicit sender timestamps shall
72 be attached automatically to all incoming messages. Takes a bus object and a boolean, which, when true,
73 enables timestamping, and, when false, disables it. Use
ce236b57
LP
74 <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
75 <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
ae937639 76 <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry>
8653422b
DDM
77 to query the timestamps of incoming messages. If negotiation is disabled or not supported, these calls
78 will fail with <constant>-ENODATA</constant>. Note that currently no transports support timestamping of
79 messages. By default, message timestamping is not negotiated for connections.</para>
ce236b57 80
ba612f42 81 <para><function>sd_bus_negotiate_creds()</function> controls whether and which implicit sender
8653422b
DDM
82 credentials shall be attached automatically to all incoming messages. Takes a bus object and a boolean
83 indicating whether to enable or disable the credential parts encoded in the bit mask value argument. Note
84 that not all transports support attaching sender credentials to messages, or do not support all types of
85 sender credential parameters, or might suppress them under certain circumstances for individual messages.
86 Specifically, dbus1 only supports <constant>SD_BUS_CREDS_UNIQUE_NAME</constant>. The sender credentials
87 are suitable for authorization decisions. By default, only
88 <constant>SD_BUS_CREDS_WELL_KNOWN_NAMES</constant> and <constant>SD_BUS_CREDS_UNIQUE_NAME</constant> are
89 enabled. In fact, these two credential fields are always sent along and cannot be turned off.</para>
90
91 <para><function>sd_bus_get_creds_mask()</function> returns the set of sender credentials that was
92 negotiated to be attached to all incoming messages in <parameter>mask</parameter>. This value is an
93 upper boundary only. Hence, always make sure to explicitly check which credentials are attached to a
94 specific message before using it.</para>
95
96 <para>The <function>sd_bus_negotiate_fds()</function> function may be called only before the connection
97 has been started with
b5dae4c7 98 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Both
8653422b
DDM
99 <function>sd_bus_negotiate_timestamp()</function> and <function>sd_bus_negotiate_creds()</function> may
100 also be called after a connection has been set up. Note that, when operating on a connection that is
101 shared between multiple components of the same program (for example via
102 <citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it
103 is highly recommended to only enable additional per message metadata fields, but never disable them
104 again, in order not to disable functionality needed by other components.</para>
ce236b57
LP
105 </refsect1>
106
107 <refsect1>
108 <title>Return Value</title>
109
8653422b
DDM
110 <para>On success, these functions return a non-negative integer. On failure, they return a negative
111 errno-style error code.</para>
ce236b57 112
b1de39de
ZJS
113 <refsect2>
114 <title>Errors</title>
ce236b57 115
b1de39de 116 <para>Returned errors may indicate the following problems:</para>
ce236b57 117
b1de39de
ZJS
118 <variablelist>
119 <varlistentry>
120 <term><constant>-EPERM</constant></term>
ce236b57 121
b1de39de
ZJS
122 <listitem><para>The bus connection has already been started.</para></listitem>
123 </varlistentry>
8653422b
DDM
124
125 <varlistentry>
126 <term><constant>-EINVAL</constant></term>
127
ec07c3c8
AK
128 <listitem><para>An argument is invalid.</para>
129
130 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
8653422b
DDM
131 </varlistentry>
132
133 <varlistentry>
134 <term><constant>-ENOPKG</constant></term>
135
ec07c3c8
AK
136 <listitem><para>The bus cannot be resolved.</para>
137
138 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
8653422b
DDM
139 </varlistentry>
140
141 <varlistentry>
142 <term><constant>-ECHILD</constant></term>
143
ec07c3c8
AK
144 <listitem><para>The bus was created in a different process, library or module instance.</para>
145
146 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
8653422b 147 </varlistentry>
b1de39de
ZJS
148 </variablelist>
149 </refsect2>
ce236b57
LP
150 </refsect1>
151
7d6b2723 152 <xi:include href="libsystemd-pkgconfig.xml" />
ce236b57 153
69106f47
AK
154 <refsect1>
155 <title>History</title>
00f95506
AK
156 <para><function>sd_bus_negotiate_fds()</function>,
157 <function>sd_bus_negotiate_timestamp()</function>, and
158 <function>sd_bus_negotiate_creds()</function> were added in version 212.</para>
69106f47
AK
159 <para><function>sd_bus_get_creds_mask()</function> was added in version 246.</para>
160 </refsect1>
161
ce236b57
LP
162 <refsect1>
163 <title>See Also</title>
164
13a69c12
DT
165 <para><simplelist type="inline">
166 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
167 <member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
168 <member><citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
169 <member><citerefentry><refentrytitle>sd_bus_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
170 <member><citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
171 <member><citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
172 <member><citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
173 <member><citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
174 </simplelist></para>
ce236b57
LP
175 </refsect1>
176
177</refentry>