1 #ifndef BABELTRACE2_CTF_WRITER_EVENT_H
2 #define BABELTRACE2_CTF_WRITER_EVENT_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #include <babeltrace2/ctf-writer/object.h>
33 struct bt_ctf_event_class
;
36 struct bt_ctf_field_type
;
38 enum bt_ctf_event_class_log_level
{
39 /// Unknown, used for errors.
40 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN
= -1,
42 /// Unspecified log level.
43 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED
= 255,
45 /// System is unusable.
46 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY
= 0,
48 /// Action must be taken immediately.
49 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT
= 1,
51 /// Critical conditions.
52 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL
= 2,
55 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR
= 3,
57 /// Warning conditions.
58 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING
= 4,
60 /// Normal, but significant, condition.
61 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE
= 5,
63 /// Informational message.
64 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO
= 6,
66 /// Debug information with system-level scope (set of programs).
67 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM
= 7,
69 /// Debug information with program-level scope (set of processes).
70 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM
= 8,
72 /// Debug information with process-level scope (set of modules).
73 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS
= 9,
75 /// Debug information with module (executable/library) scope (set of units).
76 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE
= 10,
78 /// Debug information with compilation unit scope (set of functions).
79 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT
= 11,
81 /// Debug information with function-level scope.
82 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION
= 12,
84 /// Debug information with line-level scope (default log level).
85 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE
= 13,
87 /// Debug-level message.
88 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG
= 14,
91 extern struct bt_ctf_event
*bt_ctf_event_create(
92 struct bt_ctf_event_class
*event_class
);
94 extern struct bt_ctf_field
*bt_ctf_event_get_payload(struct bt_ctf_event
*event
,
97 extern int bt_ctf_event_set_payload(struct bt_ctf_event
*event
,
98 const char *name
, struct bt_ctf_field
*field
);
100 extern struct bt_ctf_field
*bt_ctf_event_get_payload_field(
101 struct bt_ctf_event
*event
);
103 extern int bt_ctf_event_set_payload_field(struct bt_ctf_event
*event
,
104 struct bt_ctf_field
*field
);
106 extern int bt_ctf_event_set_context(struct bt_ctf_event
*event
,
107 struct bt_ctf_field
*field
);
109 extern struct bt_ctf_field
*bt_ctf_event_get_context(
110 struct bt_ctf_event
*event
);
112 extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event
*event
,
113 struct bt_ctf_field
*field
);
115 extern struct bt_ctf_field
*bt_ctf_event_get_stream_event_context(
116 struct bt_ctf_event
*event
);
118 extern int bt_ctf_event_set_header(struct bt_ctf_event
*event
,
119 struct bt_ctf_field
*field
);
121 extern struct bt_ctf_field
*bt_ctf_event_get_header(
122 struct bt_ctf_event
*event
);
124 extern struct bt_ctf_stream
*bt_ctf_event_get_stream(
125 struct bt_ctf_event
*event
);
127 extern struct bt_ctf_event_class
*bt_ctf_event_get_class(
128 struct bt_ctf_event
*event
);
130 /* Pre-2.0 CTF writer compatibility */
132 void bt_ctf_event_get(struct bt_ctf_event
*event
)
134 bt_ctf_object_get_ref(event
);
137 /* Pre-2.0 CTF writer compatibility */
139 void bt_ctf_event_put(struct bt_ctf_event
*event
)
141 bt_ctf_object_put_ref(event
);
144 extern struct bt_ctf_event_class
*bt_ctf_event_class_create(const char *name
);
146 extern struct bt_ctf_stream_class
*bt_ctf_event_class_get_stream_class(
147 struct bt_ctf_event_class
*event_class
);
149 extern const char *bt_ctf_event_class_get_name(
150 struct bt_ctf_event_class
*event_class
);
152 extern int64_t bt_ctf_event_class_get_id(
153 struct bt_ctf_event_class
*event_class
);
155 extern int bt_ctf_event_class_set_id(
156 struct bt_ctf_event_class
*event_class
, uint64_t id
);
158 extern enum bt_ctf_event_class_log_level
bt_ctf_event_class_get_log_level(
159 struct bt_ctf_event_class
*event_class
);
161 extern int bt_ctf_event_class_set_log_level(
162 struct bt_ctf_event_class
*event_class
,
163 enum bt_ctf_event_class_log_level log_level
);
165 extern const char *bt_ctf_event_class_get_emf_uri(
166 struct bt_ctf_event_class
*event_class
);
168 extern int bt_ctf_event_class_set_emf_uri(
169 struct bt_ctf_event_class
*event_class
,
170 const char *emf_uri
);
172 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_context_field_type(
173 struct bt_ctf_event_class
*event_class
);
175 extern int bt_ctf_event_class_set_context_field_type(
176 struct bt_ctf_event_class
*event_class
,
177 struct bt_ctf_field_type
*context_type
);
179 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_payload_field_type(
180 struct bt_ctf_event_class
*event_class
);
182 extern int bt_ctf_event_class_set_payload_field_type(
183 struct bt_ctf_event_class
*event_class
,
184 struct bt_ctf_field_type
*payload_type
);
186 extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class
*event_class
,
187 struct bt_ctf_field_type
*field_type
,
190 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_field_by_name(
191 struct bt_ctf_event_class
*event_class
, const char *name
);
193 /* Pre-2.0 CTF writer compatibility */
195 void bt_ctf_event_class_get(struct bt_ctf_event_class
*event_class
)
197 bt_ctf_object_get_ref(event_class
);
200 /* Pre-2.0 CTF writer compatibility */
202 void bt_ctf_event_class_put(struct bt_ctf_event_class
*event_class
)
204 bt_ctf_object_put_ref(event_class
);
211 #endif /* BABELTRACE2_CTF_WRITER_EVENT_H */