Commit | Line | Data |
---|---|---|
4a744367 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> | |
28 | ||
29 | #define LTTNG_METADATA_PATH_TEMPLATE "/tmp/lttng-live-XXXXXX" | |
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 { | |
36 | int control_sock; | |
37 | struct lttng_live_session *session; | |
38 | }; | |
39 | ||
40 | struct lttng_live_viewer_stream { | |
41 | uint64_t id; | |
42 | uint64_t mmap_size; | |
43 | int fd; | |
44 | int metadata_flag; | |
45 | int first_read; | |
46 | struct lttng_live_session *session; | |
47 | struct lttng_live_ctf_trace *ctf_trace; | |
48 | char path[PATH_MAX]; | |
49 | }; | |
50 | ||
51 | struct lttng_live_session { | |
52 | uint64_t live_timer_interval; | |
53 | uint64_t stream_count; | |
54 | struct lttng_live_ctx *ctx; | |
55 | struct lttng_live_viewer_stream *streams; | |
56 | GHashTable *ctf_traces; | |
57 | }; | |
58 | ||
59 | struct lttng_live_ctf_trace { | |
60 | uint64_t ctf_trace_id; | |
61 | struct lttng_live_viewer_stream *metadata_stream; | |
62 | GPtrArray *streams; | |
63 | FILE *metadata_fp; | |
64 | int trace_id; | |
65 | }; | |
66 | ||
67 | int lttng_live_connect_viewer(struct lttng_live_ctx *ctx, char *hostname, | |
68 | int port); | |
69 | int lttng_live_establish_connection(struct lttng_live_ctx *ctx); | |
70 | int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path); | |
71 | int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id); | |
72 | void lttng_live_read(struct lttng_live_ctx *ctx, uint64_t session_id); | |
73 | ||
74 | #endif /* _LTTNG_LIVE_FUNCTIONS_H */ |