Custom upgrade: suffix lttng_ust_context_provider_{,un}register with 1
[lttng-ust.git] / src / common / ust-context-provider.h
CommitLineData
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>
1c36b0ff 15#include <lttng/ust-config.h>
53569322 16#include <lttng/ust-events.h>
53569322 17
9d315d6d 18#include "common/dynamic-type.h"
fa194c41 19
4e48b5d2 20struct lttng_ust_registered_context_provider;
b2e37d27 21struct lttng_ust_probe_ctx;
4e48b5d2 22
daacdbfc
MD
23/*
24 * Context value
25 *
26 * IMPORTANT: this structure is part of the ABI between the probe and
35c1f459
MD
27 * UST. Additional selectors may be added in the future, mapping to new
28 * union fields, which means the overall size of this structure may
29 * increase. This means this structure should never be nested within a
30 * public structure interface, nor embedded in an array.
daacdbfc
MD
31 */
32
33struct lttng_ust_ctx_value {
35c1f459 34 enum lttng_ust_dynamic_type sel; /* Type selector */
fa194c41
MJ
35 union {
36 int64_t s64;
37 uint64_t u64;
38 const char *str;
39 double d;
40 } u;
41};
42
daacdbfc
MD
43/*
44 * Context provider
45 *
46 * IMPORTANT: this structure is part of the ABI between the probe and
47 * UST. Fields need to be only added at the end, never reordered, never
48 * removed.
49 *
50 * The field @struct_size should be used to determine the size of the
51 * structure. It should be queried before using additional fields added
52 * at the end of the structure.
53 */
54
53569322 55struct lttng_ust_context_provider {
daacdbfc
MD
56 uint32_t struct_size;
57
4e48b5d2 58 const char *name;
b2e37d27
MD
59 size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
60 size_t offset);
61 void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
62 struct lttng_ust_ring_buffer_ctx *ctx,
63 struct lttng_ust_channel_buffer *chan);
64 void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
65 struct lttng_ust_ctx_value *value);
4e48b5d2 66 void *priv;
daacdbfc
MD
67
68 /* End of base ABI. Fields below should be used after checking struct_size. */
53569322
MD
69};
70
577f6dfc
MD
71/*
72 * Application context callback private data
73 *
74 * IMPORTANT: this structure is part of the ABI between the probe and
75 * UST. Fields need to be only added at the end, never reordered, never
76 * removed.
77 *
78 * The field @struct_size should be used to determine the size of the
79 * structure. It should be queried before using additional fields added
80 * at the end of the structure.
81 */
82
83struct lttng_ust_app_context {
84 uint32_t struct_size;
85
86 struct lttng_ust_event_field *event_field;
87 char *ctx_name;
88
89 /* End of base ABI. Fields below should be used after checking struct_size. */
90};
91
1c36b0ff
MD
92/* Custom upgrade 2.12 to 2.13 */
93#ifndef LTTNG_UST_CUSTOM_UPGRADE_CONFLICTING_SYMBOLS
94#define lttng_ust_context_provider_register lttng_ust_context_provider_register1
95#define lttng_ust_context_provider_unregister lttng_ust_context_provider_unregister1
96#endif
97
4e48b5d2
MD
98/*
99 * Returns an opaque pointer on success, which must be passed to
100 * lttng_ust_context_provider_unregister for unregistration. Returns
101 * NULL on error.
102 */
103struct lttng_ust_registered_context_provider *lttng_ust_context_provider_register(struct lttng_ust_context_provider *provider);
53569322 104
4e48b5d2 105void lttng_ust_context_provider_unregister(struct lttng_ust_registered_context_provider *reg_provider);
53569322
MD
106
107#endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */
This page took 0.039087 seconds and 5 git commands to generate.