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> |
b8aa1682 | 29 | |
0a6b5085 | 30 | #define RELAYD_VERSION_COMM_MAJOR 2 |
f9090332 | 31 | #define RELAYD_VERSION_COMM_MINOR 2 |
0a6b5085 | 32 | |
b8aa1682 JD |
33 | /* |
34 | * lttng-relayd communication header. | |
35 | */ | |
36 | struct lttcomm_relayd_hdr { | |
37 | /* Circuit ID not used for now so always ignored */ | |
38 | uint64_t circuit_id; | |
39 | uint64_t data_size; /* data size following this header */ | |
7c9534d6 | 40 | uint32_t cmd; /* enum lttcomm_relayd_command */ |
b8aa1682 | 41 | uint32_t cmd_version; /* command version */ |
a9e87764 | 42 | } LTTNG_PACKED; |
b8aa1682 JD |
43 | |
44 | /* | |
45 | * lttng-relayd data header. | |
46 | */ | |
47 | struct lttcomm_relayd_data_hdr { | |
48 | /* Circuit ID not used for now so always ignored */ | |
49 | uint64_t circuit_id; | |
50 | uint64_t stream_id; /* Stream ID known by the relayd */ | |
173af62f | 51 | uint64_t net_seq_num; /* Network sequence number, per stream. */ |
b8aa1682 | 52 | uint32_t data_size; /* data size following this header */ |
1d4dfdef | 53 | uint32_t padding_size; /* Size of 0 padding the data */ |
a9e87764 | 54 | } LTTNG_PACKED; |
b8aa1682 | 55 | |
c5b6f4f0 DG |
56 | /* |
57 | * Reply from a create session command. | |
58 | */ | |
59 | struct lttcomm_relayd_status_session { | |
60 | uint64_t session_id; | |
61 | uint32_t ret_code; | |
a9e87764 | 62 | } LTTNG_PACKED; |
c5b6f4f0 | 63 | |
b8aa1682 JD |
64 | /* |
65 | * Used to add a stream on the relay daemon. | |
66 | */ | |
67 | struct lttcomm_relayd_add_stream { | |
ce2a9e76 | 68 | char channel_name[DEFAULT_STREAM_NAME_LEN]; |
b8aa1682 | 69 | char pathname[PATH_MAX]; |
a9e87764 | 70 | } LTTNG_PACKED; |
b8aa1682 | 71 | |
0f907de1 JD |
72 | /* |
73 | * Used to add a stream on the relay daemon. | |
74 | * Protocol version 2.2 | |
75 | */ | |
76 | struct lttcomm_relayd_add_stream_2_2 { | |
77 | char channel_name[DEFAULT_STREAM_NAME_LEN]; | |
78 | char pathname[PATH_MAX]; | |
79 | uint64_t tracefile_size; | |
80 | uint64_t tracefile_count; | |
81 | } LTTNG_PACKED; | |
82 | ||
b8aa1682 JD |
83 | /* |
84 | * Answer from an add stream command. | |
85 | */ | |
86 | struct lttcomm_relayd_status_stream { | |
87 | uint64_t handle; | |
88 | uint32_t ret_code; | |
a9e87764 | 89 | } LTTNG_PACKED; |
b8aa1682 JD |
90 | |
91 | /* | |
92 | * Used to return command code for command not needing special data. | |
93 | */ | |
94 | struct lttcomm_relayd_generic_reply { | |
95 | uint32_t ret_code; | |
a9e87764 | 96 | } LTTNG_PACKED; |
b8aa1682 JD |
97 | |
98 | /* | |
99 | * Used to update synchronization information. | |
100 | */ | |
101 | struct lttcomm_relayd_update_sync_info { | |
173af62f | 102 | /* TODO: fill the structure. Feature not implemented yet */ |
a9e87764 | 103 | } LTTNG_PACKED; |
b8aa1682 JD |
104 | |
105 | /* | |
106 | * Version command. | |
107 | */ | |
108 | struct lttcomm_relayd_version { | |
109 | uint32_t major; | |
110 | uint32_t minor; | |
a9e87764 | 111 | } LTTNG_PACKED; |
b8aa1682 JD |
112 | |
113 | /* | |
114 | * Metadata payload used when metadata command is sent. | |
115 | */ | |
116 | struct lttcomm_relayd_metadata_payload { | |
117 | uint64_t stream_id; | |
1d4dfdef | 118 | uint32_t padding_size; |
b8aa1682 | 119 | char payload[]; |
a9e87764 | 120 | } LTTNG_PACKED; |
b8aa1682 | 121 | |
173af62f DG |
122 | /* |
123 | * Used to indicate that a specific stream id can now be closed. | |
124 | */ | |
125 | struct lttcomm_relayd_close_stream { | |
126 | uint64_t stream_id; | |
127 | uint64_t last_net_seq_num; /* sequence number of last packet */ | |
a9e87764 | 128 | } LTTNG_PACKED; |
173af62f | 129 | |
c8f59ee5 | 130 | /* |
6d805429 DG |
131 | * Used to test if for a given stream id the data is pending on the relayd side |
132 | * for reading. | |
c8f59ee5 | 133 | */ |
6d805429 | 134 | struct lttcomm_relayd_data_pending { |
c8f59ee5 DG |
135 | uint64_t stream_id; |
136 | uint64_t last_net_seq_num; /* Sequence number of the last packet */ | |
a9e87764 | 137 | } LTTNG_PACKED; |
c8f59ee5 | 138 | |
f7079f67 DG |
139 | struct lttcomm_relayd_begin_data_pending { |
140 | uint64_t session_id; | |
a9e87764 | 141 | } LTTNG_PACKED; |
f7079f67 DG |
142 | |
143 | struct lttcomm_relayd_end_data_pending { | |
144 | uint64_t session_id; | |
a9e87764 | 145 | } LTTNG_PACKED; |
f7079f67 | 146 | |
ad7051c0 DG |
147 | struct lttcomm_relayd_quiescent_control { |
148 | uint64_t stream_id; | |
149 | } LTTNG_PACKED; | |
150 | ||
b8aa1682 | 151 | #endif /* _RELAYD_COMM */ |