Fix: big relayd cleanup and refactor
[lttng-tools.git] / src / bin / lttng-relayd / lttng-relayd.h
CommitLineData
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
d3e2ba59 23#include <limits.h>
b8aa1682
JD
24#include <urcu.h>
25#include <urcu/wfqueue.h>
a4baae1b 26#include <urcu/list.h>
d3e2ba59 27
0f907de1 28#include <common/hashtable/hashtable.h>
50adc264 29#include <common/index/ctf-index.h>
b8aa1682 30
d3e2ba59 31#include "ctf-trace.h"
2f8f53af 32#include "session.h"
d3e2ba59 33
b8aa1682
JD
34/*
35 * Queue used to enqueue relay requests
36 */
37struct relay_cmd_queue {
b8aa1682 38 struct cds_wfq_queue queue;
7717e361 39 int32_t futex;
b8aa1682
JD
40};
41
42enum connection_type {
d5200de1
DG
43 RELAY_DATA = 1,
44 RELAY_CONTROL = 2,
45 RELAY_VIEWER_COMMAND = 3,
46 RELAY_VIEWER_NOTIFICATION = 4,
b8aa1682
JD
47};
48
b8aa1682
JD
49/*
50 * Internal structure to map a socket with the corresponding session.
51 * A hashtable indexed on the socket FD is used for the lookups.
52 */
53struct relay_command {
54 struct lttcomm_sock *sock;
7717e361 55 struct relay_session *session;
b8aa1682
JD
56 struct cds_wfq_node node;
57 struct lttng_ht_node_ulong sock_n;
9d1bbf21 58 struct rcu_head rcu_node;
b8aa1682 59 enum connection_type type;
0f907de1
JD
60 /* protocol version to use for this session */
61 uint32_t major;
62 uint32_t minor;
b92fdc2b 63 uint64_t session_id;
a4baae1b
JD
64 struct cds_list_head recv_head;
65 unsigned int version_check_done:1;
d3e2ba59
JD
66};
67
68struct relay_local_data {
69 struct lttng_ht *sessions_ht;
b8aa1682
JD
70};
71
0f907de1
JD
72extern char *opt_output_path;
73
2a174661
DG
74/*
75 * Contains stream indexed by ID. This is important since many commands lookup
76 * streams only by ID thus also keeping them in this hash table makes the
77 * search O(1) instead of iterating over the ctf_traces_ht of the session.
78 */
d3e2ba59 79extern struct lttng_ht *relay_streams_ht;
2a174661 80
92c6ca54 81extern struct lttng_ht *viewer_streams_ht;
0a6518b0 82extern struct lttng_ht *indexes_ht;
d3e2ba59 83
65931c8b
MD
84extern const char *tracing_group_name;
85
cd60b05a
JG
86extern const char * const config_section_name;
87
3fd27398 88void lttng_relay_notify_ready(void);
d3e2ba59 89
7717e361 90#endif /* LTTNG_RELAYD_H */
This page took 0.032853 seconds and 4 git commands to generate.