Commit | Line | Data |
---|---|---|
daa81f58 JG |
1 | /* |
2 | * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License, version 2 only, as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
11 | * more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License along with | |
14 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
15 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef NOTIFICATION_THREAD_COMMANDS_H | |
19 | #define NOTIFICATION_THREAD_COMMANDS_H | |
20 | ||
21 | #include <lttng/domain.h> | |
22 | #include <lttng/lttng-error.h> | |
23 | #include <urcu/rculfhash.h> | |
24 | ||
25 | struct notification_thread_data; | |
26 | struct lttng_trigger; | |
27 | ||
28 | enum notification_thread_command_type { | |
29 | NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER, | |
30 | NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER, | |
31 | NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL, | |
32 | NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL, | |
33 | }; | |
34 | ||
35 | struct channel_key { | |
36 | uint64_t key; | |
37 | enum lttng_domain_type domain; | |
38 | }; | |
39 | ||
40 | struct channel_info { | |
41 | struct channel_key key; | |
42 | char *session_name; | |
43 | uid_t uid; | |
44 | gid_t gid; | |
45 | char *channel_name; | |
46 | uint64_t capacity; | |
47 | struct cds_lfht_node channels_ht_node; | |
48 | }; | |
49 | ||
50 | struct notification_thread_command { | |
51 | struct cds_list_head cmd_list_node; | |
52 | ||
53 | enum notification_thread_command_type type; | |
54 | union { | |
55 | /* Register/Unregister trigger. */ | |
56 | struct lttng_trigger *trigger; | |
57 | /* Add channel. */ | |
58 | struct channel_info add_channel; | |
59 | /* Remove channel. */ | |
60 | struct { | |
61 | uint64_t key; | |
62 | enum lttng_domain_type domain; | |
63 | } remove_channel; | |
64 | } parameters; | |
65 | ||
66 | /* Futex on which to wait for command reply (optional). */ | |
67 | int32_t reply_futex; | |
68 | enum lttng_error_code reply_code; | |
69 | }; | |
70 | ||
71 | enum lttng_error_code notification_thread_command_register_trigger( | |
72 | struct notification_thread_handle *handle, | |
73 | struct lttng_trigger *trigger); | |
74 | ||
75 | enum lttng_error_code notification_thread_command_unregister_trigger( | |
76 | struct notification_thread_handle *handle, | |
77 | struct lttng_trigger *trigger); | |
78 | ||
79 | enum lttng_error_code notification_thread_command_add_channel( | |
80 | struct notification_thread_handle *handle, | |
81 | char *session_name, uid_t uid, gid_t gid, | |
82 | char *channel_name, uint64_t key, | |
83 | enum lttng_domain_type domain, uint64_t capacity); | |
84 | ||
85 | enum lttng_error_code notification_thread_command_remove_channel( | |
86 | struct notification_thread_handle *handle, | |
87 | uint64_t key, enum lttng_domain_type domain); | |
88 | ||
89 | #endif /* NOTIFICATION_THREAD_COMMANDS_H */ |