Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */
2 :
3 : /* This is meant to be included in other files, hence no headers */
4 :
5 : struct context {
6 : bool quit;
7 : char *something;
8 : char *automatic_string_property;
9 : uint32_t automatic_integer_property;
10 : };
11 :
12 0 : static int handler(sd_bus_message *m, void *userdata, sd_bus_error *error) {
13 0 : return 1;
14 : }
15 :
16 0 : static int value_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
17 0 : return 1;
18 : }
19 :
20 0 : static int get_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
21 0 : return 1;
22 : }
23 :
24 0 : static int set_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error) {
25 0 : return 1;
26 : }
27 :
28 : static const sd_bus_vtable test_vtable_1[] = {
29 : SD_BUS_VTABLE_START(0),
30 : SD_BUS_METHOD("Hello", "ssas", "a(uu)", NULL, 0),
31 : SD_BUS_METHOD("DeprecatedHello", "", "", NULL, SD_BUS_VTABLE_DEPRECATED),
32 : SD_BUS_METHOD("DeprecatedHelloNoReply", "", "", NULL, SD_BUS_VTABLE_DEPRECATED|SD_BUS_VTABLE_METHOD_NO_REPLY),
33 : SD_BUS_SIGNAL("Wowza", "sss", 0),
34 : SD_BUS_SIGNAL("DeprecatedWowza", "ut", SD_BUS_VTABLE_DEPRECATED),
35 : SD_BUS_WRITABLE_PROPERTY("AProperty", "s", get_handler, set_handler, 0, 0),
36 : SD_BUS_PROPERTY("AReadOnlyDeprecatedProperty", "(ut)", get_handler, 0, SD_BUS_VTABLE_DEPRECATED),
37 : SD_BUS_PROPERTY("ChangingProperty", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
38 : SD_BUS_PROPERTY("Invalidating", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
39 : SD_BUS_PROPERTY("Constant", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_PROPERTY_EXPLICIT),
40 : SD_BUS_VTABLE_END
41 : };
42 :
43 : static const sd_bus_vtable test_vtable_2[] = {
44 : SD_BUS_VTABLE_START(0),
45 : SD_BUS_METHOD("AlterSomething", "s", "s", handler, 0),
46 : SD_BUS_METHOD("Exit", "", "", handler, 0),
47 : SD_BUS_METHOD_WITH_OFFSET("AlterSomething2", "s", "s", handler, 200, 0),
48 : SD_BUS_METHOD_WITH_OFFSET("Exit2", "", "", handler, 200, 0),
49 : SD_BUS_METHOD_WITH_NAMES_OFFSET("AlterSomething3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path),
50 : "s", SD_BUS_PARAM(returnstring), handler, 200, 0),
51 : SD_BUS_METHOD_WITH_NAMES("Exit3", "bx", SD_BUS_PARAM(with_confirmation) SD_BUS_PARAM(after_msec),
52 : "bb", SD_BUS_PARAM(accepted) SD_BUS_PARAM(scheduled), handler, 0),
53 : SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
54 : SD_BUS_PROPERTY("Value2", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
55 : SD_BUS_PROPERTY("Value3", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_CONST),
56 : SD_BUS_PROPERTY("Value4", "s", value_handler, 10, 0),
57 : SD_BUS_PROPERTY("AnExplicitProperty", "s", NULL, offsetof(struct context, something),
58 : SD_BUS_VTABLE_PROPERTY_EXPLICIT|SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
59 : SD_BUS_WRITABLE_PROPERTY("Something", "s", get_handler, set_handler, 0, 0),
60 : SD_BUS_WRITABLE_PROPERTY("AutomaticStringProperty", "s", NULL, NULL,
61 : offsetof(struct context, automatic_string_property), 0),
62 : SD_BUS_WRITABLE_PROPERTY("AutomaticIntegerProperty", "u", NULL, NULL,
63 : offsetof(struct context, automatic_integer_property), 0),
64 : SD_BUS_METHOD("NoOperation", NULL, NULL, NULL, 0),
65 : SD_BUS_SIGNAL("DummySignal", "b", 0),
66 : SD_BUS_SIGNAL("DummySignal2", "so", 0),
67 : SD_BUS_SIGNAL_WITH_NAMES("DummySignal3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path), 0),
68 : SD_BUS_VTABLE_END
69 : };
70 :
71 : static const sd_bus_vtable test_vtable_deprecated[] = {
72 : SD_BUS_VTABLE_START(SD_BUS_VTABLE_DEPRECATED),
73 : SD_BUS_VTABLE_END
74 : };
75 :
76 : struct sd_bus_vtable_221 {
77 : uint8_t type:8;
78 : uint64_t flags:56;
79 : union {
80 : struct {
81 : size_t element_size;
82 : } start;
83 : struct {
84 : const char *member;
85 : const char *signature;
86 : const char *result;
87 : sd_bus_message_handler_t handler;
88 : size_t offset;
89 : } method;
90 : struct {
91 : const char *member;
92 : const char *signature;
93 : } signal;
94 : struct {
95 : const char *member;
96 : const char *signature;
97 : sd_bus_property_get_t get;
98 : sd_bus_property_set_t set;
99 : size_t offset;
100 : } property;
101 : } x;
102 : };
103 :
104 : static const struct sd_bus_vtable_221 vtable_format_221[] = {
105 : {
106 : .type = _SD_BUS_VTABLE_START,
107 : .flags = 0,
108 : .x = {
109 : .start = {
110 : .element_size = sizeof(struct sd_bus_vtable_221)
111 : },
112 : },
113 : },
114 : {
115 : .type = _SD_BUS_VTABLE_METHOD,
116 : .flags = 0,
117 : .x = {
118 : .method = {
119 : .member = "Exit",
120 : .signature = "",
121 : .result = "",
122 : .handler = handler,
123 : .offset = 0,
124 : },
125 : },
126 : },
127 : {
128 : .type = _SD_BUS_VTABLE_END,
129 : .flags = 0,
130 : .x = { { 0 } },
131 : }
132 : };
|