]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: add sd_bus_set_address(3)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 18 Mar 2020 12:22:29 +0000 (13:22 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 18 Mar 2020 18:57:43 +0000 (19:57 +0100)
man/rules/meson.build
man/sd-bus.xml
man/sd_bus_default.xml
man/sd_bus_set_address.xml [new file with mode: 0644]

index 0be4b9c86ce151dee03c0acffb49ac1cd51d469c..4e04b413e98a20ac4b5bc2600820e3c06758736a 100644 (file)
@@ -330,6 +330,7 @@ manpages = [
    'sd_bus_release_name_async',
    'sd_bus_request_name_async'],
   ''],
+ ['sd_bus_set_address', '3', ['sd_bus_get_address'], ''],
  ['sd_bus_set_close_on_exit', '3', ['sd_bus_get_close_on_exit'], ''],
  ['sd_bus_set_connected_signal', '3', ['sd_bus_get_connected_signal'], ''],
  ['sd_bus_set_description',
index 14fca6ee6b1fa144743e491be1f818fe3789db36..66b022e6ea5014ac3f1b08c230975af09a1ac86c 100644 (file)
@@ -54,6 +54,7 @@
 <citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_get_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_get_n_queued_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@@ -85,6 +86,7 @@
 <citerefentry><refentrytitle>sd_bus_process</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_reply_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
index ca06f8e6f43dac9220be8dd98cad60ff0d0bc65b..a46b1cb4887b7ab4960ea5b436987bf187925e08 100644 (file)
     <para>Note that entering a container is a privileged operation, and will likely only
     work for the root user on the remote machine.</para>
 
-    <para><function>sd_bus_open_system_machine()</function> connects
-    to the system bus in the specified <parameter>machine</parameter>,
-    where <parameter>machine</parameter> is the name of a local
-    container.  See
-    <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-    for more information about the "machine" concept. Note that
-    connections into local containers are only available to privileged
-    processes at this time.</para>
+    <para><function>sd_bus_open_system_machine()</function> connects to the system bus in the specified
+    <parameter>machine</parameter>, where <parameter>machine</parameter> is the name of a local
+    container. See
+    <citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+    for a description of the address syntax, and
+    <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for more
+    information about the "machine" concept. Note that connections into local containers are only available
+    to privileged processes at this time.</para>
 
     <para>These calls allocate a bus connection object and initiate
     the connection to a well-known bus of some form. An alternative to
diff --git a/man/sd_bus_set_address.xml b/man/sd_bus_set_address.xml
new file mode 100644 (file)
index 0000000..b022741
--- /dev/null
@@ -0,0 +1,176 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_set_address"
+          xmlns:xi="http://www.w3.org/2001/XInclude">
+
+  <refentryinfo>
+    <title>sd_bus_set_address</title>
+    <productname>systemd</productname>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>sd_bus_set_address</refentrytitle>
+    <manvolnum>3</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>sd_bus_set_address</refname>
+    <refname>sd_bus_get_address</refname>
+
+    <refpurpose>Set or query the address of the bus connection</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <funcsynopsis>
+      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+      <funcprototype>
+        <funcdef>int <function>sd_bus_set_address</function></funcdef>
+        <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+        <paramdef>const char* <parameter>address</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_bus_get_address</function></funcdef>
+        <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+        <paramdef>const char** <parameter>address</parameter></paramdef>
+      </funcprototype>
+
+    </funcsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para><function>sd_bus_set_address()</function> configures a list of addresses of bus brokers to try to
+    connect to from a subsequent
+    <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> call.
+    The argument is a <literal>;</literal>-separated list of addresses to try. Each item must be one of the
+    following:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>A unix socket address specified as
+        <literal>unix:guid=<replaceable>guid</replaceable>,path=<replaceable>path</replaceable></literal> or
+        <literal>unix:guid=<replaceable>guid</replaceable>,abstract=<replaceable>path</replaceable></literal>.
+        Exactly one of the <varname>path=</varname> and <varname>abstract=</varname> keys must be present,
+        while <varname>guid=</varname> is optional.</para>
+      </listitem>
+
+      <listitem>
+        <para>A TCP socket address specified as
+        <literal>tcp:[guid=<replaceable>guid</replaceable>,][host=<replaceable>host</replaceable>][,port=<replaceable>port</replaceable>][,family=<replaceable>family</replaceable>]</literal>.
+        One or both of the <varname>host=</varname> and <varname>port=</varname> keys must be present, while
+        the rest is optional. <replaceable>family</replaceable> may be either <option>ipv4</option> or
+        <option>ipv6</option>.</para>
+      </listitem>
+      
+      <listitem>
+        <para>An executable to spawn specified as
+        <literal>unixexec:guid=<replaceable>guid</replaceable>,path=<replaceable>path</replaceable>,argv1=<replaceable>argument</replaceable>,argv2=<replaceable>argument</replaceable>,...</literal>.
+        The <varname>path=</varname> key must be present, while <varname>guid=</varname> is optional.</para>
+      </listitem>
+      
+      <listitem>
+        <para>A machine (container) to connect to specified as
+        <literal>x-machine-unix:guid=<replaceable>guid</replaceable>,machine=<replaceable>machine</replaceable>,pid=<replaceable>pid</replaceable></literal>.
+        Exactly one of the <varname>machine=</varname> and <varname>pid=</varname> keys must be present,
+        while <varname>guid=</varname> is optional. <parameter>machine</parameter> is the name of a local
+        container. See
+        <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
+        more information about the "machine" concept. <literal>machine=.host</literal> may be used to specify
+        the host machine. A connection to the standard system bus socket inside of the specified machine will
+        be created.</para>
+      </listitem>
+    </itemizedlist>
+
+    <para>In all cases, parameter <parameter>guid</parameter> is an identifier of the remote peer, in the
+    syntax accepted by
+    <citerefentry><refentrytitle>sd_id128_from_string</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+    If specified, the identifier returned by the peer after the connection is established will be checked and
+    the connection will be rejected in case of a mismatch.</para>
+
+    <para>Note that the addresses passed to <function>sd_bus_set_address()</function> may not be verified
+    immediately. If they are invalid, an error may be returned e.g. from a subsequent call to
+    <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+    </para>
+
+    <para><function>sd_bus_get_address()</function> returns any previously set addresses. In addition to
+    being explicitly set by <function>sd_bus_set_address()</function>, the address will also be set
+    automatically by
+    <citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
+    similar calls, based on environment variables or built-in defaults.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>Return Value</title>
+
+    <para>On success, these functions return a non-negative integer. On failure, they return a negative
+    errno-style error code.</para>
+
+    <refsect2>
+      <title>Errors</title>
+
+      <para>Returned errors may indicate the following problems:</para>
+
+      <variablelist>
+        <varlistentry>
+          <term><constant>-EINVAL</constant></term>
+
+          <listitem><para>The input parameters <parameter>bus</parameter> or <parameter>address</parameter> are <constant>NULL</constant>.
+          </para></listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><constant>-ENOPKG</constant></term>
+
+          <listitem><para>The bus object <parameter>bus</parameter> could not be resolved.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><constant>-EPERM</constant></term>
+
+          <listitem><para>The input parameter <parameter>bus</parameter> is in a wrong state
+          (<function>sd_bus_set_address()</function> may only be called once on a newly-created bus object).</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><constant>-ECHILD</constant></term>
+
+          <listitem><para>The bus object <parameter>bus</parameter> was created in a different
+          process.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><constant>-ENODATA</constant></term>
+
+          <listitem><para>The bus object <parameter>bus</parameter> has no address configured.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </refsect2>
+  </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_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+
+</refentry>