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