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 composer - used to complete composing packets
28 //! - @p outbound_writer - destination writer
29 //! - @p outbound_address - destination address is assigned to packets, may be null
30 Shipper(IComposer& composer,
31 IWriter& outbound_writer,
33
34 //! Get destination address for outbound packets.
36
37 //! Write outgoing packet.
39
40private:
41 IComposer& composer_;
42 IWriter& outbound_writer_;
43 address::SocketAddr outbound_address_;
44};
45
46} // namespace packet
47} // namespace roc
48
49#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
const address::SocketAddr & outbound_address() const
Get destination address for outbound packets.
virtual status::StatusCode write(const PacketPtr &packet)
Write outgoing packet.
Shipper(IComposer &composer, IWriter &outbound_writer, const address::SocketAddr *outbound_address)
Initialize.
Packet composer interface.
Packet writer interface.
StatusCode
Status code.
Definition status_code.h:19
Root namespace.
Non-copyable object.
Socket address.