]>
Commit | Line | Data |
---|---|---|
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"> | |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
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 <systemd/sd-bus.h></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 | ||
128 | <listitem><para>An argument is invalid.</para></listitem> | |
129 | </varlistentry> | |
130 | ||
131 | <varlistentry> | |
132 | <term><constant>-ENOPKG</constant></term> | |
133 | ||
134 | <listitem><para>The bus cannot be resolved.</para></listitem> | |
135 | </varlistentry> | |
136 | ||
137 | <varlistentry> | |
138 | <term><constant>-ECHILD</constant></term> | |
139 | ||
140 | <listitem><para>The bus was created in a different process.</para></listitem> | |
141 | </varlistentry> | |
b1de39de ZJS |
142 | </variablelist> |
143 | </refsect2> | |
ce236b57 LP |
144 | </refsect1> |
145 | ||
7d6b2723 | 146 | <xi:include href="libsystemd-pkgconfig.xml" /> |
ce236b57 LP |
147 | |
148 | <refsect1> | |
149 | <title>See Also</title> | |
150 | ||
151 | <para> | |
152 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
153 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
154 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
155 | <citerefentry><refentrytitle>sd_bus_message_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
156 | <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
850df10a LP |
157 | <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
158 | <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
4bc5d27b | 159 | <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
ce236b57 LP |
160 | </para> |
161 | </refsect1> | |
162 | ||
163 | </refentry> |