sd_bus_message_read_basic — Read a basic type from a message
sd_bus_message_read_basic() reads a basic type from a
message and advances the read position in the message. The set of basic
types and their ascii codes passed in
described in the D-Bus
p is not
NULL, it should contain a pointer to an
appropriate object. For example, if
'y', the object
p should have type uint8_t *. If
's', the object passed in
should have type const char **. Note that, if the basic type is a pointer (e.g.,
const char * in the case of a string), the pointer is only borrowed and the contents must
be copied if they are to be used after the end of the message's lifetime. Similarly, during the
lifetime of such a pointer, the message must not be modified. If
'h' (UNIX file descriptor), the descriptor is not duplicated by this call and the
returned descriptor remains in possession of the message object, and needs to be duplicated by the
caller in order to keep an open reference to it after the message object is freed (for example by
fcntl(fd, FD_DUPFD_CLOEXEC, 3)"). See the table below for a complete list of
Table 1. Item type specifiers
|Specifier||Constant||Description||Expected C Type|
|"||8-bit unsigned integer||uint8_t *|
|"||boolean||int * (NB: not bool *)|
|"||16-bit signed integer||int16_t *|
|"||16-bit unsigned integer||uint16_t *|
|"||32-bit signed integer||int32_t *|
|"||32-bit unsigned integer||uint32_t *|
|"||64-bit signed integer||int64_t *|
|"||64-bit unsigned integer||uint64_t *|
|"||IEEE 754 double precision floating-point||double *|
|"||UTF-8 string||const char **|
|"||D-Bus object path string||const char **|
|"||D-Bus signature string||const char **|
|"||UNIX file descriptor||int *|
If there is no object of the specified type at the current position in the message, an error is returned.
sd_bus_message_read_basic() returns a positive integer.
If the end of the currently opened array has been reached, it returns 0.
On failure, it returns a negative errno-style error code.
sd_bus_message_read_basic() was added in version 231.