Refactoring: use an opaque lttng_tracker_id type
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.h
CommitLineData
2f77fc4b
DG
1/*
2 * Copyright (C) 2012 - David Goulet <dgoulet@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 CMD_H
19#define CMD_H
20
21#include "context.h"
2f77fc4b 22#include "session.h"
aa74bd72 23#include "lttng-sessiond.h"
2f77fc4b 24
b0880ae5
JG
25struct notification_thread_handle;
26
a503e1ef
JG
27/*
28 * A callback (and associated user data) that should be run after a command
29 * has been executed. No locks should be taken while executing this handler.
30 *
31 * The command's reply should not be sent until the handler has run and
32 * completed successfully. On failure, the handler's return code should
33 * be the only reply sent to the client.
34 */
35typedef enum lttng_error_code (*completion_handler_function)(void *);
36struct cmd_completion_handler {
37 completion_handler_function run;
38 void *data;
39};
40
2f77fc4b
DG
41/*
42 * Init the command subsystem. Must be called before using any of the functions
43 * above. This is called in the main() of the session daemon.
44 */
45void cmd_init(void);
46
47/* Session commands */
b178f53e
JG
48enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
49 struct lttng_session_descriptor **return_descriptor);
e32d7f27 50int cmd_destroy_session(struct ltt_session *session,
3e3665b8
JG
51 struct notification_thread_handle *notification_thread_handle,
52 int *sock_fd);
2f77fc4b
DG
53
54/* Channel commands */
56a37563
JG
55int cmd_disable_channel(struct ltt_session *session,
56 enum lttng_domain_type domain, char *channel_name);
7972aab2 57int cmd_enable_channel(struct ltt_session *session,
df4f5a87 58 const struct lttng_domain *domain, const struct lttng_channel *attr,
56a37563 59 int wpipe);
55c9e7ca
JR
60int cmd_track_id(struct ltt_session *session,
61 enum lttng_tracker_type tracker_type,
62 enum lttng_domain_type domain,
63 const struct lttng_tracker_id *id);
64int cmd_untrack_id(struct ltt_session *session,
65 enum lttng_tracker_type tracker_type,
66 enum lttng_domain_type domain,
67 const struct lttng_tracker_id *id);
2f77fc4b
DG
68
69/* Event commands */
56a37563
JG
70int cmd_disable_event(struct ltt_session *session,
71 enum lttng_domain_type domain,
df4f5a87
JG
72 const char *channel_name,
73 const struct lttng_event *event);
56a37563 74int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
df4f5a87 75 char *channel_name, const struct lttng_event_context *ctx, int kwpipe);
56a37563 76int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
178191b3 77 char *channel_name, struct lttng_event *event,
2f77fc4b 78 struct lttng_filter_bytecode *bytecode);
df4f5a87 79int cmd_enable_event(struct ltt_session *session, const struct lttng_domain *domain,
025faf73 80 char *channel_name, struct lttng_event *event,
6b453b5e 81 char *filter_expression,
db8f1377
JI
82 struct lttng_filter_bytecode *filter,
83 struct lttng_event_exclusion *exclusion,
84 int wpipe);
2f77fc4b
DG
85
86/* Trace session action commands */
87int cmd_start_trace(struct ltt_session *session);
88int cmd_stop_trace(struct ltt_session *session);
89
90/* Consumer commands */
56a37563
JG
91int cmd_register_consumer(struct ltt_session *session,
92 enum lttng_domain_type domain,
2f77fc4b 93 const char *sock_path, struct consumer_data *cdata);
bda32d56
JG
94int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
95 struct lttng_uri *uris);
ffe60014 96int cmd_setup_relayd(struct ltt_session *session);
2f77fc4b
DG
97
98/* Listing commands */
99ssize_t cmd_list_domains(struct ltt_session *session,
100 struct lttng_domain **domains);
56a37563
JG
101ssize_t cmd_list_events(enum lttng_domain_type domain,
102 struct ltt_session *session, char *channel_name,
b4e3ceb9 103 struct lttng_event **events, size_t *total_size);
56a37563
JG
104ssize_t cmd_list_channels(enum lttng_domain_type domain,
105 struct ltt_session *session, struct lttng_channel **channels);
2f77fc4b
DG
106ssize_t cmd_list_domains(struct ltt_session *session,
107 struct lttng_domain **domains);
b178f53e
JG
108void cmd_list_lttng_sessions(struct lttng_session *sessions,
109 size_t session_count, uid_t uid, gid_t gid);
56a37563 110ssize_t cmd_list_tracepoint_fields(enum lttng_domain_type domain,
2f77fc4b 111 struct lttng_event_field **fields);
56a37563
JG
112ssize_t cmd_list_tracepoints(enum lttng_domain_type domain,
113 struct lttng_event **events);
6dc3064a
DG
114ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
115 struct lttng_snapshot_output **outputs);
834978fd 116ssize_t cmd_list_syscalls(struct lttng_event **events);
55c9e7ca
JR
117ssize_t cmd_list_tracker_ids(enum lttng_tracker_type tracker_type,
118 struct ltt_session *session,
119 enum lttng_domain_type domain,
2d97a006 120 struct lttng_tracker_id ***ids);
2f77fc4b 121
6d805429 122int cmd_data_pending(struct ltt_session *session);
2f77fc4b 123
6dc3064a
DG
124/* Snapshot */
125int cmd_snapshot_add_output(struct ltt_session *session,
df4f5a87 126 const struct lttng_snapshot_output *output, uint32_t *id);
6dc3064a 127int cmd_snapshot_del_output(struct ltt_session *session,
df4f5a87 128 const struct lttng_snapshot_output *output);
6dc3064a 129int cmd_snapshot_record(struct ltt_session *session,
df4f5a87 130 const struct lttng_snapshot_output *output, int wait);
6dc3064a 131
d7ba1388
MD
132int cmd_set_session_shm_path(struct ltt_session *session,
133 const char *shm_path);
eded6438 134int cmd_regenerate_metadata(struct ltt_session *session);
c2561365 135int cmd_regenerate_statedump(struct ltt_session *session);
d7ba1388 136
b0880ae5
JG
137int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
138 struct notification_thread_handle *notification_thread_handle);
139int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
140 struct notification_thread_handle *notification_thread_handle);
141
5c408ad8 142int cmd_rotate_session(struct ltt_session *session,
7fdbed1c 143 struct lttng_rotate_session_return *rotate_return,
343defc2
MD
144 bool quiet_rotation,
145 enum lttng_trace_chunk_command_type command);
d68c9a04
JD
146int cmd_rotate_get_info(struct ltt_session *session,
147 struct lttng_rotation_get_info_return *info_return,
148 uint64_t rotate_id);
66ea93b1
JG
149int cmd_rotation_set_schedule(struct ltt_session *session,
150 bool activate, enum lttng_rotation_schedule_type schedule_type,
151 uint64_t value,
90936dcf 152 struct notification_thread_handle *notification_thread_handle);
5c408ad8 153
a503e1ef 154const struct cmd_completion_handler *cmd_pop_completion_handler(void);
4dbe1875
MD
155int start_kernel_session(struct ltt_kernel_session *ksess);
156int stop_kernel_session(struct ltt_kernel_session *ksess);
a503e1ef 157
2f77fc4b 158#endif /* CMD_H */
This page took 0.073635 seconds and 5 git commands to generate.