298 lines
5.8 KiB
HTML
298 lines
5.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD_BUS_MESSAGE_READ_BASIC</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD_BUS_MESSAGE_READ_BASIC</H1>
|
|
Section: sd_bus_message_read_basic (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd_bus_message_read_basic - Read a basic type from a message
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>int sd_bus_message_read_basic(sd_bus_message *</B><I>m</I><B>, char </B><I>type</I><B>, void *</B><I>p</I><B>);</B>
|
|
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>sd_bus_message_read_basic()</B>
|
|
<DD>reads a basic type from a message and advances the read position in the message. The set of basic types and their ascii codes passed in
|
|
<I>type</I>
|
|
are described in the
|
|
m[blue]<B>D-Bus Specification</B>m[]<FONT SIZE="-2">[1]</FONT>.
|
|
<P>
|
|
|
|
If
|
|
<I>p</I>
|
|
is not
|
|
<B>NULL</B>, it should contain a pointer to an appropriate object. For example, if
|
|
<I>type</I>
|
|
is
|
|
<B>'y'</B>, the object passed in
|
|
<I>p</I>
|
|
should have type
|
|
<B>uint8_t *</B>. If
|
|
<I>type</I>
|
|
is
|
|
<B>'s'</B>, the object passed in
|
|
<I>p</I>
|
|
should have type
|
|
<B>const char **</B>. Note that, if the basic type is a pointer (e.g.,
|
|
<B>const char *</B>
|
|
in the case of a string), the pointer is only borrowed and the contents must be copied if they are to be used after the end of the messages lifetime. Similarly, during the lifetime of such a pointer, the message must not be modified. See the table below for a complete list of allowed types.
|
|
<P>
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
<B>Table 1. Item type specifiers</B>
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>
|
|
Specifier
|
|
</B></TD><TD><B>
|
|
Constant
|
|
</B></TD><TD><B>
|
|
Description
|
|
</B></TD><TD><B>
|
|
Expected C Type
|
|
</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"y"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_BYTE</B>
|
|
</TD><TD>
|
|
8bit unsigned integer
|
|
</TD><TD>
|
|
<B>uint8_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"b"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_BOOLEAN</B>
|
|
</TD><TD>
|
|
boolean
|
|
</TD><TD>
|
|
<B>int *</B> (NB: not <B>bool *</B>)
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"n"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_INT16</B>
|
|
</TD><TD>
|
|
16bit signed integer
|
|
</TD><TD>
|
|
<B>int16_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"q"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_UINT16</B>
|
|
</TD><TD>
|
|
16bit unsigned integer
|
|
</TD><TD>
|
|
<B>uint16_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"i"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_INT32</B>
|
|
</TD><TD>
|
|
32bit signed integer
|
|
</TD><TD>
|
|
<B>int32_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"u"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_UINT32</B>
|
|
</TD><TD>
|
|
32bit unsigned integer
|
|
</TD><TD>
|
|
<B>uint32_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"x"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_INT64</B>
|
|
</TD><TD>
|
|
64bit signed integer
|
|
</TD><TD>
|
|
<B>int64_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"t"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_UINT64</B>
|
|
</TD><TD>
|
|
64bit unsigned integer
|
|
</TD><TD>
|
|
<B>uint64_t *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"d"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_DOUBLE</B>
|
|
</TD><TD>
|
|
IEEE 754 double precision floating-point
|
|
</TD><TD>
|
|
<B>double *</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"s"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_STRING</B>
|
|
</TD><TD>
|
|
UTF-8 string
|
|
</TD><TD>
|
|
<B>const char **</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"o"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_OBJECT_PATH</B>
|
|
</TD><TD>
|
|
D-Bus object path string
|
|
</TD><TD>
|
|
<B>const char **</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"g"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_SIGNATURE</B>
|
|
</TD><TD>
|
|
D-Bus signature string
|
|
</TD><TD>
|
|
<B>const char **</B>
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
"h"
|
|
</TD><TD>
|
|
<B>SD_BUS_TYPE_UNIX_FD</B>
|
|
</TD><TD>
|
|
UNIX file descriptor
|
|
</TD><TD>
|
|
<B>int *</B>
|
|
<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<P>
|
|
|
|
If there is no object of the specified type at the current position in the message, an error is returned.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
On success,
|
|
<B>sd_bus_message_read_basic()</B>
|
|
returns 0 or a positive integer. On failure, it returns a negative errno-style error code.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Errors</H3>
|
|
|
|
<P>
|
|
|
|
Returned errors may indicate the following problems:
|
|
<P>
|
|
|
|
<B>-EINVAL</B>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
Specified type string is invalid or the message parameter is
|
|
<B>NULL</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENXIO</B>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
The message does not contain the specified type at current position.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-EBADMSG</B>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
The message cannot be parsed.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_append_basic">sd_bus_message_append_basic</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_skip">sd_bus_message_skip</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_read">sd_bus_message_read</A></B>(3)
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="5"> 1.<DD>
|
|
D-Bus Specification
|
|
<DL COMPACT><DT id="6"><DD>
|
|
<A HREF="https://dbus.freedesktop.org/doc/dbus-specification.html">https://dbus.freedesktop.org/doc/dbus-specification.html</A>
|
|
</DL>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="10"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DL>
|
|
<DT id="11"><A HREF="#lbAF">Errors</A><DD>
|
|
</DL>
|
|
<DT id="12"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
<DT id="13"><A HREF="#lbAH">NOTES</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:54 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|