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