Commit | Line | Data |
---|---|---|
53569322 | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: MIT |
53569322 | 3 | * |
c0c0989a | 4 | * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
28b9540b MJ |
5 | * |
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. | |
53569322 MD |
9 | */ |
10 | ||
c0c0989a MJ |
11 | #ifndef _LTTNG_UST_CONTEXT_PROVIDER_H |
12 | #define _LTTNG_UST_CONTEXT_PROVIDER_H | |
13 | ||
b4051ad8 | 14 | #include <stddef.h> |
53569322 MD |
15 | #include <lttng/ust-events.h> |
16 | #include <urcu/hlist.h> | |
17 | ||
18 | struct lttng_ust_context_provider { | |
19 | char *name; | |
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; | |
27 | }; | |
28 | ||
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); | |
31 | ||
32 | int lttng_context_is_app(const char *name); | |
33 | ||
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)); | |
41 | ||
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, | |
44 | const char *name, | |
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); | |
53 | ||
54 | #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */ |