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