Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
shipper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 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_packet/shipper.h
10//! @brief Prepare and ship outgoing packets.
11
12#ifndef ROC_PACKET_SHIPPER_H_
13#define ROC_PACKET_SHIPPER_H_
14
18#include "roc_packet/iwriter.h"
19
20namespace roc {
21namespace packet {
22
23//! Prepare a packet for being sent.
24class Shipper : public IWriter, public core::NonCopyable<> {
25public:
26 //! Initialize.
27 //! - @p dest_address - destination address that is assigned to the outgoing packets.
28 //! - @p composer to compose a packet if necessary.
29 //! - @p writer to write outgoing packet.
30 Shipper(const address::SocketAddr& dest_address,
31 IComposer& composer,
32 IWriter& writer);
33
34 //! Write outgoing packet.
36
37private:
38 const address::SocketAddr dest_address_;
39
40 IComposer& composer_;
41 IWriter& writer_;
42};
43
44} // namespace packet
45} // namespace roc
46
47#endif // ROC_PACKET_SHIPPER_H_
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition attributes.h:31
Base class for non-copyable objects.
Definition noncopyable.h:23
Packet composer interface.
Definition icomposer.h:22
Packet writer interface.
Definition iwriter.h:23
Prepare a packet for being sent.
Definition shipper.h:24
Shipper(const address::SocketAddr &dest_address, IComposer &composer, IWriter &writer)
Initialize.
virtual ROC_ATTR_NODISCARD status::StatusCode write(const packet::PacketPtr &packet)
Write outgoing packet.
Packet composer interface.
Packet writer interface.
Root namespace.
Non-copyable object.
Socket address.
StatusCode
Status code.
Definition status_code.h:19