chiark / gitweb /
c817a7f857ce790a32ae247dc2ffccd05649a266
[elogind.git] / man / sd_bus_message_read_basic.xml
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 <!--
6   SPDX-License-Identifier: LGPL-2.1+
7
8   Copyright 2016 Julian Orth
9 -->
10
11 <refentry id="sd_bus_message_read_basic">
12
13   <refentryinfo>
14     <title>sd_bus_message_read_basic</title>
15     <productname>systemd</productname>
16
17     <authorgroup>
18       <author>
19         <firstname>Julian</firstname>
20         <surname>Orth</surname>
21         <email>ju.orth@gmail.com</email>
22       </author>
23     </authorgroup>
24   </refentryinfo>
25
26   <refmeta>
27     <refentrytitle>sd_bus_message_read_basic</refentrytitle>
28     <manvolnum>3</manvolnum>
29   </refmeta>
30
31   <refnamediv>
32     <refname>sd_bus_message_read_basic</refname>
33
34     <refpurpose>Read a basic type from a message</refpurpose>
35   </refnamediv>
36
37   <refsynopsisdiv>
38     <funcsynopsis>
39       <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
40
41       <funcprototype>
42         <funcdef>int <function>sd_bus_message_read_basic</function></funcdef>
43         <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
44         <paramdef>char <parameter>type</parameter></paramdef>
45         <paramdef>void *<parameter>p</parameter></paramdef>
46       </funcprototype>
47     </funcsynopsis>
48   </refsynopsisdiv>
49
50   <refsect1>
51     <title>Description</title>
52
53     <para>
54       <function>sd_bus_message_read_basic()</function> reads a basic type from a
55       message and advances the read position in the message. The set of basic
56       types and their ascii codes passed in <parameter>type</parameter> are
57       described in the <ulink
58         url="https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus
59         Specification</ulink>.
60     </para>
61
62     <para>
63       If <parameter>p</parameter> is not NULL, it should contain a pointer to an
64       appropriate object. For example, if <parameter>type</parameter> is
65       <constant>'y'</constant>, the object passed in <parameter>p</parameter>
66       should have type <code>uint8_t *</code>. If <parameter>type</parameter>
67       is <constant>'s'</constant>, the object passed in <parameter>p</parameter>
68       should have type <code>const char **</code>. Note that, if the basic type
69       is a pointer (e.g., <code>const char *</code> in the case of a string),
70       the pointer is only borrowed and the contents must be copied if they are
71       to be used after the end of the messages lifetime. Similarly, during the
72       lifetime of such a pointer, the message must not be modified.
73     </para>
74
75     <para>
76       If there is no object of the specified type at the current position in the
77       message, an error is returned.
78     </para>
79   </refsect1>
80
81   <refsect1>
82     <title>Return Value</title>
83
84     <para>
85       On success, <function>sd_bus_message_read_basic()</function> returns 0 or
86       a positive integer. On failure, it returns a negative errno-style error
87       code.
88     </para>
89   </refsect1>
90
91   <refsect1>
92     <title>See Also</title>
93
94     <para>
95       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
96       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
97     </para>
98   </refsect1>
99
100 </refentry>