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 | ||
29 | #include <babeltrace/babeltrace-internal.h> | |
30 | ||
31 | //TODO: this should not be used by plugins. Should copy code into plugin | |
32 | //instead. | |
33 | #include "babeltrace/object-internal.h" | |
34 | ||
35 | #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 | |
36 | ||
37 | #define LTTNG_LIVE_MAJOR 2 | |
38 | #define LTTNG_LIVE_MINOR 4 | |
39 | ||
40 | struct bt_live_viewer_connection { | |
41 | struct bt_object obj; | |
42 | ||
43 | FILE *error_fp; | |
44 | ||
45 | GString *url; | |
46 | ||
47 | char relay_hostname[MAXNAMLEN]; | |
48 | char target_hostname[MAXNAMLEN]; | |
49 | char session_name[MAXNAMLEN]; | |
50 | int control_sock; | |
51 | int port; | |
52 | ||
53 | int32_t major; | |
54 | int32_t minor; | |
55 | }; | |
56 | ||
57 | struct packet_index_time { | |
58 | int64_t timestamp_begin; | |
59 | int64_t timestamp_end; | |
60 | }; | |
61 | ||
62 | struct packet_index { | |
63 | off_t offset; /* offset of the packet in the file, in bytes */ | |
64 | int64_t data_offset; /* offset of data within the packet, in bits */ | |
65 | uint64_t packet_size; /* packet size, in bits */ | |
66 | uint64_t content_size; /* content size, in bits */ | |
67 | uint64_t events_discarded; | |
68 | uint64_t events_discarded_len; /* length of the field, in bits */ | |
69 | struct packet_index_time ts_cycles; /* timestamp in cycles */ | |
70 | struct packet_index_time ts_real; /* realtime timestamp */ | |
71 | /* CTF_INDEX 1.0 limit */ | |
72 | uint64_t stream_instance_id; /* ID of the channel instance */ | |
73 | uint64_t packet_seq_num; /* packet sequence number */ | |
74 | }; | |
75 | ||
76 | struct bt_live_viewer_connection * | |
77 | bt_live_viewer_connection_create(const char *url, FILE *error_fp); | |
78 | ||
79 | void bt_live_viewer_connection_destroy(struct bt_live_viewer_connection *conn); | |
80 | ||
81 | struct bt_value *bt_live_viewer_connection_list_sessions(struct bt_live_viewer_connection *viewer_connection); | |
82 | ||
83 | #endif /* LTTNG_LIVE_VIEWER_CONNECTION_H */ |