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_copy" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8  <refentryinfo>
9    <title>sd_bus_message_copy</title>
10    <productname>systemd</productname>
11  </refentryinfo>
12
13  <refmeta>
14    <refentrytitle>sd_bus_message_copy</refentrytitle>
15    <manvolnum>3</manvolnum>
16  </refmeta>
17
18  <refnamediv>
19    <refname>sd_bus_message_copy</refname>
20
21    <refpurpose>Copy the contents of one message to another</refpurpose>
22  </refnamediv>
23
24  <refsynopsisdiv>
25    <funcsynopsis>
26      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
27
28      <funcprototype>
29        <funcdef>int sd_bus_message_copy</funcdef>
30        <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
31        <paramdef>sd_bus_message *<parameter>source</parameter></paramdef>
32        <paramdef>int <parameter>all</parameter></paramdef>
33      </funcprototype>
34    </funcsynopsis>
35  </refsynopsisdiv>
36
37  <refsect1>
38    <title>Description</title>
39
40    <para><function>sd_bus_message_copy()</function> copies the contents from
41    message <parameter>source</parameter> to <parameter>m</parameter>. If
42    <parameter>all</parameter> is false, a single complete type is copied
43    (basic or container). If <parameter>all</parameter> is true, the contents
44    are copied until the end of the currently open container or the end
45    of <parameter>source</parameter>.</para>
46  </refsect1>
47
48  <refsect1>
49    <title>Return Value</title>
50
51    <para>On success, this call returns true if anything was copied, and false if
52    there was nothing to copy. On failure, it returns a negative errno-style error
53    code.</para>
54
55    <refsect2 id='errors'>
56      <title>Errors</title>
57
58      <para>Returned errors may indicate the following problems:</para>
59
60      <variablelist>
61
62        <varlistentry>
63          <term><constant>-EINVAL</constant></term>
64
65          <listitem><para><parameter>source</parameter> or <parameter>m</parameter> are
66          <constant>NULL</constant>.</para></listitem>
67        </varlistentry>
68
69        <varlistentry>
70          <term><constant>-EPERM</constant></term>
71
72          <listitem><para>Message <parameter>m</parameter> has been sealed or <parameter>source</parameter>
73          has <emphasis>not</emphasis> been sealed.  </para></listitem>
74        </varlistentry>
75
76        <varlistentry>
77          <term><constant>-ESTALE</constant></term>
78
79          <listitem><para>Destination message is in invalid state.
80          </para></listitem>
81        </varlistentry>
82
83        <varlistentry>
84          <term><constant>-ENXIO</constant></term>
85
86          <listitem><para>Destination message cannot be appended to.
87          </para></listitem>
88        </varlistentry>
89
90        <varlistentry>
91          <term><constant>-ENOMEM</constant></term>
92
93          <listitem><para>Memory allocation failed.</para></listitem>
94        </varlistentry>
95      </variablelist>
96    </refsect2>
97  </refsect1>
98
99  <xi:include href="libsystemd-pkgconfig.xml" />
100
101  <refsect1>
102    <title>See Also</title>
103
104    <para>
105      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
106      <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
107      <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>
108    </para>
109  </refsect1>
110
111</refentry>
112