X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng%2Fcondition%2Fevent-rule-internal.h;fp=include%2Flttng%2Fcondition%2Fevent-rule-internal.h;h=7f71a7bee8f9a5a660ca4df0ef004a4c074cf314;hp=0000000000000000000000000000000000000000;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=3a4595c2469472dee1656cde5f8882c2123efd3c diff --git a/include/lttng/condition/event-rule-internal.h b/include/lttng/condition/event-rule-internal.h new file mode 100644 index 000000000..7f71a7bee --- /dev/null +++ b/include/lttng/condition/event-rule-internal.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2019 Jonathan Rajotte + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef LTTNG_CONDITION_event_rule_INTERNAL_H +#define LTTNG_CONDITION_event_rule_INTERNAL_H + +#include +#include +#include +#include +#include +#include + +struct lttng_capture_descriptor { + /* The index at which the capture for this descriptor in the received + * payload from the tracer. This is populated on sessiond side. + * -1 is uninitialized. + * This is necessary since a single trigger can have multiple notify + * action, only an ordered set of capture desciptor is passed to the tracer. + */ + int32_t capture_index; + struct lttng_event_expr *event_expression; +}; + +struct lttng_condition_event_rule { + struct lttng_condition parent; + struct lttng_event_rule *rule; + + /* Array of `struct lttng_capture_descriptor *` */ + struct lttng_dynamic_pointer_array capture_descriptors; +}; + +struct lttng_evaluation_event_rule { + struct lttng_evaluation parent; + char *name; + + /* 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; +}; + +struct lttng_evaluation_event_rule_comm { + uint32_t trigger_name_length; + /* Trigger name */ + char payload[]; +} LTTNG_PACKED; + +struct lttng_condition_event_rule_capture_bytecode_element +{ + struct lttng_event_expr *expression; + struct lttng_bytecode *bytecode; +}; + +LTTNG_HIDDEN +ssize_t lttng_condition_event_rule_create_from_payload( + struct lttng_payload_view *view, + struct lttng_condition **condition); + +LTTNG_HIDDEN +enum lttng_condition_status +lttng_condition_event_rule_get_rule_mutable( + const struct lttng_condition *condition, + struct lttng_event_rule **rule); + +LTTNG_HIDDEN +struct lttng_evaluation *lttng_evaluation_event_rule_create( + const struct lttng_condition_event_rule *condition, + const char* trigger_name, + const char *capture_payload, size_t capture_payload_size, + bool decode_capture_payload); + +LTTNG_HIDDEN +ssize_t lttng_evaluation_event_rule_create_from_payload( + const struct lttng_condition_event_rule *condition, + struct lttng_payload_view *view, + struct lttng_evaluation **_evaluation); + +/* + * The returned `lttng_dynamic_pointer_array` contains a index ordered set of + * `lttng_condition_event_rule_capture_bytecode_element`. + * This ensure that minimal work will be done by the tracer for cases where + * multiple identical capture expression are present. + */ +LTTNG_HIDDEN +enum lttng_error_code +lttng_condition_event_rule_generate_capture_descriptor_bytecode_set( + struct lttng_condition *condition, + struct lttng_dynamic_pointer_array *bytecode_set); + +LTTNG_HIDDEN +struct lttng_capture_descriptor * +lttng_condition_event_rule_get_internal_capture_descriptor_at_index( + const struct lttng_condition *condition, unsigned int index); + +#endif /* LTTNG_CONDITION_event_rule_INTERNAL_H */