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