1SD_BUS_MESSAGE_APPEND_BASICs(d3_)bus_message_append_bSaDs_iBcUS_MESSAGE_APPEND_BASIC(3)
2
3
4

NAME

6       sd_bus_message_append_basic - Attach a single field to a message
7

SYNOPSIS

9       #include <systemd/sd-bus.h>
10
11       int sd_bus_message_append_basic(sd_bus_message *m, char type,
12                                       const void *p);
13

DESCRIPTION

15       sd_bus_message_append_basic() appends a single field to the message m.
16       The parameter type determines how the pointer p is interpreted.  type
17       must be one of the basic types as defined by the Basic Types[1] section
18       of the D-Bus specification, and listed in the table below.
19
20       Table 1. Item type specifiers
21       ┌──────────┬─────────────────────────┬────────────────┬──────────┬────────────┐
22Specifier Constant                Description    Size     Expected C 
23       │          │                         │                │          │ Type       
24       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
25       │"y"       │ SD_BUS_TYPE_BYTE        │ unsigned       │ 1 byte   │ uint8_t    │
26       │          │                         │ integer        │          │            │
27       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
28       │"b"       │ SD_BUS_TYPE_BOOLEAN     │ boolean        │ 4 bytes  │ int        │
29       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
30       │"n"       │ SD_BUS_TYPE_INT16       │ signed         │ 2 bytes  │ int16_t    │
31       │          │                         │ integer        │          │            │
32       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
33       │"q"       │ SD_BUS_TYPE_UINT16      │ unsigned       │ 2 bytes  │ uint16_t   │
34       │          │                         │ integer        │          │            │
35       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
36       │"i"       │ SD_BUS_TYPE_INT32       │ signed         │ 4 bytes  │ int32_t    │
37       │          │                         │ integer        │          │            │
38       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
39       │"u"       │ SD_BUS_TYPE_UINT32      │ unsigned       │ 4 bytes  │ uint32_t   │
40       │          │                         │ integer        │          │            │
41       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
42       │"x"       │ SD_BUS_TYPE_INT64       │ signed         │ 8 bytes  │ int64_t    │
43       │          │                         │ integer        │          │            │
44       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
45       │"t"       │ SD_BUS_TYPE_UINT64      │ unsigned       │ 8 bytes  │ uint64_t   │
46       │          │                         │ integer        │          │            │
47       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
48       │"d"       │ SD_BUS_TYPE_DOUBLE      │ floating-point │ 8 bytes  │ double     │
49       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
50       │"s"       │ SD_BUS_TYPE_STRING      │ Unicode string │ variable │ char[]     │
51       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
52       │"o"       │ SD_BUS_TYPE_OBJECT_PATH │ object path    │ variable │ char[]     │
53       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
54       │"g"       │ SD_BUS_TYPE_SIGNATURE   │ signature      │ variable │ char[]     │
55       ├──────────┼─────────────────────────┼────────────────┼──────────┼────────────┤
56       │"h"       │ SD_BUS_TYPE_UNIX_FD     │ UNIX file      │ 4 bytes  │ int        │
57       │          │                         │ descriptor     │          │            │
58       └──────────┴─────────────────────────┴────────────────┴──────────┴────────────┘
59
60       The value of the parameter is copied into a memory area held by the
61       message object, stays in the possession of the caller and may hence be
62       freely changed after this call without affecting the bus message it has
63       been added to. If type is "h" (UNIX file descriptor), the descriptor is
64       duplicated by this call and the passed descriptor stays in possession
65       of the caller.
66
67       For types "s", "o", and "g", the parameter p is interpreted as a
68       pointer to a NUL-terminated character sequence. As a special case, a
69       NULL pointer is interpreted as an empty string. The string should be
70       valid Unicode string encoded as UTF-8. In case of the two latter types,
71       the additional requirements for a D-Bus object path or type signature
72       should be satisfied. Those requirements should be verified by the
73       recipient of the message.
74

RETURN VALUE

76       On success, this call returns 0 or a positive integer. On failure, it
77       returns a negative errno-style error code.
78
79   Errors
80       Returned errors may indicate the following problems:
81
82       -EINVAL
83           Specified parameter is invalid.
84
85       -EPERM
86           Message has been sealed.
87
88       -ESTALE
89           Message is in invalid state.
90
91       -ENXIO
92           Message cannot be appended to.
93
94       -ENOMEM
95           Memory allocation failed.
96

NOTES

98       Functions described here are available as a shared library, which can
99       be compiled against and linked to with the libsystemd pkg-config(1)
100       file.
101
102       The code described here uses getenv(3), which is declared to be not
103       multi-thread-safe. This means that the code calling the functions
104       described here must not call setenv(3) from a parallel thread. It is
105       recommended to only do calls to setenv() from an early phase of the
106       program when no other threads have been started.
107

SEE ALSO

109       systemd(1), sd-bus(3), sd_bus_message_read_basic(3),
110       sd_bus_message_append(3), The D-Bus specification[2]
111

NOTES

113        1. Basic Types
114           https://dbus.freedesktop.org/doc/dbus-specification.html#basic-types
115
116        2. The D-Bus specification
117           https://dbus.freedesktop.org/doc/dbus-specification.html
118
119
120
121systemd 254                                     SD_BUS_MESSAGE_APPEND_BASIC(3)
Impressum