blob: 686833bd7fd1455fc96eaeb9c7105d34c1801c9c [file] [log] [blame]
Patrick Williams9d3ec7f2016-09-27 20:30:58 -05001#include <systemd/sd-bus.h>
2
Lei YUd35c8522019-12-13 14:48:03 +08003#define UNUSED(x) (void)(x)
4
5int test_handler(sd_bus_message* m, void* userdata, sd_bus_error* ret_error)
6{
7 UNUSED(m);
8 UNUSED(userdata);
9 UNUSED(ret_error);
10 return 0;
11}
12int test_get(sd_bus* bus, const char* path, const char* interface,
13 const char* property, sd_bus_message* reply, void* userdata,
14 sd_bus_error* ret_error)
15{
16 UNUSED(bus);
17 UNUSED(path);
18 UNUSED(interface);
19 UNUSED(property);
20 UNUSED(reply);
21 UNUSED(userdata);
22 UNUSED(ret_error);
23 return 0;
24}
25int test_set(sd_bus* bus, const char* path, const char* interface,
26 const char* property, sd_bus_message* value, void* userdata,
27 sd_bus_error* ret_error)
28{
29 UNUSED(bus);
30 UNUSED(path);
31 UNUSED(interface);
32 UNUSED(property);
33 UNUSED(value);
34 UNUSED(userdata);
35 UNUSED(ret_error);
36 return 0;
37}
38
39typedef int (*sd_bus_message_handler_t)(sd_bus_message* m, void* userdata,
40 sd_bus_error* ret_error);
Andrew Geissler072da3e2018-01-18 07:21:42 -080041const sd_bus_vtable example2[] = {
42 SD_BUS_VTABLE_START(0),
Lei YUd35c8522019-12-13 14:48:03 +080043 SD_BUS_METHOD("1", "2", "3", &test_handler, 0),
44 SD_BUS_SIGNAL("5", "6", 0),
45 SD_BUS_PROPERTY("7", "8", &test_get, 0, SD_BUS_VTABLE_PROPERTY_CONST),
46 SD_BUS_WRITABLE_PROPERTY("10", "11", &test_get, &test_set, 0, 0),
Ed Tanousda48d202023-03-08 09:49:55 -080047 SD_BUS_PROPERTY("14", "15", &test_get, 16, 0),
Andrew Geissler072da3e2018-01-18 07:21:42 -080048 SD_BUS_VTABLE_END,
49};
Patrick Williams9d3ec7f2016-09-27 20:30:58 -050050
51const size_t example2_size = sizeof(example2);