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