File: sd_bus_message_append_basic.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 (58 lines) | stat: -rw-r--r-- 8,731 bytes parent folder | download | duplicates (2)
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_message_append_basic</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_bus_message_append_basic"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_bus_message_append_basic — Attach a single part to a message</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-bus.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int sd_bus_message_append_basic(</code></td><td>sd_bus_message *<var class="pdparam">m</var>, </td></tr><tr><td> </td><td>char <var class="pdparam">type</var>, </td></tr><tr><td> </td><td>char void *<var class="pdparam">p</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm214171102672"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_bus_message_append_basic</code> appends a
    single item to the message <em class="parameter"><code>m</code></em>. Parameter
    <em class="parameter"><code>type</code></em> determines how pointer
    <em class="parameter"><code>p</code></em> is interpreted.
    <em class="parameter"><code>type</code></em> must be one of the basic types
    as defined by the

    <a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#basic-types" target="_top">Basic Types</a>
    section of the D-Bus specification, and listed in the table below.
    </p><div class="table"><a name="format-specifiers"></a><p class="title"><b>Table 1. Item format specifiers</b></p><div class="table-contents"><table summary="Item format specifiers" border="1"><colgroup><col class="specifier"><col class="constant"><col class="description"><col class="size"></colgroup><thead><tr><th>Specifier</th><th>Constant</th><th>Description</th><th>Size</th></tr></thead><tbody><tr><td>"<code class="literal">y</code>"</td><td><code class="constant">SD_BUS_TYPE_BYTE</code></td><td>unsigned interger</td><td>1 byte</td></tr><tr><td>"<code class="literal">b</code>"</td><td><code class="constant">SD_BUS_TYPE_BOOLEAN</code></td><td>boolean</td><td>4 bytes</td></tr><tr><td>"<code class="literal">n</code>"</td><td><code class="constant">SD_BUS_TYPE_INT16</code></td><td>signed integer</td><td>2 bytes</td></tr><tr><td>"<code class="literal">q</code>"</td><td><code class="constant">SD_BUS_TYPE_UINT16</code></td><td>unsigned integer</td><td>2 bytes</td></tr><tr><td>"<code class="literal">i</code>"</td><td><code class="constant">SD_BUS_TYPE_INT32</code></td><td>signed integer</td><td>4 bytes</td></tr><tr><td>"<code class="literal">u</code>"</td><td><code class="constant">SD_BUS_TYPE_UINT32</code></td><td>unsigned integer</td><td>4 bytes</td></tr><tr><td>"<code class="literal">x</code>"</td><td><code class="constant">SD_BUS_TYPE_INT64</code></td><td>signed integer</td><td>8 bytes</td></tr><tr><td>"<code class="literal">t</code>"</td><td><code class="constant">SD_BUS_TYPE_UINT64</code></td><td>unsigned integer</td><td>8 bytes</td></tr><tr><td>"<code class="literal">d</code>"</td><td><code class="constant">SD_BUS_TYPE_DOUBLE</code></td><td>floating-point</td><td>8 bytes</td></tr><tr><td>"<code class="literal">s</code>"</td><td><code class="constant">SD_BUS_TYPE_STRING</code></td><td>Unicode string</td><td>variable</td></tr><tr><td>"<code class="literal">o</code>"</td><td><code class="constant">SD_BUS_TYPE_OBJECT_PATH</code></td><td>object path</td><td>variable</td></tr><tr><td>"<code class="literal">g</code>"</td><td><code class="constant">SD_BUS_TYPE_SIGNATURE</code></td><td>signature</td><td>variable</td></tr><tr><td>"<code class="literal">h</code>"</td><td><code class="constant">SD_BUS_TYPE_UNIX_FD</code></td><td>UNIX file descriptor</td><td>4 bytes</td></tr></tbody></table></div></div><br class="table-break"><p>The value of the parameter is copied into the memory area
    containing the message and may be changed after this call. If
    <em class="parameter"><code>type</code></em> is "<code class="literal">h</code>" (UNIX file
    descriptor), it is always "consumed" by this call, and either
    successfully appended to the message or closed.</p><p>For types "<code class="literal">s</code>", "<code class="literal">o</code>", and
    "<code class="literal">g</code>", the parameter <em class="parameter"><code>p</code></em> is
    interpreted as a pointer to a <code class="constant">NUL</code>-terminated
    character sequence. As a special case, a <code class="constant">NULL</code>
    pointer is interpreted as an empty string. The string should be
    valid Unicode string encoded as UTF-8. In case of the two latter
    types, the additional requirements for a D-Bus object path or
    type signature should be satisfied. Those requirements should be
    verified by the recepient of the message.
    </p></div><div class="refsect1"><a name="idm214171395632"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>On success, this call returns 0 or a positive integer. On
    failure, it returns a negative errno-style error code.</p></div><div class="refsect1"><a name="errors"></a><h2 id="Errors">Errors<a class="headerlink" title="Permalink to this headline" href="#Errors">¶</a></h2><p>Returned errors may indicate the following problems:</p><div class="variablelist"><dl class="variablelist"><dt id="-EINVAL"><span class="term"><code class="varname">-EINVAL</code></span><a class="headerlink" title="Permalink to this term" href="#-EINVAL">¶</a></dt><dd><p>Specified parameter is invalid.
        </p></dd><dt id="-EPERM"><span class="term"><code class="varname">-EPERM</code></span><a class="headerlink" title="Permalink to this term" href="#-EPERM">¶</a></dt><dd><p>Message has been sealed.
        </p></dd><dt id="-ESTALE"><span class="term"><code class="varname">-ESTALE</code></span><a class="headerlink" title="Permalink to this term" href="#-ESTALE">¶</a></dt><dd><p>Message is in invalid state.
        </p></dd><dt id="-ENXIO"><span class="term"><code class="varname">-ENXIO</code></span><a class="headerlink" title="Permalink to this term" href="#-ENXIO">¶</a></dt><dd><p>Message cannot be appended to.
        </p></dd><dt id="-ENOMEM"><span class="term"><code class="varname">-ENOMEM</code></span><a class="headerlink" title="Permalink to this term" href="#-ENOMEM">¶</a></dt><dd><p>Memory allocation failed.</p></dd></dl></div></div><div class="refsect1"><a name="idm214169902752"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_bus_append_basic()</code> function
    described here is available as a shared library, which can be
    compiled and linked to with the
    <code class="constant">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="idm214171653984"></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-bus.html"><span class="citerefentry"><span class="refentrytitle">sd-bus</span>(3)</span></a>,
      <a href="sd_bus_message_append.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_append</span>(3)</span></a>,
      <a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html" target="_top">The D-Bus specification</a>
    </p></div></div></body></html>