Fix: Relay daemon ownership and reference counting
[lttng-tools.git] / src / bin / lttng-relayd / viewer-session.h
CommitLineData
7591bab1
MD
1#ifndef _VIEWER_SESSION_H
2#define _VIEWER_SESSION_H
3
4/*
5 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
6 * David Goulet <dgoulet@efficios.com>
7 * 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License, version 2 only, as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program; if not, write to the Free Software Foundation, Inc., 51
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include <limits.h>
24#include <inttypes.h>
25#include <pthread.h>
26#include <urcu/list.h>
27#include <urcu/ref.h>
28
29#include <common/hashtable/hashtable.h>
30
31#include "session.h"
32
33struct relay_viewer_session {
34 /*
35 * Session list. Updates are protected by the session_list_lock.
36 * Traversals are protected by RCU.
37 * This list limits the design to having the sessions in at most
38 * one viewer session.
39 */
40 struct cds_list_head session_list; /* RCU list. */
41 pthread_mutex_t session_list_lock; /* Protects list updates. */
42};
43
44struct relay_viewer_session *viewer_session_create(void);
45void viewer_session_destroy(struct relay_viewer_session *vsession);
46void viewer_session_close(struct relay_viewer_session *vsession);
47
48int viewer_session_attach(struct relay_viewer_session *vsession,
49 struct relay_session *session);
50int viewer_session_is_attached(struct relay_viewer_session *vsession,
51 struct relay_session *session);
52
53#endif /* _VIEWER_SESSION_H */
This page took 0.024665 seconds and 4 git commands to generate.