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