Commit | Line | Data |
---|---|---|
b8aa1682 JD |
1 | /* |
2 | * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com> | |
3 | * Julien Desfossez <julien.desfossez@efficios.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License, version 2 only, | |
7 | * as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along | |
15 | * with this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | */ | |
18 | ||
19 | #ifndef _RELAYD_COMM | |
20 | #define _RELAYD_COMM | |
21 | ||
b8aa1682 JD |
22 | #include <limits.h> |
23 | #include <stdint.h> | |
24 | ||
25 | #include <lttng/lttng.h> | |
ce2a9e76 | 26 | #include <common/defaults.h> |
50adc264 | 27 | #include <common/index/ctf-index.h> |
b8aa1682 | 28 | |
6947778e MD |
29 | #define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR |
30 | #define RELAYD_VERSION_COMM_MINOR VERSION_MINOR | |
0a6b5085 | 31 | |
b8aa1682 JD |
32 | /* |
33 | * lttng-relayd communication header. | |
34 | */ | |
35 | struct lttcomm_relayd_hdr { | |
36 | /* Circuit ID not used for now so always ignored */ | |
37 | uint64_t circuit_id; | |
38 | uint64_t data_size; /* data size following this header */ | |
7c9534d6 | 39 | uint32_t cmd; /* enum lttcomm_relayd_command */ |
b8aa1682 | 40 | uint32_t cmd_version; /* command version */ |
a9e87764 | 41 | } LTTNG_PACKED; |
b8aa1682 JD |
42 | |
43 | /* | |
44 | * lttng-relayd data header. | |
45 | */ | |
46 | struct lttcomm_relayd_data_hdr { | |
47 | /* Circuit ID not used for now so always ignored */ | |
48 | uint64_t circuit_id; | |
49 | uint64_t stream_id; /* Stream ID known by the relayd */ | |
173af62f | 50 | uint64_t net_seq_num; /* Network sequence number, per stream. */ |
b8aa1682 | 51 | uint32_t data_size; /* data size following this header */ |
1d4dfdef | 52 | uint32_t padding_size; /* Size of 0 padding the data */ |
a9e87764 | 53 | } LTTNG_PACKED; |
b8aa1682 | 54 | |
c5b6f4f0 DG |
55 | /* |
56 | * Reply from a create session command. | |
57 | */ | |
58 | struct lttcomm_relayd_status_session { | |
59 | uint64_t session_id; | |
60 | uint32_t ret_code; | |
a9e87764 | 61 | } LTTNG_PACKED; |
c5b6f4f0 | 62 | |
b8aa1682 JD |
63 | /* |
64 | * Used to add a stream on the relay daemon. | |
65 | */ | |
66 | struct lttcomm_relayd_add_stream { | |
ce2a9e76 | 67 | char channel_name[DEFAULT_STREAM_NAME_LEN]; |
ba86d0a7 | 68 | char pathname[LTTNG_PATH_MAX]; |
a9e87764 | 69 | } LTTNG_PACKED; |
b8aa1682 | 70 | |
0f907de1 JD |
71 | /* |
72 | * Used to add a stream on the relay daemon. | |
73 | * Protocol version 2.2 | |
74 | */ | |
75 | struct lttcomm_relayd_add_stream_2_2 { | |
76 | char channel_name[DEFAULT_STREAM_NAME_LEN]; | |
ba86d0a7 | 77 | char pathname[LTTNG_PATH_MAX]; |
0f907de1 JD |
78 | uint64_t tracefile_size; |
79 | uint64_t tracefile_count; | |
80 | } LTTNG_PACKED; | |
81 | ||
b8aa1682 JD |
82 | /* |
83 | * Answer from an add stream command. | |
84 | */ | |
85 | struct lttcomm_relayd_status_stream { | |
86 | uint64_t handle; | |
87 | uint32_t ret_code; | |
a9e87764 | 88 | } LTTNG_PACKED; |
b8aa1682 JD |
89 | |
90 | /* | |
91 | * Used to return command code for command not needing special data. | |
92 | */ | |
93 | struct lttcomm_relayd_generic_reply { | |
94 | uint32_t ret_code; | |
a9e87764 | 95 | } LTTNG_PACKED; |
b8aa1682 JD |
96 | |
97 | /* | |
98 | * Used to update synchronization information. | |
99 | */ | |
100 | struct lttcomm_relayd_update_sync_info { | |
173af62f | 101 | /* TODO: fill the structure. Feature not implemented yet */ |
a9e87764 | 102 | } LTTNG_PACKED; |
b8aa1682 JD |
103 | |
104 | /* | |
105 | * Version command. | |
106 | */ | |
107 | struct lttcomm_relayd_version { | |
108 | uint32_t major; | |
109 | uint32_t minor; | |
a9e87764 | 110 | } LTTNG_PACKED; |
b8aa1682 JD |
111 | |
112 | /* | |
113 | * Metadata payload used when metadata command is sent. | |
114 | */ | |
115 | struct lttcomm_relayd_metadata_payload { | |
116 | uint64_t stream_id; | |
1d4dfdef | 117 | uint32_t padding_size; |
b8aa1682 | 118 | char payload[]; |
a9e87764 | 119 | } LTTNG_PACKED; |
b8aa1682 | 120 | |
173af62f DG |
121 | /* |
122 | * Used to indicate that a specific stream id can now be closed. | |
123 | */ | |
124 | struct lttcomm_relayd_close_stream { | |
125 | uint64_t stream_id; | |
126 | uint64_t last_net_seq_num; /* sequence number of last packet */ | |
a9e87764 | 127 | } LTTNG_PACKED; |
173af62f | 128 | |
c8f59ee5 | 129 | /* |
6d805429 DG |
130 | * Used to test if for a given stream id the data is pending on the relayd side |
131 | * for reading. | |
c8f59ee5 | 132 | */ |
6d805429 | 133 | struct lttcomm_relayd_data_pending { |
c8f59ee5 DG |
134 | uint64_t stream_id; |
135 | uint64_t last_net_seq_num; /* Sequence number of the last packet */ | |
a9e87764 | 136 | } LTTNG_PACKED; |
c8f59ee5 | 137 | |
f7079f67 DG |
138 | struct lttcomm_relayd_begin_data_pending { |
139 | uint64_t session_id; | |
a9e87764 | 140 | } LTTNG_PACKED; |
f7079f67 DG |
141 | |
142 | struct lttcomm_relayd_end_data_pending { | |
143 | uint64_t session_id; | |
a9e87764 | 144 | } LTTNG_PACKED; |
f7079f67 | 145 | |
ad7051c0 DG |
146 | struct lttcomm_relayd_quiescent_control { |
147 | uint64_t stream_id; | |
148 | } LTTNG_PACKED; | |
149 | ||
1c20f0e2 JD |
150 | /* |
151 | * Index data. | |
152 | */ | |
153 | struct lttcomm_relayd_index { | |
154 | uint64_t relay_stream_id; | |
155 | uint64_t net_seq_num; | |
156 | uint64_t packet_size; | |
157 | uint64_t content_size; | |
158 | uint64_t timestamp_begin; | |
159 | uint64_t timestamp_end; | |
160 | uint64_t events_discarded; | |
161 | uint64_t stream_id; | |
162 | } LTTNG_PACKED; | |
163 | ||
d3e2ba59 JD |
164 | /* |
165 | * Create session in 2.4 adds additionnal parameters for live reading. | |
166 | */ | |
167 | struct lttcomm_relayd_create_session_2_4 { | |
36d2e35d | 168 | char session_name[LTTNG_NAME_MAX]; |
9cf3eb20 | 169 | char hostname[LTTNG_HOST_NAME_MAX]; |
d3e2ba59 | 170 | uint32_t live_timer; |
7d2f7452 | 171 | uint32_t snapshot; |
d3e2ba59 JD |
172 | } LTTNG_PACKED; |
173 | ||
b8aa1682 | 174 | #endif /* _RELAYD_COMM */ |