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">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright © 2016 Julian Orth
11 <refentry id="sd_bus_message_read_basic">
14 <title>sd_bus_message_read_basic</title>
15 <productname>systemd</productname>
19 <refentrytitle>sd_bus_message_read_basic</refentrytitle>
20 <manvolnum>3</manvolnum>
24 <refname>sd_bus_message_read_basic</refname>
26 <refpurpose>Read a basic type from a message</refpurpose>
31 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
34 <funcdef>int <function>sd_bus_message_read_basic</function></funcdef>
35 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
36 <paramdef>char <parameter>type</parameter></paramdef>
37 <paramdef>void *<parameter>p</parameter></paramdef>
43 <title>Description</title>
46 <function>sd_bus_message_read_basic()</function> reads a basic type from a
47 message and advances the read position in the message. The set of basic
48 types and their ascii codes passed in <parameter>type</parameter> are
49 described in the <ulink
50 url="https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus
51 Specification</ulink>.
55 If <parameter>p</parameter> is not NULL, it should contain a pointer to an
56 appropriate object. For example, if <parameter>type</parameter> is
57 <constant>'y'</constant>, the object passed in <parameter>p</parameter>
58 should have type <code>uint8_t *</code>. If <parameter>type</parameter>
59 is <constant>'s'</constant>, the object passed in <parameter>p</parameter>
60 should have type <code>const char **</code>. Note that, if the basic type
61 is a pointer (e.g., <code>const char *</code> in the case of a string),
62 the pointer is only borrowed and the contents must be copied if they are
63 to be used after the end of the messages lifetime. Similarly, during the
64 lifetime of such a pointer, the message must not be modified.
68 If there is no object of the specified type at the current position in the
69 message, an error is returned.
74 <title>Return Value</title>
77 On success, <function>sd_bus_message_read_basic()</function> returns 0 or
78 a positive integer. On failure, it returns a negative errno-style error
84 <title>See Also</title>
87 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
88 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,