2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
14 #include <common/sessiond-comm/relayd.h>
15 #include <common/sessiond-comm/sessiond-comm.h>
16 #include <common/trace-chunk.h>
17 #include <common/dynamic-array.h>
23 struct relayd_stream_rotation_position
{
26 * Packet sequence number of the first packet belonging to the new
27 * "destination" trace chunk to which the stream is rotating.
29 * Ignored for metadata streams.
31 uint64_t rotate_at_seq_num
;
34 int relayd_connect(struct lttcomm_relayd_sock
*sock
);
35 int relayd_close(struct lttcomm_relayd_sock
*sock
);
36 int relayd_create_session(struct lttcomm_relayd_sock
*rsock
,
37 uint64_t *relayd_session_id
,
38 const char *session_name
, const char *hostname
,
39 const char *base_path
, int session_live_timer
,
40 unsigned int snapshot
, uint64_t sessiond_session_id
,
41 const lttng_uuid sessiond_uuid
,
42 const uint64_t *current_chunk_id
,
43 time_t creation_time
, bool session_name_contains_creation_time
,
45 int relayd_add_stream(struct lttcomm_relayd_sock
*sock
, const char *channel_name
,
46 const char *domain_name
, const char *pathname
, uint64_t *stream_id
,
47 uint64_t tracefile_size
, uint64_t tracefile_count
,
48 struct lttng_trace_chunk
*trace_chunk
);
49 int relayd_streams_sent(struct lttcomm_relayd_sock
*rsock
);
50 int relayd_send_close_stream(struct lttcomm_relayd_sock
*sock
, uint64_t stream_id
,
51 uint64_t last_net_seq_num
);
52 int relayd_version_check(struct lttcomm_relayd_sock
*sock
);
53 int relayd_start_data(struct lttcomm_relayd_sock
*sock
);
54 int relayd_send_metadata(struct lttcomm_relayd_sock
*sock
, size_t len
);
55 int relayd_send_data_hdr(struct lttcomm_relayd_sock
*sock
,
56 struct lttcomm_relayd_data_hdr
*hdr
, size_t size
);
57 int relayd_data_pending(struct lttcomm_relayd_sock
*sock
, uint64_t stream_id
,
58 uint64_t last_net_seq_num
);
59 int relayd_quiescent_control(struct lttcomm_relayd_sock
*sock
,
60 uint64_t metadata_stream_id
);
61 int relayd_begin_data_pending(struct lttcomm_relayd_sock
*sock
, uint64_t id
);
62 int relayd_end_data_pending(struct lttcomm_relayd_sock
*sock
, uint64_t id
,
63 unsigned int *is_data_inflight
);
64 int relayd_send_index(struct lttcomm_relayd_sock
*rsock
,
65 struct ctf_packet_index
*index
, uint64_t relay_stream_id
,
66 uint64_t net_seq_num
);
67 int relayd_reset_metadata(struct lttcomm_relayd_sock
*rsock
,
68 uint64_t stream_id
, uint64_t version
);
69 /* `positions` is an array of `stream_count` relayd_stream_rotation_position. */
70 int relayd_rotate_streams(struct lttcomm_relayd_sock
*sock
,
71 unsigned int stream_count
, const uint64_t *new_chunk_id
,
72 const struct relayd_stream_rotation_position
*positions
);
73 int relayd_create_trace_chunk(struct lttcomm_relayd_sock
*sock
,
74 struct lttng_trace_chunk
*chunk
);
75 int relayd_close_trace_chunk(struct lttcomm_relayd_sock
*sock
,
76 struct lttng_trace_chunk
*chunk
,
78 int relayd_trace_chunk_exists(struct lttcomm_relayd_sock
*sock
,
79 uint64_t chunk_id
, bool *chunk_exists
);
80 int relayd_get_configuration(struct lttcomm_relayd_sock
*sock
,
82 uint64_t *result_flags
);
88 #endif /* _RELAYD_H */