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_rewind"
7          xmlns:xi="http://www.w3.org/2001/XInclude">
8
9  <refentryinfo>
10    <title>sd_bus_message_rewind</title>
11    <productname>systemd</productname>
12  </refentryinfo>
13
14  <refmeta>
15    <refentrytitle>sd_bus_message_rewind</refentrytitle>
16    <manvolnum>3</manvolnum>
17  </refmeta>
18
19  <refnamediv>
20    <refname>sd_bus_message_rewind</refname>
21
22    <refpurpose>Return to beginning of message or current container</refpurpose>
23  </refnamediv>
24
25  <refsynopsisdiv>
26    <funcsynopsis>
27      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29      <funcprototype>
30        <funcdef>int <function>sd_bus_message_rewind</function></funcdef>
31        <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
32        <paramdef>int <parameter>complete</parameter></paramdef>
33      </funcprototype>
34    </funcsynopsis>
35  </refsynopsisdiv>
36
37  <refsect1>
38    <title>Description</title>
39
40    <para><function>sd_bus_message_rewind()</function> moves the "read pointer" in the message
41    <parameter>m</parameter> to either the beginning of the message (if
42    <parameter>complete</parameter> is true) or to the beginning of the currently open container. If
43    no container is open, <parameter>complete</parameter> has no effect.</para>
44  </refsect1>
45
46  <refsect1>
47    <title>Return Value</title>
48
49    <para>
50      On success, this function returns 0 or a positive integer. The value is zero if the current
51      container or whole message in case no container is open is empty, and positive otherwise. On
52      failure, it returns a negative errno-style error code.
53    </para>
54
55    <refsect2>
56      <title>Errors</title>
57
58      <para>Returned errors may indicate the following problems:</para>
59
60      <variablelist>
61        <varlistentry>
62          <term><constant>-EINVAL</constant></term>
63
64          <listitem><para>The <parameter>m</parameter> parameter is <constant>NULL</constant>.</para></listitem>
65        </varlistentry>
66
67        <varlistentry>
68          <term><constant>-EPERM</constant></term>
69
70          <listitem><para>The message <parameter>m</parameter> has not been sealed.</para></listitem>
71        </varlistentry>
72      </variablelist>
73    </refsect2>
74  </refsect1>
75
76  <xi:include href="libsystemd-pkgconfig.xml" />
77
78  <refsect1>
79    <title>See Also</title>
80
81    <para>
82      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
83      <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
84      <citerefentry><refentrytitle>sd_bus_message_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>
85    </para>
86  </refsect1>
87
88</refentry>
89