]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_read_basic.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / sd_bus_message_read_basic.xml
CommitLineData
e382c49f 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
e382c49f 8 This file is part of systemd.
9
10 Copyright 2016 Julian Orth
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24-->
25
26<refentry id="sd_bus_message_read_basic">
27
28 <refentryinfo>
29 <title>sd_bus_message_read_basic</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <firstname>Julian</firstname>
35 <surname>Orth</surname>
36 <email>ju.orth@gmail.com</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>sd_bus_message_read_basic</refentrytitle>
43 <manvolnum>3</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>sd_bus_message_read_basic</refname>
48
49 <refpurpose>Read a basic type from a message</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <funcsynopsis>
54 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
55
56 <funcprototype>
57 <funcdef>int <function>sd_bus_message_read_basic</function></funcdef>
58 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
59 <paramdef>char <parameter>type</parameter></paramdef>
60 <paramdef>void *<parameter>p</parameter></paramdef>
61 </funcprototype>
62 </funcsynopsis>
63 </refsynopsisdiv>
64
65 <refsect1>
66 <title>Description</title>
67
68 <para>
69 <function>sd_bus_message_read_basic()</function> reads a basic type from a
70 message and advances the read position in the message. The set of basic
71 types and their ascii codes passed in <parameter>type</parameter> are
72 described in the <ulink
73 url="https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus
74 Specification</ulink>.
75 </para>
76
77 <para>
78 If <parameter>p</parameter> is not NULL, it should contain a pointer to an
79 appropriate object. For example, if <parameter>type</parameter> is
80 <constant>'y'</constant>, the object passed in <parameter>p</parameter>
81 should have type <code>uint8_t *</code>. If <parameter>type</parameter>
82 is <constant>'s'</constant>, the object passed in <parameter>p</parameter>
83 should have type <code>const char **</code>. Note that, if the basic type
84 is a pointer (e.g., <code>const char *</code> in the case of a string),
85 the pointer is only borrowed and the contents must be copied if they are
86 to be used after the end of the messages lifetime. Similarly, during the
87 lifetime of such a pointer, the message must not be modified.
88 </para>
89
90 <para>
91 If there is no object of the specified type at the current position in the
92 message, an error is returned.
93 </para>
94 </refsect1>
95
96 <refsect1>
97 <title>Return Value</title>
98
99 <para>
100 On success, <function>sd_bus_message_read_basic()</function> returns 0 or
101 a positive integer. On failure, it returns a negative errno-style error
102 code.
103 </para>
104 </refsect1>
105
106 <refsect1>
107 <title>See Also</title>
108
109 <para>
110 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 </para>
113 </refsect1>
114
115</refentry>