Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
basic_control_endpoint.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Roc Streaming authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_ctl/basic_control_endpoint.h
10//! @brief Base class for control endpoints.
11
12#ifndef ROC_CTL_BASIC_CONTROL_ENDPOINT_H_
13#define ROC_CTL_BASIC_CONTROL_ENDPOINT_H_
14
16#include "roc_core/list_node.h"
21
22namespace roc {
23namespace ctl {
24
25//! Base class for control endpoints.
27 : public core::RefCounted<BasicControlEndpoint, core::StandardAllocation>,
28 public core::ListNode {
30
31public:
32 //! Initialization.
34
35 virtual ~BasicControlEndpoint();
36
37 //! Check if endpoint is successfully bound to local URI.
38 virtual bool is_bound() const = 0;
39
40 //! Check if endpoint is successfully connected to remote URI.
41 virtual bool is_connected() const = 0;
42
43 //! Initiate asynchronous binding to local URI.
44 //! On completion, resumes @p notify_task.
45 virtual bool async_bind(const address::EndpointUri& uri,
46 ControlTask& notify_task) = 0;
47
48 //! Initiate asynchronous connecting to remote URI.
49 //! Should be called after successfull bind.
50 //! On completion, resumes @p notify_task.
51 virtual bool async_connect(const address::EndpointUri& uri,
52 ControlTask& notify_task) = 0;
53
54 //! Initiate asynchronous closing of endpoint.
55 //! On completion, resumes @p notify_task.
56 virtual void async_close(ControlTask& notify_task) = 0;
57
58 //! Add sink pipeline controlled by this endpoint.
59 //! Should be called after successfull bind.
60 virtual bool attach_sink(const address::EndpointUri& uri,
61 pipeline::SenderLoop& sink) = 0;
62
63 //! Remove sink pipeline.
64 //! Should be called for earlier attached sink.
65 virtual bool detach_sink(pipeline::SenderLoop& sink) = 0;
66
67 //! Add source pipeline controlled by this endpoint.
68 //! Should be called after successfull bind.
69 virtual bool attach_source(const address::EndpointUri& uri,
70 pipeline::ReceiverLoop& source) = 0;
71
72 //! Remove source pipeline.
73 //! Should be called for earlier attached source.
74 virtual bool detach_source(pipeline::ReceiverLoop& source) = 0;
75};
76
77} // namespace ctl
78} // namespace roc
79
80#endif // ROC_CTL_BASIC_CONTROL_ENDPOINT_H_
Network endpoint URI.
Memory allocator interface.
Definition iallocator.h:23
Base class for list element.
Definition list_node.h:26
Base class for reference counted object.
Definition ref_counted.h:39
Base class for control endpoints.
virtual bool detach_sink(pipeline::SenderLoop &sink)=0
Remove sink pipeline. Should be called for earlier attached sink.
virtual void async_close(ControlTask &notify_task)=0
Initiate asynchronous closing of endpoint. On completion, resumes notify_task.
virtual bool detach_source(pipeline::ReceiverLoop &source)=0
Remove source pipeline. Should be called for earlier attached source.
virtual bool is_bound() const =0
Check if endpoint is successfully bound to local URI.
virtual bool attach_sink(const address::EndpointUri &uri, pipeline::SenderLoop &sink)=0
Add sink pipeline controlled by this endpoint. Should be called after successfull bind.
virtual bool async_bind(const address::EndpointUri &uri, ControlTask &notify_task)=0
Initiate asynchronous binding to local URI. On completion, resumes notify_task.
virtual bool async_connect(const address::EndpointUri &uri, ControlTask &notify_task)=0
Initiate asynchronous connecting to remote URI. Should be called after successfull bind....
virtual bool is_connected() const =0
Check if endpoint is successfully connected to remote URI.
BasicControlEndpoint(core::IAllocator &)
Initialization.
virtual bool attach_source(const address::EndpointUri &uri, pipeline::ReceiverLoop &source)=0
Add source pipeline controlled by this endpoint. Should be called after successfull bind.
Base class for control tasks.
Receiver pipeline loop.
Sender pipeline loop.
Definition sender_loop.h:43
Control task.
Network endpoint URI.
Linked list node.
Root namespace.
Receiver pipeline loop.
Base class for reference counted object.
Sender pipeline loop.