2 * SPDX-License-Identifier: MIT
4 * SPDX-FileCopyrightText: 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * The context provider feature is part of the ABI and used by the Java jni
7 * interface. This header should be moved to the public header directory once
8 * some test code and documentation is written.
11 #ifndef _LTTNG_UST_CONTEXT_PROVIDER_H
12 #define _LTTNG_UST_CONTEXT_PROVIDER_H
15 #include <lttng/ust-events.h>
17 enum lttng_ust_dynamic_type
{
18 LTTNG_UST_DYNAMIC_TYPE_NONE
,
19 LTTNG_UST_DYNAMIC_TYPE_S8
,
20 LTTNG_UST_DYNAMIC_TYPE_S16
,
21 LTTNG_UST_DYNAMIC_TYPE_S32
,
22 LTTNG_UST_DYNAMIC_TYPE_S64
,
23 LTTNG_UST_DYNAMIC_TYPE_U8
,
24 LTTNG_UST_DYNAMIC_TYPE_U16
,
25 LTTNG_UST_DYNAMIC_TYPE_U32
,
26 LTTNG_UST_DYNAMIC_TYPE_U64
,
27 LTTNG_UST_DYNAMIC_TYPE_FLOAT
,
28 LTTNG_UST_DYNAMIC_TYPE_DOUBLE
,
29 LTTNG_UST_DYNAMIC_TYPE_STRING
,
30 _NR_LTTNG_UST_DYNAMIC_TYPES
,
33 int lttng_ust_dynamic_type_choices(size_t *nr_choices
,
34 const struct lttng_ust_event_field
* const **choices
)
35 __attribute__((visibility("hidden")));
37 const struct lttng_ust_event_field
*lttng_ust_dynamic_type_field(int64_t value
)
38 __attribute__((visibility("hidden")));
40 const struct lttng_ust_event_field
*lttng_ust_dynamic_type_tag_field(void)
41 __attribute__((visibility("hidden")));
43 struct lttng_ust_registered_context_provider
;
44 struct lttng_ust_probe_ctx
;
49 * IMPORTANT: this structure is part of the ABI between the probe and
50 * UST. Additional selectors may be added in the future, mapping to new
51 * union fields, which means the overall size of this structure may
52 * increase. This means this structure should never be nested within a
53 * public structure interface, nor embedded in an array.
56 struct lttng_ust_ctx_value
{
57 enum lttng_ust_dynamic_type sel
; /* Type selector */
69 * IMPORTANT: this structure is part of the ABI between the probe and
70 * UST. Fields need to be only added at the end, never reordered, never
73 * The field @struct_size should be used to determine the size of the
74 * structure. It should be queried before using additional fields added
75 * at the end of the structure.
78 struct lttng_ust_context_provider
{
82 size_t (*get_size
)(void *priv
, struct lttng_ust_probe_ctx
*probe_ctx
,
84 void (*record
)(void *priv
, struct lttng_ust_probe_ctx
*probe_ctx
,
85 struct lttng_ust_ring_buffer_ctx
*ctx
,
86 struct lttng_ust_channel_buffer
*chan
);
87 void (*get_value
)(void *priv
, struct lttng_ust_probe_ctx
*probe_ctx
,
88 struct lttng_ust_ctx_value
*value
);
91 /* End of base ABI. Fields below should be used after checking struct_size. */
95 * Application context callback private data
97 * IMPORTANT: this structure is part of the ABI between the probe and
98 * UST. Fields need to be only added at the end, never reordered, never
101 * The field @struct_size should be used to determine the size of the
102 * structure. It should be queried before using additional fields added
103 * at the end of the structure.
106 struct lttng_ust_app_context
{
107 uint32_t struct_size
;
109 struct lttng_ust_event_field
*event_field
;
112 /* End of base ABI. Fields below should be used after checking struct_size. */
116 * Returns an opaque pointer on success, which must be passed to
117 * lttng_ust_context_provider_unregister for unregistration. Returns
120 struct lttng_ust_registered_context_provider
*lttng_ust_context_provider_register(struct lttng_ust_context_provider
*provider
);
122 void lttng_ust_context_provider_unregister(struct lttng_ust_registered_context_provider
*reg_provider
);
124 #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */