Fix: debug-info feature enable/disable
[babeltrace.git] / formats / lttng-live / lttng-viewer-abi.h
CommitLineData
158eea6e
JD
1#ifndef LTTNG_VIEWER_ABI_H
2#define LTTNG_VIEWER_ABI_H
4a744367
JD
3
4/*
5 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
6 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * David Goulet <dgoulet@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
8099326b 28#include <babeltrace/compat/limits.h>
4a744367
JD
29
30#define LTTNG_VIEWER_PATH_MAX 4096
31#define LTTNG_VIEWER_NAME_MAX 255
32#define LTTNG_VIEWER_HOST_NAME_MAX 64
33
34/* Flags in reply to get_next_index and get_packet. */
35enum {
36 /* New metadata is required to read this packet. */
37 LTTNG_VIEWER_FLAG_NEW_METADATA = (1 << 0),
38 /* New stream got added to the trace. */
39 LTTNG_VIEWER_FLAG_NEW_STREAM = (1 << 1),
40};
41
42enum lttng_viewer_command {
43 LTTNG_VIEWER_CONNECT = 1,
44 LTTNG_VIEWER_LIST_SESSIONS = 2,
45 LTTNG_VIEWER_ATTACH_SESSION = 3,
46 LTTNG_VIEWER_GET_NEXT_INDEX = 4,
47 LTTNG_VIEWER_GET_PACKET = 5,
48 LTTNG_VIEWER_GET_METADATA = 6,
158eea6e
JD
49 LTTNG_VIEWER_GET_NEW_STREAMS = 7,
50 LTTNG_VIEWER_CREATE_SESSION = 8,
4a744367
JD
51};
52
53enum lttng_viewer_attach_return_code {
54 LTTNG_VIEWER_ATTACH_OK = 1, /* The attach command succeeded. */
55 LTTNG_VIEWER_ATTACH_ALREADY = 2, /* A viewer is already attached. */
56 LTTNG_VIEWER_ATTACH_UNK = 3, /* The session ID is unknown. */
57 LTTNG_VIEWER_ATTACH_NOT_LIVE = 4, /* The session is not live. */
58 LTTNG_VIEWER_ATTACH_SEEK_ERR = 5, /* Seek error. */
158eea6e 59 LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */
4a744367
JD
60};
61
62enum lttng_viewer_next_index_return_code {
63 LTTNG_VIEWER_INDEX_OK = 1, /* Index is available. */
64 LTTNG_VIEWER_INDEX_RETRY = 2, /* Index not yet available. */
65 LTTNG_VIEWER_INDEX_HUP = 3, /* Index closed (trace destroyed). */
66 LTTNG_VIEWER_INDEX_ERR = 4, /* Unknow error. */
67 LTTNG_VIEWER_INDEX_INACTIVE = 5, /* Inactive stream beacon. */
68 LTTNG_VIEWER_INDEX_EOF = 6, /* End of index file. */
69};
70
71enum lttng_viewer_get_packet_return_code {
72 LTTNG_VIEWER_GET_PACKET_OK = 1,
73 LTTNG_VIEWER_GET_PACKET_RETRY = 2,
74 LTTNG_VIEWER_GET_PACKET_ERR = 3,
75 LTTNG_VIEWER_GET_PACKET_EOF = 4,
76};
77
78enum lttng_viewer_get_metadata_return_code {
79 LTTNG_VIEWER_METADATA_OK = 1,
80 LTTNG_VIEWER_NO_NEW_METADATA = 2,
81 LTTNG_VIEWER_METADATA_ERR = 3,
82};
83
84enum lttng_viewer_connection_type {
85 LTTNG_VIEWER_CLIENT_COMMAND = 1,
86 LTTNG_VIEWER_CLIENT_NOTIFICATION = 2,
87};
88
89enum lttng_viewer_seek {
90 /* Receive the trace packets from the beginning. */
91 LTTNG_VIEWER_SEEK_BEGINNING = 1,
92 /* Receive the trace packets from now. */
93 LTTNG_VIEWER_SEEK_LAST = 2,
94};
95
158eea6e
JD
96enum lttng_viewer_new_streams_return_code {
97 LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */
98 LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */
99 LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */
2acdc547 100 LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */
158eea6e
JD
101};
102
103enum lttng_viewer_create_session_return_code {
104 LTTNG_VIEWER_CREATE_SESSION_OK = 1,
105 LTTNG_VIEWER_CREATE_SESSION_ERR = 2,
106};
107
4a744367
JD
108struct lttng_viewer_session {
109 uint64_t id;
110 uint32_t live_timer;
111 uint32_t clients;
112 uint32_t streams;
113 char hostname[LTTNG_VIEWER_HOST_NAME_MAX];
114 char session_name[LTTNG_VIEWER_NAME_MAX];
115} __attribute__((__packed__));
116
117struct lttng_viewer_stream {
118 uint64_t id;
119 uint64_t ctf_trace_id;
158eea6e 120 uint32_t metadata_flag;
4a744367
JD
121 char path_name[LTTNG_VIEWER_PATH_MAX];
122 char channel_name[LTTNG_VIEWER_NAME_MAX];
123} __attribute__((__packed__));
124
125struct lttng_viewer_cmd {
126 uint64_t data_size; /* data size following this header */
127 uint32_t cmd; /* enum lttcomm_relayd_command */
128 uint32_t cmd_version; /* command version */
129} __attribute__((__packed__));
130
131/*
132 * LTTNG_VIEWER_CONNECT payload.
133 */
134struct lttng_viewer_connect {
135 /* session ID assigned by the relay for command connections */
136 uint64_t viewer_session_id;
137 uint32_t major;
138 uint32_t minor;
139 uint32_t type; /* enum lttng_viewer_connection_type */
140} __attribute__((__packed__));
141
142/*
143 * LTTNG_VIEWER_LIST_SESSIONS payload.
144 */
145struct lttng_viewer_list_sessions {
146 uint32_t sessions_count;
147 char session_list[]; /* struct lttng_viewer_session */
148} __attribute__((__packed__));
149
150/*
151 * LTTNG_VIEWER_ATTACH_SESSION payload.
152 */
153struct lttng_viewer_attach_session_request {
154 uint64_t session_id;
155 uint64_t offset; /* unused for now */
156 uint32_t seek; /* enum lttng_viewer_seek */
157} __attribute__((__packed__));
158
159struct lttng_viewer_attach_session_response {
160 /* enum lttng_viewer_attach_return_code */
161 uint32_t status;
162 uint32_t streams_count;
163 /* struct lttng_viewer_stream */
164 char stream_list[];
165} __attribute__((__packed__));
166
167/*
168 * LTTNG_VIEWER_GET_NEXT_INDEX payload.
169 */
170struct lttng_viewer_get_next_index {
171 uint64_t stream_id;
172} __attribute__ ((__packed__));
173
174struct lttng_viewer_index {
175 uint64_t offset;
176 uint64_t packet_size;
177 uint64_t content_size;
178 uint64_t timestamp_begin;
179 uint64_t timestamp_end;
180 uint64_t events_discarded;
181 uint64_t stream_id;
182 uint32_t status; /* enum lttng_viewer_next_index_return_code */
183 uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
184} __attribute__ ((__packed__));
185
186/*
187 * LTTNG_VIEWER_GET_PACKET payload.
188 */
189struct lttng_viewer_get_packet {
190 uint64_t stream_id;
191 uint64_t offset;
192 uint32_t len;
193} __attribute__((__packed__));
194
195struct lttng_viewer_trace_packet {
196 uint32_t status; /* enum lttng_viewer_get_packet_return_code */
197 uint32_t len;
198 uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
199 char data[];
200} __attribute__((__packed__));
201
202/*
203 * LTTNG_VIEWER_GET_METADATA payload.
204 */
205struct lttng_viewer_get_metadata {
206 uint64_t stream_id;
207} __attribute__((__packed__));
208
209struct lttng_viewer_metadata_packet {
210 uint64_t len;
211 uint32_t status; /* enum lttng_viewer_get_metadata_return_code */
212 char data[];
213} __attribute__((__packed__));
214
158eea6e
JD
215/*
216 * LTTNG_VIEWER_GET_NEW_STREAMS payload.
217 */
218struct lttng_viewer_new_streams_request {
219 uint64_t session_id;
220} __attribute__((__packed__));
221
222struct lttng_viewer_new_streams_response {
223 /* enum lttng_viewer_new_streams_return_code */
224 uint32_t status;
225 uint32_t streams_count;
226 /* struct lttng_viewer_stream */
227 char stream_list[];
228} __attribute__((__packed__));
229
230struct lttng_viewer_create_session_response {
231 /* enum lttng_viewer_create_session_return_code */
232 uint32_t status;
233} __attribute__((__packed__));
234
235#endif /* LTTNG_VIEWER_ABI_H */
This page took 0.038131 seconds and 4 git commands to generate.