test-bus-{vtable,introspect}: share data and test introspect_path()
test-bus-introspect is also applied to the tables from test-bus-vtable.c. test-bus-vtable.c is also used as C++ sources to produce test-bus-vtable-cc, and our hashmap headers are not C++ compatible. So let's do the introspection part only in the C version.
This commit is contained in:
parent
dff9e25a76
commit
d603324b4b
|
@ -888,6 +888,7 @@ int introspect_path(
|
||||||
const char *path,
|
const char *path,
|
||||||
struct node *n,
|
struct node *n,
|
||||||
bool require_fallback,
|
bool require_fallback,
|
||||||
|
bool ignore_nodes_modified,
|
||||||
bool *found_object,
|
bool *found_object,
|
||||||
char **ret,
|
char **ret,
|
||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
@ -899,10 +900,16 @@ int introspect_path(
|
||||||
bool empty;
|
bool empty;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (!n) {
|
||||||
|
n = hashmap_get(bus->nodes, path);
|
||||||
|
if (!n)
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
r = get_child_nodes(bus, path, n, 0, &s, error);
|
r = get_child_nodes(bus, path, n, 0, &s, error);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (bus->nodes_modified)
|
if (bus->nodes_modified && !ignore_nodes_modified)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = introspect_begin(&intro, bus->trusted);
|
r = introspect_begin(&intro, bus->trusted);
|
||||||
|
@ -922,7 +929,7 @@ int introspect_path(
|
||||||
r = node_vtable_get_userdata(bus, path, c, NULL, error);
|
r = node_vtable_get_userdata(bus, path, c, NULL, error);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (bus->nodes_modified)
|
if (bus->nodes_modified && !ignore_nodes_modified)
|
||||||
return 0;
|
return 0;
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -955,11 +962,12 @@ int introspect_path(
|
||||||
r = bus_node_exists(bus, n, path, require_fallback);
|
r = bus_node_exists(bus, n, path, require_fallback);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
if (bus->nodes_modified)
|
if (bus->nodes_modified && !ignore_nodes_modified)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*found_object = true;
|
if (found_object)
|
||||||
|
*found_object = true;
|
||||||
|
|
||||||
r = introspect_write_child_nodes(&intro, s, path);
|
r = introspect_write_child_nodes(&intro, s, path);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -989,7 +997,7 @@ static int process_introspect(
|
||||||
assert(n);
|
assert(n);
|
||||||
assert(found_object);
|
assert(found_object);
|
||||||
|
|
||||||
r = introspect_path(bus, m->path, n, require_fallback, found_object, &s, &error);
|
r = introspect_path(bus, m->path, n, require_fallback, false, found_object, &s, &error);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return bus_maybe_reply_error(m, r, &error);
|
return bus_maybe_reply_error(m, r, &error);
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
|
|
|
@ -14,6 +14,7 @@ int introspect_path(
|
||||||
const char *path,
|
const char *path,
|
||||||
struct node *n,
|
struct node *n,
|
||||||
bool require_fallback,
|
bool require_fallback,
|
||||||
|
bool ignore_nodes_modified,
|
||||||
bool *found_object,
|
bool *found_object,
|
||||||
char **ret,
|
char **ret,
|
||||||
sd_bus_error *error);
|
sd_bus_error *error);
|
||||||
|
|
|
@ -4,33 +4,14 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
|
||||||
static int prop_get(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
|
#include "test-vtable-data.h"
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int prop_set(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
|
static void test_manual_introspection(const sd_bus_vtable vtable[]) {
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const sd_bus_vtable vtable[] = {
|
|
||||||
SD_BUS_VTABLE_START(0),
|
|
||||||
SD_BUS_METHOD("Hello", "ssas", "a(uu)", NULL, 0),
|
|
||||||
SD_BUS_METHOD("DeprecatedHello", "", "", NULL, SD_BUS_VTABLE_DEPRECATED),
|
|
||||||
SD_BUS_METHOD("DeprecatedHelloNoReply", "", "", NULL, SD_BUS_VTABLE_DEPRECATED|SD_BUS_VTABLE_METHOD_NO_REPLY),
|
|
||||||
SD_BUS_SIGNAL("Wowza", "sss", 0),
|
|
||||||
SD_BUS_SIGNAL("DeprecatedWowza", "ut", SD_BUS_VTABLE_DEPRECATED),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("AProperty", "s", prop_get, prop_set, 0, 0),
|
|
||||||
SD_BUS_PROPERTY("AReadOnlyDeprecatedProperty", "(ut)", prop_get, 0, SD_BUS_VTABLE_DEPRECATED),
|
|
||||||
SD_BUS_PROPERTY("ChangingProperty", "t", prop_get, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
|
||||||
SD_BUS_PROPERTY("Invalidating", "t", prop_get, 0, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
|
||||||
SD_BUS_PROPERTY("Constant", "t", prop_get, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_PROPERTY_EXPLICIT),
|
|
||||||
SD_BUS_VTABLE_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static void test_manual_introspection(void) {
|
|
||||||
struct introspect intro = {};
|
struct introspect intro = {};
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *s = NULL;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
assert_se(introspect_begin(&intro, false) >= 0);
|
assert_se(introspect_begin(&intro, false) >= 0);
|
||||||
|
|
||||||
fprintf(intro.f, " <interface name=\"org.foo\">\n");
|
fprintf(intro.f, " <interface name=\"org.foo\">\n");
|
||||||
|
@ -39,12 +20,16 @@ static void test_manual_introspection(void) {
|
||||||
|
|
||||||
assert_se(introspect_finish(&intro, &s) == 0);
|
assert_se(introspect_finish(&intro, &s) == 0);
|
||||||
fputs(s, stdout);
|
fputs(s, stdout);
|
||||||
|
fputs("\n", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
test_setup_logging(LOG_DEBUG);
|
test_setup_logging(LOG_DEBUG);
|
||||||
|
|
||||||
test_manual_introspection();
|
test_manual_introspection(test_vtable_1);
|
||||||
|
test_manual_introspection(test_vtable_2);
|
||||||
|
test_manual_introspection(test_vtable_deprecated);
|
||||||
|
test_manual_introspection((const sd_bus_vtable *) vtable_format_221);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
@ -5,120 +7,18 @@
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "sd-bus-vtable.h"
|
#include "sd-bus-vtable.h"
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
# include "bus-objects.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "test-vtable-data.h"
|
||||||
|
|
||||||
#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
|
#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
|
||||||
|
|
||||||
struct context {
|
|
||||||
bool quit;
|
|
||||||
char *something;
|
|
||||||
char *automatic_string_property;
|
|
||||||
uint32_t automatic_integer_property;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int handler(sd_bus_message *m, void *userdata, sd_bus_error *error) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const sd_bus_vtable vtable[] = {
|
|
||||||
SD_BUS_VTABLE_START(0),
|
|
||||||
SD_BUS_METHOD("AlterSomething", "s", "s", handler, 0),
|
|
||||||
SD_BUS_METHOD("Exit", "", "", handler, 0),
|
|
||||||
SD_BUS_METHOD_WITH_OFFSET("AlterSomething2", "s", "s", handler, 200, 0),
|
|
||||||
SD_BUS_METHOD_WITH_OFFSET("Exit2", "", "", handler, 200, 0),
|
|
||||||
SD_BUS_METHOD_WITH_NAMES_OFFSET("AlterSomething3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path),
|
|
||||||
"s", SD_BUS_PARAM(returnstring), handler, 200, 0),
|
|
||||||
SD_BUS_METHOD_WITH_NAMES("Exit3", "bx", SD_BUS_PARAM(with_confirmation) SD_BUS_PARAM(after_msec),
|
|
||||||
"bb", SD_BUS_PARAM(accepted) SD_BUS_PARAM(scheduled), handler, 0),
|
|
||||||
SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
|
||||||
SD_BUS_PROPERTY("Value2", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
|
||||||
SD_BUS_PROPERTY("Value3", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_CONST),
|
|
||||||
SD_BUS_PROPERTY("Value4", "s", value_handler, 10, 0),
|
|
||||||
SD_BUS_PROPERTY("AnExplicitProperty", "s", NULL, offsetof(struct context, something),
|
|
||||||
SD_BUS_VTABLE_PROPERTY_EXPLICIT|SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("Something", "s", get_handler, set_handler, 0, 0),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("AutomaticStringProperty", "s", NULL, NULL,
|
|
||||||
offsetof(struct context, automatic_string_property), 0),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("AutomaticIntegerProperty", "u", NULL, NULL,
|
|
||||||
offsetof(struct context, automatic_integer_property), 0),
|
|
||||||
SD_BUS_METHOD("NoOperation", NULL, NULL, NULL, 0),
|
|
||||||
SD_BUS_SIGNAL("DummySignal", "b", 0),
|
|
||||||
SD_BUS_SIGNAL("DummySignal2", "so", 0),
|
|
||||||
SD_BUS_SIGNAL_WITH_NAMES("DummySignal3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path), 0),
|
|
||||||
SD_BUS_VTABLE_END
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sd_bus_vtable_221 {
|
|
||||||
uint8_t type:8;
|
|
||||||
uint64_t flags:56;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
size_t element_size;
|
|
||||||
} start;
|
|
||||||
struct {
|
|
||||||
const char *member;
|
|
||||||
const char *signature;
|
|
||||||
const char *result;
|
|
||||||
sd_bus_message_handler_t handler;
|
|
||||||
size_t offset;
|
|
||||||
} method;
|
|
||||||
struct {
|
|
||||||
const char *member;
|
|
||||||
const char *signature;
|
|
||||||
} signal;
|
|
||||||
struct {
|
|
||||||
const char *member;
|
|
||||||
const char *signature;
|
|
||||||
sd_bus_property_get_t get;
|
|
||||||
sd_bus_property_set_t set;
|
|
||||||
size_t offset;
|
|
||||||
} property;
|
|
||||||
} x;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct sd_bus_vtable_221 vtable_format_221[] = {
|
|
||||||
{
|
|
||||||
.type = _SD_BUS_VTABLE_START,
|
|
||||||
.flags = 0,
|
|
||||||
.x = {
|
|
||||||
.start = {
|
|
||||||
.element_size = sizeof(struct sd_bus_vtable_221)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.type = _SD_BUS_VTABLE_METHOD,
|
|
||||||
.flags = 0,
|
|
||||||
.x = {
|
|
||||||
.method = {
|
|
||||||
.member = "Exit",
|
|
||||||
.signature = "",
|
|
||||||
.result = "",
|
|
||||||
.handler = handler,
|
|
||||||
.offset = 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.type = _SD_BUS_VTABLE_END,
|
|
||||||
.flags = 0,
|
|
||||||
.x = { { 0 } },
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void test_vtable(void) {
|
static void test_vtable(void) {
|
||||||
sd_bus *bus = NULL;
|
sd_bus *bus = NULL;
|
||||||
struct context c = {};
|
struct context c = {};
|
||||||
|
@ -126,16 +26,24 @@ static void test_vtable(void) {
|
||||||
|
|
||||||
assert(sd_bus_new(&bus) >= 0);
|
assert(sd_bus_new(&bus) >= 0);
|
||||||
|
|
||||||
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable", vtable, &c) >= 0);
|
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable", test_vtable_2, &c) >= 0);
|
||||||
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable2", vtable, &c) >= 0);
|
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable2", test_vtable_2, &c) >= 0);
|
||||||
/* the cast on the line below is needed to test with the old version of the table */
|
/* the cast on the line below is needed to test with the old version of the table */
|
||||||
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable221", (const sd_bus_vtable *)vtable_format_221, &c) >= 0);
|
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable221",
|
||||||
|
(const sd_bus_vtable *)vtable_format_221, &c) >= 0);
|
||||||
|
|
||||||
assert(sd_bus_set_address(bus, DEFAULT_BUS_PATH) >= 0);
|
assert(sd_bus_set_address(bus, DEFAULT_BUS_PATH) >= 0);
|
||||||
r = sd_bus_start(bus);
|
r = sd_bus_start(bus);
|
||||||
assert(r == 0 || /* success */
|
assert(r == 0 || /* success */
|
||||||
r == -ENOENT /* dbus is inactive */ );
|
r == -ENOENT /* dbus is inactive */ );
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
_cleanup_free_ char *s = NULL;
|
||||||
|
|
||||||
|
assert_se(introspect_path(bus, "/foo", NULL, false, true, NULL, &s, NULL) == 1);
|
||||||
|
fputs(s, stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
sd_bus_unref(bus);
|
sd_bus_unref(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
132
src/libsystemd/sd-bus/test-vtable-data.h
Normal file
132
src/libsystemd/sd-bus/test-vtable-data.h
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
/* This is meant to be included in other files, hence no headers */
|
||||||
|
|
||||||
|
struct context {
|
||||||
|
bool quit;
|
||||||
|
char *something;
|
||||||
|
char *automatic_string_property;
|
||||||
|
uint32_t automatic_integer_property;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int handler(sd_bus_message *m, void *userdata, sd_bus_error *error) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const sd_bus_vtable test_vtable_1[] = {
|
||||||
|
SD_BUS_VTABLE_START(0),
|
||||||
|
SD_BUS_METHOD("Hello", "ssas", "a(uu)", NULL, 0),
|
||||||
|
SD_BUS_METHOD("DeprecatedHello", "", "", NULL, SD_BUS_VTABLE_DEPRECATED),
|
||||||
|
SD_BUS_METHOD("DeprecatedHelloNoReply", "", "", NULL, SD_BUS_VTABLE_DEPRECATED|SD_BUS_VTABLE_METHOD_NO_REPLY),
|
||||||
|
SD_BUS_SIGNAL("Wowza", "sss", 0),
|
||||||
|
SD_BUS_SIGNAL("DeprecatedWowza", "ut", SD_BUS_VTABLE_DEPRECATED),
|
||||||
|
SD_BUS_WRITABLE_PROPERTY("AProperty", "s", get_handler, set_handler, 0, 0),
|
||||||
|
SD_BUS_PROPERTY("AReadOnlyDeprecatedProperty", "(ut)", get_handler, 0, SD_BUS_VTABLE_DEPRECATED),
|
||||||
|
SD_BUS_PROPERTY("ChangingProperty", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||||
|
SD_BUS_PROPERTY("Invalidating", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
||||||
|
SD_BUS_PROPERTY("Constant", "t", get_handler, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_PROPERTY_EXPLICIT),
|
||||||
|
SD_BUS_VTABLE_END
|
||||||
|
};
|
||||||
|
|
||||||
|
static const sd_bus_vtable test_vtable_2[] = {
|
||||||
|
SD_BUS_VTABLE_START(0),
|
||||||
|
SD_BUS_METHOD("AlterSomething", "s", "s", handler, 0),
|
||||||
|
SD_BUS_METHOD("Exit", "", "", handler, 0),
|
||||||
|
SD_BUS_METHOD_WITH_OFFSET("AlterSomething2", "s", "s", handler, 200, 0),
|
||||||
|
SD_BUS_METHOD_WITH_OFFSET("Exit2", "", "", handler, 200, 0),
|
||||||
|
SD_BUS_METHOD_WITH_NAMES_OFFSET("AlterSomething3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path),
|
||||||
|
"s", SD_BUS_PARAM(returnstring), handler, 200, 0),
|
||||||
|
SD_BUS_METHOD_WITH_NAMES("Exit3", "bx", SD_BUS_PARAM(with_confirmation) SD_BUS_PARAM(after_msec),
|
||||||
|
"bb", SD_BUS_PARAM(accepted) SD_BUS_PARAM(scheduled), handler, 0),
|
||||||
|
SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||||
|
SD_BUS_PROPERTY("Value2", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
||||||
|
SD_BUS_PROPERTY("Value3", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||||
|
SD_BUS_PROPERTY("Value4", "s", value_handler, 10, 0),
|
||||||
|
SD_BUS_PROPERTY("AnExplicitProperty", "s", NULL, offsetof(struct context, something),
|
||||||
|
SD_BUS_VTABLE_PROPERTY_EXPLICIT|SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
||||||
|
SD_BUS_WRITABLE_PROPERTY("Something", "s", get_handler, set_handler, 0, 0),
|
||||||
|
SD_BUS_WRITABLE_PROPERTY("AutomaticStringProperty", "s", NULL, NULL,
|
||||||
|
offsetof(struct context, automatic_string_property), 0),
|
||||||
|
SD_BUS_WRITABLE_PROPERTY("AutomaticIntegerProperty", "u", NULL, NULL,
|
||||||
|
offsetof(struct context, automatic_integer_property), 0),
|
||||||
|
SD_BUS_METHOD("NoOperation", NULL, NULL, NULL, 0),
|
||||||
|
SD_BUS_SIGNAL("DummySignal", "b", 0),
|
||||||
|
SD_BUS_SIGNAL("DummySignal2", "so", 0),
|
||||||
|
SD_BUS_SIGNAL_WITH_NAMES("DummySignal3", "so", SD_BUS_PARAM(string) SD_BUS_PARAM(path), 0),
|
||||||
|
SD_BUS_VTABLE_END
|
||||||
|
};
|
||||||
|
|
||||||
|
static const sd_bus_vtable test_vtable_deprecated[] = {
|
||||||
|
SD_BUS_VTABLE_START(SD_BUS_VTABLE_DEPRECATED),
|
||||||
|
SD_BUS_VTABLE_END
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sd_bus_vtable_221 {
|
||||||
|
uint8_t type:8;
|
||||||
|
uint64_t flags:56;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
size_t element_size;
|
||||||
|
} start;
|
||||||
|
struct {
|
||||||
|
const char *member;
|
||||||
|
const char *signature;
|
||||||
|
const char *result;
|
||||||
|
sd_bus_message_handler_t handler;
|
||||||
|
size_t offset;
|
||||||
|
} method;
|
||||||
|
struct {
|
||||||
|
const char *member;
|
||||||
|
const char *signature;
|
||||||
|
} signal;
|
||||||
|
struct {
|
||||||
|
const char *member;
|
||||||
|
const char *signature;
|
||||||
|
sd_bus_property_get_t get;
|
||||||
|
sd_bus_property_set_t set;
|
||||||
|
size_t offset;
|
||||||
|
} property;
|
||||||
|
} x;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct sd_bus_vtable_221 vtable_format_221[] = {
|
||||||
|
{
|
||||||
|
.type = _SD_BUS_VTABLE_START,
|
||||||
|
.flags = 0,
|
||||||
|
.x = {
|
||||||
|
.start = {
|
||||||
|
.element_size = sizeof(struct sd_bus_vtable_221)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.type = _SD_BUS_VTABLE_METHOD,
|
||||||
|
.flags = 0,
|
||||||
|
.x = {
|
||||||
|
.method = {
|
||||||
|
.member = "Exit",
|
||||||
|
.signature = "",
|
||||||
|
.result = "",
|
||||||
|
.handler = handler,
|
||||||
|
.offset = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.type = _SD_BUS_VTABLE_END,
|
||||||
|
.flags = 0,
|
||||||
|
.x = { { 0 } },
|
||||||
|
}
|
||||||
|
};
|
|
@ -911,7 +911,8 @@ tests += [
|
||||||
[],
|
[],
|
||||||
[threads]],
|
[threads]],
|
||||||
|
|
||||||
[['src/libsystemd/sd-bus/test-bus-vtable.c'],
|
[['src/libsystemd/sd-bus/test-bus-vtable.c',
|
||||||
|
'src/libsystemd/sd-bus/test-vtable-data.h'],
|
||||||
[],
|
[],
|
||||||
[]],
|
[]],
|
||||||
|
|
||||||
|
@ -934,7 +935,8 @@ tests += [
|
||||||
[threads],
|
[threads],
|
||||||
'', 'manual'],
|
'', 'manual'],
|
||||||
|
|
||||||
[['src/libsystemd/sd-bus/test-bus-introspect.c'],
|
[['src/libsystemd/sd-bus/test-bus-introspect.c',
|
||||||
|
'src/libsystemd/sd-bus/test-vtable-data.h'],
|
||||||
[],
|
[],
|
||||||
[]],
|
[]],
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue