2 * Copyright (C) 2012 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
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.
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
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.
19 #ifndef LTTNG_RELAYD_H
20 #define LTTNG_RELAYD_H
25 #include <urcu/wfqueue.h>
26 #include <urcu/list.h>
28 #include <common/hashtable/hashtable.h>
29 #include <common/index/ctf-index.h>
31 #include "ctf-trace.h"
35 * Queue used to enqueue relay requests
37 struct relay_cmd_queue
{
38 struct cds_wfq_queue queue
;
42 enum connection_type
{
45 RELAY_VIEWER_COMMAND
= 3,
46 RELAY_VIEWER_NOTIFICATION
= 4,
50 * Internal structure to map a socket with the corresponding session.
51 * A hashtable indexed on the socket FD is used for the lookups.
53 struct relay_command
{
54 struct lttcomm_sock
*sock
;
55 struct relay_session
*session
;
56 struct cds_wfq_node node
;
57 struct lttng_ht_node_ulong sock_n
;
58 struct rcu_head rcu_node
;
59 enum connection_type type
;
60 /* protocol version to use for this session */
64 struct cds_list_head recv_head
;
65 unsigned int version_check_done
:1;
68 struct relay_local_data
{
69 struct lttng_ht
*sessions_ht
;
72 extern char *opt_output_path
;
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.
79 extern struct lttng_ht
*relay_streams_ht
;
81 extern struct lttng_ht
*viewer_streams_ht
;
82 extern struct lttng_ht
*indexes_ht
;
84 extern const char *tracing_group_name
;
86 extern const char * const config_section_name
;
88 extern int thread_quit_pipe
[2];
90 void lttng_relay_notify_ready(void);
92 #endif /* LTTNG_RELAYD_H */