clang-tidy: add Chrome-inspired checks
[lttng-tools.git] / src / bin / lttng-sessiond / ust-registry-channel.hpp
CommitLineData
d7bfb9b0
JG
1/*
2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef LTTNG_UST_REGISTRY_CHANNEL_H
9#define LTTNG_UST_REGISTRY_CHANNEL_H
10
11#include "stream-class.hpp"
24ed18f2 12#include "trace-class.hpp"
d7bfb9b0
JG
13
14#include <common/hashtable/hashtable.hpp>
15
16#include <lttng/lttng.h>
17
18#include <urcu.h>
19#include <functional>
20
21struct ust_app;
22
23namespace lttng {
24namespace sessiond {
25namespace ust {
26
27class registry_event;
28
29class registry_channel : public lttng::sessiond::trace::stream_class {
30public:
31 using registered_listener_fn = std::function<void(const registry_channel&)>;
32 using event_added_listener_fn = std::function<void(const registry_channel&, const registry_event &)>;
33
34 registry_channel(uint32_t channel_id,
24ed18f2
JG
35 const lttng::sessiond::trace::abi& trace_abi,
36 std::string default_clock_class_name,
d7bfb9b0
JG
37 registered_listener_fn channel_registered_listener,
38 event_added_listener_fn new_event_listener);
39 void add_event(int session_objd,
40 int channel_objd,
41 std::string name,
42 std::string signature,
43 std::vector<lttng::sessiond::trace::field::cuptr> event_fields,
44 int loglevel_value,
45 nonstd::optional<std::string> model_emf_uri,
46 lttng_buffer_type buffer_type,
47 const ust_app& app,
48 uint32_t& out_event_id);
cd9adb8b 49 ~registry_channel() override;
d7bfb9b0 50
cd9adb8b 51 const lttng::sessiond::trace::type *event_context() const final;
4bcf2294 52 void event_context(lttng::sessiond::trace::type::cuptr context);
d7bfb9b0
JG
53
54 /* Channel was registered to at least one application. */
55 bool is_registered() const;
56 void set_as_registered();
57
58 uint64_t _key;
59 uint64_t _consumer_key;
60
d7bfb9b0
JG
61 /*
62 * Hash table containing events sent by the UST tracer. MUST be accessed
63 * with a RCU read side lock acquired.
64 */
65 struct lttng_ht *_events;
66 struct lttng_ht_node_u64 _node;
67 /* For delayed reclaim */
68 struct rcu_head _rcu_head;
69 /* Once this value reaches UINT32_MAX, no more id can be allocated. */
70 uint32_t _next_event_id;
71
72private:
cd9adb8b
JG
73 void _accept_on_event_classes(
74 lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
d7bfb9b0
JG
75
76 registered_listener_fn _is_registered_listener;
77 event_added_listener_fn _event_added_listener;
78 /* Indicates if this channel registry has already been registered. */
79 bool _is_registered;
80};
81
82} /* namespace ust */
83} /* namespace sessiond */
84} /* namespace lttng */
85
86#endif /* LTTNG_UST_REGISTRY_CHANNEL_H */
This page took 0.029804 seconds and 4 git commands to generate.