| 1 | /* |
| 2 | * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H |
| 9 | #define LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H |
| 10 | |
| 11 | #include <common/payload-view.h> |
| 12 | #include <common/macros.h> |
| 13 | #include <lttng/domain.h> |
| 14 | #include <lttng/event-rule/event-rule-internal.h> |
| 15 | #include <lttng/event-rule/tracepoint.h> |
| 16 | #include <lttng/event.h> |
| 17 | |
| 18 | struct lttng_event_rule_tracepoint { |
| 19 | struct lttng_event_rule parent; |
| 20 | |
| 21 | /* Domain. */ |
| 22 | enum lttng_domain_type domain; |
| 23 | |
| 24 | /* Name pattern. */ |
| 25 | char *pattern; |
| 26 | |
| 27 | /* Filter. */ |
| 28 | char *filter_expression; |
| 29 | |
| 30 | /* Loglevel. */ |
| 31 | struct { |
| 32 | enum lttng_loglevel_type type; |
| 33 | int value; |
| 34 | } loglevel; |
| 35 | |
| 36 | /* Exclusions. */ |
| 37 | struct lttng_dynamic_pointer_array exclusions; |
| 38 | |
| 39 | /* internal use only. */ |
| 40 | struct { |
| 41 | char *filter; |
| 42 | struct lttng_filter_bytecode *bytecode; |
| 43 | } internal_filter; |
| 44 | }; |
| 45 | |
| 46 | struct lttng_event_rule_tracepoint_comm { |
| 47 | /* enum lttng_domain_type. */ |
| 48 | int8_t domain_type; |
| 49 | /* enum lttng_event_logleven_type. */ |
| 50 | int8_t loglevel_type; |
| 51 | int32_t loglevel_value; |
| 52 | /* Includes terminator `\0`. */ |
| 53 | uint32_t pattern_len; |
| 54 | /* Includes terminator `\0`. */ |
| 55 | uint32_t filter_expression_len; |
| 56 | uint32_t exclusions_count; |
| 57 | uint32_t exclusions_len; |
| 58 | /* |
| 59 | * Payload is composed of, in that order: |
| 60 | * - pattern (null terminated), |
| 61 | * - filter expression (null terminated), |
| 62 | * - exclusions (32 bit length + null terminated string). |
| 63 | */ |
| 64 | char payload[]; |
| 65 | } LTTNG_PACKED; |
| 66 | |
| 67 | LTTNG_HIDDEN |
| 68 | ssize_t lttng_event_rule_tracepoint_create_from_payload( |
| 69 | struct lttng_payload_view *view, |
| 70 | struct lttng_event_rule **rule); |
| 71 | |
| 72 | #endif /* LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H */ |