]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_append_basic.xml
Merge pull request #288 from phomes/cgroup-util
[thirdparty/systemd.git] / man / sd_bus_message_append_basic.xml
CommitLineData
3802a3d3 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
effbc8e4 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
681eb9cf
FB
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
effbc8e4
ZJS
7
8<!--
b975b0d5 9 This file is part of systemd.
effbc8e4 10
b975b0d5 11 Copyright 2014 Zbigniew Jędrzejewski-Szmek
effbc8e4 12
b975b0d5
ZJS
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
effbc8e4 17
b975b0d5
ZJS
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
effbc8e4 22
b975b0d5
ZJS
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
effbc8e4
ZJS
25-->
26
48f69d8f 27<refentry id="sd_bus_message_append_basic">
effbc8e4
ZJS
28
29 <refentryinfo>
30 <title>sd_bus_message_append_basic</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>A monkey with a typewriter</contrib>
36 <firstname>Zbigniew</firstname>
37 <surname>Jędrzejewski-Szmek</surname>
38 <email>zbyszek@in.waw.pl</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>sd_bus_message_append_basic</refentrytitle>
45 <manvolnum>3</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>sd_bus_message_append_basic</refname>
50
51 <refpurpose>Attach a single part to a message</refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <funcsynopsis>
56 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
57
58 <funcprototype>
59 <funcdef>int sd_bus_message_append_basic</funcdef>
60 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
61 <paramdef>char <parameter>type</parameter></paramdef>
62 <paramdef>char void *<parameter>p</parameter></paramdef>
63 </funcprototype>
64 </funcsynopsis>
65 </refsynopsisdiv>
66
67 <refsect1>
68 <title>Description</title>
69
70 <para><function>sd_bus_message_append_basic</function> appends a
71 single item to the message <parameter>m</parameter>. Parameter
72 <parameter>type</parameter> determines how pointer
73 <parameter>p</parameter> is interpreted.
74 <parameter>type</parameter> must be one of the basic types
75 as defined by the
76
77 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html#basic-types">Basic Types</ulink>
78 section of the D-Bus specification, and listed in the table below.
79 </para>
80
81 <table id='format-specifiers'>
82 <title>Item format specifiers</title>
83
84 <tgroup cols='4'>
85 <colspec colname='specifier' />
86 <colspec colname='constant' />
87 <colspec colname='description' />
88 <colspec colname='size' />
89 <thead>
90 <row>
91 <entry>Specifier</entry>
92 <entry>Constant</entry>
93 <entry>Description</entry>
94 <entry>Size</entry>
95 </row>
96 </thead>
97 <tbody>
98 <row>
99 <entry><literal>y</literal></entry>
100 <entry><constant>SD_BUS_TYPE_BYTE</constant></entry>
06b643e7 101 <entry>unsigned integer</entry>
effbc8e4
ZJS
102 <entry>1 byte</entry>
103 </row>
104
105 <row>
106 <entry><literal>b</literal></entry>
107 <entry><constant>SD_BUS_TYPE_BOOLEAN</constant></entry>
108 <entry>boolean</entry>
109 <entry>4 bytes</entry>
110 </row>
111
112 <row>
113 <entry><literal>n</literal></entry>
114 <entry><constant>SD_BUS_TYPE_INT16</constant></entry>
115 <entry>signed integer</entry>
116 <entry>2 bytes</entry>
117 </row>
118
119 <row>
120 <entry><literal>q</literal></entry>
121 <entry><constant>SD_BUS_TYPE_UINT16</constant></entry>
122 <entry>unsigned integer</entry>
123 <entry>2 bytes</entry>
124 </row>
125
126 <row>
127 <entry><literal>i</literal></entry>
128 <entry><constant>SD_BUS_TYPE_INT32</constant></entry>
129 <entry>signed integer</entry>
130 <entry>4 bytes</entry>
131 </row>
132
133 <row>
134 <entry><literal>u</literal></entry>
135 <entry><constant>SD_BUS_TYPE_UINT32</constant></entry>
136 <entry>unsigned integer</entry>
137 <entry>4 bytes</entry>
138 </row>
139
140 <row>
141 <entry><literal>x</literal></entry>
142 <entry><constant>SD_BUS_TYPE_INT64</constant></entry>
143 <entry>signed integer</entry>
144 <entry>8 bytes</entry>
145 </row>
146
147 <row>
148 <entry><literal>t</literal></entry>
149 <entry><constant>SD_BUS_TYPE_UINT64</constant></entry>
150 <entry>unsigned integer</entry>
151 <entry>8 bytes</entry>
152 </row>
153
154 <row>
155 <entry><literal>d</literal></entry>
156 <entry><constant>SD_BUS_TYPE_DOUBLE</constant></entry>
157 <entry>floating-point</entry>
158 <entry>8 bytes</entry>
159 </row>
160
161 <row>
162 <entry><literal>s</literal></entry>
163 <entry><constant>SD_BUS_TYPE_STRING</constant></entry>
164 <entry>Unicode string</entry>
165 <entry>variable</entry>
166 </row>
167
168 <row>
169 <entry><literal>o</literal></entry>
170 <entry><constant>SD_BUS_TYPE_OBJECT_PATH</constant></entry>
171 <entry>object path</entry>
172 <entry>variable</entry>
173 </row>
174
175 <row>
176 <entry><literal>g</literal></entry>
177 <entry><constant>SD_BUS_TYPE_SIGNATURE</constant></entry>
178 <entry>signature</entry>
179 <entry>variable</entry>
180 </row>
181
182 <row>
183 <entry><literal>h</literal></entry>
184 <entry><constant>SD_BUS_TYPE_UNIX_FD</constant></entry>
185 <entry>UNIX file descriptor</entry>
186 <entry>4 bytes</entry>
187 </row>
188 </tbody>
189 </tgroup>
190 </table>
191
192 <para>The value of the parameter is copied into the memory area
193 containing the message and may be changed after this call. If
194 <parameter>type</parameter> is <literal>h</literal> (UNIX file
195 descriptor), it is always "consumed" by this call, and either
196 successfully appended to the message or closed.</para>
197
198 <para>For types <literal>s</literal>, <literal>o</literal>, and
199 <literal>g</literal>, the parameter <parameter>p</parameter> is
200 interpreted as a pointer to a <constant>NUL</constant>-terminated
201 character sequence. As a special case, a <constant>NULL</constant>
202 pointer is interpreted as an empty string. The string should be
203 valid Unicode string encoded as UTF-8. In case of the two latter
b8bde116 204 types, the additional requirements for a D-Bus object path or
effbc8e4 205 type signature should be satisfied. Those requirements should be
06b643e7 206 verified by the recipient of the message.
effbc8e4
ZJS
207 </para>
208 </refsect1>
209
210 <refsect1>
211 <title>Return Value</title>
212
213 <para>On success, this call returns 0 or a positive integer. On
214 failure, it returns a negative errno-style error code.</para>
215 </refsect1>
216
217 <refsect1 id='errors'>
218 <title>Errors</title>
219
220 <para>Returned errors may indicate the following problems:</para>
221
222 <variablelist>
223
224 <varlistentry>
8474b70c 225 <term><constant>-EINVAL</constant></term>
effbc8e4
ZJS
226
227 <listitem><para>Specified parameter is invalid.
228 </para></listitem>
229 </varlistentry>
230
231 <varlistentry>
8474b70c 232 <term><constant>-EPERM</constant></term>
effbc8e4
ZJS
233
234 <listitem><para>Message has been sealed.
235 </para></listitem>
236 </varlistentry>
237
238 <varlistentry>
8474b70c 239 <term><constant>-ESTALE</constant></term>
effbc8e4
ZJS
240
241 <listitem><para>Message is in invalid state.
242 </para></listitem>
243 </varlistentry>
244
245 <varlistentry>
8474b70c 246 <term><constant>-ENXIO</constant></term>
effbc8e4
ZJS
247
248 <listitem><para>Message cannot be appended to.
249 </para></listitem>
250 </varlistentry>
251
252 <varlistentry>
8474b70c 253 <term><constant>-ENOMEM</constant></term>
effbc8e4
ZJS
254
255 <listitem><para>Memory allocation failed.</para></listitem>
256 </varlistentry>
257 </variablelist>
258 </refsect1>
259
260 <refsect1>
261 <title>Notes</title>
262
b8bde116 263 <para>The <function>sd_bus_append_basic()</function> function
effbc8e4
ZJS
264 described here is available as a shared library, which can be
265 compiled and linked to with the
5aded369 266 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
effbc8e4
ZJS
267 file.</para>
268 </refsect1>
269
270 <refsect1>
271 <title>See Also</title>
272
273 <para>
274 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
275 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
276 <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
277 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>
278 </para>
279 </refsect1>
280
281</refentry>