Fix: check the lttng-relayd protocol version
[babeltrace.git] / formats / lttng-live / lttng-live.h
CommitLineData
c98627ca
MD
1#ifndef _LTTNG_LIVE_H
2#define _LTTNG_LIVE_H
4a744367
JD
3
4/*
5 * Copyright 2013 Julien Desfossez <julien.desfossez@efficios.com>
6 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
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:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
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
24 * SOFTWARE.
25 */
26
27#include <stdint.h>
28
4a744367
JD
29#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
30
31#define LTTNG_LIVE_MAJOR 2
32#define LTTNG_LIVE_MINOR 4
33
34struct lttng_live_ctx {
b5a1fa45
JD
35 char traced_hostname[NAME_MAX];
36 char session_name[NAME_MAX];
37 char relay_hostname[NAME_MAX];
4a744367 38 int control_sock;
b5a1fa45 39 int port;
0dfc7b62
JD
40 /* Protocol version to use for this connection. */
41 uint32_t major;
42 uint32_t minor;
4a744367 43 struct lttng_live_session *session;
2acdc547 44 struct bt_context *bt_ctx;
b5a1fa45 45 GArray *session_ids;
4a744367
JD
46};
47
48struct lttng_live_viewer_stream {
49 uint64_t id;
50 uint64_t mmap_size;
af701dc4
JD
51 FILE *metadata_fp_write;
52 ssize_t metadata_len;
4a744367
JD
53 int metadata_flag;
54 int first_read;
55 struct lttng_live_session *session;
56 struct lttng_live_ctf_trace *ctf_trace;
57 char path[PATH_MAX];
58};
59
60struct lttng_live_session {
61 uint64_t live_timer_interval;
62 uint64_t stream_count;
63 struct lttng_live_ctx *ctx;
64 struct lttng_live_viewer_stream *streams;
65 GHashTable *ctf_traces;
66};
67
68struct lttng_live_ctf_trace {
69 uint64_t ctf_trace_id;
70 struct lttng_live_viewer_stream *metadata_stream;
71 GPtrArray *streams;
72 FILE *metadata_fp;
150595c4 73 struct bt_trace_handle *handle;
4a744367 74 int trace_id;
2acdc547 75 int in_use;
4a744367
JD
76};
77
b5a1fa45
JD
78/* Just used in listing. */
79struct lttng_live_relay_session {
80 uint32_t streams;
81 uint32_t clients;
82 uint32_t timer;
83 char *name;
84 char *hostname;
85};
86
87int lttng_live_connect_viewer(struct lttng_live_ctx *ctx);
4a744367
JD
88int lttng_live_establish_connection(struct lttng_live_ctx *ctx);
89int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path);
90int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id);
23285bf3 91int lttng_live_read(struct lttng_live_ctx *ctx);
2acdc547 92int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id);
8ace20bf 93int lttng_live_should_quit(void);
4a744367 94
c98627ca 95#endif /* _LTTNG_LIVE_H */
This page took 0.026656 seconds and 4 git commands to generate.