table of contents
- buster 241-7~deb10u7
- buster-backports 247.3-6~bpo10+1
- testing 247.3-6
- unstable 247.3-6
- experimental 249.3-3
SD_BUS_MESSAGE_READ_BASIC(3) | sd_bus_message_read_basic | SD_BUS_MESSAGE_READ_BASIC(3) |
NAME¶
sd_bus_message_read_basic - Read a basic type from a messageSYNOPSIS¶
#include <systemd/sd-bus.h>
int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p);
DESCRIPTION¶
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 type are described in the D-Bus Specification[1].If p is not NULL, it should contain a pointer to an appropriate object. For example, if type is 'y', the object passed in p should have type uint8_t *. If type is 's', the object passed in p 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 messages lifetime. Similarly, during the lifetime of such a pointer, the message must not be modified. See the table below for a complete list of allowed types.
Table 1. Item type specifiers
Specifier | Constant | Description | Expected C Type |
"y" | SD_BUS_TYPE_BYTE | unsigned integer | uint8_t * |
"b" | SD_BUS_TYPE_BOOLEAN | boolean | int * |
"n" | SD_BUS_TYPE_INT16 | signed integer | int16_t * |
"q" | SD_BUS_TYPE_UINT16 | unsigned integer | uint16_t * |
"i" | SD_BUS_TYPE_INT32 | signed integer | int32_t * |
"u" | SD_BUS_TYPE_UINT32 | unsigned integer | uint32_t * |
"x" | SD_BUS_TYPE_INT64 | signed integer | int64_t * |
"t" | SD_BUS_TYPE_UINT64 | unsigned integer | uint64_t * |
"d" | SD_BUS_TYPE_DOUBLE | floating-point | double * |
"s" | SD_BUS_TYPE_STRING | Unicode string | const char ** |
"o" | SD_BUS_TYPE_OBJECT_PATH | object path | const char ** |
"g" | SD_BUS_TYPE_SIGNATURE | signature | const char ** |
"h" | SD_BUS_TYPE_UNIX_FD | UNIX file descriptor | int * |
If there is no object of the specified type at the current
position in the message, an error is returned.
RETURN VALUE¶
On success, sd_bus_message_read_basic() returns 0 or a positive integer. On failure, it returns a negative errno-style error code.ERRORS¶
Returned errors may indicate the following problems:-EINVAL
-ENXIO
-EBADMSG
SEE ALSO¶
systemd(1), sd-bus(3), sd_bus_message_append_basic(3), sd_bus_message_skip(3), sd_bus_message_read(3)NOTES¶
- 1.
- D-Bus Specification
systemd 241 |