man: add sd_bus_message_get_type(3)

sd_bus_message{get_type,is_signal,is_method_call,is_method_error} get one man
page.

sd_bus_message_{set,get}_{destination,path,interface,member,sender} are put in
the second one.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-07-27 14:58:41 +02:00
parent f16a506418
commit 9c9207912e
4 changed files with 207 additions and 9 deletions

View File

@ -213,6 +213,12 @@ manpages = [
'3',
['sd_bus_message_get_realtime_usec', 'sd_bus_message_get_seqnum'],
''],
['sd_bus_message_get_type',
'3',
['sd_bus_message_is_method_call',
'sd_bus_message_is_method_error',
'sd_bus_message_is_signal'],
''],
['sd_bus_message_new',
'3',
['SD_BUS_MESSAGE_METHOD_CALL',
@ -236,7 +242,15 @@ manpages = [
['sd_bus_message_new_signal', '3', [], ''],
['sd_bus_message_read', '3', ['sd_bus_message_readv'], ''],
['sd_bus_message_read_basic', '3', [], ''],
['sd_bus_message_set_destination', '3', ['sd_bus_message_set_sender'], ''],
['sd_bus_message_set_destination',
'3',
['sd_bus_message_get_destination',
'sd_bus_message_get_interface',
'sd_bus_message_get_member',
'sd_bus_message_get_path',
'sd_bus_message_get_sender',
'sd_bus_message_set_sender'],
''],
['sd_bus_negotiate_fds',
'3',
['sd_bus_negotiate_creds', 'sd_bus_negotiate_timestamp'],

View File

@ -60,6 +60,7 @@
<citerefentry><refentrytitle>sd_bus_message_copy</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_cookie</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_type</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,

View File

@ -0,0 +1,129 @@
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
<refentry id="sd_bus_message_get_type" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_bus_message_get_type</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_bus_message_get_type</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_bus_message_get_type</refname>
<refname>sd_bus_message_is_signal</refname>
<refname>sd_bus_message_is_method_call</refname>
<refname>sd_bus_message_is_method_error</refname>
<refpurpose>Query bus message addressing metadata</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_bus_message_get_type</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>uint8_t *<parameter>type</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_signal</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_method_call</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_method_error</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>const char *<parameter>name</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_message_get_type()</function> returns the type of a message in the output
parameter <parameter>type</parameter>, one of <constant>SD_BUS_MESSAGE_METHOD_CALL</constant>,
<constant>SD_BUS_MESSAGE_METHOD_RETURN</constant>,
<constant>SD_BUS_MESSAGE_METHOD_ERROR</constant>, <constant>SD_BUS_MESSAGE_SIGNAL</constant>.
This type is either specified as a parameter when the message is created using
<citerefentry><refentrytitle>sd_bus_set_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
or is set automatically when the message is created using
<citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and similar functions.
</para>
<para><function>sd_bus_message_is_signal()</function> checks if message <parameter>m</parameter>
is a signal message. If <parameter>interface</parameter> is non-null, it also checks if the
message has the same interface set. If <parameter>member</parameter> is non-null, it also checks
if the message has the same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
<para><function>sd_bus_message_is_method_call()</function> checks if message <parameter>m</parameter>
is a method call message. If <parameter>interface</parameter> is non-null, it also checks if the
message has the same interface set. If <parameter>member</parameter> is non-null, it also checks
if the message has the same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
<para><function>sd_bus_message_is_method_error()</function> checks if message <parameter>m</parameter>
is an error reply message. If <parameter>name</parameter> is non-null, it also checks if the
message has the same error identifier set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, those functions return 0 or a positive
integer. On failure, it returns a negative errno-style error code.</para>
</refsect1>
<refsect1>
<title>Errors</title>
<para>Returned errors may indicate the following problems:</para>
<variablelist>
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>The <parameter>message</parameter> parameter or the output parameter are
<constant>NULL</constant>.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -6,7 +6,6 @@
-->
<refentry id="sd_bus_message_set_destination" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_bus_message_set_destination</title>
<productname>systemd</productname>
@ -19,8 +18,14 @@
<refnamediv>
<refname>sd_bus_message_set_destination</refname>
<refname>sd_bus_message_get_destination</refname>
<refname>sd_bus_message_get_path</refname>
<refname>sd_bus_message_get_interface</refname>
<refname>sd_bus_message_get_member</refname>
<refname>sd_bus_message_set_sender</refname>
<refpurpose>Set the destination or sender service name of a bus message</refpurpose>
<refname>sd_bus_message_get_sender</refname>
<refpurpose>Set and query bus message addressing information</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -33,31 +38,77 @@
<paramdef>const char *<parameter>destination</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>const char* <function>sd_bus_message_get_destination</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>const char* <function>sd_bus_message_get_path</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>const char* <function>sd_bus_message_get_interface</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>const char* <function>sd_bus_message_get_member</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_set_sender</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>const char *<parameter>sender</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>const char* <function>sd_bus_message_get_sender</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_message_set_destination()</function> sets the destination service name for the specified bus
message object. The specified name must be a valid unique or well-known service name.</para>
<para><function>sd_bus_message_set_destination()</function> sets the destination service name
for the specified bus message object. The specified name must be a valid unique or well-known
service name.</para>
<para><function>sd_bus_message_get_destination()</function>,
<function>sd_bus_message_get_path()</function>,
<function>sd_bus_message_get_interface()</function>, and
<function>sd_bus_message_get_member()</function> return the destination, path, interface, and
member fields from <parameter>message</parameter> header. The return value will be
<constant>NULL</constant> is <parameter>message</parameter> is <constant>NULL</constant> or the
message is of a type that doesn't use those fields or the message doesn't have them set. See
<citerefentry><refentrytitle>sd_bus_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for more discussion of those values.</para>
<para><function>sd_bus_message_set_sender()</function> sets the sender service name for the specified bus message
object. The specified name must be a valid unique or well-known service name. This function is useful only for
messages to send on direct connections as for connections to bus brokers the broker will fill in the destination
field anyway, and the sender field set by original sender is ignored.</para>
<para><function>sd_bus_message_get_sender()</function> returns the sender field from
<parameter>message</parameter>.</para>
<para>When a string is returned, it is a pointer to internal storage, and may not be modified or
freed. It is only valid as long as the <parameter>message</parameter> remains referenced and
this field hasn't been changed by a different call.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, these calls return 0 or a positive integer. On failure, these calls return a negative errno-style
error code.</para>
<para>On success, these calls return 0 or a positive integer. On failure, these calls return a
negative errno-style error code.</para>
</refsect1>
<refsect1>
@ -69,13 +120,16 @@
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>A specified parameter is invalid.</para></listitem>
<listitem><para>The <parameter>message</parameter> parameter or the output parameter are
<constant>NULL</constant>.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-EPERM</constant></term>
<listitem><para>The message is already sealed.</para></listitem>
<listitem><para>For <function>sd_bus_message_set_destination</function> or
<function>sd_bus_message_set_sender</function>, the message is already
sealed.</para></listitem>
</varlistentry>
<varlistentry>