File: sd_bus_message_dump.xml

package info (click to toggle)
systemd-udeb 259-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,120 kB
  • sloc: ansic: 726,480; xml: 121,118; python: 35,852; sh: 33,447; cpp: 946; awk: 102; makefile: 89; lisp: 13; sed: 1
file content (134 lines) | stat: -rw-r--r-- 5,298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->

<refentry id="sd_bus_message_dump"
          xmlns:xi="http://www.w3.org/2001/XInclude">

  <refentryinfo>
    <title>sd_bus_message_dump</title>
    <productname>systemd</productname>
  </refentryinfo>

  <refmeta>
    <refentrytitle>sd_bus_message_dump</refentrytitle>
    <manvolnum>3</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>sd_bus_message_dump</refname>
    <refname>sd_bus_message_dump_json</refname>

    <refpurpose>Produce a string representation of a message for debugging purposes</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <funcsynopsis>
      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>

      <funcprototype>
        <funcdef>int sd_bus_message_dump</funcdef>
        <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
        <paramdef>FILE *<parameter>f</parameter></paramdef>
        <paramdef>uint64_t <parameter>flags</parameter></paramdef>
      </funcprototype>

      <funcprototype>
        <funcdef>int sd_bus_message_dump_json</funcdef>
        <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
        <paramdef>uint64_t <parameter>flags</parameter></paramdef>
        <paramdef>sd_json_variant **<parameter>ret</parameter></paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para>The <function>sd_bus_message_dump()</function> function writes a textual representation of the
    message <parameter>m</parameter> to the stream <parameter>f</parameter>. If <parameter>f</parameter> is
    <constant>NULL</constant>, standard output (<constant>stdio</constant>) will be used. This function is
    intended to be used for debugging purposes, and the output is neither stable nor designed to be machine
    readable.</para>

    <para>The <function>sd_bus_message_dump_json()</function> function converts the DBus message
    <parameter>m</parameter> to a JSON variant and stores it in <parameter>ret</parameter>. The caller should
    call <function>sd_json_variant_unref()</function> for the acquired JSON variant after use. Unlike
    <function>sd_bus_message_dump()</function>, the function itself does not print anything. To print the
    DBus message in the JSON format, please pass the returned JSON variant to
    <function>sd_json_variant_dump()</function>.</para>

    <para>The <parameter>flags</parameter> parameter may be used to modify the output, and is a combination
    of zero or more of the following flags:</para>

    <variablelist>
      <varlistentry>
        <term><constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER</constant></term>

        <listitem><para>The header of the message that specifies the message type, flags, and several more
        additional metadata will be printed or included in the resulting JSON object.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><constant>SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY</constant></term>

        <listitem><para>Only the current container will be printed or converted. When the flag is
        <emphasis>not</emphasis> specified, the contents of the whole message will be printed or converted.
        </para></listitem>
      </varlistentry>
    </variablelist>

    <para>Note that these functions move the read pointer of the message. It may be necessary to reset the
    position afterwards, for example with
    <citerefentry><refentrytitle>sd_bus_message_rewind</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
    </para>

  </refsect1>

  <refsect1>
    <title>Examples</title>

    <para>Output for a signal message (with <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER</constant>):
    <programlisting>
‣ Type=signal  Endian=l  Flags=1  Version=1  Cookie=22
  Path=/value/a  Interface=org.freedesktop.DBus.Properties  Member=PropertiesChanged
  MESSAGE "sa{sv}as" {
          STRING "org.freedesktop.systemd.ValueTest";
          ARRAY "{sv}" {
                  DICT_ENTRY "sv" {
                          STRING "Value";
                          VARIANT "s" {
                                  STRING "object 0x1e, path /value/a";
                          };
                  };
          };
          ARRAY "s" {
                  STRING "Value2";
                  STRING "AnExplicitProperty";
          };
  };
</programlisting>
    </para>
  </refsect1>

  <refsect1>
    <title>Return Value</title>

    <para>On success, this function returns 0 or a positive integer. On failure, it returns a negative
    errno-style error code. No error codes are currently defined.</para>
  </refsect1>

  <xi:include href="libsystemd-pkgconfig.xml" />

  <refsect1>
    <title>See Also</title>

    <para><simplelist type="inline">
      <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
      <member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
      <member><citerefentry><refentrytitle>sd-json</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
    </simplelist></para>
  </refsect1>

</refentry>