1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
6 <refentry id=
"sd_bus_message_get_type" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
9 <title>sd_bus_message_get_type
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>sd_bus_message_get_type
</refentrytitle>
15 <manvolnum>3</manvolnum>
19 <refname>sd_bus_message_get_type
</refname>
20 <refname>sd_bus_message_is_signal
</refname>
21 <refname>sd_bus_message_is_method_call
</refname>
22 <refname>sd_bus_message_is_method_error
</refname>
24 <refpurpose>Query bus message addressing metadata
</refpurpose>
29 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
32 <funcdef>int
<function>sd_bus_message_get_type
</function></funcdef>
33 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
34 <paramdef>uint8_t *
<parameter>type
</parameter></paramdef>
38 <funcdef>int
<function>sd_bus_message_is_signal
</function></funcdef>
39 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
40 <paramdef>const char *
<parameter>interface
</parameter></paramdef>
41 <paramdef>const char *
<parameter>member
</parameter></paramdef>
45 <funcdef>int
<function>sd_bus_message_is_method_call
</function></funcdef>
46 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
47 <paramdef>const char *
<parameter>interface
</parameter></paramdef>
48 <paramdef>const char *
<parameter>member
</parameter></paramdef>
52 <funcdef>int
<function>sd_bus_message_is_method_error
</function></funcdef>
53 <paramdef>sd_bus_message *
<parameter>message
</parameter></paramdef>
54 <paramdef>const char *
<parameter>name
</parameter></paramdef>
61 <title>Description
</title>
63 <para><function>sd_bus_message_get_type()
</function> returns the type of a message in the output
64 parameter
<parameter>type
</parameter>, one of
<constant>SD_BUS_MESSAGE_METHOD_CALL
</constant>,
65 <constant>SD_BUS_MESSAGE_METHOD_RETURN
</constant>,
66 <constant>SD_BUS_MESSAGE_METHOD_ERROR
</constant>,
<constant>SD_BUS_MESSAGE_SIGNAL
</constant>.
67 This type is either specified as a parameter when the message is created using
68 <citerefentry><refentrytitle>sd_bus_set_message_new
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
69 or is set automatically when the message is created using
70 <citerefentry><refentrytitle>sd_bus_set_message_new_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
71 <citerefentry><refentrytitle>sd_bus_set_message_new_method_call
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
72 <citerefentry><refentrytitle>sd_bus_set_message_new_method_error
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
73 and similar functions.
76 <para><function>sd_bus_message_is_signal()
</function> checks if message
<parameter>m
</parameter>
77 is a signal message. If
<parameter>interface
</parameter> is non-null, it also checks if the
78 message has the same interface set. If
<parameter>member
</parameter> is non-null, it also checks
79 if the message has the same member set. Also see
80 <citerefentry><refentrytitle>sd_bus_set_message_new_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.
</para>
82 <para><function>sd_bus_message_is_method_call()
</function> checks if message
<parameter>m
</parameter>
83 is a method call message. If
<parameter>interface
</parameter> is non-null, it also checks if the
84 message has the same interface set. If
<parameter>member
</parameter> is non-null, it also checks
85 if the message has the same member set. Also see
86 <citerefentry><refentrytitle>sd_bus_set_message_new_method_call
</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.
</para>
88 <para><function>sd_bus_message_is_method_error()
</function> checks if message
<parameter>m
</parameter>
89 is an error reply message. If
<parameter>name
</parameter> is non-null, it also checks if the
90 message has the same error identifier set. Also see
91 <citerefentry><refentrytitle>sd_bus_set_message_new_method_error
</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.
</para>
95 <title>Return Value
</title>
97 <para>On success, those functions return
0 or a positive
98 integer. On failure, it returns a negative errno-style error code.
</para>
102 <title>Errors
</title>
104 <para>Returned errors may indicate the following problems:
</para>
108 <term><constant>-EINVAL
</constant></term>
110 <listitem><para>The
<parameter>message
</parameter> parameter or the output parameter are
111 <constant>NULL
</constant>.
</para></listitem>
116 <xi:include href=
"libsystemd-pkgconfig.xml" />
119 <title>See Also
</title>
122 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
123 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
124 <citerefentry><refentrytitle>sd_bus_message_new
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
125 <citerefentry><refentrytitle>sd_bus_message_set_destination
</refentrytitle><manvolnum>3</manvolnum></citerefentry>