| 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.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd-varlink" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>sd-varlink</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>sd-varlink</refentrytitle> |
| 16 |
<manvolnum>3</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>sd-varlink</refname> |
| 21 |
<refpurpose>APIs for Varlink IPC</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<funcsynopsis> |
| 26 |
<funcsynopsisinfo>#include <systemd/sd-varlink.h></funcsynopsisinfo> |
| 27 |
</funcsynopsis> |
| 28 |
|
| 29 |
<cmdsynopsis> |
| 30 |
<command>pkg-config --cflags --libs libsystemd</command> |
| 31 |
</cmdsynopsis> |
| 32 |
</refsynopsisdiv> |
| 33 |
|
| 34 |
<refsect1> |
| 35 |
<title>Description</title> |
| 36 |
|
| 37 |
<para><filename>sd-varlink.h</filename> is part of |
| 38 |
<citerefentry><refentrytitle>libsystemd</refentrytitle><manvolnum>3</manvolnum></citerefentry> and |
| 39 |
provides APIs for implementing Varlink IPC clients and services. See <ulink url="https://varlink.org/"/> |
| 40 |
for more information about Varlink IPC.</para> |
| 41 |
|
| 42 |
<para>Varlink IPC uses <ulink url="https://json.org/">JSON</ulink> as marshalling format. The sd-varlink |
| 43 |
API relies on the |
| 44 |
<citerefentry><refentrytitle>sd-json</refentrytitle><manvolnum>3</manvolnum></citerefentry> API for JSON |
| 45 |
serialization, deserialization and manipulation.</para> |
| 46 |
|
| 47 |
<para>Canonical encoding rules: sd-varlink omits the <literal>"parameters"</literal> member on the wire in replies, |
| 48 |
errors, and notifications when there are no parameters to transmit. This reduces message size and |
| 49 |
avoids ambiguity. Receivers must be tolerant and accept any of the following encodings for the |
| 50 |
absence of parameters: an omitted <literal>"parameters"</literal> key (preferred), a JSON <literal>null</literal> |
| 51 |
value, or an empty object <literal>{}</literal>. When decoding, sd-varlink treats JSON <literal>null</literal> |
| 52 |
as if the member was omitted.</para> |
| 53 |
|
| 54 |
<para>The <citerefentry><refentrytitle>varlinkctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> tool |
| 55 |
makes the functionality implemented by sd-varlink available from the command line.</para> |
| 56 |
</refsect1> |
| 57 |
|
| 58 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 59 |
|
| 60 |
<refsect1> |
| 61 |
<title>Directories</title> |
| 62 |
|
| 63 |
<variablelist> |
| 64 |
<varlistentry> |
| 65 |
<term><filename>/usr/lib/systemd/varlink-bridges/</filename></term> |
| 66 |
<listitem> |
| 67 |
<para>When <function>sd_varlink_connect_url()</function> encounters a URL with a scheme that is not |
| 68 |
natively supported, it looks for a bridge helper binary named after the URL scheme in this |
| 69 |
directory. The binary is invoked the same way as <literal>exec:</literal> binaries but with the full |
| 70 |
URL passed as the first command line argument.</para> |
| 71 |
|
| 72 |
<para>For example, if |
| 73 |
<command>varlinkctl introspect https://example.com/ws/sockets/io.systemd.Hostname</command> |
| 74 |
is called, <command>varlinkctl</command> will look for an executable |
| 75 |
<filename>/usr/lib/systemd/varlink-bridges/https</filename> and invoke it with |
| 76 |
<literal>https://example.com/ws/sockets/io.systemd.Hostname</literal> as its only |
| 77 |
argument.</para> |
| 78 |
</listitem> |
| 79 |
</varlistentry> |
| 80 |
</variablelist> |
| 81 |
</refsect1> |
| 82 |
|
| 83 |
<refsect1> |
| 84 |
<title>See Also</title> |
| 85 |
<para><simplelist type="inline"> |
| 86 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 87 |
<member><citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 88 |
<member><citerefentry><refentrytitle>sd-json</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 89 |
<member><citerefentry><refentrytitle>varlinkctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 90 |
<member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 91 |
<member><citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 92 |
</simplelist></para> |
| 93 |
</refsect1> |
| 94 |
</refentry> |