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 | ||
11 | #include <stdint.h> | |
12 | ||
13 | #include <common/buffer-view.h> | |
14 | #include <common/dynamic-array.h> | |
15 | #include <common/macros.h> | |
16 | #include <common/payload-view.h> | |
17 | #include <common/payload.h> | |
18 | #include <lttng/event.h> | |
19 | #include <lttng/log-level-rule.h> | |
740da7d5 | 20 | #include <lttng/lttng-error.h> |
85b05318 | 21 | |
7966af57 SM |
22 | #ifdef __cplusplus |
23 | extern "C" { | |
24 | #endif | |
25 | ||
6a751b95 JR |
26 | struct mi_writer; |
27 | ||
85b05318 JR |
28 | /* |
29 | * For now only a single backing struct is used for both type of log level | |
30 | * rule (exactly, as_severe) since both only have require "level" as property. | |
31 | */ | |
32 | struct lttng_log_level_rule { | |
33 | enum lttng_log_level_rule_type type; | |
34 | int level; | |
35 | }; | |
36 | ||
37 | struct lttng_log_level_rule_comm { | |
38 | /* enum lttng_log_level_rule_type */ | |
39 | int8_t type; | |
40 | int32_t level; | |
41 | }; | |
42 | ||
85b05318 JR |
43 | ssize_t lttng_log_level_rule_create_from_payload( |
44 | struct lttng_payload_view *view, | |
45 | struct lttng_log_level_rule **rule); | |
46 | ||
85b05318 JR |
47 | int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule, |
48 | struct lttng_payload *payload); | |
49 | ||
85b05318 JR |
50 | bool lttng_log_level_rule_is_equal(const struct lttng_log_level_rule *a, |
51 | const struct lttng_log_level_rule *b); | |
52 | ||
85b05318 JR |
53 | struct lttng_log_level_rule *lttng_log_level_rule_copy( |
54 | const struct lttng_log_level_rule *source); | |
55 | ||
85b05318 JR |
56 | void lttng_log_level_rule_to_loglevel( |
57 | const struct lttng_log_level_rule *log_level_rule, | |
58 | enum lttng_loglevel_type *loglevel_type, | |
59 | int *loglevel_value); | |
60 | ||
85b05318 JR |
61 | unsigned long lttng_log_level_rule_hash( |
62 | const struct lttng_log_level_rule *log_level_rule); | |
63 | ||
6a751b95 JR |
64 | enum lttng_error_code lttng_log_level_rule_mi_serialize( |
65 | const struct lttng_log_level_rule *rule, | |
66 | struct mi_writer *writer); | |
67 | ||
7966af57 SM |
68 | #ifdef __cplusplus |
69 | } | |
70 | #endif | |
71 | ||
85b05318 | 72 | #endif /* LTTNG_LOG_LEVEL_RULE_INTERNAL_H */ |