5 * Copyright 2013 Julien Desfossez <julien.desfossez@efficios.com>
6 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 #include <sys/param.h>
29 #include <babeltrace/list.h>
30 #include "lttng-viewer-abi.h"
32 #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
34 #define LTTNG_LIVE_MAJOR 2
35 #define LTTNG_LIVE_MINOR 4
38 * The lttng-live output file pointer is currently hardcoded to stdout,
39 * and is expected to be hardcoded to this by fflush() performed between
42 #define LTTNG_LIVE_OUTPUT_FP stdout
44 struct lttng_live_ctx
{
45 char traced_hostname
[MAXNAMLEN
];
46 char session_name
[MAXNAMLEN
];
47 char relay_hostname
[MAXNAMLEN
];
50 /* Protocol version to use for this connection. */
53 struct lttng_live_session
*session
;
54 struct bt_context
*bt_ctx
;
58 struct lttng_live_viewer_stream
{
61 uint64_t ctf_stream_id
;
62 FILE *metadata_fp_write
;
66 struct lttng_live_session
*session
;
67 struct lttng_live_ctf_trace
*ctf_trace
;
68 struct lttng_viewer_index current_index
;
69 struct bt_list_head stream_node
;
73 struct lttng_live_session
{
74 uint64_t live_timer_interval
;
75 uint64_t stream_count
;
76 struct lttng_live_ctx
*ctx
;
77 struct bt_list_head stream_list
;
78 GHashTable
*ctf_traces
;
81 struct lttng_live_ctf_trace
{
82 uint64_t ctf_trace_id
;
83 struct lttng_live_viewer_stream
*metadata_stream
;
86 struct bt_trace_handle
*handle
;
91 /* Just used in listing. */
92 struct lttng_live_relay_session
{
100 int lttng_live_connect_viewer(struct lttng_live_ctx
*ctx
);
101 int lttng_live_establish_connection(struct lttng_live_ctx
*ctx
);
102 int lttng_live_list_sessions(struct lttng_live_ctx
*ctx
, const char *path
);
103 int lttng_live_attach_session(struct lttng_live_ctx
*ctx
, uint64_t id
);
104 int lttng_live_read(struct lttng_live_ctx
*ctx
);
105 int lttng_live_get_new_streams(struct lttng_live_ctx
*ctx
, uint64_t id
);
106 int lttng_live_should_quit(void);
108 #endif /* _LTTNG_LIVE_H */