4 * Linux Trace Toolkit Control Library
6 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 * SPDX-License-Identifier: LGPL-2.1-only
12 #ifndef LTTNG_EVENT_INTERNAL_H
13 #define LTTNG_EVENT_INTERNAL_H
15 #include <common/macros.h>
16 #include <lttng/event.h>
17 #include <lttng/lttng-error.h>
19 struct lttng_event_exclusion
;
20 struct lttng_userspace_probe_location
;
21 struct lttng_dynamic_buffer
;
22 struct lttng_buffer_view
;
24 struct lttng_event_comm
{
33 /* Includes terminator `\0`. */
35 uint32_t exclusion_count
;
36 /* Includes terminator `\0`. */
37 uint32_t filter_expression_len
;
38 uint32_t bytecode_len
;
40 /* Type specific payload. */
41 uint32_t userspace_probe_location_len
;
42 uint32_t lttng_event_probe_attr_len
;
43 uint32_t lttng_event_function_attr_len
;
49 * - char filter_expression[filter_expression_len],
50 * - unsigned char filter_bytecode[bytecode_len],
51 * - userspace probe location [userspace_probe_location_len],
52 * - probe or ftrace based on event type.
58 struct lttng_event_exclusion_comm
{
59 /* Includes terminator `\0`. */
64 struct lttng_event_probe_attr_comm
{
67 /* Includes terminator `\0`. */
68 uint32_t symbol_name_len
;
73 struct lttng_event_function_attr_comm
{
74 /* Includes terminator `\0`. */
75 uint32_t symbol_name_len
;
80 struct lttng_event_context_comm
{
83 * Depending on the type.
85 * - LTTNG_EVENT_CONTEXT_APP_CONTEXT.
87 * -> struct lttng_event_context_app_comm
90 * - LTTNG_EVENT_CONTEXT_PERF_COUNTER,
91 * - LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER,
92 * - LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER.
94 * -> struct lttng_event_context_perf_counter_comm
96 * Other type -> no payload.
101 struct lttng_event_context_perf_counter_comm
{
104 /* Includes terminator `\0`. */
107 * char name [name_len]
112 struct lttng_event_context_app_comm
{
113 /* Includes terminator `\0`. */
114 uint32_t provider_name_len
;
115 /* Includes terminator `\0`. */
116 uint32_t ctx_name_len
;
118 * provider name [provider_name_len]
119 * ctx name [ctx_name_len]
124 struct lttng_event_field_comm
{
127 /* Includes terminator `\0`. */
133 * - lttng_event object
138 struct lttng_event_extended
{
140 * exclusions and filter_expression are only set when the lttng_event
141 * was created/allocated by a list operation. These two elements must
142 * not be free'd as they are part of the same contiguous buffer that
143 * contains all events returned by the listing.
145 char *filter_expression
;
148 /* Array of strings of fixed LTTNG_SYMBOL_NAME_LEN length. */
151 struct lttng_userspace_probe_location
*probe_location
;
155 struct lttng_event
*lttng_event_copy(const struct lttng_event
*event
);
157 ssize_t
lttng_event_create_from_payload(struct lttng_payload_view
*view
,
158 struct lttng_event
**out_event
,
159 struct lttng_event_exclusion
**out_exclusion
,
160 char **out_filter_expression
,
161 struct lttng_bytecode
**out_bytecode
);
163 int lttng_event_serialize(const struct lttng_event
*event
,
164 unsigned int exclusion_count
,
165 char **exclusion_list
,
166 char *filter_expression
,
168 struct lttng_bytecode
*bytecode
,
169 struct lttng_payload
*payload
);
171 ssize_t
lttng_event_context_create_from_payload(
172 struct lttng_payload_view
*view
,
173 struct lttng_event_context
**event_ctx
);
175 int lttng_event_context_serialize(struct lttng_event_context
*context
,
176 struct lttng_payload
*payload
);
178 void lttng_event_context_destroy(struct lttng_event_context
*context
);
180 enum lttng_error_code
lttng_events_create_and_flatten_from_payload(
181 struct lttng_payload_view
*view
,
183 struct lttng_event
**events
);
185 ssize_t
lttng_event_field_create_from_payload(
186 struct lttng_payload_view
*view
,
187 struct lttng_event_field
**field
);
189 int lttng_event_field_serialize(const struct lttng_event_field
*field
,
190 struct lttng_payload
*payload
);
192 enum lttng_error_code
lttng_event_fields_create_and_flatten_from_payload(
193 struct lttng_payload_view
*view
,
195 struct lttng_event_field
**fields
);
197 #endif /* LTTNG_EVENT_INTERNAL_H */