Commit | Line | Data |
---|---|---|
12a91e9d JD |
1 | #ifndef _LTTNG_LIVE_FUNCTIONS_H |
2 | #define _LTTNG_LIVE_FUNCTIONS_H | |
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> | |
6c5f6d07 | 28 | #include "lttng-viewer-abi.h" |
12a91e9d | 29 | |
12a91e9d JD |
30 | #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 |
31 | ||
32 | #define LTTNG_LIVE_MAJOR 2 | |
33 | #define LTTNG_LIVE_MINOR 4 | |
34 | ||
35 | struct lttng_live_ctx { | |
d81179de JD |
36 | char traced_hostname[NAME_MAX]; |
37 | char session_name[NAME_MAX]; | |
38 | char relay_hostname[NAME_MAX]; | |
12a91e9d | 39 | int control_sock; |
d81179de | 40 | int port; |
6c5f6d07 JD |
41 | /* Protocol version to use for this connection. */ |
42 | uint32_t major; | |
43 | uint32_t minor; | |
12a91e9d | 44 | struct lttng_live_session *session; |
d81179de JD |
45 | struct bt_context *bt_ctx; |
46 | GArray *session_ids; | |
12a91e9d JD |
47 | }; |
48 | ||
49 | struct lttng_live_viewer_stream { | |
50 | uint64_t id; | |
51 | uint64_t mmap_size; | |
6c5f6d07 JD |
52 | uint64_t ctf_stream_id; |
53 | FILE *metadata_fp_write; | |
54 | ssize_t metadata_len; | |
12a91e9d | 55 | int metadata_flag; |
6c5f6d07 | 56 | int data_pending; |
12a91e9d JD |
57 | struct lttng_live_session *session; |
58 | struct lttng_live_ctf_trace *ctf_trace; | |
6c5f6d07 | 59 | struct lttng_viewer_index current_index; |
12a91e9d JD |
60 | char path[PATH_MAX]; |
61 | }; | |
62 | ||
63 | struct lttng_live_session { | |
64 | uint64_t live_timer_interval; | |
65 | uint64_t stream_count; | |
66 | struct lttng_live_ctx *ctx; | |
67 | struct lttng_live_viewer_stream *streams; | |
68 | GHashTable *ctf_traces; | |
69 | }; | |
70 | ||
71 | struct lttng_live_ctf_trace { | |
72 | uint64_t ctf_trace_id; | |
73 | struct lttng_live_viewer_stream *metadata_stream; | |
74 | GPtrArray *streams; | |
75 | FILE *metadata_fp; | |
6c5f6d07 | 76 | struct bt_trace_handle *handle; |
12a91e9d | 77 | int trace_id; |
d81179de | 78 | int in_use; |
12a91e9d JD |
79 | }; |
80 | ||
d81179de JD |
81 | /* Just used in listing. */ |
82 | struct lttng_live_relay_session { | |
83 | uint32_t streams; | |
84 | uint32_t clients; | |
85 | uint32_t timer; | |
86 | char *name; | |
87 | char *hostname; | |
88 | }; | |
89 | ||
90 | int lttng_live_connect_viewer(struct lttng_live_ctx *ctx); | |
12a91e9d JD |
91 | int lttng_live_establish_connection(struct lttng_live_ctx *ctx); |
92 | int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path); | |
93 | int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id); | |
6c5f6d07 | 94 | int lttng_live_read(struct lttng_live_ctx *ctx); |
d81179de | 95 | int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id); |
6c5f6d07 | 96 | int lttng_live_should_quit(void); |
12a91e9d JD |
97 | |
98 | #endif /* _LTTNG_LIVE_FUNCTIONS_H */ |