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