2 * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_EVENT_FIELD_VALUE_H
9 #define LTTNG_EVENT_FIELD_VALUE_H
11 #include <lttng/lttng-export.h>
15 struct lttng_event_field_value
;
22 * Types of a event field value expression.
24 enum lttng_event_field_value_type
{
28 LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN
= -2,
31 * Returned by lttng_event_field_value_get_type() with an
34 LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID
= -1,
37 * Unsigned integer event field value.
39 LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT
= 0,
42 * Signed integer event field value.
44 LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT
= 1,
47 * Unsigned enumeration event field value.
49 * This type conceptually inherits
50 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT`.
52 LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM
= 2,
55 * Signed enumeration event field value.
57 * This type conceptually inherits
58 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT`.
60 LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM
= 3,
63 * Real event field value.
65 LTTNG_EVENT_FIELD_VALUE_TYPE_REAL
= 4,
68 * String event field value.
70 LTTNG_EVENT_FIELD_VALUE_TYPE_STRING
= 5,
73 * Array event field value.
75 LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY
= 6,
79 * Event field value API status codes.
81 enum lttng_event_field_value_status
{
83 * Event field value is not available.
85 LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE
= -2,
90 LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID
= -1,
95 LTTNG_EVENT_FIELD_VALUE_STATUS_OK
= 0,
99 * Returns the type of the event field value `field_val`, or:
101 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN`:
102 * The type of `field_val` is unknown as of this version of the
103 * LTTng control library.
105 * `LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID`:
106 * `field_val` is `NULL`.
108 LTTNG_EXPORT
extern enum lttng_event_field_value_type
109 lttng_event_field_value_get_type(const struct lttng_event_field_value
*field_val
);
112 * Sets `*val` to the raw value of the unsigned integer/enumeration
113 * event field value `field_val`.
117 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
120 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
121 * * `field_val` is `NULL`.
122 * * The type of `field_val` is not
123 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT` or
124 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM`.
127 LTTNG_EXPORT
extern enum lttng_event_field_value_status
128 lttng_event_field_value_unsigned_int_get_value(const struct lttng_event_field_value
*field_val
,
132 * Sets `*val` to the raw value of the signed integer/enumeration event
133 * field value `field_val`.
137 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
140 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
141 * * `field_val` is `NULL`.
142 * * The type of `field_val` is not
143 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT` or
144 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM`.
147 LTTNG_EXPORT
extern enum lttng_event_field_value_status
148 lttng_event_field_value_signed_int_get_value(const struct lttng_event_field_value
*field_val
,
152 * Sets `*val` to the raw value of the real event field value
157 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
160 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
161 * * `field_val` is `NULL`.
162 * * The type of `field_val` is not
163 * `LTTNG_EVENT_FIELD_VALUE_TYPE_REAL`.
166 LTTNG_EXPORT
extern enum lttng_event_field_value_status
167 lttng_event_field_value_real_get_value(const struct lttng_event_field_value
*field_val
,
171 * Returns the raw value (an UTF-8 C string) of the string event field
172 * value `field_val`, or `NULL` if:
174 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
177 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
178 * * `field_val` is `NULL`.
179 * * The type of `field_val` is not
180 * `LTTNG_EVENT_FIELD_VALUE_TYPE_STRING`.
182 LTTNG_EXPORT
extern enum lttng_event_field_value_status
183 lttng_event_field_value_string_get_value(const struct lttng_event_field_value
*field_val
,
187 * Sets `*length` to the length (the number of contained elements) of
188 * the array event field value `field_val`.
192 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
195 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
196 * * `field_val` is `NULL`.
197 * * The type of `field_val` is not
198 * `LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY`.
199 * * `length` is `NULL`.
201 LTTNG_EXPORT
extern enum lttng_event_field_value_status
202 lttng_event_field_value_array_get_length(const struct lttng_event_field_value
*field_val
,
203 unsigned int *length
);
206 * Sets `*elem_field_val` to the event field value at index `index` in
207 * the array event field value `field_val`.
211 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
214 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
215 * * `field_val` is `NULL`.
216 * * The type of `field_val` is not
217 * `LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY`.
218 * * `index` is greater than or equal to the length of `field_val`,
219 * as returned by lttng_event_field_value_array_get_length().
221 * `LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE`:
222 * * No event field value exists at index `index` within
225 LTTNG_EXPORT
extern enum lttng_event_field_value_status
226 lttng_event_field_value_array_get_element_at_index(
227 const struct lttng_event_field_value
*field_val
,
229 const struct lttng_event_field_value
**elem_field_val
);
235 #endif /* LTTNG_EVENT_FIELD_VALUE_H */