| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #ifndef _LTTNG_UST_CONTEXT_PROVIDER_H |
| 12 | #define _LTTNG_UST_CONTEXT_PROVIDER_H |
| 13 | |
| 14 | #include <stddef.h> |
| 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 | void lttng_ust_context_set_session_provider(const char *name, |
| 33 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset), |
| 34 | void (*record)(struct lttng_ctx_field *field, |
| 35 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 36 | struct lttng_channel *chan), |
| 37 | void (*get_value)(struct lttng_ctx_field *field, |
| 38 | struct lttng_ctx_value *value)); |
| 39 | |
| 40 | int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ctx **ctx); |
| 41 | int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx, |
| 42 | const char *name, |
| 43 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset), |
| 44 | void (*record)(struct lttng_ctx_field *field, |
| 45 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 46 | struct lttng_channel *chan), |
| 47 | void (*get_value)(struct lttng_ctx_field *field, |
| 48 | struct lttng_ctx_value *value)); |
| 49 | |
| 50 | #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */ |