1 #ifndef _VIEWER_SESSION_H
2 #define _VIEWER_SESSION_H
5 * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
6 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
7 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * SPDX-License-Identifier: GPL-2.0-only
16 #include <urcu/list.h>
19 #include <common/hashtable/hashtable.h>
20 #include <common/trace-chunk.h>
24 struct relay_viewer_session
{
26 * Session list. Updates are protected by the session_list_lock.
27 * Traversals are protected by RCU.
28 * This list limits the design to having the sessions in at most
31 struct cds_list_head session_list
; /* RCU list. */
32 pthread_mutex_t session_list_lock
; /* Protects list updates. */
33 /* Once set, the current trace chunk of a viewer must not change. */
34 struct lttng_trace_chunk
*current_trace_chunk
;
37 struct relay_viewer_session
*viewer_session_create(void);
38 void viewer_session_destroy(struct relay_viewer_session
*vsession
);
39 void viewer_session_close(struct relay_viewer_session
*vsession
);
41 enum lttng_viewer_attach_return_code
viewer_session_attach(
42 struct relay_viewer_session
*vsession
,
43 struct relay_session
*session
);
44 int viewer_session_is_attached(struct relay_viewer_session
*vsession
,
45 struct relay_session
*session
);
46 void viewer_session_close_one_session(struct relay_viewer_session
*vsession
,
47 struct relay_session
*session
);
48 int viewer_session_set_trace_chunk_copy(struct relay_viewer_session
*vsession
,
49 struct lttng_trace_chunk
*relay_session_trace_chunk
);
51 #endif /* _VIEWER_SESSION_H */