Commit | Line | Data |
---|---|---|
57553dfd MD |
1 | // SPDX-License-Identifier: MIT |
2 | /* | |
3 | * Copyright 2022-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | */ | |
5 | ||
b8dfb348 MD |
6 | #ifndef SIDE_ABI_EVENT_DESCRIPTION_H |
7 | #define SIDE_ABI_EVENT_DESCRIPTION_H | |
57553dfd MD |
8 | |
9 | #include <stdint.h> | |
10 | #include <side/macros.h> | |
11 | #include <side/endian.h> | |
12 | ||
35e4f870 MD |
13 | /* |
14 | * SIDE ABI event description. | |
15 | * | |
16 | * The extensibility scheme for the SIDE ABI event description is as | |
17 | * follows: | |
18 | * | |
19 | * * Changing the semantic of the existing event description fields is a | |
20 | * breaking ABI change: the SIDE_EVENT_DESCRIPTION_ABI_VERSION should | |
21 | * be increased to reflect this. | |
22 | * | |
23 | * * Event descriptions can be extended by adding fields at the end of | |
24 | * the structure. The "struct side_event_description" is a structure | |
25 | * with flexible size which must not be used within arrays. | |
26 | */ | |
27 | ||
57553dfd MD |
28 | #define SIDE_EVENT_DESCRIPTION_ABI_VERSION 0 |
29 | ||
30 | enum side_event_flags { | |
31 | SIDE_EVENT_FLAG_VARIADIC = (1 << 0), | |
32 | }; | |
33 | ||
34 | enum side_loglevel { | |
35 | SIDE_LOGLEVEL_EMERG = 0, | |
36 | SIDE_LOGLEVEL_ALERT = 1, | |
37 | SIDE_LOGLEVEL_CRIT = 2, | |
38 | SIDE_LOGLEVEL_ERR = 3, | |
39 | SIDE_LOGLEVEL_WARNING = 4, | |
40 | SIDE_LOGLEVEL_NOTICE = 5, | |
41 | SIDE_LOGLEVEL_INFO = 6, | |
42 | SIDE_LOGLEVEL_DEBUG = 7, | |
43 | }; | |
44 | ||
45 | struct side_event_description { | |
46 | uint32_t struct_size; /* Size of this structure. */ | |
47 | uint32_t version; /* Event description ABI version. */ | |
48 | ||
49 | side_ptr_t(struct side_event_state) state; | |
50 | side_ptr_t(const char) provider_name; | |
51 | side_ptr_t(const char) event_name; | |
52 | side_ptr_t(const struct side_event_field) fields; | |
53 | side_ptr_t(const struct side_attr) attr; | |
54 | uint64_t flags; /* Bitwise OR of enum side_event_flags */ | |
55 | uint16_t nr_side_type_label; | |
56 | uint16_t nr_side_attr_type; | |
57 | side_enum_t(enum side_loglevel, uint32_t) loglevel; | |
58 | uint32_t nr_fields; | |
59 | uint32_t nr_attr; | |
3cac1780 | 60 | #define side_event_description_orig_abi_last nr_attr |
57553dfd MD |
61 | /* End of fields supported in the original ABI. */ |
62 | ||
63 | char end[]; /* End with a flexible array to account for extensibility. */ | |
64 | } SIDE_PACKED; | |
65 | ||
b8dfb348 | 66 | #endif /* SIDE_ABI_EVENT_DESCRIPTION_H */ |