1 #ifndef _VIEWER_SESSION_H
2 #define _VIEWER_SESSION_H
5 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
6 * David Goulet <dgoulet@efficios.com>
7 * 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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.
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
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.
26 #include <urcu/list.h>
29 #include <common/hashtable/hashtable.h>
33 struct relay_viewer_session
{
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
40 struct cds_list_head session_list
; /* RCU list. */
41 pthread_mutex_t session_list_lock
; /* Protects list updates. */
44 struct relay_viewer_session
*viewer_session_create(void);
45 void viewer_session_destroy(struct relay_viewer_session
*vsession
);
46 void viewer_session_close(struct relay_viewer_session
*vsession
);
48 int viewer_session_attach(struct relay_viewer_session
*vsession
,
49 struct relay_session
*session
);
50 int viewer_session_is_attached(struct relay_viewer_session
*vsession
,
51 struct relay_session
*session
);
52 void viewer_session_close_one_session(struct relay_viewer_session
*vsession
,
53 struct relay_session
*session
);
55 #endif /* _VIEWER_SESSION_H */