2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"sd_bus_message_dump"
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>sd_bus_message_dump
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>sd_bus_message_dump
</refentrytitle>
16 <manvolnum>3</manvolnum>
20 <refname>sd_bus_message_dump
</refname>
22 <refpurpose>Produce a string representation of a message for debugging purposes
</refpurpose>
27 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
30 <funcdef>int sd_bus_message_dump
</funcdef>
31 <paramdef>sd_bus_message *
<parameter>m
</parameter></paramdef>
32 <paramdef>FILE *
<parameter>f
</parameter></paramdef>
33 <paramdef>uint64_t
<parameter>flags
</parameter></paramdef>
38 <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER
</constant>,
39 <constant>SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY
</constant>
44 <title>Description
</title>
46 <para>The
<function>sd_bus_message_dump()
</function> function writes a textual representation of the
47 message
<parameter>m
</parameter> to the stream
<parameter>f
</parameter>. If
<parameter>f
</parameter> is
48 <constant>NULL
</constant>, standard output (
<constant>stdio
</constant>) will be used. This function is
49 intended to be used for debugging purposes, and the output is neither stable nor designed to be machine
52 <para>The
<parameter>flags
</parameter> parameter may be used to modify the output. With
53 <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER
</constant>, a header that specifies the message type and flags
54 and some additional metadata is printed. When
<constant>SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY
</constant> is
55 not passed, the contents of the whole message are printed. When it
<emphasis>is
</emphasis> passed,
56 only the current container in printed.
</para>
58 <para>Note that this function moves the read pointer of the message. It may be necessary to reset the
59 position afterwards, for example with
60 <citerefentry><refentrytitle>sd_bus_message_rewind
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
65 <title>Examples
</title>
67 <para>Output for a signal message (with
<constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER
</constant>):
69 ‣ Type=signal Endian=l Flags=
1 Version=
1 Cookie=
22
70 Path=/value/a Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged
72 STRING
"org.freedesktop.systemd.ValueTest";
77 STRING
"object 0x1e, path /value/a";
83 STRING
"AnExplicitProperty";
91 <title>Return Value
</title>
93 <para>On success, this function returns
0 or a positive integer. On failure, it returns a negative
94 errno-style error code. No error codes are currently defined.
</para>
97 <xi:include href=
"libsystemd-pkgconfig.xml" />
100 <title>See Also
</title>
102 <para><simplelist type=
"inline">
103 <member><citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
104 <member><citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>