| 1 | /* |
| 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef NOTIFICATION_THREAD_INTERNAL_H |
| 9 | #define NOTIFICATION_THREAD_INTERNAL_H |
| 10 | |
| 11 | #include <lttng/ref-internal.h> |
| 12 | #include <urcu/rculfhash.h> |
| 13 | #include <unistd.h> |
| 14 | |
| 15 | struct channel_key { |
| 16 | uint64_t key; |
| 17 | enum lttng_domain_type domain; |
| 18 | }; |
| 19 | |
| 20 | struct session_info { |
| 21 | struct lttng_ref ref; |
| 22 | char *name; |
| 23 | uid_t uid; |
| 24 | gid_t gid; |
| 25 | /* |
| 26 | * Hashtable containing back-refs (weak) to all channels in this session. |
| 27 | * The hashtable's key is a hash of (struct channel_key) and |
| 28 | * the value is of type (struct channel_info *). |
| 29 | */ |
| 30 | struct cds_lfht *channel_infos_ht; |
| 31 | struct lttng_session_trigger_list *trigger_list; |
| 32 | /* Node in the notification thread state's sessions_ht. */ |
| 33 | struct cds_lfht_node sessions_ht_node; |
| 34 | /* |
| 35 | * Weak reference to the thread state's sessions_ht. Used for removal on |
| 36 | * destruction. |
| 37 | */ |
| 38 | struct cds_lfht *sessions_ht; |
| 39 | uint64_t consumed_data_size; |
| 40 | struct { |
| 41 | /* Whether a rotation is ongoing for this session. */ |
| 42 | bool ongoing; |
| 43 | /* Identifier of the currently ongoing rotation. */ |
| 44 | uint64_t id; |
| 45 | } rotation; |
| 46 | /* call_rcu delayed reclaim. */ |
| 47 | struct rcu_head rcu_node; |
| 48 | }; |
| 49 | |
| 50 | struct channel_info { |
| 51 | struct channel_key key; |
| 52 | char *name; |
| 53 | uint64_t capacity; |
| 54 | /* |
| 55 | * A channel info holds a reference (lttng_ref) on session_info. |
| 56 | * session_info, in return, holds a weak reference to the channel. |
| 57 | */ |
| 58 | struct session_info *session_info; |
| 59 | /* Node in the notification thread state's channels_ht. */ |
| 60 | struct cds_lfht_node channels_ht_node; |
| 61 | /* Node in the session_info's channels_ht. */ |
| 62 | struct cds_lfht_node session_info_channels_ht_node; |
| 63 | /* call_rcu delayed reclaim. */ |
| 64 | struct rcu_head rcu_node; |
| 65 | }; |
| 66 | |
| 67 | enum client_transmission_status { |
| 68 | CLIENT_TRANSMISSION_STATUS_COMPLETE, |
| 69 | CLIENT_TRANSMISSION_STATUS_QUEUED, |
| 70 | /* Communication failure. */ |
| 71 | CLIENT_TRANSMISSION_STATUS_FAIL, |
| 72 | /* Fatal error. */ |
| 73 | CLIENT_TRANSMISSION_STATUS_ERROR, |
| 74 | }; |
| 75 | #endif /* NOTIFICATION_THREAD_INTERNAL_H */ |