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