]>
Commit | Line | Data |
---|---|---|
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 <systemd/sd-bus.h></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 | ||
41 | <para><function>sd_bus_message_read_array()</function> gives access to an element array in | |
42 | message <parameter>m</parameter>. The "read pointer" in the message must be right before an | |
43 | array of type <parameter>type</parameter>. As a special case, <parameter>type</parameter> may be | |
44 | <constant>NUL</constant>, in which case any type is acceptable. A pointer to the array data is | |
45 | returned in the parameter <parameter>ptr</parameter> and the size of array data (in bytes) is | |
46 | returned in the parameter <parameter>size</parameter>. If <parameter>size</parameter> is 0, a | |
47 | valid non-null pointer will be returned, but it may not be dereferenced. The data is aligned as | |
48 | appropriate for the data type. The data is part of the message — it may not be modified and is | |
49 | valid only as long as the message is referenced. After this function returns, the "read pointer" | |
50 | 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> | |
61 | On success, <function>sd_bus_message_read_array()</function> returns 0 or | |
62 | a positive integer. On failure, it returns a negative errno-style error | |
63 | code. | |
64 | </para> | |
7f9f55e1 | 65 | |
b1de39de ZJS |
66 | <refsect2> |
67 | <title>Errors</title> | |
7f9f55e1 | 68 | |
b1de39de | 69 | <para>Returned errors may indicate the following problems:</para> |
7f9f55e1 | 70 | |
b1de39de ZJS |
71 | <variablelist> |
72 | <varlistentry> | |
73 | <term><constant>-EINVAL</constant></term> | |
7f9f55e1 | 74 | |
e0db55a6 LP |
75 | <listitem><para>Specified type is invalid or not a trivial type (see above), or the message |
76 | parameter or one of the output parameters are <constant>NULL</constant>.</para></listitem> | |
b1de39de | 77 | </varlistentry> |
7f9f55e1 | 78 | |
b1de39de ZJS |
79 | <varlistentry> |
80 | <term><constant>-EOPNOTSUPP</constant></term> | |
7f9f55e1 | 81 | |
b1de39de ZJS |
82 | <listitem><para>The byte order in the message is different than native byte |
83 | order.</para></listitem> | |
84 | </varlistentry> | |
7f9f55e1 | 85 | |
b1de39de ZJS |
86 | <varlistentry> |
87 | <term><constant>-EPERM</constant></term> | |
7f9f55e1 | 88 | |
b1de39de ZJS |
89 | <listitem><para>The message is not sealed.</para></listitem> |
90 | </varlistentry> | |
7f9f55e1 | 91 | |
b1de39de ZJS |
92 | <varlistentry> |
93 | <term><constant>-EBADMSG</constant></term> | |
7f9f55e1 | 94 | |
b1de39de ZJS |
95 | <listitem><para>The message cannot be parsed.</para></listitem> |
96 | </varlistentry> | |
7f9f55e1 | 97 | |
b1de39de ZJS |
98 | </variablelist> |
99 | </refsect2> | |
7f9f55e1 ZJS |
100 | </refsect1> |
101 | ||
102 | <refsect1> | |
103 | <title>See Also</title> | |
104 | ||
105 | <para> | |
106 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
107 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
e5f1a3fa DDM |
108 | <citerefentry><refentrytitle>sd_bus_message_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
109 | <citerefentry><refentrytitle>sd_bus_message_read_strv</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
7f9f55e1 ZJS |
110 | </para> |
111 | </refsect1> | |
112 | ||
113 | </refentry> |