]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_read_array.xml
Merge pull request #17444 from BtbN/fix_ib_dhcp4
[thirdparty/systemd.git] / man / sd_bus_message_read_array.xml
CommitLineData
7f9f55e1 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
7f9f55e1
ZJS
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6<refentry id="sd_bus_message_read_array">
7
8 <refentryinfo>
9 <title>sd_bus_message_read_array</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_message_read_array</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_bus_message_read_array</refname>
20
21 <refpurpose>Access an array of elements in a message</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <funcsynopsis>
26 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
27
28 <funcprototype>
29 <funcdef>int <function>sd_bus_message_read_array</function></funcdef>
30 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
31 <paramdef>char <parameter>type</parameter></paramdef>
32 <paramdef>const void **<parameter>ptr</parameter></paramdef>
33 <paramdef>size_t *<parameter>size</parameter></paramdef>
34 </funcprototype>
35 </funcsynopsis>
36 </refsynopsisdiv>
37
38 <refsect1>
39 <title>Description</title>
40
4840807c
LP
41 <para><function>sd_bus_message_read_array()</function> provides access to an array elements in the
42 bus message <parameter>m</parameter>. The "read pointer" in the message must be right before an array of type
43 <parameter>type</parameter>. As a special case, <parameter>type</parameter> may be
44 <constant>NUL</constant>, in which case any trivial type is acceptable. A pointer to the array data is returned
45 in the parameter <parameter>ptr</parameter> and the size of array data (in bytes) is returned in the
46 parameter <parameter>size</parameter>. If the returned <parameter>size</parameter> parameter is 0, a
47 valid non-null pointer will be returned as <parameter>ptr</parameter>, but it may not be
48 dereferenced. The data is aligned as appropriate for the data type. The data is part of the message — it
49 may not be modified and is valid only as long as the message is referenced. After this function returns,
50 the "read pointer" points at the next element after the array.</para>
e0db55a6
LP
51
52 <para>Note that this function only supports arrays of trivial types, i.e. arrays of booleans, the various
53 integer types, as well as floating point numbers. In particular it may not be used for arrays of strings,
54 structures or similar.</para>
7f9f55e1
ZJS
55 </refsect1>
56
57 <refsect1>
58 <title>Return Value</title>
59
60 <para>
4840807c
LP
61 On success and when an array was read, <function>sd_bus_message_read_array()</function> returns an
62 integer greater than zero. If invoked while inside a container element (such as an array, e.g. when
63 operating on an array of arrays) and the final element of the outer container has been read already and
64 the read pointer is thus behind the last element of the outer container this call returns 0 (and the
65 returned pointer will be <constant>NULL</constant> and the size will be 0). On failure, it returns a
66 negative errno-style error code.
7f9f55e1 67 </para>
7f9f55e1 68
b1de39de
ZJS
69 <refsect2>
70 <title>Errors</title>
7f9f55e1 71
b1de39de 72 <para>Returned errors may indicate the following problems:</para>
7f9f55e1 73
b1de39de
ZJS
74 <variablelist>
75 <varlistentry>
76 <term><constant>-EINVAL</constant></term>
7f9f55e1 77
e0db55a6
LP
78 <listitem><para>Specified type is invalid or not a trivial type (see above), or the message
79 parameter or one of the output parameters are <constant>NULL</constant>.</para></listitem>
b1de39de 80 </varlistentry>
7f9f55e1 81
b1de39de
ZJS
82 <varlistentry>
83 <term><constant>-EOPNOTSUPP</constant></term>
7f9f55e1 84
b1de39de
ZJS
85 <listitem><para>The byte order in the message is different than native byte
86 order.</para></listitem>
87 </varlistentry>
7f9f55e1 88
b1de39de
ZJS
89 <varlistentry>
90 <term><constant>-EPERM</constant></term>
7f9f55e1 91
b1de39de
ZJS
92 <listitem><para>The message is not sealed.</para></listitem>
93 </varlistentry>
7f9f55e1 94
b1de39de
ZJS
95 <varlistentry>
96 <term><constant>-EBADMSG</constant></term>
7f9f55e1 97
b1de39de
ZJS
98 <listitem><para>The message cannot be parsed.</para></listitem>
99 </varlistentry>
7f9f55e1 100
b1de39de
ZJS
101 </variablelist>
102 </refsect2>
7f9f55e1
ZJS
103 </refsect1>
104
105 <refsect1>
106 <title>See Also</title>
107
108 <para>
109 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
110 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
e5f1a3fa
DDM
111 <citerefentry><refentrytitle>sd_bus_message_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>sd_bus_message_read_strv</refentrytitle><manvolnum>3</manvolnum></citerefentry>
7f9f55e1
ZJS
113 </para>
114 </refsect1>
115
116</refentry>