| 1 | /* |
| 2 | * Copyright (C) 2021 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H |
| 9 | #define LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H |
| 10 | |
| 11 | #include <common/payload-view.h> |
| 12 | #include <common/macros.h> |
| 13 | #include <common/optional.h> |
| 14 | #include <lttng/domain.h> |
| 15 | #include <lttng/event-rule/event-rule-internal.h> |
| 16 | #include <lttng/event-rule/user-tracepoint.h> |
| 17 | #include <lttng/event.h> |
| 18 | #include <lttng/log-level-rule-internal.h> |
| 19 | |
| 20 | struct lttng_event_rule_user_tracepoint { |
| 21 | struct lttng_event_rule parent; |
| 22 | |
| 23 | /* Name pattern. */ |
| 24 | char *pattern; |
| 25 | |
| 26 | /* Filter. */ |
| 27 | char *filter_expression; |
| 28 | |
| 29 | /* Log level. */ |
| 30 | struct lttng_log_level_rule *log_level_rule; |
| 31 | |
| 32 | /* Exclusions. */ |
| 33 | struct lttng_dynamic_pointer_array exclusions; |
| 34 | |
| 35 | /* internal use only. */ |
| 36 | struct { |
| 37 | char *filter; |
| 38 | struct lttng_bytecode *bytecode; |
| 39 | } internal_filter; |
| 40 | }; |
| 41 | |
| 42 | struct lttng_event_rule_user_tracepoint_comm { |
| 43 | /* Includes terminator `\0`. */ |
| 44 | uint32_t pattern_len; |
| 45 | /* Includes terminator `\0`. */ |
| 46 | uint32_t filter_expression_len; |
| 47 | /* enum lttng_log_level_rule_comm + payload if any */ |
| 48 | uint32_t log_level_rule_len; |
| 49 | uint32_t exclusions_count; |
| 50 | uint32_t exclusions_len; |
| 51 | /* |
| 52 | * Payload is composed of, in that order: |
| 53 | * - pattern (null terminated), |
| 54 | * - filter expression (null terminated), |
| 55 | * - log level rule serialized object, |
| 56 | * - exclusions (32 bit length + null terminated string). |
| 57 | */ |
| 58 | char payload[]; |
| 59 | } LTTNG_PACKED; |
| 60 | |
| 61 | ssize_t lttng_event_rule_user_tracepoint_create_from_payload( |
| 62 | struct lttng_payload_view *view, |
| 63 | struct lttng_event_rule **rule); |
| 64 | |
| 65 | #endif /* LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H */ |