#include "remoting/protocol/stream_packet_socket.h"
#include "base/functional/callback.h"
#include "components/webrtc/net_address_utils.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/log/net_log_source.h"
#include "net/socket/stream_socket.h"
#include "net/socket/tcp_client_socket.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/protocol/stun_tcp_packet_processor.h"
namespace remoting::protocol {
namespace {
constexpr int kMaxSendBufferSize = …;
constexpr int kReadBufferSize = …;
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
rtc::SocketAddress GetAddress(
int (net::StreamSocket::*getAddressFn)(net::IPEndPoint*) const,
const net::StreamSocket* socket) { … }
}
StreamPacketSocket::PendingPacket::PendingPacket(
scoped_refptr<net::DrainableIOBuffer> data,
rtc::PacketOptions options)
: … { … }
StreamPacketSocket::PendingPacket::PendingPacket(const PendingPacket&) =
default;
StreamPacketSocket::PendingPacket::PendingPacket(PendingPacket&&) = default;
StreamPacketSocket::PendingPacket::~PendingPacket() = default;
StreamPacketSocket::StreamPacketSocket() = default;
StreamPacketSocket::~StreamPacketSocket() = default;
bool StreamPacketSocket::Init(std::unique_ptr<net::StreamSocket> socket,
StreamPacketProcessor* packet_processor) { … }
bool StreamPacketSocket::InitClientTcp(
const rtc::SocketAddress& local_address,
const rtc::SocketAddress& remote_address,
const rtc::PacketSocketTcpOptions& tcp_options) { … }
rtc::SocketAddress StreamPacketSocket::GetLocalAddress() const { … }
rtc::SocketAddress StreamPacketSocket::GetRemoteAddress() const { … }
int StreamPacketSocket::Send(const void* data,
size_t data_size,
const rtc::PacketOptions& options) { … }
int StreamPacketSocket::SendTo(const void* data,
size_t data_size,
const rtc::SocketAddress& address,
const rtc::PacketOptions& options) { … }
int StreamPacketSocket::Close() { … }
rtc::AsyncPacketSocket::State StreamPacketSocket::GetState() const { … }
int StreamPacketSocket::GetOption(rtc::Socket::Option option, int* value) { … }
int StreamPacketSocket::SetOption(rtc::Socket::Option option, int value) { … }
int StreamPacketSocket::GetError() const { … }
void StreamPacketSocket::SetError(int error) { … }
void StreamPacketSocket::OnConnectCompleted(int result) { … }
void StreamPacketSocket::DoWrite() { … }
bool StreamPacketSocket::HandleWriteResult(int result) { … }
void StreamPacketSocket::OnAsyncWriteCompleted(int result) { … }
void StreamPacketSocket::DoRead() { … }
bool StreamPacketSocket::HandleReadResult(int result) { … }
void StreamPacketSocket::OnAsyncReadCompleted(int result) { … }
void StreamPacketSocket::CloseWithNetError(int net_error) { … }
}