prepare the 0.3 release
[lttngtop.git] / src / lttng-viewer-abi.h
CommitLineData
0c445945
JD
1#ifndef LTTNG_VIEWER_ABI_H
2#define LTTNG_VIEWER_ABI_H
38e24060 3
b1acd2b3
JD
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
b1acd2b3
JD
28#include <limits.h>
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. */
12a91e9d
JD
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};
b1acd2b3
JD
41
42enum lttng_viewer_command {
12a91e9d
JD
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,
0c445945
JD
49 LTTNG_VIEWER_GET_NEW_STREAMS = 7,
50 LTTNG_VIEWER_CREATE_SESSION = 8,
b1acd2b3
JD
51};
52
53enum lttng_viewer_attach_return_code {
12a91e9d
JD
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. */
0c445945 59 LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */
b1acd2b3
JD
60};
61
62enum lttng_viewer_next_index_return_code {
12a91e9d
JD
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. */
b1acd2b3
JD
69};
70
71enum lttng_viewer_get_packet_return_code {
12a91e9d
JD
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,
b1acd2b3
JD
76};
77
78enum lttng_viewer_get_metadata_return_code {
12a91e9d
JD
79 LTTNG_VIEWER_METADATA_OK = 1,
80 LTTNG_VIEWER_NO_NEW_METADATA = 2,
81 LTTNG_VIEWER_METADATA_ERR = 3,
b1acd2b3
JD
82};
83
84enum lttng_viewer_connection_type {
12a91e9d
JD
85 LTTNG_VIEWER_CLIENT_COMMAND = 1,
86 LTTNG_VIEWER_CLIENT_NOTIFICATION = 2,
b1acd2b3
JD
87};
88
89enum lttng_viewer_seek {
38e24060 90 /* Receive the trace packets from the beginning. */
12a91e9d 91 LTTNG_VIEWER_SEEK_BEGINNING = 1,
38e24060 92 /* Receive the trace packets from now. */
12a91e9d 93 LTTNG_VIEWER_SEEK_LAST = 2,
b1acd2b3
JD
94};
95
0c445945
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. */
100 LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */
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
b1acd2b3
JD
108struct lttng_viewer_session {
109 uint64_t id;
b1acd2b3
JD
110 uint32_t live_timer;
111 uint32_t clients;
38e24060
JD
112 uint32_t streams;
113 char hostname[LTTNG_VIEWER_HOST_NAME_MAX];
114 char session_name[LTTNG_VIEWER_NAME_MAX];
b1acd2b3
JD
115} __attribute__((__packed__));
116
117struct lttng_viewer_stream {
118 uint64_t id;
119 uint64_t ctf_trace_id;
0c445945 120 uint32_t metadata_flag;
b1acd2b3
JD
121 char path_name[LTTNG_VIEWER_PATH_MAX];
122 char channel_name[LTTNG_VIEWER_NAME_MAX];
b1acd2b3
JD
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/*
12a91e9d 132 * LTTNG_VIEWER_CONNECT payload.
b1acd2b3
JD
133 */
134struct lttng_viewer_connect {
38e24060
JD
135 /* session ID assigned by the relay for command connections */
136 uint64_t viewer_session_id;
b1acd2b3
JD
137 uint32_t major;
138 uint32_t minor;
12a91e9d 139 uint32_t type; /* enum lttng_viewer_connection_type */
b1acd2b3
JD
140} __attribute__((__packed__));
141
142/*
12a91e9d 143 * LTTNG_VIEWER_LIST_SESSIONS payload.
b1acd2b3
JD
144 */
145struct lttng_viewer_list_sessions {
146 uint32_t sessions_count;
12a91e9d 147 char session_list[]; /* struct lttng_viewer_session */
b1acd2b3
JD
148} __attribute__((__packed__));
149
150/*
12a91e9d 151 * LTTNG_VIEWER_ATTACH_SESSION payload.
b1acd2b3
JD
152 */
153struct lttng_viewer_attach_session_request {
154 uint64_t session_id;
b1acd2b3 155 uint64_t offset; /* unused for now */
38e24060 156 uint32_t seek; /* enum lttng_viewer_seek */
b1acd2b3
JD
157} __attribute__((__packed__));
158
159struct lttng_viewer_attach_session_response {
38e24060
JD
160 /* enum lttng_viewer_attach_return_code */
161 uint32_t status;
b1acd2b3 162 uint32_t streams_count;
38e24060
JD
163 /* struct lttng_viewer_stream */
164 char stream_list[];
b1acd2b3
JD
165} __attribute__((__packed__));
166
167/*
12a91e9d 168 * LTTNG_VIEWER_GET_NEXT_INDEX payload.
b1acd2b3
JD
169 */
170struct lttng_viewer_get_next_index {
171 uint64_t stream_id;
172} __attribute__ ((__packed__));
173
174struct lttng_viewer_index {
b1acd2b3
JD
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;
12a91e9d
JD
182 uint32_t status; /* enum lttng_viewer_next_index_return_code */
183 uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
b1acd2b3
JD
184} __attribute__ ((__packed__));
185
186/*
12a91e9d 187 * LTTNG_VIEWER_GET_PACKET payload.
b1acd2b3
JD
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 {
12a91e9d 196 uint32_t status; /* enum lttng_viewer_get_packet_return_code */
b1acd2b3 197 uint32_t len;
12a91e9d 198 uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
b1acd2b3
JD
199 char data[];
200} __attribute__((__packed__));
201
202/*
12a91e9d 203 * LTTNG_VIEWER_GET_METADATA payload.
b1acd2b3
JD
204 */
205struct lttng_viewer_get_metadata {
206 uint64_t stream_id;
207} __attribute__((__packed__));
208
209struct lttng_viewer_metadata_packet {
b1acd2b3 210 uint64_t len;
12a91e9d 211 uint32_t status; /* enum lttng_viewer_get_metadata_return_code */
b1acd2b3
JD
212 char data[];
213} __attribute__((__packed__));
214
0c445945
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.049482 seconds and 4 git commands to generate.