X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fcondition%2Fcondition-internal.h;h=a491d3fe34a46e33bf02f6d4a5c585724a17c89f;hb=48a4000561343808724f7cb5fa8c131877489ccd;hp=c54141e2239e945285bff472cc54001f68152f53;hpb=3647288fe42b25340f905046f3bd9aef21e12aaa;p=lttng-tools.git diff --git a/include/lttng/condition/condition-internal.h b/include/lttng/condition/condition-internal.h index c54141e22..a491d3fe3 100644 --- a/include/lttng/condition/condition-internal.h +++ b/include/lttng/condition/condition-internal.h @@ -1,49 +1,55 @@ /* - * Copyright (C) 2017 - Jérémie Galarneau + * Copyright (C) 2017 Jérémie Galarneau * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef LTTNG_CONDITION_INTERNAL_H #define LTTNG_CONDITION_INTERNAL_H -#include #include -#include -#include +#include +#include +#include +#include #include -#include #include #include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +struct mi_writer; +struct mi_lttng_error_query_callbacks; +struct lttng_trigger; typedef void (*condition_destroy_cb)(struct lttng_condition *condition); typedef bool (*condition_validate_cb)(const struct lttng_condition *condition); typedef int (*condition_serialize_cb)( const struct lttng_condition *condition, - struct lttng_dynamic_buffer *buf); + struct lttng_payload *payload); typedef bool (*condition_equal_cb)(const struct lttng_condition *a, const struct lttng_condition *b); -typedef ssize_t (*condition_create_from_buffer_cb)( - const struct lttng_buffer_view *view, +typedef ssize_t (*condition_create_from_payload_cb)( + struct lttng_payload_view *view, struct lttng_condition **condition); +typedef enum lttng_error_code (*condition_mi_serialize_cb)( + const struct lttng_condition *condition, + struct mi_writer *writer); struct lttng_condition { + /* Reference counting is only exposed to internal users. */ + struct urcu_ref ref; enum lttng_condition_type type; condition_validate_cb validate; condition_serialize_cb serialize; condition_equal_cb equal; condition_destroy_cb destroy; + condition_mi_serialize_cb mi_serialize; }; struct lttng_condition_comm { @@ -52,24 +58,36 @@ struct lttng_condition_comm { char payload[]; }; -LTTNG_HIDDEN +void lttng_condition_get(struct lttng_condition *condition); + +void lttng_condition_put(struct lttng_condition *condition); + void lttng_condition_init(struct lttng_condition *condition, enum lttng_condition_type type); -LTTNG_HIDDEN bool lttng_condition_validate(const struct lttng_condition *condition); -LTTNG_HIDDEN -ssize_t lttng_condition_create_from_buffer( - const struct lttng_buffer_view *buffer, +ssize_t lttng_condition_create_from_payload( + struct lttng_payload_view *view, struct lttng_condition **condition); -LTTNG_HIDDEN int lttng_condition_serialize(const struct lttng_condition *condition, - struct lttng_dynamic_buffer *buf); + struct lttng_payload *payload); -LTTNG_HIDDEN bool lttng_condition_is_equal(const struct lttng_condition *a, const struct lttng_condition *b); +enum lttng_error_code lttng_condition_mi_serialize( + const struct lttng_trigger *trigger, + const struct lttng_condition *condition, + struct mi_writer *writer, + const struct mi_lttng_error_query_callbacks + *error_query_callbacks); + +const char *lttng_condition_type_str(enum lttng_condition_type type); + +#if defined(__cplusplus) +} +#endif + #endif /* LTTNG_CONDITION_INTERNAL_H */