| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _LTTNG_UST_CONTEXT_PROVIDER_H |
| 8 | #define _LTTNG_UST_CONTEXT_PROVIDER_H |
| 9 | |
| 10 | #include <stddef.h> |
| 11 | #include <lttng/ust-events.h> |
| 12 | #include <urcu/hlist.h> |
| 13 | |
| 14 | struct lttng_ust_context_provider { |
| 15 | char *name; |
| 16 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset); |
| 17 | void (*record)(struct lttng_ctx_field *field, |
| 18 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 19 | struct lttng_channel *chan); |
| 20 | void (*get_value)(struct lttng_ctx_field *field, |
| 21 | struct lttng_ctx_value *value); |
| 22 | struct cds_hlist_node node; |
| 23 | }; |
| 24 | |
| 25 | int lttng_ust_context_provider_register(struct lttng_ust_context_provider *provider); |
| 26 | void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider *provider); |
| 27 | |
| 28 | int lttng_context_is_app(const char *name); |
| 29 | |
| 30 | void lttng_ust_context_set_session_provider(const char *name, |
| 31 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset), |
| 32 | void (*record)(struct lttng_ctx_field *field, |
| 33 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 34 | struct lttng_channel *chan), |
| 35 | void (*get_value)(struct lttng_ctx_field *field, |
| 36 | struct lttng_ctx_value *value)); |
| 37 | |
| 38 | int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ctx **ctx); |
| 39 | int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx, |
| 40 | const char *name, |
| 41 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset), |
| 42 | void (*record)(struct lttng_ctx_field *field, |
| 43 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 44 | struct lttng_channel *chan), |
| 45 | void (*get_value)(struct lttng_ctx_field *field, |
| 46 | struct lttng_ctx_value *value)); |
| 47 | int lttng_context_add_rcu(struct lttng_ctx **ctx_p, |
| 48 | const struct lttng_ctx_field *f); |
| 49 | |
| 50 | #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */ |