X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbus-match.h;h=1d381266002107960aad79b2b50c260e0233ab3d;hp=a31c5d67dc9022bea553af2d7715eed43ccee207;hb=c1b9d935725103e95901f347b8981647ce4dd546;hpb=52f3ba915bdce4d7476c3ea53b8371deff5f567d diff --git a/src/libsystemd-bus/bus-match.h b/src/libsystemd-bus/bus-match.h index a31c5d67d..1d3812660 100644 --- a/src/libsystemd-bus/bus-match.h +++ b/src/libsystemd-bus/bus-match.h @@ -31,8 +31,8 @@ enum bus_match_node_type { BUS_MATCH_LEAF, /* The following are all different kinds of compare nodes */ - BUS_MATCH_MESSAGE_TYPE, BUS_MATCH_SENDER, + BUS_MATCH_MESSAGE_TYPE, BUS_MATCH_DESTINATION, BUS_MATCH_INTERFACE, BUS_MATCH_MEMBER, @@ -54,12 +54,14 @@ struct bus_match_node { union { struct { - uint8_t u8; char *str; + uint8_t u8; } value; struct { sd_bus_message_handler_t callback; void *userdata; + unsigned last_iteration; + uint64_t cookie; } leaf; struct { /* If this is set, then the child is NULL */ @@ -68,10 +70,16 @@ struct bus_match_node { }; }; -int bus_match_run(sd_bus *bus, struct bus_match_node *root, int ret, sd_bus_message *m); +struct bus_match_component { + enum bus_match_node_type type; + uint8_t value_u8; + char *value_str; +}; -int bus_match_add(struct bus_match_node *root, const char *match, sd_bus_message_handler_t callback, void *userdata, struct bus_match_node **ret); -int bus_match_remove(struct bus_match_node *root, const char *match, sd_bus_message_handler_t callback, void *userdata); +int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m); + +int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, sd_bus_message_handler_t callback, void *userdata, uint64_t cookie, struct bus_match_node **ret); +int bus_match_remove(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, sd_bus_message_handler_t callback, void *userdata, uint64_t *cookie); void bus_match_free(struct bus_match_node *node); @@ -79,3 +87,6 @@ void bus_match_dump(struct bus_match_node *node, unsigned level); const char* bus_match_node_type_to_string(enum bus_match_node_type t, char buf[], size_t l); enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n); + +int bus_match_parse(const char *match, struct bus_match_component **_components, unsigned *_n_components); +void bus_match_parse_free(struct bus_match_component *components, unsigned n_components);