X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng%2Fcondition%2Fevent-rule-matches-internal.hpp;fp=include%2Flttng%2Fcondition%2Fevent-rule-matches-internal.hpp;h=bb7e03e21b51259c19faf11a91712948e09ceafc;hp=0000000000000000000000000000000000000000;hb=c9e313bc594f40a86eed237dce222c0fc99c957f;hpb=4878de5c7deb512bbdac4fdfc498907efa06fb7c diff --git a/include/lttng/condition/event-rule-matches-internal.hpp b/include/lttng/condition/event-rule-matches-internal.hpp new file mode 100644 index 000000000..bb7e03e21 --- /dev/null +++ b/include/lttng/condition/event-rule-matches-internal.hpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2019 Jonathan Rajotte + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H +#define LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H + +#include +#include +#include +#include +#include +#include +#include + +struct lttng_capture_descriptor { + struct lttng_event_expr *event_expression; + struct lttng_bytecode *bytecode; +}; + +struct lttng_condition_event_rule_matches { + struct lttng_condition parent; + struct lttng_event_rule *rule; + + /* + * Internal use only. + * Error accounting counter index. + */ + LTTNG_OPTIONAL(uint64_t) error_counter_index; + + /* Array of `struct lttng_capture_descriptor *`. */ + struct lttng_dynamic_pointer_array capture_descriptors; +}; + +struct lttng_evaluation_event_rule_matches { + struct lttng_evaluation parent; + + /* MessagePack-encoded captured event field values. */ + struct lttng_dynamic_buffer capture_payload; + + /* + * The content of this array event field value is the decoded + * version of `capture_payload` above. + * + * This is a cache: it's not serialized/deserialized in + * communications from/to the library and the session daemon. + */ + struct lttng_event_field_value *captured_values; +}; + +ssize_t lttng_condition_event_rule_matches_create_from_payload( + struct lttng_payload_view *view, + struct lttng_condition **condition); + +enum lttng_condition_status +lttng_condition_event_rule_matches_borrow_rule_mutable( + const struct lttng_condition *condition, + struct lttng_event_rule **rule); + +void lttng_condition_event_rule_matches_set_error_counter_index( + struct lttng_condition *condition, + uint64_t error_counter_index); + +uint64_t lttng_condition_event_rule_matches_get_error_counter_index( + const struct lttng_condition *condition); + +struct lttng_evaluation *lttng_evaluation_event_rule_matches_create( + const struct lttng_condition_event_rule_matches *condition, + const char *capture_payload, + size_t capture_payload_size, + bool decode_capture_payload); + +ssize_t lttng_evaluation_event_rule_matches_create_from_payload( + const struct lttng_condition_event_rule_matches *condition, + struct lttng_payload_view *view, + struct lttng_evaluation **_evaluation); + +enum lttng_error_code +lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode( + struct lttng_condition *condition); + +const struct lttng_bytecode * +lttng_condition_event_rule_matches_get_capture_bytecode_at_index( + const struct lttng_condition *condition, unsigned int index); + +#endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */