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
24 #include <urcu/wfqueue.h>
27 * Queue used to enqueue relay requests
29 struct relay_cmd_queue
{
30 struct cds_wfq_queue queue
;
34 enum connection_type
{
40 * Represents a session for the relay point of view
42 struct relay_session
{
44 * This session id is used to identify a set of stream to a tracing session
45 * but also make sure we have a unique session id associated with a session
46 * daemon which can provide multiple data source.
49 struct lttcomm_sock
*sock
;
53 * Represents a stream in the relay
56 uint64_t stream_handle
;
57 uint64_t prev_seq
; /* previous data sequence number encountered */
58 struct lttng_ht_node_ulong stream_n
;
59 struct relay_session
*session
;
60 struct rcu_head rcu_node
;
63 /* Information telling us when to close the stream */
64 unsigned int close_flag
:1;
65 uint64_t last_net_seq_num
;
66 /* Indicate if the stream was initialized for a data pending command. */
67 unsigned int data_pending_check_done
:1;
71 * Internal structure to map a socket with the corresponding session.
72 * A hashtable indexed on the socket FD is used for the lookups.
74 struct relay_command
{
75 struct lttcomm_sock
*sock
;
76 struct relay_session
*session
;
77 struct cds_wfq_node node
;
78 struct lttng_ht_node_ulong sock_n
;
79 struct rcu_head rcu_node
;
80 enum connection_type type
;
81 unsigned int version_check_done
:1;
84 #endif /* LTTNG_RELAYD_H */