Commit | Line | Data |
---|---|---|
b47b01d8 JR |
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_JUL_LOGGING_INTERNAL_H | |
9 | #define LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H | |
10 | ||
c9e313bc SM |
11 | #include <common/macros.hpp> |
12 | #include <common/optional.hpp> | |
28f23191 JG |
13 | #include <common/payload-view.hpp> |
14 | ||
c9e313bc | 15 | #include <lttng/event-rule/event-rule-internal.hpp> |
b47b01d8 JR |
16 | #include <lttng/event-rule/jul-logging.h> |
17 | #include <lttng/event.h> | |
c9e313bc | 18 | #include <lttng/log-level-rule-internal.hpp> |
b47b01d8 | 19 | |
47abf22b MJ |
20 | #define LTTNG_JUL_EVENT_RULE_AT_LEAST_AS_SEVERE_AS_OP ">=" |
21 | ||
b47b01d8 JR |
22 | struct lttng_event_rule_jul_logging { |
23 | struct lttng_event_rule parent; | |
24 | ||
25 | /* Name pattern. */ | |
26 | char *pattern; | |
27 | ||
28 | /* Filter. */ | |
29 | char *filter_expression; | |
30 | ||
31 | /* Log level. */ | |
32 | struct lttng_log_level_rule *log_level_rule; | |
33 | ||
34 | /* internal use only. */ | |
35 | struct { | |
36 | char *filter; | |
37 | struct lttng_bytecode *bytecode; | |
38 | } internal_filter; | |
39 | }; | |
40 | ||
41 | struct lttng_event_rule_jul_logging_comm { | |
42 | /* Includes terminator `\0`. */ | |
43 | uint32_t pattern_len; | |
44 | /* Includes terminator `\0`. */ | |
45 | uint32_t filter_expression_len; | |
46 | /* enum lttng_log_level_rule_comm + payload if any */ | |
47 | uint32_t log_level_rule_len; | |
48 | /* | |
49 | * Payload is composed of, in that order: | |
50 | * - pattern (null terminated), | |
51 | * - filter expression (null terminated), | |
52 | * - log level rule serialized object, | |
53 | */ | |
54 | char payload[]; | |
55 | } LTTNG_PACKED; | |
56 | ||
28f23191 JG |
57 | ssize_t lttng_event_rule_jul_logging_create_from_payload(struct lttng_payload_view *view, |
58 | struct lttng_event_rule **rule); | |
b47b01d8 JR |
59 | |
60 | #endif /* LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H */ |