5 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
6 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * David Goulet <dgoulet@efficios.com>
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:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
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
30 #define LTTNG_VIEWER_PATH_MAX 4096
31 #define LTTNG_VIEWER_NAME_MAX 255
32 #define LTTNG_VIEWER_HOST_NAME_MAX 64
34 /* Flags in reply to get_next_index and get_packet. */
35 /* New metadata is required to read this packet. */
36 #define LTTNG_VIEWER_FLAG_NEW_METADATA (1 << 0)
37 /* New stream got added to the trace. */
38 #define LTTNG_VIEWER_FLAG_NEW_STREAM (1 << 1)
40 enum lttng_viewer_command
{
42 VIEWER_LIST_SESSIONS
= 2,
43 VIEWER_ATTACH_SESSION
= 3,
44 VIEWER_GET_NEXT_INDEX
= 4,
45 VIEWER_GET_PACKET
= 5,
46 VIEWER_GET_METADATA
= 6,
49 enum lttng_viewer_attach_return_code
{
50 VIEWER_ATTACH_OK
= 1, /* If the attach command succeeded. */
51 VIEWER_ATTACH_ALREADY
= 2, /* If a viewer is already attached. */
52 VIEWER_ATTACH_UNK
= 3, /* If the session ID is unknown. */
53 VIEWER_ATTACH_NOT_LIVE
= 4, /* If the session is not live. */
54 VIEWER_ATTACH_SEEK_ERR
= 5, /* Seek error. */
57 enum lttng_viewer_next_index_return_code
{
58 VIEWER_INDEX_OK
= 1, /* Index is available. */
59 VIEWER_INDEX_RETRY
= 2, /* Index not yet available. */
60 VIEWER_INDEX_HUP
= 3, /* Index closed (trace destroyed). */
61 VIEWER_INDEX_ERR
= 4, /* Unknow error. */
62 VIEWER_INDEX_INACTIVE
= 5, /* Inactive stream beacon. */
63 VIEWER_INDEX_EOF
= 6, /* End of index file. */
66 enum lttng_viewer_get_packet_return_code
{
67 VIEWER_GET_PACKET_OK
= 1,
68 VIEWER_GET_PACKET_RETRY
= 2,
69 VIEWER_GET_PACKET_ERR
= 3,
70 VIEWER_GET_PACKET_EOF
= 4,
73 enum lttng_viewer_get_metadata_return_code
{
74 VIEWER_METADATA_OK
= 1,
75 VIEWER_NO_NEW_METADATA
= 2,
76 VIEWER_METADATA_ERR
= 3,
79 enum lttng_viewer_connection_type
{
80 VIEWER_CLIENT_COMMAND
= 1,
81 VIEWER_CLIENT_NOTIFICATION
= 2,
84 enum lttng_viewer_seek
{
85 /* Receive the trace packets from the beginning. */
86 VIEWER_SEEK_BEGINNING
= 1,
87 /* Receive the trace packets from now. */
91 struct lttng_viewer_session
{
96 char hostname
[LTTNG_VIEWER_HOST_NAME_MAX
];
97 char session_name
[LTTNG_VIEWER_NAME_MAX
];
98 } __attribute__((__packed__
));
100 struct lttng_viewer_stream
{
102 uint64_t ctf_trace_id
;
104 char path_name
[LTTNG_VIEWER_PATH_MAX
];
105 char channel_name
[LTTNG_VIEWER_NAME_MAX
];
106 } __attribute__((__packed__
));
108 struct lttng_viewer_cmd
{
109 uint64_t data_size
; /* data size following this header */
110 uint32_t cmd
; /* enum lttcomm_relayd_command */
111 uint32_t cmd_version
; /* command version */
112 } __attribute__((__packed__
));
117 struct lttng_viewer_connect
{
118 /* session ID assigned by the relay for command connections */
119 uint64_t viewer_session_id
;
122 uint32_t type
; /* enum lttng_viewer_connection_type */
123 } __attribute__((__packed__
));
126 * VIEWER_LIST_SESSIONS payload.
128 struct lttng_viewer_list_sessions
{
129 uint32_t sessions_count
;
130 char session_list
[]; /* struct lttng_viewer_session */
131 } __attribute__((__packed__
));
134 * VIEWER_ATTACH_SESSION payload.
136 struct lttng_viewer_attach_session_request
{
138 uint64_t offset
; /* unused for now */
139 uint32_t seek
; /* enum lttng_viewer_seek */
140 } __attribute__((__packed__
));
142 struct lttng_viewer_attach_session_response
{
143 /* enum lttng_viewer_attach_return_code */
145 uint32_t streams_count
;
146 /* struct lttng_viewer_stream */
148 } __attribute__((__packed__
));
151 * VIEWER_GET_NEXT_INDEX payload.
153 struct lttng_viewer_get_next_index
{
155 } __attribute__ ((__packed__
));
157 struct lttng_viewer_index
{
159 uint64_t packet_size
;
160 uint64_t content_size
;
161 uint64_t timestamp_begin
;
162 uint64_t timestamp_end
;
163 uint64_t events_discarded
;
165 /* enum lttng_viewer_next_index_return_code */
167 uint32_t flags
; /* LTTNG_VIEWER_FLAG_* */
168 } __attribute__ ((__packed__
));
171 * VIEWER_GET_PACKET payload.
173 struct lttng_viewer_get_packet
{
177 } __attribute__((__packed__
));
179 struct lttng_viewer_trace_packet
{
180 /* enum lttng_viewer_get_packet_return_code */
183 uint32_t flags
; /* LTTNG_VIEWER_FLAG_* */
185 } __attribute__((__packed__
));
188 * VIEWER_GET_METADATA payload.
190 struct lttng_viewer_get_metadata
{
192 } __attribute__((__packed__
));
194 struct lttng_viewer_metadata_packet
{
196 /* enum lttng_viewer_get_metadata_return_code */
199 } __attribute__((__packed__
));
201 #endif /* LTTNG_VIEWER_H */