]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_message_dump.xml
f32ce08050d4a66e7567c3c6dd233c956600be48
[thirdparty/systemd.git] / man / sd_bus_message_dump.xml
1 <?xml version='1.0'?>
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-or-later -->
5
6 <refentry id="sd_bus_message_dump"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>sd_bus_message_dump</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>sd_bus_message_dump</refentrytitle>
16 <manvolnum>3</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>sd_bus_message_dump</refname>
21
22 <refpurpose>Produce a string representation of a message for debugging purposes</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
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>
34 </funcprototype>
35 </funcsynopsis>
36
37 <para>
38 <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER</constant>,
39 <constant>SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY</constant>
40 </para>
41 </refsynopsisdiv>
42
43 <refsect1>
44 <title>Description</title>
45
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
50 readable.</para>
51
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>
57
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>.
61 </para>
62 </refsect1>
63
64 <refsect1>
65 <title>Examples</title>
66
67 <para>Output for a signal message (with <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER</constant>):
68 <programlisting>
69 ‣ Type=signal Endian=l Flags=1 Version=1 Cookie=22
70 Path=/value/a Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged
71 MESSAGE "sa{sv}as" {
72 STRING "org.freedesktop.systemd.ValueTest";
73 ARRAY "{sv}" {
74 DICT_ENTRY "sv" {
75 STRING "Value";
76 VARIANT "s" {
77 STRING "object 0x1e, path /value/a";
78 };
79 };
80 };
81 ARRAY "s" {
82 STRING "Value2";
83 STRING "AnExplicitProperty";
84 };
85 };
86 </programlisting>
87 </para>
88 </refsect1>
89
90 <refsect1>
91 <title>Return Value</title>
92
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>
95 </refsect1>
96
97 <xi:include href="libsystemd-pkgconfig.xml" />
98
99 <refsect1>
100 <title>See Also</title>
101
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>
105 </simplelist></para>
106 </refsect1>
107
108 </refentry>