Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
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
15
#include "
roc_address/socket_addr.h
"
16
#include "
roc_core/noncopyable.h
"
17
#include "
roc_packet/icomposer.h
"
18
#include "
roc_packet/iwriter.h
"
19
20
namespace
roc
{
21
namespace
packet
{
22
23
//! Prepare a packet for being sent.
24
class
Shipper
:
public
IWriter
,
public
core::NonCopyable
<> {
25
public
:
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,
32
const
address::SocketAddr
*
outbound_address
);
33
34
//! Get destination address for outbound packets.
35
const
address::SocketAddr
&
outbound_address
()
const
;
36
37
//! Write outgoing packet.
38
virtual
ROC_ATTR_NODISCARD
status::StatusCode
write
(
const
PacketPtr
&
packet
);
39
40
private
:
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_
ROC_ATTR_NODISCARD
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition
attributes.h:31
roc::address::SocketAddr
Socket address.
Definition
socket_addr.h:26
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::packet::IComposer
Packet composer interface.
Definition
icomposer.h:22
roc::packet::IWriter
Packet writer interface.
Definition
iwriter.h:23
roc::packet::Shipper::write
virtual ROC_ATTR_NODISCARD status::StatusCode write(const PacketPtr &packet)
Write outgoing packet.
roc::packet::Shipper::outbound_address
const address::SocketAddr & outbound_address() const
Get destination address for outbound packets.
roc::packet::Shipper::Shipper
Shipper(IComposer &composer, IWriter &outbound_writer, const address::SocketAddr *outbound_address)
Initialize.
icomposer.h
Packet composer interface.
iwriter.h
Packet writer interface.
roc::packet
Network packets and packet processing.
roc::packet::PacketPtr
core::SharedPtr< Packet > PacketPtr
Packet smart pointer.
Definition
packet.h:34
roc
Root namespace.
noncopyable.h
Non-copyable object.
socket_addr.h
Socket address.
roc::status::StatusCode
StatusCode
Status code.
Definition
status_code.h:19
roc_packet
shipper.h
Generated by
1.17.0