]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_message_get_type.xml
travis: use UBSan checks from OSS-Fuzz
[thirdparty/systemd.git] / man / sd_bus_message_get_type.xml
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+ -->
5
6 <refentry id="sd_bus_message_get_type" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_bus_message_get_type</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_message_get_type</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
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>
23
24 <refpurpose>Query bus message addressing metadata</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
30
31 <funcprototype>
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>
35 </funcprototype>
36
37 <funcprototype>
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>
42 </funcprototype>
43
44 <funcprototype>
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>
49 </funcprototype>
50
51 <funcprototype>
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>
55 </funcprototype>
56 </funcsynopsis>
57
58 </refsynopsisdiv>
59
60 <refsect1>
61 <title>Description</title>
62
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.
74 </para>
75
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>
81
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>
87
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>
92 </refsect1>
93
94 <refsect1>
95 <title>Return Value</title>
96
97 <para>On success, those functions return 0 or a positive
98 integer. On failure, it returns a negative errno-style error code.</para>
99
100 <refsect2>
101 <title>Errors</title>
102
103 <para>Returned errors may indicate the following problems:</para>
104
105 <variablelist>
106 <varlistentry>
107 <term><constant>-EINVAL</constant></term>
108
109 <listitem><para>The <parameter>message</parameter> parameter or the output parameter are
110 <constant>NULL</constant>.</para></listitem>
111 </varlistentry>
112 </variablelist>
113 </refsect2>
114 </refsect1>
115
116 <xi:include href="libsystemd-pkgconfig.xml" />
117
118 <refsect1>
119 <title>See Also</title>
120
121 <para>
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>
126 </para>
127 </refsect1>
128
129 </refentry>