X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fcondition%2Fon-event-internal.h;fp=include%2Flttng%2Fcondition%2Fon-event-internal.h;h=e22cb762a7b7a05e483677d4453c1befeffd2fcc;hb=e393070aaad23313daae844ff87043babaae69e7;hp=0000000000000000000000000000000000000000;hpb=d602bd6a8ee25d5ca662dde4edb3db3cabf264e1;p=lttng-tools.git diff --git a/include/lttng/condition/on-event-internal.h b/include/lttng/condition/on-event-internal.h new file mode 100644 index 000000000..e22cb762a --- /dev/null +++ b/include/lttng/condition/on-event-internal.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2019 Jonathan Rajotte + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef LTTNG_CONDITION_ON_EVENT_INTERNAL_H +#define LTTNG_CONDITION_ON_EVENT_INTERNAL_H + +#include +#include +#include +#include +#include +#include + +struct lttng_capture_descriptor { + struct lttng_event_expr *event_expression; + struct lttng_bytecode *bytecode; +}; + +struct lttng_condition_on_event { + 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_on_event { + 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_on_event_comm { + /* Includes the null terminator. */ + uint32_t trigger_name_length; + /* Trigger name. */ + char payload[]; +} LTTNG_PACKED; + +LTTNG_HIDDEN +ssize_t lttng_condition_on_event_create_from_payload( + struct lttng_payload_view *view, + struct lttng_condition **condition); + +LTTNG_HIDDEN +enum lttng_condition_status +lttng_condition_on_event_borrow_rule_mutable( + const struct lttng_condition *condition, + struct lttng_event_rule **rule); + +LTTNG_HIDDEN +struct lttng_evaluation *lttng_evaluation_on_event_create( + const struct lttng_condition_on_event *condition, + const char* trigger_name, + const char *capture_payload, size_t capture_payload_size, + bool decode_capture_payload); + +LTTNG_HIDDEN +ssize_t lttng_evaluation_on_event_create_from_payload( + const struct lttng_condition_on_event *condition, + struct lttng_payload_view *view, + struct lttng_evaluation **_evaluation); + +LTTNG_HIDDEN +enum lttng_error_code +lttng_condition_on_event_generate_capture_descriptor_bytecode( + struct lttng_condition *condition); + +LTTNG_HIDDEN +const struct lttng_bytecode * +lttng_condition_on_event_get_capture_bytecode_at_index( + const struct lttng_condition *condition, unsigned int index); + +#endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */