Commit | Line | Data |
---|---|---|
ab0ee2ca 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 | #include "notification-thread.h" | |
8abe313a JG |
25 | #include "notification-thread-internal.h" |
26 | #include "notification-thread-events.h" | |
8ada111f | 27 | #include <common/waiter.h> |
ab0ee2ca JG |
28 | |
29 | struct notification_thread_data; | |
30 | struct lttng_trigger; | |
31 | ||
32 | enum notification_thread_command_type { | |
33 | NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER, | |
34 | NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER, | |
35 | NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL, | |
36 | NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL, | |
37 | NOTIFICATION_COMMAND_TYPE_QUIT, | |
38 | }; | |
39 | ||
ab0ee2ca JG |
40 | struct notification_thread_command { |
41 | struct cds_list_head cmd_list_node; | |
42 | ||
43 | enum notification_thread_command_type type; | |
44 | union { | |
45 | /* Register/Unregister trigger. */ | |
46 | struct lttng_trigger *trigger; | |
47 | /* Add channel. */ | |
8abe313a JG |
48 | struct { |
49 | struct { | |
50 | const char *name; | |
51 | uid_t uid; | |
52 | gid_t gid; | |
53 | } session; | |
54 | struct { | |
55 | const char *name; | |
56 | enum lttng_domain_type domain; | |
57 | uint64_t key; | |
58 | uint64_t capacity; | |
59 | } channel; | |
60 | } add_channel; | |
ab0ee2ca JG |
61 | /* Remove channel. */ |
62 | struct { | |
63 | uint64_t key; | |
64 | enum lttng_domain_type domain; | |
65 | } remove_channel; | |
66 | } parameters; | |
67 | ||
8ada111f JG |
68 | /* lttng_waiter on which to wait for command reply (optional). */ |
69 | struct lttng_waiter reply_waiter; | |
ab0ee2ca JG |
70 | enum lttng_error_code reply_code; |
71 | }; | |
72 | ||
73 | enum lttng_error_code notification_thread_command_register_trigger( | |
74 | struct notification_thread_handle *handle, | |
75 | struct lttng_trigger *trigger); | |
76 | ||
77 | enum lttng_error_code notification_thread_command_unregister_trigger( | |
78 | struct notification_thread_handle *handle, | |
79 | struct lttng_trigger *trigger); | |
80 | ||
81 | enum lttng_error_code notification_thread_command_add_channel( | |
82 | struct notification_thread_handle *handle, | |
83 | char *session_name, uid_t uid, gid_t gid, | |
84 | char *channel_name, uint64_t key, | |
85 | enum lttng_domain_type domain, uint64_t capacity); | |
86 | ||
87 | enum lttng_error_code notification_thread_command_remove_channel( | |
88 | struct notification_thread_handle *handle, | |
89 | uint64_t key, enum lttng_domain_type domain); | |
90 | ||
91 | void notification_thread_command_quit( | |
92 | struct notification_thread_handle *handle); | |
93 | ||
94 | #endif /* NOTIFICATION_THREAD_COMMANDS_H */ |