]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_append_basic.xml
man: don't claim systemd-analyze was documented as part of the man-pages project
[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"
12b42c76 3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
effbc8e4
ZJS
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
b975b0d5 8 This file is part of systemd.
effbc8e4 9
b975b0d5 10 Copyright 2014 Zbigniew Jędrzejewski-Szmek
effbc8e4
ZJS
11-->
12
48f69d8f 13<refentry id="sd_bus_message_append_basic">
effbc8e4
ZJS
14
15 <refentryinfo>
16 <title>sd_bus_message_append_basic</title>
17 <productname>systemd</productname>
18
19 <authorgroup>
20 <author>
21 <contrib>A monkey with a typewriter</contrib>
22 <firstname>Zbigniew</firstname>
23 <surname>Jędrzejewski-Szmek</surname>
24 <email>zbyszek@in.waw.pl</email>
25 </author>
26 </authorgroup>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>sd_bus_message_append_basic</refentrytitle>
31 <manvolnum>3</manvolnum>
32 </refmeta>
33
34 <refnamediv>
35 <refname>sd_bus_message_append_basic</refname>
36
e8216945 37 <refpurpose>Attach a single field to a message</refpurpose>
effbc8e4
ZJS
38 </refnamediv>
39
40 <refsynopsisdiv>
41 <funcsynopsis>
42 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
43
44 <funcprototype>
45 <funcdef>int sd_bus_message_append_basic</funcdef>
46 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
47 <paramdef>char <parameter>type</parameter></paramdef>
e8216945 48 <paramdef>const void *<parameter>p</parameter></paramdef>
effbc8e4
ZJS
49 </funcprototype>
50 </funcsynopsis>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
e8216945
LP
56 <para><function>sd_bus_message_append_basic()</function> appends a
57 single field to the message <parameter>m</parameter>. The
58 parameter <parameter>type</parameter> determines how the pointer
effbc8e4 59 <parameter>p</parameter> is interpreted.
e8216945
LP
60 <parameter>type</parameter> must be one of the basic types as
61 defined by the <ulink
62 url="http://dbus.freedesktop.org/doc/dbus-specification.html#basic-types">Basic
63 Types</ulink> section of the D-Bus specification, and listed in
64 the table below.
effbc8e4
ZJS
65 </para>
66
67 <table id='format-specifiers'>
e8216945 68 <title>Item type specifiers</title>
effbc8e4 69
e8216945 70 <tgroup cols='5'>
effbc8e4
ZJS
71 <colspec colname='specifier' />
72 <colspec colname='constant' />
73 <colspec colname='description' />
74 <colspec colname='size' />
e8216945 75 <colspec colname='ctype' />
effbc8e4
ZJS
76 <thead>
77 <row>
78 <entry>Specifier</entry>
79 <entry>Constant</entry>
80 <entry>Description</entry>
81 <entry>Size</entry>
e8216945 82 <entry>Expected C Type</entry>
effbc8e4
ZJS
83 </row>
84 </thead>
85 <tbody>
86 <row>
87 <entry><literal>y</literal></entry>
88 <entry><constant>SD_BUS_TYPE_BYTE</constant></entry>
06b643e7 89 <entry>unsigned integer</entry>
effbc8e4 90 <entry>1 byte</entry>
e8216945 91 <entry>uint8_t</entry>
effbc8e4
ZJS
92 </row>
93
94 <row>
95 <entry><literal>b</literal></entry>
96 <entry><constant>SD_BUS_TYPE_BOOLEAN</constant></entry>
97 <entry>boolean</entry>
98 <entry>4 bytes</entry>
e8216945 99 <entry>int</entry>
effbc8e4
ZJS
100 </row>
101
102 <row>
103 <entry><literal>n</literal></entry>
104 <entry><constant>SD_BUS_TYPE_INT16</constant></entry>
105 <entry>signed integer</entry>
106 <entry>2 bytes</entry>
e8216945 107 <entry>int16_t</entry>
effbc8e4
ZJS
108 </row>
109
110 <row>
111 <entry><literal>q</literal></entry>
112 <entry><constant>SD_BUS_TYPE_UINT16</constant></entry>
113 <entry>unsigned integer</entry>
114 <entry>2 bytes</entry>
e8216945 115 <entry>uint16_t</entry>
effbc8e4
ZJS
116 </row>
117
118 <row>
119 <entry><literal>i</literal></entry>
120 <entry><constant>SD_BUS_TYPE_INT32</constant></entry>
121 <entry>signed integer</entry>
122 <entry>4 bytes</entry>
e8216945 123 <entry>int32_t</entry>
effbc8e4
ZJS
124 </row>
125
126 <row>
127 <entry><literal>u</literal></entry>
128 <entry><constant>SD_BUS_TYPE_UINT32</constant></entry>
129 <entry>unsigned integer</entry>
130 <entry>4 bytes</entry>
e8216945 131 <entry>uint32_t</entry>
effbc8e4
ZJS
132 </row>
133
134 <row>
135 <entry><literal>x</literal></entry>
136 <entry><constant>SD_BUS_TYPE_INT64</constant></entry>
137 <entry>signed integer</entry>
138 <entry>8 bytes</entry>
e8216945 139 <entry>int64_t</entry>
effbc8e4
ZJS
140 </row>
141
142 <row>
143 <entry><literal>t</literal></entry>
144 <entry><constant>SD_BUS_TYPE_UINT64</constant></entry>
145 <entry>unsigned integer</entry>
146 <entry>8 bytes</entry>
e8216945 147 <entry>uint64_t</entry>
effbc8e4
ZJS
148 </row>
149
150 <row>
151 <entry><literal>d</literal></entry>
152 <entry><constant>SD_BUS_TYPE_DOUBLE</constant></entry>
153 <entry>floating-point</entry>
154 <entry>8 bytes</entry>
e8216945 155 <entry>double</entry>
effbc8e4
ZJS
156 </row>
157
158 <row>
159 <entry><literal>s</literal></entry>
160 <entry><constant>SD_BUS_TYPE_STRING</constant></entry>
161 <entry>Unicode string</entry>
162 <entry>variable</entry>
e8216945 163 <entry>char[]</entry>
effbc8e4
ZJS
164 </row>
165
166 <row>
167 <entry><literal>o</literal></entry>
168 <entry><constant>SD_BUS_TYPE_OBJECT_PATH</constant></entry>
169 <entry>object path</entry>
170 <entry>variable</entry>
e8216945 171 <entry>char[]</entry>
effbc8e4
ZJS
172 </row>
173
174 <row>
175 <entry><literal>g</literal></entry>
176 <entry><constant>SD_BUS_TYPE_SIGNATURE</constant></entry>
177 <entry>signature</entry>
178 <entry>variable</entry>
e8216945 179 <entry>char[]</entry>
effbc8e4
ZJS
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>
e8216945 187 <entry>int</entry>
effbc8e4
ZJS
188 </row>
189 </tbody>
190 </tgroup>
191 </table>
192
e8216945
LP
193 <para>The value of the parameter is copied into a memory area held
194 by the message object, stays in the possession of the caller and
195 may hence be freely changed after this call without affecting the
196 bus message it has been added to. If <parameter>type</parameter>
197 is <literal>h</literal> (UNIX file descriptor), the descriptor is
198 duplicated by this call and the passed descriptor stays in
199 possession of the caller.</para>
effbc8e4
ZJS
200
201 <para>For types <literal>s</literal>, <literal>o</literal>, and
202 <literal>g</literal>, the parameter <parameter>p</parameter> is
203 interpreted as a pointer to a <constant>NUL</constant>-terminated
204 character sequence. As a special case, a <constant>NULL</constant>
205 pointer is interpreted as an empty string. The string should be
206 valid Unicode string encoded as UTF-8. In case of the two latter
b8bde116 207 types, the additional requirements for a D-Bus object path or
effbc8e4 208 type signature should be satisfied. Those requirements should be
06b643e7 209 verified by the recipient of the message.
effbc8e4
ZJS
210 </para>
211 </refsect1>
212
213 <refsect1>
214 <title>Return Value</title>
215
216 <para>On success, this call returns 0 or a positive integer. On
217 failure, it returns a negative errno-style error code.</para>
218 </refsect1>
219
220 <refsect1 id='errors'>
221 <title>Errors</title>
222
223 <para>Returned errors may indicate the following problems:</para>
224
225 <variablelist>
226
227 <varlistentry>
8474b70c 228 <term><constant>-EINVAL</constant></term>
effbc8e4
ZJS
229
230 <listitem><para>Specified parameter is invalid.
231 </para></listitem>
232 </varlistentry>
233
234 <varlistentry>
8474b70c 235 <term><constant>-EPERM</constant></term>
effbc8e4
ZJS
236
237 <listitem><para>Message has been sealed.
238 </para></listitem>
239 </varlistentry>
240
241 <varlistentry>
8474b70c 242 <term><constant>-ESTALE</constant></term>
effbc8e4
ZJS
243
244 <listitem><para>Message is in invalid state.
245 </para></listitem>
246 </varlistentry>
247
248 <varlistentry>
8474b70c 249 <term><constant>-ENXIO</constant></term>
effbc8e4
ZJS
250
251 <listitem><para>Message cannot be appended to.
252 </para></listitem>
253 </varlistentry>
254
255 <varlistentry>
8474b70c 256 <term><constant>-ENOMEM</constant></term>
effbc8e4
ZJS
257
258 <listitem><para>Memory allocation failed.</para></listitem>
259 </varlistentry>
260 </variablelist>
261 </refsect1>
262
263 <refsect1>
264 <title>Notes</title>
265
b8bde116 266 <para>The <function>sd_bus_append_basic()</function> function
effbc8e4
ZJS
267 described here is available as a shared library, which can be
268 compiled and linked to with the
5aded369 269 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
effbc8e4
ZJS
270 file.</para>
271 </refsect1>
272
273 <refsect1>
274 <title>See Also</title>
275
276 <para>
277 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
278 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
279 <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
280 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>
281 </para>
282 </refsect1>
283
284</refentry>