5be2328b9794676462f1c0cd96a588a0e97fc406
[lttng-tools.git] / src / common / sessiond-comm / relayd.h
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>
28
29 #define RELAYD_VERSION_COMM_MAJOR 2
30 #define RELAYD_VERSION_COMM_MINOR 1
31
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 */
39 uint32_t cmd; /* enum lttcomm_sessiond_command */
40 uint32_t cmd_version; /* command version */
41 } __attribute__ ((__packed__));
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 */
50 uint64_t net_seq_num; /* Network sequence number, per stream. */
51 uint32_t data_size; /* data size following this header */
52 uint32_t padding_size; /* Size of 0 padding the data */
53 } __attribute__ ((__packed__));
54
55 /*
56 * Used to add a stream on the relay daemon.
57 */
58 struct lttcomm_relayd_add_stream {
59 char channel_name[LTTNG_SYMBOL_NAME_LEN];
60 char pathname[PATH_MAX];
61 } __attribute__ ((__packed__));
62
63 /*
64 * Answer from an add stream command.
65 */
66 struct lttcomm_relayd_status_stream {
67 uint64_t handle;
68 uint32_t ret_code;
69 } __attribute__ ((__packed__));
70
71 /*
72 * Used to return command code for command not needing special data.
73 */
74 struct lttcomm_relayd_generic_reply {
75 uint32_t ret_code;
76 } __attribute__ ((__packed__));
77
78 /*
79 * Used to update synchronization information.
80 */
81 struct lttcomm_relayd_update_sync_info {
82 /* TODO: fill the structure. Feature not implemented yet */
83 } __attribute__ ((__packed__));
84
85 /*
86 * Version command.
87 */
88 struct lttcomm_relayd_version {
89 uint32_t major;
90 uint32_t minor;
91 } __attribute__ ((__packed__));
92
93 /*
94 * Metadata payload used when metadata command is sent.
95 */
96 struct lttcomm_relayd_metadata_payload {
97 uint64_t stream_id;
98 uint32_t padding_size;
99 char payload[];
100 } __attribute__ ((__packed__));
101
102 /*
103 * Used to indicate that a specific stream id can now be closed.
104 */
105 struct lttcomm_relayd_close_stream {
106 uint64_t stream_id;
107 uint64_t last_net_seq_num; /* sequence number of last packet */
108 } __attribute__ ((__packed__));
109
110 /*
111 * Used to test if for a given stream id the data is available on the relayd
112 * side for reading.
113 */
114 struct lttcomm_relayd_data_available {
115 uint64_t stream_id;
116 uint64_t last_net_seq_num; /* Sequence number of the last packet */
117 } __attribute__ ((__packed__));
118
119 #endif /* _RELAYD_COMM */
This page took 0.031239 seconds and 4 git commands to generate.