Move to kernel style SPDX license identifiers
[babeltrace.git] / include / babeltrace2-ctf-writer / event.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5 */
6
7 #ifndef BABELTRACE2_CTF_WRITER_EVENT_H
8 #define BABELTRACE2_CTF_WRITER_EVENT_H
9
10 #include <babeltrace2-ctf-writer/object.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
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;
21
22 enum bt_ctf_event_class_log_level {
23 /// Unknown, used for errors.
24 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
25
26 /// Unspecified log level.
27 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
28
29 /// System is unusable.
30 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
31
32 /// Action must be taken immediately.
33 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
34
35 /// Critical conditions.
36 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
37
38 /// Error conditions.
39 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
40
41 /// Warning conditions.
42 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
43
44 /// Normal, but significant, condition.
45 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
46
47 /// Informational message.
48 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
49
50 /// Debug information with system-level scope (set of programs).
51 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
52
53 /// Debug information with program-level scope (set of processes).
54 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
55
56 /// Debug information with process-level scope (set of modules).
57 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
58
59 /// Debug information with module (executable/library) scope (set of units).
60 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
61
62 /// Debug information with compilation unit scope (set of functions).
63 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
64
65 /// Debug information with function-level scope.
66 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
67
68 /// Debug information with line-level scope (default log level).
69 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
70
71 /// Debug-level message.
72 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
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 {
118 bt_ctf_object_get_ref(event);
119 }
120
121 /* Pre-2.0 CTF writer compatibility */
122 static inline
123 void bt_ctf_event_put(struct bt_ctf_event *event)
124 {
125 bt_ctf_object_put_ref(event);
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
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
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 {
193 bt_ctf_object_get_ref(event_class);
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 {
200 bt_ctf_object_put_ref(event_class);
201 }
202
203 #ifdef __cplusplus
204 }
205 #endif
206
207 #endif /* BABELTRACE2_CTF_WRITER_EVENT_H */
This page took 0.033742 seconds and 4 git commands to generate.