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 | ||
3fadfbc0 MJ |
29 | #include <babeltrace2/babeltrace-internal.h> |
30 | #include <babeltrace2/compat/socket-internal.h> | |
7cdc2bab MD |
31 | |
32 | //TODO: this should not be used by plugins. Should copy code into plugin | |
33 | //instead. | |
3fadfbc0 | 34 | #include <babeltrace2/object-internal.h> |
7cdc2bab MD |
35 | |
36 | #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 | |
37 | ||
38 | #define LTTNG_LIVE_MAJOR 2 | |
39 | #define LTTNG_LIVE_MINOR 4 | |
40 | ||
4c66436f MD |
41 | struct lttng_live_component; |
42 | ||
14f28187 | 43 | struct live_viewer_connection { |
b19ff26f | 44 | bt_object obj; |
7cdc2bab | 45 | |
7cdc2bab MD |
46 | GString *url; |
47 | ||
94b828f3 MD |
48 | GString *relay_hostname; |
49 | GString *target_hostname; | |
50 | GString *session_name; | |
51 | ||
1cb3cdd7 | 52 | BT_SOCKET control_sock; |
7cdc2bab MD |
53 | int port; |
54 | ||
55 | int32_t major; | |
56 | int32_t minor; | |
4c66436f | 57 | |
14f28187 FD |
58 | bool in_query; |
59 | struct lttng_live_msg_iter *lttng_live_msg_iter; | |
7cdc2bab MD |
60 | }; |
61 | ||
62 | struct packet_index_time { | |
14f28187 FD |
63 | uint64_t timestamp_begin; |
64 | uint64_t timestamp_end; | |
7cdc2bab MD |
65 | }; |
66 | ||
67 | struct packet_index { | |
68 | off_t offset; /* offset of the packet in the file, in bytes */ | |
69 | int64_t data_offset; /* offset of data within the packet, in bits */ | |
70 | uint64_t packet_size; /* packet size, in bits */ | |
71 | uint64_t content_size; /* content size, in bits */ | |
72 | uint64_t events_discarded; | |
73 | uint64_t events_discarded_len; /* length of the field, in bits */ | |
74 | struct packet_index_time ts_cycles; /* timestamp in cycles */ | |
75 | struct packet_index_time ts_real; /* realtime timestamp */ | |
76 | /* CTF_INDEX 1.0 limit */ | |
77 | uint64_t stream_instance_id; /* ID of the channel instance */ | |
78 | uint64_t packet_seq_num; /* packet sequence number */ | |
79 | }; | |
80 | ||
14f28187 FD |
81 | struct live_viewer_connection * live_viewer_connection_create( |
82 | const char *url, bool in_query, | |
83 | struct lttng_live_msg_iter *lttng_live_msg_iter); | |
7cdc2bab | 84 | |
14f28187 FD |
85 | void live_viewer_connection_destroy( |
86 | struct live_viewer_connection *conn); | |
7cdc2bab | 87 | |
14f28187 FD |
88 | bt_query_status live_viewer_connection_list_sessions( |
89 | struct live_viewer_connection *viewer_connection, | |
90 | const bt_value **user_result); | |
7cdc2bab MD |
91 | |
92 | #endif /* LTTNG_LIVE_VIEWER_CONNECTION_H */ |