Commit | Line | Data |
---|---|---|
46bd0f2b | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
46bd0f2b | 3 | * |
0235b0db | 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
46bd0f2b JG |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE2_CTF_WRITER_EVENT_H |
8 | #define BABELTRACE2_CTF_WRITER_EVENT_H | |
9 | ||
217cf9d3 | 10 | #include <babeltrace2-ctf-writer/object.h> |
8c18d80b PP |
11 | |
12 | #ifdef __cplusplus | |
13 | extern "C" { | |
14 | #endif | |
15 | ||
3dca2276 PP |
16 | struct bt_ctf_event; |
17 | struct bt_ctf_event_class; | |
18 | struct bt_ctf_stream; | |
19 | struct bt_ctf_field; | |
20 | struct bt_ctf_field_type; | |
8c18d80b | 21 | |
3dca2276 PP |
22 | enum bt_ctf_event_class_log_level { |
23 | /// Unknown, used for errors. | |
16ca5ff0 | 24 | BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1, |
3dca2276 PP |
25 | |
26 | /// Unspecified log level. | |
16ca5ff0 | 27 | BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255, |
3dca2276 PP |
28 | |
29 | /// System is unusable. | |
16ca5ff0 | 30 | BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0, |
3dca2276 PP |
31 | |
32 | /// Action must be taken immediately. | |
16ca5ff0 | 33 | BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1, |
3dca2276 PP |
34 | |
35 | /// Critical conditions. | |
16ca5ff0 | 36 | BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2, |
3dca2276 PP |
37 | |
38 | /// Error conditions. | |
16ca5ff0 | 39 | BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3, |
3dca2276 PP |
40 | |
41 | /// Warning conditions. | |
16ca5ff0 | 42 | BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4, |
3dca2276 PP |
43 | |
44 | /// Normal, but significant, condition. | |
16ca5ff0 | 45 | BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5, |
3dca2276 PP |
46 | |
47 | /// Informational message. | |
16ca5ff0 | 48 | BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6, |
3dca2276 PP |
49 | |
50 | /// Debug information with system-level scope (set of programs). | |
16ca5ff0 | 51 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7, |
3dca2276 PP |
52 | |
53 | /// Debug information with program-level scope (set of processes). | |
16ca5ff0 | 54 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8, |
3dca2276 PP |
55 | |
56 | /// Debug information with process-level scope (set of modules). | |
16ca5ff0 | 57 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9, |
3dca2276 PP |
58 | |
59 | /// Debug information with module (executable/library) scope (set of units). | |
16ca5ff0 | 60 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10, |
3dca2276 PP |
61 | |
62 | /// Debug information with compilation unit scope (set of functions). | |
16ca5ff0 | 63 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11, |
3dca2276 PP |
64 | |
65 | /// Debug information with function-level scope. | |
16ca5ff0 | 66 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12, |
3dca2276 PP |
67 | |
68 | /// Debug information with line-level scope (default log level). | |
16ca5ff0 | 69 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13, |
3dca2276 PP |
70 | |
71 | /// Debug-level message. | |
16ca5ff0 | 72 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14, |
3dca2276 PP |
73 | }; |
74 | ||
75 | extern struct bt_ctf_event *bt_ctf_event_create( | |
76 | struct bt_ctf_event_class *event_class); | |
77 | ||
78 | extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, | |
79 | const char *name); | |
80 | ||
81 | extern int bt_ctf_event_set_payload(struct bt_ctf_event *event, | |
82 | const char *name, struct bt_ctf_field *field); | |
83 | ||
84 | extern struct bt_ctf_field *bt_ctf_event_get_payload_field( | |
85 | struct bt_ctf_event *event); | |
86 | ||
87 | extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event, | |
88 | struct bt_ctf_field *field); | |
89 | ||
90 | extern int bt_ctf_event_set_context(struct bt_ctf_event *event, | |
91 | struct bt_ctf_field *field); | |
92 | ||
93 | extern struct bt_ctf_field *bt_ctf_event_get_context( | |
94 | struct bt_ctf_event *event); | |
95 | ||
96 | extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, | |
97 | struct bt_ctf_field *field); | |
98 | ||
99 | extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context( | |
100 | struct bt_ctf_event *event); | |
101 | ||
102 | extern int bt_ctf_event_set_header(struct bt_ctf_event *event, | |
103 | struct bt_ctf_field *field); | |
104 | ||
105 | extern struct bt_ctf_field *bt_ctf_event_get_header( | |
106 | struct bt_ctf_event *event); | |
107 | ||
108 | extern struct bt_ctf_stream *bt_ctf_event_get_stream( | |
109 | struct bt_ctf_event *event); | |
110 | ||
111 | extern struct bt_ctf_event_class *bt_ctf_event_get_class( | |
112 | struct bt_ctf_event *event); | |
113 | ||
114 | /* Pre-2.0 CTF writer compatibility */ | |
115 | static inline | |
116 | void bt_ctf_event_get(struct bt_ctf_event *event) | |
117 | { | |
e1e02a22 | 118 | bt_ctf_object_get_ref(event); |
3dca2276 PP |
119 | } |
120 | ||
121 | /* Pre-2.0 CTF writer compatibility */ | |
122 | static inline | |
123 | void bt_ctf_event_put(struct bt_ctf_event *event) | |
124 | { | |
e1e02a22 | 125 | bt_ctf_object_put_ref(event); |
3dca2276 PP |
126 | } |
127 | ||
128 | extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name); | |
129 | ||
130 | extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class( | |
131 | struct bt_ctf_event_class *event_class); | |
132 | ||
133 | extern const char *bt_ctf_event_class_get_name( | |
134 | struct bt_ctf_event_class *event_class); | |
135 | ||
136 | extern int64_t bt_ctf_event_class_get_id( | |
137 | struct bt_ctf_event_class *event_class); | |
138 | ||
139 | extern int bt_ctf_event_class_set_id( | |
140 | struct bt_ctf_event_class *event_class, uint64_t id); | |
141 | ||
142 | extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( | |
143 | struct bt_ctf_event_class *event_class); | |
144 | ||
145 | extern int bt_ctf_event_class_set_log_level( | |
146 | struct bt_ctf_event_class *event_class, | |
147 | enum bt_ctf_event_class_log_level log_level); | |
148 | ||
149 | extern const char *bt_ctf_event_class_get_emf_uri( | |
150 | struct bt_ctf_event_class *event_class); | |
151 | ||
152 | extern int bt_ctf_event_class_set_emf_uri( | |
153 | struct bt_ctf_event_class *event_class, | |
154 | const char *emf_uri); | |
155 | ||
156 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type( | |
157 | struct bt_ctf_event_class *event_class); | |
158 | ||
159 | extern int bt_ctf_event_class_set_context_field_type( | |
160 | struct bt_ctf_event_class *event_class, | |
161 | struct bt_ctf_field_type *context_type); | |
162 | ||
163 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type( | |
164 | struct bt_ctf_event_class *event_class); | |
165 | ||
7c7301d5 SM |
166 | extern int64_t bt_ctf_event_class_get_payload_type_field_count( |
167 | struct bt_ctf_event_class *event_class); | |
168 | ||
169 | extern int bt_ctf_event_class_get_payload_type_field_by_index( | |
170 | struct bt_ctf_event_class *event_class, | |
171 | const char **field_name, struct bt_ctf_field_type **field_type, | |
172 | uint64_t index); | |
173 | ||
174 | extern struct bt_ctf_field_type * | |
175 | bt_ctf_event_class_get_payload_type_field_type_by_name( | |
176 | struct bt_ctf_event_class *event_class, const char *name); | |
177 | ||
3dca2276 PP |
178 | extern int bt_ctf_event_class_set_payload_field_type( |
179 | struct bt_ctf_event_class *event_class, | |
180 | struct bt_ctf_field_type *payload_type); | |
181 | ||
182 | extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, | |
183 | struct bt_ctf_field_type *field_type, | |
184 | const char *name); | |
185 | ||
186 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( | |
187 | struct bt_ctf_event_class *event_class, const char *name); | |
188 | ||
189 | /* Pre-2.0 CTF writer compatibility */ | |
190 | static inline | |
191 | void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class) | |
192 | { | |
e1e02a22 | 193 | bt_ctf_object_get_ref(event_class); |
3dca2276 PP |
194 | } |
195 | ||
196 | /* Pre-2.0 CTF writer compatibility */ | |
197 | static inline | |
198 | void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class) | |
199 | { | |
e1e02a22 | 200 | bt_ctf_object_put_ref(event_class); |
3dca2276 | 201 | } |
8c18d80b PP |
202 | |
203 | #ifdef __cplusplus | |
204 | } | |
205 | #endif | |
206 | ||
924dc299 | 207 | #endif /* BABELTRACE2_CTF_WRITER_EVENT_H */ |