Remove stdbool.h includes from C++ files
[babeltrace.git] / src / plugins / ctf / lttng-live / viewer-connection.hpp
CommitLineData
7cdc2bab 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
7cdc2bab 3 *
0235b0db 4 * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7cdc2bab
MD
5 */
6
0235b0db
MJ
7#ifndef LTTNG_LIVE_VIEWER_CONNECTION_H
8#define LTTNG_LIVE_VIEWER_CONNECTION_H
9
c802cacb 10#include <glib.h>
3c22a242 11#include <stdint.h>
7cdc2bab 12#include <stdio.h>
3c22a242 13
3c22a242
FD
14#include <babeltrace2/babeltrace.h>
15
91d81473 16#include "common/macros.h"
578e048b 17#include "compat/socket.h"
7cdc2bab 18
4164020e 19#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
7cdc2bab 20
4164020e
SM
21#define LTTNG_LIVE_MAJOR 2
22#define LTTNG_LIVE_MINOR 4
7cdc2bab 23
4164020e
SM
24enum lttng_live_viewer_status
25{
26 LTTNG_LIVE_VIEWER_STATUS_OK = 0,
27 LTTNG_LIVE_VIEWER_STATUS_ERROR = -1,
28 LTTNG_LIVE_VIEWER_STATUS_INTERRUPTED = -2,
f79c2d7a
FD
29};
30
4164020e
SM
31enum lttng_live_get_one_metadata_status
32{
33 /* The end of the metadata stream was reached. */
34 LTTNG_LIVE_GET_ONE_METADATA_STATUS_END = 1,
35 /* One metadata packet was received and written to file. */
36 LTTNG_LIVE_GET_ONE_METADATA_STATUS_OK = LTTNG_LIVE_VIEWER_STATUS_OK,
37 /*
38 * A critical error occurred when contacting the relay or while
39 * handling its response.
40 */
41 LTTNG_LIVE_GET_ONE_METADATA_STATUS_ERROR = LTTNG_LIVE_VIEWER_STATUS_ERROR,
42
43 LTTNG_LIVE_GET_ONE_METADATA_STATUS_INTERRUPTED = LTTNG_LIVE_VIEWER_STATUS_INTERRUPTED,
44
45 /* The metadata stream was not found on the relay. */
46 LTTNG_LIVE_GET_ONE_METADATA_STATUS_CLOSED = -3,
f79c2d7a
FD
47};
48
4c66436f
MD
49struct lttng_live_component;
50
4164020e
SM
51struct live_viewer_connection
52{
53 bt_logging_level log_level;
54 bt_self_component *self_comp;
55 bt_self_component_class *self_comp_class;
7cdc2bab 56
4164020e 57 GString *url;
7cdc2bab 58
4164020e
SM
59 GString *relay_hostname;
60 GString *target_hostname;
61 GString *session_name;
62 GString *proto;
94b828f3 63
4164020e
SM
64 BT_SOCKET control_sock;
65 int port;
7cdc2bab 66
4164020e
SM
67 int32_t major;
68 int32_t minor;
4c66436f 69
4164020e
SM
70 bool in_query;
71 struct lttng_live_msg_iter *lttng_live_msg_iter;
7cdc2bab
MD
72};
73
4164020e
SM
74struct packet_index_time
75{
76 uint64_t timestamp_begin;
77 uint64_t timestamp_end;
7cdc2bab
MD
78};
79
4164020e
SM
80struct packet_index
81{
82 off_t offset; /* offset of the packet in the file, in bytes */
83 int64_t data_offset; /* offset of data within the packet, in bits */
84 uint64_t packet_size; /* packet size, in bits */
85 uint64_t content_size; /* content size, in bits */
86 uint64_t events_discarded;
87 uint64_t events_discarded_len; /* length of the field, in bits */
88 struct packet_index_time ts_cycles; /* timestamp in cycles */
89 struct packet_index_time ts_real; /* realtime timestamp */
90 /* CTF_INDEX 1.0 limit */
91 uint64_t stream_instance_id; /* ID of the channel instance */
92 uint64_t packet_seq_num; /* packet sequence number */
7cdc2bab
MD
93};
94
4164020e
SM
95enum lttng_live_viewer_status
96live_viewer_connection_create(bt_self_component *self_comp,
97 bt_self_component_class *self_comp_class, bt_logging_level log_level,
98 const char *url, bool in_query,
99 struct lttng_live_msg_iter *lttng_live_msg_iter,
100 struct live_viewer_connection **viewer_connection);
7cdc2bab 101
4164020e 102void live_viewer_connection_destroy(struct live_viewer_connection *conn);
7cdc2bab 103
4164020e
SM
104enum lttng_live_viewer_status
105lttng_live_create_viewer_session(struct lttng_live_msg_iter *lttng_live_msg_iter);
36e94ad6 106
4164020e
SM
107bt_component_class_query_method_status
108live_viewer_connection_list_sessions(struct live_viewer_connection *viewer_connection,
109 const bt_value **user_result);
7cdc2bab
MD
110
111#endif /* LTTNG_LIVE_VIEWER_CONNECTION_H */
This page took 0.117322 seconds and 4 git commands to generate.