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 DG |
30 | #define RELAYD_VERSION_COMM_MAJOR 2 |
31 | #define RELAYD_VERSION_COMM_MINOR 1 | |
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 */ | |
40 | uint32_t cmd; /* enum lttcomm_sessiond_command */ | |
41 | uint32_t cmd_version; /* command version */ | |
42 | } __attribute__ ((__packed__)); | |
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 */ |
b8aa1682 JD |
54 | } __attribute__ ((__packed__)); |
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; | |
62 | } __attribute__ ((__packed__)); | |
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 JD |
69 | char pathname[PATH_MAX]; |
70 | } __attribute__ ((__packed__)); | |
71 | ||
72 | /* | |
73 | * Answer from an add stream command. | |
74 | */ | |
75 | struct lttcomm_relayd_status_stream { | |
76 | uint64_t handle; | |
77 | uint32_t ret_code; | |
78 | } __attribute__ ((__packed__)); | |
79 | ||
80 | /* | |
81 | * Used to return command code for command not needing special data. | |
82 | */ | |
83 | struct lttcomm_relayd_generic_reply { | |
84 | uint32_t ret_code; | |
85 | } __attribute__ ((__packed__)); | |
86 | ||
87 | /* | |
88 | * Used to update synchronization information. | |
89 | */ | |
90 | struct lttcomm_relayd_update_sync_info { | |
173af62f | 91 | /* TODO: fill the structure. Feature not implemented yet */ |
b8aa1682 JD |
92 | } __attribute__ ((__packed__)); |
93 | ||
94 | /* | |
95 | * Version command. | |
96 | */ | |
97 | struct lttcomm_relayd_version { | |
98 | uint32_t major; | |
99 | uint32_t minor; | |
100 | } __attribute__ ((__packed__)); | |
101 | ||
102 | /* | |
103 | * Metadata payload used when metadata command is sent. | |
104 | */ | |
105 | struct lttcomm_relayd_metadata_payload { | |
106 | uint64_t stream_id; | |
1d4dfdef | 107 | uint32_t padding_size; |
b8aa1682 JD |
108 | char payload[]; |
109 | } __attribute__ ((__packed__)); | |
110 | ||
173af62f DG |
111 | /* |
112 | * Used to indicate that a specific stream id can now be closed. | |
113 | */ | |
114 | struct lttcomm_relayd_close_stream { | |
115 | uint64_t stream_id; | |
116 | uint64_t last_net_seq_num; /* sequence number of last packet */ | |
117 | } __attribute__ ((__packed__)); | |
118 | ||
c8f59ee5 | 119 | /* |
6d805429 DG |
120 | * Used to test if for a given stream id the data is pending on the relayd side |
121 | * for reading. | |
c8f59ee5 | 122 | */ |
6d805429 | 123 | struct lttcomm_relayd_data_pending { |
c8f59ee5 DG |
124 | uint64_t stream_id; |
125 | uint64_t last_net_seq_num; /* Sequence number of the last packet */ | |
126 | } __attribute__ ((__packed__)); | |
127 | ||
f7079f67 DG |
128 | struct lttcomm_relayd_begin_data_pending { |
129 | uint64_t session_id; | |
130 | } __attribute__ ((__packed__)); | |
131 | ||
132 | struct lttcomm_relayd_end_data_pending { | |
133 | uint64_t session_id; | |
134 | } __attribute__ ((__packed__)); | |
135 | ||
b8aa1682 | 136 | #endif /* _RELAYD_COMM */ |