2 * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
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.
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
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.
18 #ifndef NOTIFICATION_THREAD_COMMANDS_H
19 #define NOTIFICATION_THREAD_COMMANDS_H
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>
29 struct notification_thread_data
;
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
,
42 struct notification_thread_command
{
43 struct cds_list_head cmd_list_node
;
45 enum notification_thread_command_type type
;
47 /* Register/Unregister trigger. */
48 struct lttng_trigger
*trigger
;
58 enum lttng_domain_type domain
;
66 enum lttng_domain_type domain
;
69 const char *session_name
;
72 uint64_t trace_archive_chunk_id
;
73 struct lttng_trace_archive_location
*location
;
77 /* lttng_waiter on which to wait for command reply (optional). */
78 struct lttng_waiter reply_waiter
;
79 enum lttng_error_code reply_code
;
82 enum lttng_error_code
notification_thread_command_register_trigger(
83 struct notification_thread_handle
*handle
,
84 struct lttng_trigger
*trigger
);
86 enum lttng_error_code
notification_thread_command_unregister_trigger(
87 struct notification_thread_handle
*handle
,
88 struct lttng_trigger
*trigger
);
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
);
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
);
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
);
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
);
112 void notification_thread_command_quit(
113 struct notification_thread_handle
*handle
);
115 #endif /* NOTIFICATION_THREAD_COMMANDS_H */