1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2013 Lennart Poettering
12 enum bus_match_node_type {
17 /* The following are all different kinds of compare nodes */
19 BUS_MATCH_MESSAGE_TYPE,
20 BUS_MATCH_DESTINATION,
24 BUS_MATCH_PATH_NAMESPACE,
26 BUS_MATCH_ARG_LAST = BUS_MATCH_ARG + 63,
28 BUS_MATCH_ARG_PATH_LAST = BUS_MATCH_ARG_PATH + 63,
29 BUS_MATCH_ARG_NAMESPACE,
30 BUS_MATCH_ARG_NAMESPACE_LAST = BUS_MATCH_ARG_NAMESPACE + 63,
32 BUS_MATCH_ARG_HAS_LAST = BUS_MATCH_ARG_HAS + 63,
33 _BUS_MATCH_NODE_TYPE_MAX,
34 _BUS_MATCH_NODE_TYPE_INVALID = -1
37 struct bus_match_node {
38 enum bus_match_node_type type;
39 struct bus_match_node *parent, *next, *prev, *child;
47 struct match_callback *callback;
50 /* If this is set, then the child is NULL */
56 struct bus_match_component {
57 enum bus_match_node_type type;
62 enum bus_match_scope {
68 int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m);
70 int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, struct match_callback *callback);
71 int bus_match_remove(struct bus_match_node *root, struct match_callback *callback);
73 int bus_match_find(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, sd_bus_message_handler_t callback, void *userdata, struct match_callback **ret);
75 void bus_match_free(struct bus_match_node *node);
77 void bus_match_dump(struct bus_match_node *node, unsigned level);
79 const char* bus_match_node_type_to_string(enum bus_match_node_type t, char buf[], size_t l);
80 enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n);
82 int bus_match_parse(const char *match, struct bus_match_component **_components, unsigned *_n_components);
83 void bus_match_parse_free(struct bus_match_component *components, unsigned n_components);
84 #if 0 /// UNNEEDED by elogind
85 char *bus_match_to_string(struct bus_match_component *components, unsigned n_components);
88 enum bus_match_scope bus_match_get_scope(const struct bus_match_component *components, unsigned n_components);