2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
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>. This function is intended to be
48 used for debugging purposes, and the output is neither stable nor designed to be machine readable.
51 <para>The
<parameter>flags
</parameter> parameter may be used to modify the output. With
52 <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER
</constant>, a header that specifies the message type and flags
53 and some additional metadata is printed. When
<constant>SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY
</constant> is
54 not passed, the contents of the whole message are printed. When it
<emphasis>is
</emphasis> passed,
55 only the current container in printed.
</para>
57 <para>Note that this function moves the read pointer of the message. It may be necessary to reset the
58 position afterwards, for example with
59 <citerefentry><refentrytitle>sd_bus_message_rewind
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
64 <title>Examples
</title>
66 <para>Output for a signal message (with
<constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER
</constant>):
68 ‣ Type=signal Endian=l Flags=
1 Version=
1 Cookie=
22
69 Path=/value/a Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged
71 STRING
"org.freedesktop.systemd.ValueTest";
76 STRING
"object 0x1e, path /value/a";
82 STRING
"AnExplicitProperty";
90 <title>Return Value
</title>
92 <para>On success, this function returns
0 or a positive integer. On failure, it returns a negative
93 errno-style error code. No error codes are currently defined.
</para>
96 <xi:include href=
"libsystemd-pkgconfig.xml" />
99 <title>See Also
</title>
102 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
103 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>