chiark / gitweb /
tree-wide: remove Lennart's copyright lines
[elogind.git] / man / sd_id128_to_string.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="sd_id128_to_string" xmlns:xi="http://www.w3.org/2001/XInclude">
10
11   <refentryinfo>
12     <title>sd_id128_to_string</title>
13     <productname>elogind</productname>
14
15     <authorgroup>
16       <author>
17         <contrib>Developer</contrib>
18         <firstname>Lennart</firstname>
19         <surname>Poettering</surname>
20         <email>lennart@poettering.net</email>
21       </author>
22     </authorgroup>
23   </refentryinfo>
24
25   <refmeta>
26     <refentrytitle>sd_id128_to_string</refentrytitle>
27     <manvolnum>3</manvolnum>
28   </refmeta>
29
30   <refnamediv>
31     <refname>sd_id128_to_string</refname>
32     <refname>sd_id128_from_string</refname>
33     <refpurpose>Format or parse 128-bit IDs as strings</refpurpose>
34   </refnamediv>
35
36   <refsynopsisdiv>
37     <funcsynopsis>
38       <funcsynopsisinfo>#include &lt;elogind/sd-id128.h&gt;</funcsynopsisinfo>
39
40       <funcprototype>
41         <funcdef>char *<function>sd_id128_to_string</function></funcdef>
42         <paramdef>sd_id128_t <parameter>id</parameter>, char <parameter>s</parameter>[33]</paramdef>
43       </funcprototype>
44
45       <funcprototype>
46         <funcdef>int <function>sd_id128_from_string</function></funcdef>
47         <paramdef>const char *<parameter>s</parameter>, sd_id128_t *<parameter>ret</parameter></paramdef>
48       </funcprototype>
49
50     </funcsynopsis>
51   </refsynopsisdiv>
52
53   <refsect1>
54     <title>Description</title>
55
56     <para><function>sd_id128_to_string()</function> formats a 128-bit
57     ID as a character string. It expects the ID and a string array
58     capable of storing 33 characters. The ID will be formatted as 32
59     lowercase hexadecimal digits and be terminated by a
60     <constant>NUL</constant> byte.</para>
61
62     <para><function>sd_id128_from_string()</function> implements the reverse operation: it takes a 33 character string
63     with 32 hexadecimal digits (either lowercase or uppercase, terminated by <constant>NUL</constant>) and parses them
64     back into a 128-bit ID returned in <parameter>ret</parameter>. Alternatively, this call can also parse a
65     37-character string with a 128-bit ID formatted as RFC UUID. If <parameter>ret</parameter> is passed as NULL the
66     function will validate the passed ID string, but not actually return it in parsed form.</para>
67
68     <para>For more information about the <literal>sd_id128_t</literal>
69     type see
70     <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
71     Note that these calls operate the same way on all architectures,
72     i.e. the results do not depend on endianness.</para>
73
74     <para>When formatting a 128-bit ID into a string, it is often
75     easier to use a format string for
76     <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
77     This is easily done using the
78     <function>SD_ID128_FORMAT_STR</function> and
79     <function>SD_ID128_FORMAT_VAL()</function> macros. For more
80     information see
81     <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
82   </refsect1>
83
84   <refsect1>
85     <title>Return Value</title>
86
87     <para><function>sd_id128_to_string()</function> always succeeds
88     and returns a pointer to the string array passed in.
89     <function>sd_id128_from_string</function> returns 0 on success, in
90     which case <parameter>ret</parameter> is filled in, or a negative
91     errno-style error code.</para>
92   </refsect1>
93
94   <xi:include href="libelogind-pkgconfig.xml" />
95
96   <refsect1>
97     <title>See Also</title>
98
99     <para>
100       <!-- 0 /// elogind is in section 8
101       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
102       --><!-- else -->
103       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
104       <!-- // 0 -->
105       <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
106       <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>
107     </para>
108   </refsect1>
109
110 </refentry>