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 | ||
22 | #define _GNU_SOURCE | |
23 | ||
24 | #include <limits.h> | |
25 | #include <stdint.h> | |
26 | ||
27 | #include <lttng/lttng.h> | |
ce2a9e76 | 28 | #include <common/defaults.h> |
50adc264 | 29 | #include <common/index/ctf-index.h> |
6947778e | 30 | #include <config.h> |
b8aa1682 | 31 | |
6947778e MD |
32 | #define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR |
33 | #define RELAYD_VERSION_COMM_MINOR VERSION_MINOR | |
0a6b5085 | 34 | |
b8aa1682 JD |
35 | /* |
36 | * lttng-relayd communication header. | |
37 | */ | |
38 | struct lttcomm_relayd_hdr { | |
39 | /* Circuit ID not used for now so always ignored */ | |
40 | uint64_t circuit_id; | |
41 | uint64_t data_size; /* data size following this header */ | |
7c9534d6 | 42 | uint32_t cmd; /* enum lttcomm_relayd_command */ |
b8aa1682 | 43 | uint32_t cmd_version; /* command version */ |
a9e87764 | 44 | } LTTNG_PACKED; |
b8aa1682 JD |
45 | |
46 | /* | |
47 | * lttng-relayd data header. | |
48 | */ | |
49 | struct lttcomm_relayd_data_hdr { | |
50 | /* Circuit ID not used for now so always ignored */ | |
51 | uint64_t circuit_id; | |
52 | uint64_t stream_id; /* Stream ID known by the relayd */ | |
173af62f | 53 | uint64_t net_seq_num; /* Network sequence number, per stream. */ |
b8aa1682 | 54 | uint32_t data_size; /* data size following this header */ |
1d4dfdef | 55 | uint32_t padding_size; /* Size of 0 padding the data */ |
a9e87764 | 56 | } LTTNG_PACKED; |
b8aa1682 | 57 | |
c5b6f4f0 DG |
58 | /* |
59 | * Reply from a create session command. | |
60 | */ | |
61 | struct lttcomm_relayd_status_session { | |
62 | uint64_t session_id; | |
63 | uint32_t ret_code; | |
a9e87764 | 64 | } LTTNG_PACKED; |
c5b6f4f0 | 65 | |
b8aa1682 JD |
66 | /* |
67 | * Used to add a stream on the relay daemon. | |
68 | */ | |
69 | struct lttcomm_relayd_add_stream { | |
ce2a9e76 | 70 | char channel_name[DEFAULT_STREAM_NAME_LEN]; |
b8aa1682 | 71 | char pathname[PATH_MAX]; |
a9e87764 | 72 | } LTTNG_PACKED; |
b8aa1682 | 73 | |
0f907de1 JD |
74 | /* |
75 | * Used to add a stream on the relay daemon. | |
76 | * Protocol version 2.2 | |
77 | */ | |
78 | struct lttcomm_relayd_add_stream_2_2 { | |
79 | char channel_name[DEFAULT_STREAM_NAME_LEN]; | |
80 | char pathname[PATH_MAX]; | |
81 | uint64_t tracefile_size; | |
82 | uint64_t tracefile_count; | |
83 | } LTTNG_PACKED; | |
84 | ||
b8aa1682 JD |
85 | /* |
86 | * Answer from an add stream command. | |
87 | */ | |
88 | struct lttcomm_relayd_status_stream { | |
89 | uint64_t handle; | |
90 | uint32_t ret_code; | |
a9e87764 | 91 | } LTTNG_PACKED; |
b8aa1682 JD |
92 | |
93 | /* | |
94 | * Used to return command code for command not needing special data. | |
95 | */ | |
96 | struct lttcomm_relayd_generic_reply { | |
97 | uint32_t ret_code; | |
a9e87764 | 98 | } LTTNG_PACKED; |
b8aa1682 JD |
99 | |
100 | /* | |
101 | * Used to update synchronization information. | |
102 | */ | |
103 | struct lttcomm_relayd_update_sync_info { | |
173af62f | 104 | /* TODO: fill the structure. Feature not implemented yet */ |
a9e87764 | 105 | } LTTNG_PACKED; |
b8aa1682 JD |
106 | |
107 | /* | |
108 | * Version command. | |
109 | */ | |
110 | struct lttcomm_relayd_version { | |
111 | uint32_t major; | |
112 | uint32_t minor; | |
a9e87764 | 113 | } LTTNG_PACKED; |
b8aa1682 JD |
114 | |
115 | /* | |
116 | * Metadata payload used when metadata command is sent. | |
117 | */ | |
118 | struct lttcomm_relayd_metadata_payload { | |
119 | uint64_t stream_id; | |
1d4dfdef | 120 | uint32_t padding_size; |
b8aa1682 | 121 | char payload[]; |
a9e87764 | 122 | } LTTNG_PACKED; |
b8aa1682 | 123 | |
173af62f DG |
124 | /* |
125 | * Used to indicate that a specific stream id can now be closed. | |
126 | */ | |
127 | struct lttcomm_relayd_close_stream { | |
128 | uint64_t stream_id; | |
129 | uint64_t last_net_seq_num; /* sequence number of last packet */ | |
a9e87764 | 130 | } LTTNG_PACKED; |
173af62f | 131 | |
c8f59ee5 | 132 | /* |
6d805429 DG |
133 | * Used to test if for a given stream id the data is pending on the relayd side |
134 | * for reading. | |
c8f59ee5 | 135 | */ |
6d805429 | 136 | struct lttcomm_relayd_data_pending { |
c8f59ee5 DG |
137 | uint64_t stream_id; |
138 | uint64_t last_net_seq_num; /* Sequence number of the last packet */ | |
a9e87764 | 139 | } LTTNG_PACKED; |
c8f59ee5 | 140 | |
f7079f67 DG |
141 | struct lttcomm_relayd_begin_data_pending { |
142 | uint64_t session_id; | |
a9e87764 | 143 | } LTTNG_PACKED; |
f7079f67 DG |
144 | |
145 | struct lttcomm_relayd_end_data_pending { | |
146 | uint64_t session_id; | |
a9e87764 | 147 | } LTTNG_PACKED; |
f7079f67 | 148 | |
ad7051c0 DG |
149 | struct lttcomm_relayd_quiescent_control { |
150 | uint64_t stream_id; | |
151 | } LTTNG_PACKED; | |
152 | ||
1c20f0e2 JD |
153 | /* |
154 | * Index data. | |
155 | */ | |
156 | struct lttcomm_relayd_index { | |
157 | uint64_t relay_stream_id; | |
158 | uint64_t net_seq_num; | |
159 | uint64_t packet_size; | |
160 | uint64_t content_size; | |
161 | uint64_t timestamp_begin; | |
162 | uint64_t timestamp_end; | |
163 | uint64_t events_discarded; | |
164 | uint64_t stream_id; | |
165 | } LTTNG_PACKED; | |
166 | ||
d3e2ba59 JD |
167 | /* |
168 | * Create session in 2.4 adds additionnal parameters for live reading. | |
169 | */ | |
170 | struct lttcomm_relayd_create_session_2_4 { | |
36d2e35d | 171 | char session_name[LTTNG_NAME_MAX]; |
9cf3eb20 | 172 | char hostname[LTTNG_HOST_NAME_MAX]; |
d3e2ba59 | 173 | uint32_t live_timer; |
7d2f7452 | 174 | uint32_t snapshot; |
d3e2ba59 JD |
175 | } LTTNG_PACKED; |
176 | ||
b8aa1682 | 177 | #endif /* _RELAYD_COMM */ |