Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
basic_port.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Roc 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_netio/target_libuv/roc_netio/basic_port.h
10//! @brief Basic network port.
11
12#ifndef ROC_NETIO_BASIC_PORT_H_
13#define ROC_NETIO_BASIC_PORT_H_
14
15#include "roc_core/iallocator.h"
16#include "roc_core/list_node.h"
17#include "roc_core/refcnt.h"
18#include "roc_packet/address.h"
19
20namespace roc {
21namespace netio {
22
23//! Basic port interface.
24class BasicPort : public core::RefCnt<BasicPort>, public core::ListNode {
25public:
26 //! Initialize.
28
29 //! Destroy.
30 virtual ~BasicPort();
31
32 //! Get bind address.
33 virtual const packet::Address& address() const = 0;
34
35 //! Open port.
36 //!
37 //! @remarks
38 //! Should be called from the event loop thread.
39 virtual bool open() = 0;
40
41 //! Asynchronous close.
42 //!
43 //! @remarks
44 //! Should be called from the event loop thread.
45 virtual void async_close() = 0;
46
47private:
48 friend class core::RefCnt<BasicPort>;
49
50 void destroy();
51
52 core::IAllocator& allocator_;
53};
54
55} // namespace netio
56} // namespace roc
57
58#endif // ROC_NETIO_BASIC_PORT_H_
Network address.
Memory allocator interface.
Definition: iallocator.h:23
Base class for list element.
Definition: list_node.h:26
Base class for reference countable objects.
Definition: refcnt.h:25
Basic port interface.
Definition: basic_port.h:24
virtual bool open()=0
Open port.
virtual void async_close()=0
Asynchronous close.
BasicPort(core::IAllocator &)
Initialize.
virtual const packet::Address & address() const =0
Get bind address.
virtual ~BasicPort()
Destroy.
Network address.
Definition: address.h:24
Memory allocator interface.
Linked list node.
Root namespace.
Base class for reference countable objects.