| 1 | /* |
| 2 | * Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_ACTION_LIST_H |
| 9 | #define LTTNG_ACTION_LIST_H |
| 10 | |
| 11 | #include <lttng/lttng-export.h> |
| 12 | |
| 13 | struct lttng_action; |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | /* |
| 20 | * Create a newly allocated action list object. |
| 21 | * |
| 22 | * Returns a new action list on success, NULL on failure. This action list |
| 23 | * must be destroyed using lttng_action_destroy(). |
| 24 | */ |
| 25 | LTTNG_EXPORT extern struct lttng_action *lttng_action_list_create(void); |
| 26 | |
| 27 | /* |
| 28 | * Add an action to an lttng_action object of type LTTNG_ACTION_LIST. |
| 29 | * |
| 30 | * The action list acquires a reference to the action. The action can be |
| 31 | * safely destroyed after calling this function. An action must not be |
| 32 | * modified after adding it to a list. |
| 33 | * |
| 34 | * Adding an action list to an action list is not supported. |
| 35 | */ |
| 36 | LTTNG_EXPORT extern enum lttng_action_status |
| 37 | lttng_action_list_add_action(struct lttng_action *list, struct lttng_action *action); |
| 38 | |
| 39 | /* |
| 40 | * Get the number of actions in an action list. |
| 41 | */ |
| 42 | LTTNG_EXPORT extern enum lttng_action_status |
| 43 | lttng_action_list_get_count(const struct lttng_action *list, unsigned int *count); |
| 44 | |
| 45 | /* |
| 46 | * Get an action from the action list at a given index. |
| 47 | * |
| 48 | * Note that the list maintains the ownership of the returned action. |
| 49 | * It must not be destroyed by the user, nor should it be held beyond |
| 50 | * the lifetime of the action list. |
| 51 | * |
| 52 | * Returns an action, or NULL on error. |
| 53 | */ |
| 54 | LTTNG_EXPORT extern const struct lttng_action * |
| 55 | lttng_action_list_get_at_index(const struct lttng_action *list, unsigned int index); |
| 56 | |
| 57 | #ifdef __cplusplus |
| 58 | } |
| 59 | #endif |
| 60 | |
| 61 | #endif /* LTTNG_ACTION_LIST_H */ |