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