2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * 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 with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <urcu/list.h>
28 #include <common/hashtable/hashtable.h>
29 #include <common/sessiond-comm/sessiond-comm.h>
33 enum connection_type
{
36 RELAY_VIEWER_COMMAND
= 3,
37 RELAY_VIEWER_NOTIFICATION
= 4,
41 * Internal structure to map a socket with the corresponding session.
42 * A hashtable indexed on the socket FD is used for the lookups.
44 struct relay_connection
{
45 struct lttcomm_sock
*sock
;
46 struct relay_session
*session
;
47 struct relay_viewer_session
*viewer_session
;
48 struct cds_wfq_node qnode
;
49 struct lttng_ht_node_ulong sock_n
;
50 struct rcu_head rcu_node
;
51 enum connection_type type
;
52 /* Protocol version to use for this connection. */
56 struct cds_list_head recv_head
;
57 unsigned int version_check_done
:1;
59 /* Pointer to the sessions HT that this connection can use. */
60 struct lttng_ht
*sessions_ht
;
63 struct relay_connection
*connection_find_by_sock(struct lttng_ht
*ht
,
65 struct relay_connection
*connection_create(void);
66 void connection_init(struct relay_connection
*conn
);
67 void connection_delete(struct lttng_ht
*ht
, struct relay_connection
*conn
);
68 void connection_destroy(struct relay_connection
*conn
);
69 void connection_free(struct relay_connection
*conn
);
71 #endif /* _CONNECTION_H */