]>
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 LP |
21 | <refname>sd_bus_negotiate_creds</refname> |
22 | ||
23 | <refpurpose>Control feature negotiation on bus connections</refpurpose> | |
24 | </refnamediv> | |
25 | ||
26 | <refsynopsisdiv> | |
27 | <funcsynopsis> | |
28 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
29 | ||
30 | <funcprototype> | |
31 | <funcdef>int <function>sd_bus_negotiate_fds</function></funcdef> | |
32 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
33 | <paramdef>int <parameter>b</parameter></paramdef> | |
34 | </funcprototype> | |
35 | ||
36 | <funcprototype> | |
37 | <funcdef>int <function>sd_bus_negotiate_timestamp</function></funcdef> | |
38 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
39 | <paramdef>int <parameter>b</parameter></paramdef> | |
40 | </funcprototype> | |
41 | ||
42 | <funcprototype> | |
43 | <funcdef>int <function>sd_bus_negotiate_creds</function></funcdef> | |
44 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
45 | <paramdef>int <parameter>b</parameter></paramdef> | |
850df10a | 46 | <paramdef>uint64_t <parameter>mask</parameter></paramdef> |
ce236b57 LP |
47 | </funcprototype> |
48 | </funcsynopsis> | |
49 | </refsynopsisdiv> | |
50 | ||
51 | <refsect1> | |
52 | <title>Description</title> | |
53 | ||
54 | <para><function>sd_bus_negotiate_fds()</function> controls whether | |
55 | file descriptor passing shall be negotiated for the specified bus | |
b8bde116 | 56 | connection. It takes a bus object and a boolean, which, when true, |
850df10a LP |
57 | enables file descriptor passing, and, when false, disables |
58 | it. Note that not all transports and servers support file | |
59 | descriptor passing. In particular, networked transports generally | |
60 | do not support file descriptor passing. To find out whether file | |
61 | descriptor passing is available after negotiation, use | |
ce236b57 LP |
62 | <citerefentry><refentrytitle>sd_bus_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
63 | and pass <constant>SD_BUS_TYPE_UNIX_FD</constant>. Note that file | |
64 | descriptor passing is always enabled for both sending and | |
65 | receiving or for neither, but never only in one direction. By | |
b8bde116 | 66 | default, file descriptor passing is negotiated for all |
ce236b57 LP |
67 | connections.</para> |
68 | ||
ba612f42 ZJS |
69 | <para><function>sd_bus_negotiate_timestamp()</function> controls whether implicit sender |
70 | timestamps shall be attached automatically to all incoming messages. Takes a bus object and a | |
71 | boolean, which, when true, enables timestamping, and, when false, disables it. Use | |
ce236b57 LP |
72 | <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
73 | <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
ae937639 | 74 | <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
ba612f42 ZJS |
75 | to query the timestamps of incoming messages. If negotiation is disabled or not supported, these |
76 | calls will fail with <constant>-ENODATA</constant>. Note that currently no transports support | |
77 | timestamping of messages. By default, message timestamping is not negotiated for | |
850df10a | 78 | connections.</para> |
ce236b57 | 79 | |
ba612f42 ZJS |
80 | <para><function>sd_bus_negotiate_creds()</function> controls whether and which implicit sender |
81 | credentials shall be attached automatically to all incoming messages. Takes a bus object and a | |
82 | boolean indicating whether to enable or disable the credential parts encoded in the bit mask | |
83 | value argument. Note that not all transports support attaching sender credentials to messages, | |
84 | or do not support all types of sender credential parameters, or might suppress them under | |
85 | certain circumstances for individual messages. Specifically, dbus1 only supports | |
86 | <constant>SD_BUS_CREDS_UNIQUE_NAME</constant>. The sender credentials are suitable for | |
87 | authorization decisions. By default, only <constant>SD_BUS_CREDS_WELL_KNOWN_NAMES</constant> and | |
88 | <constant>SD_BUS_CREDS_UNIQUE_NAME</constant> are enabled. In fact, these two credential fields | |
89 | are always sent along and cannot be turned off.</para> | |
b5dae4c7 LP |
90 | |
91 | <para>The <function>sd_bus_negotiate_fds()</function> function may | |
92 | be called only before the connection has been started with | |
93 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Both | |
94 | <function>sd_bus_negotiate_timestamp()</function> and | |
850df10a | 95 | <function>sd_bus_negotiate_creds()</function> may also be called |
b938cb90 | 96 | after a connection has been set up. Note that, when operating on a |
b5dae4c7 LP |
97 | connection that is shared between multiple components of the same |
98 | program (for example via | |
a8eaaee7 | 99 | <citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>), |
b5dae4c7 LP |
100 | it is highly recommended to only enable additional per message |
101 | metadata fields, but never disable them again, in order not to | |
102 | disable functionality needed by other components.</para> | |
ce236b57 LP |
103 | </refsect1> |
104 | ||
105 | <refsect1> | |
106 | <title>Return Value</title> | |
107 | ||
dd2b607b | 108 | <para>On success, these functions return 0 or a |
faae655d | 109 | positive integer. On failure, they return a negative errno-style |
ce236b57 LP |
110 | error code.</para> |
111 | </refsect1> | |
112 | ||
113 | <refsect1> | |
114 | <title>Errors</title> | |
115 | ||
116 | <para>Returned errors may indicate the following problems:</para> | |
117 | ||
118 | <variablelist> | |
119 | <varlistentry> | |
8474b70c | 120 | <term><constant>-EPERM</constant></term> |
ce236b57 LP |
121 | |
122 | <listitem><para>The bus connection has already been started.</para></listitem> | |
123 | </varlistentry> | |
124 | </variablelist> | |
125 | </refsect1> | |
126 | ||
7d6b2723 | 127 | <xi:include href="libsystemd-pkgconfig.xml" /> |
ce236b57 LP |
128 | |
129 | <refsect1> | |
130 | <title>See Also</title> | |
131 | ||
132 | <para> | |
133 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
134 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
135 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
136 | <citerefentry><refentrytitle>sd_bus_message_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
137 | <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
850df10a LP |
138 | <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
139 | <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
4bc5d27b | 140 | <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
ce236b57 LP |
141 | </para> |
142 | </refsect1> | |
143 | ||
144 | </refentry> |