2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 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>
16 #include <urcu/hlist.h>
18 struct lttng_ust_context_provider
{
20 size_t (*get_size
)(struct lttng_ctx_field
*field
, size_t offset
);
21 void (*record
)(struct lttng_ctx_field
*field
,
22 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
23 struct lttng_channel
*chan
);
24 void (*get_value
)(struct lttng_ctx_field
*field
,
25 struct lttng_ctx_value
*value
);
26 struct cds_hlist_node node
;
29 int lttng_ust_context_provider_register(struct lttng_ust_context_provider
*provider
);
30 void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider
*provider
);
32 int lttng_context_is_app(const char *name
);
34 void lttng_ust_context_set_session_provider(const char *name
,
35 size_t (*get_size
)(struct lttng_ctx_field
*field
, size_t offset
),
36 void (*record
)(struct lttng_ctx_field
*field
,
37 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
38 struct lttng_channel
*chan
),
39 void (*get_value
)(struct lttng_ctx_field
*field
,
40 struct lttng_ctx_value
*value
));
42 int lttng_ust_add_app_context_to_ctx_rcu(const char *name
, struct lttng_ctx
**ctx
);
43 int lttng_ust_context_set_provider_rcu(struct lttng_ctx
**_ctx
,
45 size_t (*get_size
)(struct lttng_ctx_field
*field
, size_t offset
),
46 void (*record
)(struct lttng_ctx_field
*field
,
47 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
48 struct lttng_channel
*chan
),
49 void (*get_value
)(struct lttng_ctx_field
*field
,
50 struct lttng_ctx_value
*value
));
51 int lttng_context_add_rcu(struct lttng_ctx
**ctx_p
,
52 const struct lttng_ctx_field
*f
);
54 #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */