Blame include/lttng/ust-context-provider.h

Packit c04fcb
#ifndef _LTTNG_UST_CONTEXT_PROVIDER_H
Packit c04fcb
#define _LTTNG_UST_CONTEXT_PROVIDER_H
Packit c04fcb
Packit c04fcb
/*
Packit c04fcb
 * Copyright 2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Packit c04fcb
 *
Packit c04fcb
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit c04fcb
 * of this software and associated documentation files (the "Software"), to deal
Packit c04fcb
 * in the Software without restriction, including without limitation the rights
Packit c04fcb
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Packit c04fcb
 * copies of the Software, and to permit persons to whom the Software is
Packit c04fcb
 * furnished to do so, subject to the following conditions:
Packit c04fcb
 *
Packit c04fcb
 * The above copyright notice and this permission notice shall be included in
Packit c04fcb
 * all copies or substantial portions of the Software.
Packit c04fcb
 *
Packit c04fcb
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit c04fcb
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit c04fcb
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Packit c04fcb
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Packit c04fcb
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Packit c04fcb
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit c04fcb
 * SOFTWARE.
Packit c04fcb
 */
Packit c04fcb
Packit c04fcb
#include <lttng/ust-events.h>
Packit c04fcb
#include <urcu/hlist.h>
Packit c04fcb
Packit c04fcb
struct lttng_ust_context_provider {
Packit c04fcb
	char *name;
Packit c04fcb
	size_t (*get_size)(struct lttng_ctx_field *field, size_t offset);
Packit c04fcb
	void (*record)(struct lttng_ctx_field *field,
Packit c04fcb
		       struct lttng_ust_lib_ring_buffer_ctx *ctx,
Packit c04fcb
		       struct lttng_channel *chan);
Packit c04fcb
	void (*get_value)(struct lttng_ctx_field *field,
Packit c04fcb
			 struct lttng_ctx_value *value);
Packit c04fcb
	struct cds_hlist_node node;
Packit c04fcb
};
Packit c04fcb
Packit c04fcb
int lttng_ust_context_provider_register(struct lttng_ust_context_provider *provider);
Packit c04fcb
void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider *provider);
Packit c04fcb
Packit c04fcb
int lttng_context_is_app(const char *name);
Packit c04fcb
Packit c04fcb
void lttng_ust_context_set_session_provider(const char *name,
Packit c04fcb
		size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
Packit c04fcb
		void (*record)(struct lttng_ctx_field *field,
Packit c04fcb
			struct lttng_ust_lib_ring_buffer_ctx *ctx,
Packit c04fcb
			struct lttng_channel *chan),
Packit c04fcb
		void (*get_value)(struct lttng_ctx_field *field,
Packit c04fcb
			struct lttng_ctx_value *value));
Packit c04fcb
Packit c04fcb
int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ctx **ctx);
Packit c04fcb
int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx,
Packit c04fcb
		const char *name,
Packit c04fcb
		size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
Packit c04fcb
		void (*record)(struct lttng_ctx_field *field,
Packit c04fcb
			struct lttng_ust_lib_ring_buffer_ctx *ctx,
Packit c04fcb
			struct lttng_channel *chan),
Packit c04fcb
		void (*get_value)(struct lttng_ctx_field *field,
Packit c04fcb
			struct lttng_ctx_value *value));
Packit c04fcb
int lttng_context_add_rcu(struct lttng_ctx **ctx_p,
Packit c04fcb
		const struct lttng_ctx_field *f);
Packit c04fcb
Packit c04fcb
#endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */