1SD_BUS_SET_PROPERTY(3) sd_bus_set_property SD_BUS_SET_PROPERTY(3)
2
3
4
6 sd_bus_set_property, sd_bus_set_propertyv, sd_bus_get_property,
7 sd_bus_get_property_trivial, sd_bus_get_property_string,
8 sd_bus_get_property_strv - Set or query D-Bus service properties
9
11 #include <systemd/sd-bus.h>
12
13 int sd_bus_set_property(sd_bus *bus, const char *destination,
14 const char *path, const char *interface,
15 const char *member, sd_bus_error *ret_error,
16 sd_bus_message **reply, const char *type, ...);
17
18 int sd_bus_set_propertyv(sd_bus *bus, const char *destination,
19 const char *path, const char *interface,
20 const char *member, sd_bus_error *ret_error,
21 sd_bus_message **reply, const char *type,
22 va_list ap);
23
24 int sd_bus_get_property(sd_bus *bus, const char *destination,
25 const char *path, const char *interface,
26 const char *member, sd_bus_error *ret_error,
27 sd_bus_message **reply, const char *type);
28
29 int sd_bus_get_property_trivial(sd_bus *bus, const char *destination,
30 const char *path,
31 const char *interface,
32 const char *member,
33 sd_bus_error *ret_error, char type,
34 void *ret_ptr);
35
36 int sd_bus_get_property_string(sd_bus *bus, const char *destination,
37 const char *path, const char *interface,
38 const char *member,
39 sd_bus_error *ret_error, char **ret);
40
41 int sd_bus_get_property_strv(sd_bus *bus, const char *destination,
42 const char *path, const char *interface,
43 const char *member,
44 sd_bus_error *ret_error, char ***ret);
45
47 These functions set or query D-Bus properties. D-Bus properties are
48 service fields exposed via the org.freedesktop.DBus.Properties
49 interface. Under the hood, these functions call methods of the
50 org.freedesktop.DBus.Properties interface and as a result their
51 semantics are similar to sd_bus_call_method(3).
52
53 sd_bus_set_property() sets a D-Bus property. On success, the response
54 is stored in reply. If setting the property fails or an internal error
55 occurs, an error is returned and an extended description of the error
56 is optionally stored in ret_error if it is not NULL. type and the
57 arguments that follow it describe the new value of the property and
58 must follow the format described in sd_bus_message_append(3).
59
60 sd_bus_set_propertyv() is equivalent to sd_bus_set_property(), except
61 that it is called with a "va_list" instead of a variable number of
62 arguments.
63
64 sd_bus_get_property() queries a D-Bus property. If retrieving the
65 property fails or an internal error occurs, an error is returned and an
66 extended description of the error is optionally stored in ret_error if
67 it is not NULL. On success, the property is stored in reply. type
68 describes the property type and must follow the format described in
69 sd_bus_message_append(3).
70
71 sd_bus_get_property_trivial(), sd_bus_get_property_string() and
72 sd_bus_get_property_strv() are shorthands for sd_bus_get_property()
73 that are used to query basic, string and string vector properties
74 respectively. The caller is responsible for freeing the string and
75 string vector results stored in ret by sd_bus_get_property_string() and
76 sd_bus_get_property_strv().
77
79 On success, these functions return a non-negative integer. On failure,
80 they return a negative errno-style error code.
81
82 Errors
83 See the sd_bus_call_method(3) man page for a list of possible errors.
84
86 These APIs are implemented as a shared library, which can be compiled
87 and linked to with the libsystemd pkg-config(1) file.
88
90 systemd(1), sd-bus(3), sd_bus_call_method(3)
91
92
93
94systemd 248 SD_BUS_SET_PROPERTY(3)