1SD_BUS_NEGOTIATE_FDS(3)      sd_bus_negotiate_fds      SD_BUS_NEGOTIATE_FDS(3)
2
3
4

NAME

6       sd_bus_negotiate_fds, sd_bus_negotiate_timestamp,
7       sd_bus_negotiate_creds, sd_bus_get_creds_mask - Control feature
8       negotiation on bus connections
9

SYNOPSIS

11       #include <systemd/sd-bus.h>
12
13       int sd_bus_negotiate_fds(sd_bus *bus, int b);
14
15       int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
16
17       int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t mask);
18
19       int sd_bus_get_creds_mask(sd_bus *bus, uint64_t *mask);
20

DESCRIPTION

22       sd_bus_negotiate_fds() controls whether file descriptor passing shall
23       be negotiated for the specified bus connection. It takes a bus object
24       and a boolean, which, when true, enables file descriptor passing, and,
25       when false, disables it. Note that not all transports and servers
26       support file descriptor passing. In particular, networked transports
27       generally do not support file descriptor passing. To find out whether
28       file descriptor passing is available after negotiation, use
29       sd_bus_can_send(3) and pass SD_BUS_TYPE_UNIX_FD. Note that file
30       descriptor passing is always enabled for both sending and receiving or
31       for neither, but never only in one direction. By default, file
32       descriptor passing is negotiated for all connections.
33
34       sd_bus_negotiate_timestamp() controls whether implicit sender
35       timestamps shall be attached automatically to all incoming messages.
36       Takes a bus object and a boolean, which, when true, enables
37       timestamping, and, when false, disables it. Use
38       sd_bus_message_get_monotonic_usec(3),
39       sd_bus_message_get_realtime_usec(3), sd_bus_message_get_seqnum(3) to
40       query the timestamps of incoming messages. If negotiation is disabled
41       or not supported, these calls will fail with -ENODATA. Note that
42       currently no transports support timestamping of messages. By default,
43       message timestamping is not negotiated for connections.
44
45       sd_bus_negotiate_creds() controls whether and which implicit sender
46       credentials shall be attached automatically to all incoming messages.
47       Takes a bus object and a boolean indicating whether to enable or
48       disable the credential parts encoded in the bit mask value argument.
49       Note that not all transports support attaching sender credentials to
50       messages, or do not support all types of sender credential parameters,
51       or might suppress them under certain circumstances for individual
52       messages. Specifically, dbus1 only supports SD_BUS_CREDS_UNIQUE_NAME.
53       The sender credentials are suitable for authorization decisions. By
54       default, only SD_BUS_CREDS_WELL_KNOWN_NAMES and
55       SD_BUS_CREDS_UNIQUE_NAME are enabled. In fact, these two credential
56       fields are always sent along and cannot be turned off.
57
58       sd_bus_get_creds_mask() returns the set of sender credentials that was
59       negotiated to be attached to all incoming messages in mask. This value
60       is an upper boundary only. Hence, always make sure to explicitly check
61       which credentials are attached to a specific message before using it.
62
63       The sd_bus_negotiate_fds() function may be called only before the
64       connection has been started with sd_bus_start(3). Both
65       sd_bus_negotiate_timestamp() and sd_bus_negotiate_creds() may also be
66       called after a connection has been set up. Note that, when operating on
67       a connection that is shared between multiple components of the same
68       program (for example via sd_bus_default(3)), it is highly recommended
69       to only enable additional per message metadata fields, but never
70       disable them again, in order not to disable functionality needed by
71       other components.
72

RETURN VALUE

74       On success, these functions return a non-negative integer. On failure,
75       they return a negative errno-style error code.
76
77   Errors
78       Returned errors may indicate the following problems:
79
80       -EPERM
81           The bus connection has already been started.
82
83       -EINVAL
84           An argument is invalid.
85
86       -ENOPKG
87           The bus cannot be resolved.
88
89       -ECHILD
90           The bus was created in a different process.
91

NOTES

93       These APIs are implemented as a shared library, which can be compiled
94       and linked to with the libsystemd pkg-config(1) file.
95

SEE ALSO

97       systemd(1), sd-bus(3), sd_bus_start(3), sd_bus_can_send(3),
98       sd_bus_message_get_monotonic_usec(3),
99       sd_bus_message_get_realtime_usec(3), sd_bus_message_get_seqnum(3),
100       sd_bus_message_get_creds(3)
101
102
103
104systemd 250                                            SD_BUS_NEGOTIATE_FDS(3)
Impressum