Add session rotation ongoing/completed notification commands
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.h
CommitLineData
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
29struct notification_thread_data;
30struct lttng_trigger;
31
32enum 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,
731c1b12
JG
37 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING,
38 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED,
ab0ee2ca
JG
39 NOTIFICATION_COMMAND_TYPE_QUIT,
40};
41
ab0ee2ca
JG
42struct 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. */
8abe313a
JG
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;
ab0ee2ca
JG
63 /* Remove channel. */
64 struct {
65 uint64_t key;
66 enum lttng_domain_type domain;
67 } remove_channel;
731c1b12
JG
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;
ab0ee2ca
JG
75 } parameters;
76
8ada111f
JG
77 /* lttng_waiter on which to wait for command reply (optional). */
78 struct lttng_waiter reply_waiter;
ab0ee2ca
JG
79 enum lttng_error_code reply_code;
80};
81
82enum lttng_error_code notification_thread_command_register_trigger(
83 struct notification_thread_handle *handle,
84 struct lttng_trigger *trigger);
85
86enum lttng_error_code notification_thread_command_unregister_trigger(
87 struct notification_thread_handle *handle,
88 struct lttng_trigger *trigger);
89
90enum lttng_error_code notification_thread_command_add_channel(
91 struct notification_thread_handle *handle,
731c1b12 92 char *session_name, uid_t session_uid, gid_t session_gid,
ab0ee2ca
JG
93 char *channel_name, uint64_t key,
94 enum lttng_domain_type domain, uint64_t capacity);
95
96enum lttng_error_code notification_thread_command_remove_channel(
97 struct notification_thread_handle *handle,
98 uint64_t key, enum lttng_domain_type domain);
99
731c1b12
JG
100enum 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. */
106enum 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
ab0ee2ca
JG
112void notification_thread_command_quit(
113 struct notification_thread_handle *handle);
114
115#endif /* NOTIFICATION_THREAD_COMMANDS_H */
This page took 0.030564 seconds and 4 git commands to generate.