Sort includes in C++ files
[babeltrace.git] / src / plugins / ctf / lttng-live / viewer-connection.hpp
... / ...
CommitLineData
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 */
6
7#ifndef LTTNG_LIVE_VIEWER_CONNECTION_H
8#define LTTNG_LIVE_VIEWER_CONNECTION_H
9
10#include <glib.h>
11#include <stdbool.h>
12#include <stdint.h>
13#include <stdio.h>
14
15#include <babeltrace2/babeltrace.h>
16
17#include "common/macros.h"
18#include "compat/socket.h"
19
20#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
21
22#define LTTNG_LIVE_MAJOR 2
23#define LTTNG_LIVE_MINOR 4
24
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,
30};
31
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,
48};
49
50struct lttng_live_component;
51
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;
57
58 GString *url;
59
60 GString *relay_hostname;
61 GString *target_hostname;
62 GString *session_name;
63 GString *proto;
64
65 BT_SOCKET control_sock;
66 int port;
67
68 int32_t major;
69 int32_t minor;
70
71 bool in_query;
72 struct lttng_live_msg_iter *lttng_live_msg_iter;
73};
74
75struct packet_index_time
76{
77 uint64_t timestamp_begin;
78 uint64_t timestamp_end;
79};
80
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 */
94};
95
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);
102
103void live_viewer_connection_destroy(struct live_viewer_connection *conn);
104
105enum lttng_live_viewer_status
106lttng_live_create_viewer_session(struct lttng_live_msg_iter *lttng_live_msg_iter);
107
108bt_component_class_query_method_status
109live_viewer_connection_list_sessions(struct live_viewer_connection *viewer_connection,
110 const bt_value **user_result);
111
112#endif /* LTTNG_LIVE_VIEWER_CONNECTION_H */
This page took 0.022369 seconds and 4 git commands to generate.