Add session rotation ongoing/completed notification commands
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.h
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"
25 #include "notification-thread-internal.h"
26 #include "notification-thread-events.h"
27 #include <common/waiter.h>
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_SESSION_ROTATION_ONGOING,
38 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED,
39 NOTIFICATION_COMMAND_TYPE_QUIT,
40 };
41
42 struct notification_thread_command {
43 struct cds_list_head cmd_list_node;
44
45 enum notification_thread_command_type type;
46 union {
47 /* Register/Unregister trigger. */
48 struct lttng_trigger *trigger;
49 /* Add channel. */
50 struct {
51 struct {
52 const char *name;
53 uid_t uid;
54 gid_t gid;
55 } session;
56 struct {
57 const char *name;
58 enum lttng_domain_type domain;
59 uint64_t key;
60 uint64_t capacity;
61 } channel;
62 } add_channel;
63 /* Remove channel. */
64 struct {
65 uint64_t key;
66 enum lttng_domain_type domain;
67 } remove_channel;
68 struct {
69 const char *session_name;
70 uid_t uid;
71 gid_t gid;
72 uint64_t trace_archive_chunk_id;
73 struct lttng_trace_archive_location *location;
74 } session_rotation;
75 } parameters;
76
77 /* lttng_waiter on which to wait for command reply (optional). */
78 struct lttng_waiter reply_waiter;
79 enum lttng_error_code reply_code;
80 };
81
82 enum lttng_error_code notification_thread_command_register_trigger(
83 struct notification_thread_handle *handle,
84 struct lttng_trigger *trigger);
85
86 enum lttng_error_code notification_thread_command_unregister_trigger(
87 struct notification_thread_handle *handle,
88 struct lttng_trigger *trigger);
89
90 enum lttng_error_code notification_thread_command_add_channel(
91 struct notification_thread_handle *handle,
92 char *session_name, uid_t session_uid, gid_t session_gid,
93 char *channel_name, uint64_t key,
94 enum lttng_domain_type domain, uint64_t capacity);
95
96 enum lttng_error_code notification_thread_command_remove_channel(
97 struct notification_thread_handle *handle,
98 uint64_t key, enum lttng_domain_type domain);
99
100 enum lttng_error_code notification_thread_command_session_rotation_ongoing(
101 struct notification_thread_handle *handle,
102 const char *session_name, uid_t session_uid, gid_t session_gid,
103 uint64_t trace_archive_chunk_id);
104
105 /* Ownership of location is transferred. */
106 enum lttng_error_code notification_thread_command_session_rotation_completed(
107 struct notification_thread_handle *handle,
108 const char *session_name, uid_t session_uid, gid_t session_gid,
109 uint64_t trace_archive_chunk_id,
110 struct lttng_trace_archive_location *location);
111
112 void notification_thread_command_quit(
113 struct notification_thread_handle *handle);
114
115 #endif /* NOTIFICATION_THREAD_COMMANDS_H */
This page took 0.042783 seconds and 4 git commands to generate.