1 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
2 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 SPDX-License-Identifier: LGPL-2.1+
8 <refentry id=
"sd_bus_message_set_destination" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>sd_bus_message_set_destination
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>sd_bus_message_set_destination
</refentrytitle>
16 <manvolnum>3</manvolnum>
20 <refname>sd_bus_message_set_destination
</refname>
21 <refname>sd_bus_message_get_destination
</refname>
22 <refname>sd_bus_message_get_path
</refname>
23 <refname>sd_bus_message_get_interface
</refname>
24 <refname>sd_bus_message_get_member
</refname>
25 <refname>sd_bus_message_set_sender
</refname>
26 <refname>sd_bus_message_get_sender
</refname>
28 <refpurpose>Set and query bus message addressing information
</refpurpose>
33 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
36 <funcdef>int
<function>sd_bus_message_set_destination
</function></funcdef>
37 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
38 <paramdef>const char *
<parameter>destination
</parameter></paramdef>
42 <funcdef>const char*
<function>sd_bus_message_get_destination
</function></funcdef>
43 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
47 <funcdef>const char*
<function>sd_bus_message_get_path
</function></funcdef>
48 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
52 <funcdef>const char*
<function>sd_bus_message_get_interface
</function></funcdef>
53 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
57 <funcdef>const char*
<function>sd_bus_message_get_member
</function></funcdef>
58 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
62 <funcdef>int
<function>sd_bus_message_set_sender
</function></funcdef>
63 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
64 <paramdef>const char *
<parameter>sender
</parameter></paramdef>
68 <funcdef>const char*
<function>sd_bus_message_get_sender
</function></funcdef>
69 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
75 <title>Description
</title>
77 <para><function>sd_bus_message_set_destination()
</function> sets the destination service name
78 for the specified bus message object. The specified name must be a valid unique or well-known
81 <para><function>sd_bus_message_get_destination()
</function>,
82 <function>sd_bus_message_get_path()
</function>,
83 <function>sd_bus_message_get_interface()
</function>, and
84 <function>sd_bus_message_get_member()
</function> return the destination, path, interface, and
85 member fields from
<parameter>message
</parameter> header. The return value will be
86 <constant>NULL
</constant> is
<parameter>message
</parameter> is
<constant>NULL
</constant> or the
87 message is of a type that doesn't use those fields or the message doesn't have them set. See
88 <citerefentry><refentrytitle>sd_bus_message_new_method_call
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
90 <citerefentry><refentrytitle>sd_bus_message_set_destination
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
91 for more discussion of those values.
</para>
94 <para><function>sd_bus_message_set_sender()
</function> sets the sender service name for the specified bus message
95 object. The specified name must be a valid unique or well-known service name. This function is useful only for
96 messages to send on direct connections as for connections to bus brokers the broker will fill in the destination
97 field anyway, and the sender field set by original sender is ignored.
</para>
99 <para><function>sd_bus_message_get_sender()
</function> returns the sender field from
100 <parameter>message
</parameter>.
</para>
102 <para>When a string is returned, it is a pointer to internal storage, and may not be modified or
103 freed. It is only valid as long as the
<parameter>message
</parameter> remains referenced and
104 this field hasn't been changed by a different call.
</para>
108 <title>Return Value
</title>
110 <para>On success, these calls return
0 or a positive integer. On failure, these calls return a
111 negative errno-style error code.
</para>
115 <title>Errors
</title>
117 <para>Returned errors may indicate the following problems:
</para>
121 <term><constant>-EINVAL
</constant></term>
123 <listitem><para>The
<parameter>message
</parameter> parameter or the output parameter are
124 <constant>NULL
</constant>.
</para></listitem>
128 <term><constant>-EPERM
</constant></term>
130 <listitem><para>For
<function>sd_bus_message_set_destination
</function> or
131 <function>sd_bus_message_set_sender
</function>, the message is already
132 sealed.
</para></listitem>
136 <term><constant>-EEXIST
</constant></term>
138 <listitem><para>The message already has a destination or sender field set.
</para></listitem>
143 <xi:include href=
"libsystemd-pkgconfig.xml" />
146 <title>See Also
</title>
149 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>sd_bus_new
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>sd_bus_set_sender
</refentrytitle><manvolnum>3</manvolnum></citerefentry>