1SD_BUS_NEGOTIATE_FDS(3) sd_bus_negotiate_fds SD_BUS_NEGOTIATE_FDS(3)
2
3
4
6 sd_bus_negotiate_fds, sd_bus_negotiate_timestamp,
7 sd_bus_negotiate_creds - Control feature negotiation on bus connections
8
10 #include <systemd/sd-bus.h>
11
12 int sd_bus_negotiate_fds(sd_bus *bus, int b);
13
14 int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
15
16 int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t mask);
17
19 sd_bus_negotiate_fds() controls whether file descriptor passing shall
20 be negotiated for the specified bus connection. It takes a bus object
21 and a boolean, which, when true, enables file descriptor passing, and,
22 when false, disables it. Note that not all transports and servers
23 support file descriptor passing. In particular, networked transports
24 generally do not support file descriptor passing. To find out whether
25 file descriptor passing is available after negotiation, use
26 sd_bus_can_send(3) and pass SD_BUS_TYPE_UNIX_FD. Note that file
27 descriptor passing is always enabled for both sending and receiving or
28 for neither, but never only in one direction. By default, file
29 descriptor passing is negotiated for all connections.
30
31 sd_bus_negotiate_timestamp() controls whether implicit sender
32 timestamps shall be attached automatically to all incoming messages.
33 Takes a bus object and a boolean, which, when true, enables
34 timestamping, and, when false, disables it. Use
35 sd_bus_message_get_monotonic_usec(3),
36 sd_bus_message_get_realtime_usec(3), sd_bus_message_get_seqnum(3) to
37 query the timestamps of incoming messages. If negotiation is disabled
38 or not supported, these calls will fail with -ENODATA. Note that
39 currently no transports support timestamping of messages. By default,
40 message timestamping is not negotiated for connections.
41
42 sd_bus_negotiate_creds() controls whether and which implicit sender
43 credentials shall be attached automatically to all incoming messages.
44 Takes a bus object and a boolean indicating whether to enable or
45 disable the credential parts encoded in the bit mask value argument.
46 Note that not all transports support attaching sender credentials to
47 messages, or do not support all types of sender credential parameters,
48 or might suppress them under certain circumstances for individual
49 messages. Specifically, dbus1 only supports SD_BUS_CREDS_UNIQUE_NAME.
50 The sender credentials are suitable for authorization decisions. By
51 default, only SD_BUS_CREDS_WELL_KNOWN_NAMES and
52 SD_BUS_CREDS_UNIQUE_NAME are enabled. In fact, these two credential
53 fields are always sent along and cannot be turned off.
54
55 The sd_bus_negotiate_fds() function may be called only before the
56 connection has been started with sd_bus_start(3). Both
57 sd_bus_negotiate_timestamp() and sd_bus_negotiate_creds() may also be
58 called after a connection has been set up. Note that, when operating on
59 a connection that is shared between multiple components of the same
60 program (for example via sd_bus_default(3)), it is highly recommended
61 to only enable additional per message metadata fields, but never
62 disable them again, in order not to disable functionality needed by
63 other components.
64
66 On success, these functions return 0 or a positive integer. On failure,
67 they return a negative errno-style error code.
68
70 Returned errors may indicate the following problems:
71
72 -EPERM
73 The bus connection has already been started.
74
76 These APIs are implemented as a shared library, which can be compiled
77 and linked to with the libsystemd pkg-config(1) file.
78
80 systemd(1), sd-bus(3), sd_bus_start(3), sd_bus_message_can_send(3),
81 sd_bus_message_get_monotonic_usec(3),
82 sd_bus_message_get_realtime_usec(3), sd_bus_message_get_seqnum(3),
83 sd_bus_message_get_creds(3)
84
85
86
87systemd 241 SD_BUS_NEGOTIATE_FDS(3)