Commit | Line | Data |
---|---|---|
b8aa1682 JD |
1 | /* |
2 | * Copyright (C) 2012 - Julien Desfossez <jdesfossez@efficios.com> | |
3 | * David Goulet <dgoulet@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 | ||
7717e361 MD |
19 | #ifndef LTTNG_RELAYD_H |
20 | #define LTTNG_RELAYD_H | |
b8aa1682 JD |
21 | |
22 | #define _LGPL_SOURCE | |
23 | #include <urcu.h> | |
24 | #include <urcu/wfqueue.h> | |
0f907de1 | 25 | #include <common/hashtable/hashtable.h> |
b8aa1682 JD |
26 | |
27 | /* | |
28 | * Queue used to enqueue relay requests | |
29 | */ | |
30 | struct relay_cmd_queue { | |
b8aa1682 | 31 | struct cds_wfq_queue queue; |
7717e361 | 32 | int32_t futex; |
b8aa1682 JD |
33 | }; |
34 | ||
35 | enum connection_type { | |
36 | RELAY_DATA, | |
37 | RELAY_CONTROL, | |
38 | }; | |
39 | ||
40 | /* | |
41 | * Represents a session for the relay point of view | |
42 | */ | |
43 | struct relay_session { | |
f7079f67 DG |
44 | /* |
45 | * This session id is used to identify a set of stream to a tracing session | |
46 | * but also make sure we have a unique session id associated with a session | |
47 | * daemon which can provide multiple data source. | |
48 | */ | |
b8aa1682 JD |
49 | uint64_t id; |
50 | struct lttcomm_sock *sock; | |
b8aa1682 JD |
51 | }; |
52 | ||
53 | /* | |
54 | * Represents a stream in the relay | |
55 | */ | |
56 | struct relay_stream { | |
57 | uint64_t stream_handle; | |
173af62f | 58 | uint64_t prev_seq; /* previous data sequence number encountered */ |
7717e361 | 59 | struct lttng_ht_node_ulong stream_n; |
b8aa1682 | 60 | struct relay_session *session; |
9d1bbf21 | 61 | struct rcu_head rcu_node; |
7717e361 | 62 | int fd; |
173af62f | 63 | |
0f907de1 JD |
64 | char *path_name; |
65 | char *channel_name; | |
66 | /* on-disk circular buffer of tracefiles */ | |
67 | uint64_t tracefile_size; | |
68 | uint64_t tracefile_size_current; | |
69 | uint64_t tracefile_count; | |
70 | uint64_t tracefile_count_current; | |
71 | ||
173af62f DG |
72 | /* Information telling us when to close the stream */ |
73 | unsigned int close_flag:1; | |
74 | uint64_t last_net_seq_num; | |
f7079f67 DG |
75 | /* Indicate if the stream was initialized for a data pending command. */ |
76 | unsigned int data_pending_check_done:1; | |
b8aa1682 JD |
77 | }; |
78 | ||
79 | /* | |
80 | * Internal structure to map a socket with the corresponding session. | |
81 | * A hashtable indexed on the socket FD is used for the lookups. | |
82 | */ | |
83 | struct relay_command { | |
84 | struct lttcomm_sock *sock; | |
7717e361 | 85 | struct relay_session *session; |
b8aa1682 JD |
86 | struct cds_wfq_node node; |
87 | struct lttng_ht_node_ulong sock_n; | |
9d1bbf21 | 88 | struct rcu_head rcu_node; |
b8aa1682 | 89 | enum connection_type type; |
c5b6f4f0 | 90 | unsigned int version_check_done:1; |
0f907de1 JD |
91 | /* protocol version to use for this session */ |
92 | uint32_t major; | |
93 | uint32_t minor; | |
b8aa1682 JD |
94 | }; |
95 | ||
0f907de1 JD |
96 | extern char *opt_output_path; |
97 | ||
7717e361 | 98 | #endif /* LTTNG_RELAYD_H */ |