Commit | Line | Data |
---|---|---|
85b05318 JR |
1 | /* |
2 | * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef LTTNG_LOG_LEVEL_RULE_INTERNAL_H | |
9 | #define LTTNG_LOG_LEVEL_RULE_INTERNAL_H | |
10 | ||
c9e313bc SM |
11 | #include <common/buffer-view.hpp> |
12 | #include <common/dynamic-array.hpp> | |
13 | #include <common/macros.hpp> | |
14 | #include <common/payload-view.hpp> | |
15 | #include <common/payload.hpp> | |
28f23191 | 16 | |
85b05318 JR |
17 | #include <lttng/event.h> |
18 | #include <lttng/log-level-rule.h> | |
740da7d5 | 19 | #include <lttng/lttng-error.h> |
85b05318 | 20 | |
28f23191 JG |
21 | #include <stdint.h> |
22 | ||
6a751b95 JR |
23 | struct mi_writer; |
24 | ||
85b05318 JR |
25 | /* |
26 | * For now only a single backing struct is used for both type of log level | |
27 | * rule (exactly, as_severe) since both only have require "level" as property. | |
28 | */ | |
29 | struct lttng_log_level_rule { | |
30 | enum lttng_log_level_rule_type type; | |
31 | int level; | |
32 | }; | |
33 | ||
34 | struct lttng_log_level_rule_comm { | |
35 | /* enum lttng_log_level_rule_type */ | |
36 | int8_t type; | |
37 | int32_t level; | |
38 | }; | |
39 | ||
28f23191 JG |
40 | ssize_t lttng_log_level_rule_create_from_payload(struct lttng_payload_view *view, |
41 | struct lttng_log_level_rule **rule); | |
85b05318 | 42 | |
85b05318 | 43 | int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule, |
28f23191 | 44 | struct lttng_payload *payload); |
85b05318 | 45 | |
85b05318 | 46 | bool lttng_log_level_rule_is_equal(const struct lttng_log_level_rule *a, |
28f23191 | 47 | const struct lttng_log_level_rule *b); |
85b05318 | 48 | |
28f23191 | 49 | struct lttng_log_level_rule *lttng_log_level_rule_copy(const struct lttng_log_level_rule *source); |
85b05318 | 50 | |
28f23191 JG |
51 | void lttng_log_level_rule_to_loglevel(const struct lttng_log_level_rule *log_level_rule, |
52 | enum lttng_loglevel_type *loglevel_type, | |
53 | int *loglevel_value); | |
85b05318 | 54 | |
28f23191 | 55 | unsigned long lttng_log_level_rule_hash(const struct lttng_log_level_rule *log_level_rule); |
85b05318 | 56 | |
28f23191 JG |
57 | enum lttng_error_code lttng_log_level_rule_mi_serialize(const struct lttng_log_level_rule *rule, |
58 | struct mi_writer *writer); | |
6a751b95 | 59 | |
85b05318 | 60 | #endif /* LTTNG_LOG_LEVEL_RULE_INTERNAL_H */ |