]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_message_get_type.xml
Merge pull request #15527 from Werkov/mkosi-opensuse
[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_get_error</refname>
21 <refname>sd_bus_message_get_errno</refname>
22 <refname>sd_bus_message_is_signal</refname>
23 <refname>sd_bus_message_is_method_call</refname>
24 <refname>sd_bus_message_is_method_error</refname>
25
26 <refpurpose>Query bus message addressing metadata</refpurpose>
27 </refnamediv>
28
29 <refsynopsisdiv>
30 <funcsynopsis>
31 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
32
33 <funcprototype>
34 <funcdef>int <function>sd_bus_message_get_type</function></funcdef>
35 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
36 <paramdef>uint8_t *<parameter>type</parameter></paramdef>
37 </funcprototype>
38
39 <funcprototype>
40 <funcdef>sd_bus_error* <function>sd_bus_message_get_error</function></funcdef>
41 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
42 </funcprototype>
43
44 <funcprototype>
45 <funcdef>int <function>sd_bus_message_get_errno</function></funcdef>
46 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
47 </funcprototype>
48
49 <funcprototype>
50 <funcdef>int <function>sd_bus_message_is_signal</function></funcdef>
51 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
52 <paramdef>const char *<parameter>interface</parameter></paramdef>
53 <paramdef>const char *<parameter>member</parameter></paramdef>
54 </funcprototype>
55
56 <funcprototype>
57 <funcdef>int <function>sd_bus_message_is_method_call</function></funcdef>
58 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
59 <paramdef>const char *<parameter>interface</parameter></paramdef>
60 <paramdef>const char *<parameter>member</parameter></paramdef>
61 </funcprototype>
62
63 <funcprototype>
64 <funcdef>int <function>sd_bus_message_is_method_error</function></funcdef>
65 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
66 <paramdef>const char *<parameter>name</parameter></paramdef>
67 </funcprototype>
68 </funcsynopsis>
69
70 </refsynopsisdiv>
71
72 <refsect1>
73 <title>Description</title>
74
75 <para><function>sd_bus_message_get_type()</function> returns the type of a message in the output
76 parameter <parameter>type</parameter>, one of <constant>SD_BUS_MESSAGE_METHOD_CALL</constant>,
77 <constant>SD_BUS_MESSAGE_METHOD_RETURN</constant>, <constant>SD_BUS_MESSAGE_METHOD_ERROR</constant>,
78 <constant>SD_BUS_MESSAGE_SIGNAL</constant>. This type is either specified as a parameter when the message
79 is created using
80 <citerefentry><refentrytitle>sd_bus_set_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
81 or is set automatically when the message is created using
82 <citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
83 <citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
84 <citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>
85 and similar functions.</para>
86
87 <para><function>sd_bus_message_get_error()</function> returns the error stored in the message
88 <parameter>m</parameter>, if there is any. Otherwise, it returns <constant>NULL</constant>.
89 <function>sd_bus_message_get_errno()</function> returns the error stored in the message
90 <parameter>m</parameter> as a positive errno-style value, if there is any. Otherwise, it returns zero.
91 Errors are mapped to errno values according to the default and any additional registered error mappings.
92 See <citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
93 <citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
94 </para>
95
96 <para><function>sd_bus_message_is_signal()</function> checks if message <parameter>m</parameter> is a
97 signal message. If <parameter>interface</parameter> is non-null, it also checks if the message has the
98 same interface set. If <parameter>member</parameter> is non-null, it also checks if the message has the
99 same member set. Also see
100 <citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
101 It returns true when all checks pass.</para>
102
103 <para><function>sd_bus_message_is_method_call()</function> checks if message <parameter>m</parameter>
104 is a method call message. If <parameter>interface</parameter> is non-null, it also checks if the message
105 has the same interface set. If <parameter>member</parameter> is non-null, it also checks if the message
106 has the same member set. Also see
107 <citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
108 It returns true when all checks pass.</para>
109
110 <para><function>sd_bus_message_is_method_error()</function> checks if message <parameter>m</parameter>
111 is an error reply message. If <parameter>name</parameter> is non-null, it also checks if the message has
112 the same error identifier set. Also see
113 <citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
114 It returns true when all checks pass.</para>
115 </refsect1>
116
117 <refsect1>
118 <title>Return Value</title>
119
120 <para>On success, these functions return a non-negative integer. On failure, they return a negative
121 errno-style error code. <function>sd_bus_message_get_errno()</function> always returns a non-negative
122 integer, even on failure.</para>
123
124 <refsect2>
125 <title>Errors</title>
126
127 <para>Returned errors may indicate the following problems:</para>
128
129 <variablelist>
130 <varlistentry>
131 <term><constant>-EINVAL</constant></term>
132
133 <listitem><para>The message parameter <parameter>m</parameter> or an output parameter is
134 <constant>NULL</constant>.</para></listitem>
135 </varlistentry>
136 </variablelist>
137 </refsect2>
138 </refsect1>
139
140 <xi:include href="libsystemd-pkgconfig.xml" />
141
142 <refsect1>
143 <title>See Also</title>
144
145 <para>
146 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
147 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
148 <citerefentry><refentrytitle>sd_bus_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
149 <citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>
152 </para>
153 </refsect1>
154
155 </refentry>