X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-registry-channel.hpp;fp=src%2Fbin%2Flttng-sessiond%2Fust-registry-channel.hpp;h=e8819812e139aa28062f86dfb9202241cc81f8b5;hb=d7bfb9b0fa35679d3e728b9165699d9faf905539;hp=0000000000000000000000000000000000000000;hpb=0220be14254fac4f7af642fd6630282b29776a70;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-registry-channel.hpp b/src/bin/lttng-sessiond/ust-registry-channel.hpp new file mode 100644 index 000000000..e8819812e --- /dev/null +++ b/src/bin/lttng-sessiond/ust-registry-channel.hpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2022 Jérémie Galarneau + * + * SPDX-License-Identifier: GPL-2.0-only + * + */ + +#ifndef LTTNG_UST_REGISTRY_CHANNEL_H +#define LTTNG_UST_REGISTRY_CHANNEL_H + +#include "stream-class.hpp" + +#include + +#include + +#include +#include + +struct ust_app; + +namespace lttng { +namespace sessiond { +namespace ust { + +class registry_event; + +class registry_channel : public lttng::sessiond::trace::stream_class { +public: + using registered_listener_fn = std::function; + using event_added_listener_fn = std::function; + + registry_channel(uint32_t channel_id, + registered_listener_fn channel_registered_listener, + event_added_listener_fn new_event_listener); + void add_event(int session_objd, + int channel_objd, + std::string name, + std::string signature, + std::vector event_fields, + int loglevel_value, + nonstd::optional model_emf_uri, + lttng_buffer_type buffer_type, + const ust_app& app, + uint32_t& out_event_id); + virtual ~registry_channel(); + + virtual const lttng::sessiond::trace::type& get_context() const override final; + void set_context(lttng::sessiond::trace::type::cuptr context); + + /* Channel was registered to at least one application. */ + bool is_registered() const; + void set_as_registered(); + + uint64_t _key; + uint64_t _consumer_key; + + /* + * Flag for this channel if the metadata was dumped once during + * registration. 0 means no, 1 yes. + */ + unsigned int _metadata_dumped; + + /* + * Hash table containing events sent by the UST tracer. MUST be accessed + * with a RCU read side lock acquired. + */ + struct lttng_ht *_events; + struct lttng_ht_node_u64 _node; + /* For delayed reclaim */ + struct rcu_head _rcu_head; + /* Once this value reaches UINT32_MAX, no more id can be allocated. */ + uint32_t _next_event_id; + +private: + virtual void _accept_on_event_classes( + lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const override final; + + registered_listener_fn _is_registered_listener; + event_added_listener_fn _event_added_listener; + /* Indicates if this channel registry has already been registered. */ + bool _is_registered; +}; + +} /* namespace ust */ +} /* namespace sessiond */ +} /* namespace lttng */ + +#endif /* LTTNG_UST_REGISTRY_CHANNEL_H */