Commit | Line | Data |
---|---|---|
7cdc2bab MD |
1 | #ifndef LTTNG_LIVE_VIEWER_CONNECTION_H |
2 | #define LTTNG_LIVE_VIEWER_CONNECTION_H | |
3 | ||
4 | /* | |
5 | * Copyright 2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
8 | * of this software and associated documentation files (the "Software"), to deal | |
9 | * in the Software without restriction, including without limitation the rights | |
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | * copies of the Software, and to permit persons to whom the Software is | |
12 | * furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
23 | * SOFTWARE. | |
24 | */ | |
25 | ||
26 | #include <stdio.h> | |
27 | #include <glib.h> | |
28 | ||
91d81473 | 29 | #include "common/macros.h" |
578e048b | 30 | #include "compat/socket.h" |
7cdc2bab | 31 | |
c01594de PP |
32 | /* |
33 | * FIXME: This is an internal Babeltrace library header; it is not meant | |
34 | * to be generic as it is now. Make sure this included code does not | |
35 | * log because it won't find our local log level. | |
36 | */ | |
37 | #define BT_OBJECT_DONT_LOG | |
578e048b | 38 | #include "lib/object.h" |
7cdc2bab MD |
39 | |
40 | #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 | |
41 | ||
42 | #define LTTNG_LIVE_MAJOR 2 | |
43 | #define LTTNG_LIVE_MINOR 4 | |
44 | ||
4c66436f MD |
45 | struct lttng_live_component; |
46 | ||
14f28187 | 47 | struct live_viewer_connection { |
c01594de | 48 | bt_logging_level log_level; |
2ece7dd0 | 49 | bt_self_component *self_comp; |
b19ff26f | 50 | bt_object obj; |
7cdc2bab | 51 | |
7cdc2bab MD |
52 | GString *url; |
53 | ||
94b828f3 MD |
54 | GString *relay_hostname; |
55 | GString *target_hostname; | |
56 | GString *session_name; | |
57 | ||
1cb3cdd7 | 58 | BT_SOCKET control_sock; |
7cdc2bab MD |
59 | int port; |
60 | ||
61 | int32_t major; | |
62 | int32_t minor; | |
4c66436f | 63 | |
14f28187 FD |
64 | bool in_query; |
65 | struct lttng_live_msg_iter *lttng_live_msg_iter; | |
7cdc2bab MD |
66 | }; |
67 | ||
68 | struct packet_index_time { | |
14f28187 FD |
69 | uint64_t timestamp_begin; |
70 | uint64_t timestamp_end; | |
7cdc2bab MD |
71 | }; |
72 | ||
73 | struct packet_index { | |
74 | off_t offset; /* offset of the packet in the file, in bytes */ | |
75 | int64_t data_offset; /* offset of data within the packet, in bits */ | |
76 | uint64_t packet_size; /* packet size, in bits */ | |
77 | uint64_t content_size; /* content size, in bits */ | |
78 | uint64_t events_discarded; | |
79 | uint64_t events_discarded_len; /* length of the field, in bits */ | |
80 | struct packet_index_time ts_cycles; /* timestamp in cycles */ | |
81 | struct packet_index_time ts_real; /* realtime timestamp */ | |
82 | /* CTF_INDEX 1.0 limit */ | |
83 | uint64_t stream_instance_id; /* ID of the channel instance */ | |
84 | uint64_t packet_seq_num; /* packet sequence number */ | |
85 | }; | |
86 | ||
14f28187 FD |
87 | struct live_viewer_connection * live_viewer_connection_create( |
88 | const char *url, bool in_query, | |
550004b4 PP |
89 | struct lttng_live_msg_iter *lttng_live_msg_iter, |
90 | bt_logging_level log_level); | |
7cdc2bab | 91 | |
14f28187 FD |
92 | void live_viewer_connection_destroy( |
93 | struct live_viewer_connection *conn); | |
7cdc2bab | 94 | |
d24d5663 | 95 | bt_component_class_query_method_status live_viewer_connection_list_sessions( |
14f28187 FD |
96 | struct live_viewer_connection *viewer_connection, |
97 | const bt_value **user_result); | |
7cdc2bab MD |
98 | |
99 | #endif /* LTTNG_LIVE_VIEWER_CONNECTION_H */ |