]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: add sd_bus_message_get_type(3)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Jul 2018 12:58:41 +0000 (14:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 2 Aug 2018 13:49:45 +0000 (15:49 +0200)
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.

man/rules/meson.build
man/sd-bus.xml
man/sd_bus_message_get_type.xml [new file with mode: 0644]
man/sd_bus_message_set_destination.xml

index 6f9a04cf61258951a0d39ad77a5ef7034437e470..5be98947a132314e7fcd1847039d416cdbcb7028 100644 (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'],
index 6f58b001c073561329afcf96208b950cf5875084..0e381cc9d8ef3532f91c73b7b1c80ca5a295a886 100644 (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>,
diff --git a/man/sd_bus_message_get_type.xml b/man/sd_bus_message_get_type.xml
new file mode 100644 (file)
index 0000000..6f6b7d0
--- /dev/null
@@ -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>
index 626272b0aa32e9fd3187bd0d2c0cbb1e0d83d262..e8a1206ae8ef2e8bcfcf4024128b68716c3362b9 100644 (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>
 
   <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>
         <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>
       <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>