MI: implement all objects related to trigger machine interface
[lttng-tools.git] / include / lttng / event-field-value.h
CommitLineData
d28fcdec
PP
1/*
2 * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_EVENT_FIELD_VALUE_H
9#define LTTNG_EVENT_FIELD_VALUE_H
10
11#include <stdint.h>
12
13struct lttng_event_field_value;
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*
20 * Types of a event field value expression.
21 */
22enum lttng_event_field_value_type {
23 /*
24 * Unknown.
25 */
26 LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN = -2,
27
28 /*
29 * Returned by lttng_event_field_value_get_type() with an
30 * invalid parameter.
31 */
32 LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID = -1,
33
34 /*
35 * Unsigned integer event field value.
36 */
37 LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT = 0,
38
39 /*
40 * Signed integer event field value.
41 */
42 LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT = 1,
43
44 /*
45 * Unsigned enumeration event field value.
46 *
47 * This type conceptually inherits
48 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT`.
49 */
50 LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM = 2,
51
52 /*
53 * Signed enumeration event field value.
54 *
55 * This type conceptually inherits
56 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT`.
57 */
58 LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM = 3,
59
60 /*
61 * Real event field value.
62 */
63 LTTNG_EVENT_FIELD_VALUE_TYPE_REAL = 4,
64
65 /*
66 * String event field value.
67 */
68 LTTNG_EVENT_FIELD_VALUE_TYPE_STRING = 5,
69
70 /*
71 * Array event field value.
72 */
73 LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY = 6,
74};
75
76/*
77 * Event field value API status codes.
78 */
79enum lttng_event_field_value_status {
80 /*
81 * Event field value is not available.
82 */
83 LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE = -2,
84
85 /*
86 * Invalid parameter.
87 */
88 LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID = -1,
89
90 /*
91 * Success.
92 */
93 LTTNG_EVENT_FIELD_VALUE_STATUS_OK = 0,
94};
95
96/*
97 * Returns the type of the event field value `field_val`, or:
98 *
99 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN`:
100 * The type of `field_val` is unknown as of this version of the
101 * LTTng control library.
102 *
103 * `LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID`:
104 * `field_val` is `NULL`.
105 */
106extern enum lttng_event_field_value_type lttng_event_field_value_get_type(
107 const struct lttng_event_field_value *field_val);
108
109/*
110 * Sets `*val` to the raw value of the unsigned integer/enumeration
111 * event field value `field_val`.
112 *
113 * Returns:
114 *
115 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
116 * Success.
117 *
118 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
119 * * `field_val` is `NULL`.
120 * * The type of `field_val` is not
121 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT` or
122 * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM`.
123 * * `val` is `NULL`.
124 */
125extern enum lttng_event_field_value_status
126lttng_event_field_value_unsigned_int_get_value(
127 const struct lttng_event_field_value *field_val, uint64_t *val);
128
129/*
130 * Sets `*val` to the raw value of the signed integer/enumeration event
131 * field value `field_val`.
132 *
133 * Returns:
134 *
135 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
136 * Success.
137 *
138 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
139 * * `field_val` is `NULL`.
140 * * The type of `field_val` is not
141 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT` or
142 * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM`.
143 * * `val` is `NULL`.
144 */
145extern enum lttng_event_field_value_status
146lttng_event_field_value_signed_int_get_value(
147 const struct lttng_event_field_value *field_val, int64_t *val);
148
149/*
150 * Sets `*val` to the raw value of the real event field value
151 * `field_val`.
152 *
153 * Returns:
154 *
155 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
156 * Success.
157 *
158 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
159 * * `field_val` is `NULL`.
160 * * The type of `field_val` is not
161 * `LTTNG_EVENT_FIELD_VALUE_TYPE_REAL`.
162 * * `val` is `NULL`.
163 */
164extern enum lttng_event_field_value_status
165lttng_event_field_value_real_get_value(
166 const struct lttng_event_field_value *field_val, double *val);
167
168/*
169 * Returns the raw value (an UTF-8 C string) of the string event field
170 * value `field_val`, or `NULL` if:
171 *
7c920b63
PP
172 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
173 * Success.
174 *
175 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
176 * * `field_val` is `NULL`.
177 * * The type of `field_val` is not
178 * `LTTNG_EVENT_FIELD_VALUE_TYPE_STRING`.
d28fcdec 179 */
7c920b63
PP
180extern enum lttng_event_field_value_status
181lttng_event_field_value_string_get_value(
182 const struct lttng_event_field_value *field_val,
183 const char **value);
d28fcdec
PP
184
185/*
186 * Sets `*length` to the length (the number of contained elements) of
187 * the array event field value `field_val`.
188 *
189 * Returns:
190 *
191 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
192 * Success.
193 *
194 * `LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID`:
195 * * `field_val` is `NULL`.
196 * * The type of `field_val` is not
197 * `LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY`.
198 * * `length` is `NULL`.
199 */
200extern enum lttng_event_field_value_status
201lttng_event_field_value_array_get_length(
202 const struct lttng_event_field_value *field_val,
203 unsigned int *length);
204
205/*
206 * Sets `*elem_field_val` to the event field value at index `index` in
207 * the array event field value `field_val`.
208 *
209 * Returns:
210 *
211 * `LTTNG_EVENT_FIELD_VALUE_STATUS_OK`:
212 * Success.
213 *
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().
220 *
221 * `LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE`:
222 * * No event field value exists at index `index` within
223 * `field_val`.
224 */
225extern enum lttng_event_field_value_status
226lttng_event_field_value_array_get_element_at_index(
227 const struct lttng_event_field_value *field_val,
228 unsigned int index,
229 const struct lttng_event_field_value **elem_field_val);
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* LTTNG_EVENT_FIELD_VALUE_H */
This page took 0.03191 seconds and 4 git commands to generate.