File: sd_id128_from_string.html

package info (click to toggle)
systemd 215-17
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 49,568 kB
  • sloc: ansic: 192,789; xml: 39,586; sh: 13,002; makefile: 4,700; perl: 1,461; python: 1,355
file content (60 lines) | stat: -rw-r--r-- 5,916 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_id128_to_string</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
    a.headerlink {
      color: #c60f0f;
      font-size: 0.8em;
      padding: 0 4px 0 4px;
      text-decoration: none;
      visibility: hidden;
    }

    a.headerlink:hover {
      background-color: #c60f0f;
      color: white;
    }

    h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
      visibility: visible;
    }
  </style><a href="index.html">Index </a>·
  <a href="systemd.directives.html">Directives </a>·
  <a href="../python-systemd/index.html">Python </a>·
  <a href="../libudev/index.html">libudev </a>·
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 215</span><hr><div class="refentry"><a name="sd_id128_to_string"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_id128_to_string, sd_id128_from_string — Format or parse 128-bit IDs as strings</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-id128.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">char *<b class="fsfunc">sd_id128_to_string</b>(</code></td><td>sd_id128_t <var class="pdparam">id</var>, char <var class="pdparam">s</var>[33]<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_id128_from_string</b>(</code></td><td>const char *<var class="pdparam">s</var>, sd_id128_t *<var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm214171729760"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_id128_to_string()</code>
                formats a 128-bit ID as a character string. It expects
                the ID and a string array capable of storing 33
                characters. The ID will be formatted as 32 lowercase
                hexadecimal digits and be terminated by a
                <code class="constant">NUL</code> byte.</p><p><code class="function">sd_id128_from_string()</code>
                implements the reverse operation: it takes a 33
                character string with 32 hexadecimal digits (either
                lowercase or uppercase, terminated by
                <code class="constant">NUL</code>) and parses them back into a
                128-bit ID returned in
                <em class="parameter"><code>ret</code></em>. Alternatively, this call
                can also parse a 37-character string with a 128-bit ID
                formatted as RFC UUID.</p><p>For more information about the
                "<code class="literal">sd_id128_t</code>" type see
                <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>. Note
                that these calls operate the same way on all
                architectures, i.e. the results do not depend on
                endianness.</p><p>When formatting a 128-bit ID into a string, it is
                often easier to use a format string for
                <a href="printf.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>. This
                is easily done using the
                <code class="function">SD_ID128_FORMAT_STR</code> and
                <code class="function">SD_ID128_FORMAT_VAL()</code> macros. For
                more information see
                <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.</p></div><div class="refsect1"><a name="idm214171795728"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p><code class="function">sd_id128_to_string()</code> always
                succeeds and returns a pointer to the string array
                passed in. <code class="function">sd_id128_from_string</code>
                returns 0 on success, in which case
                <em class="parameter"><code>ret</code></em> is filled in, or a negative
                errno-style error code.</p></div><div class="refsect1"><a name="idm214171792528"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_id128_to_string()</code>
                and <code class="function">sd_id128_from_string()</code> interfaces are
                available as a shared library, which can be compiled and
                linked to with the "<code class="literal">libsystemd</code>" <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
                file.</p></div><div class="refsect1"><a name="idm214171788160"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
                        <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
                        <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>,
                        <a href="printf.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>
                </p></div></div></body></html>