#include "remoting/protocol/pseudotcp_adapter.h"
#include <stddef.h>
#include <utility>
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "net/base/address_list.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/protocol/p2p_datagram_socket.h"
PseudoTcp;
namespace {
const int kReadBufferSize = …;
const uint16_t kDefaultMtu = …;
}
namespace remoting::protocol {
class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
public base::RefCounted<Core> { … };
PseudoTcpAdapter::Core::Core(std::unique_ptr<P2PDatagramSocket> socket)
: … { … }
PseudoTcpAdapter::Core::~Core() = default;
int PseudoTcpAdapter::Core::Read(const scoped_refptr<net::IOBuffer>& buffer,
int buffer_size,
net::CompletionOnceCallback callback) { … }
int PseudoTcpAdapter::Core::Write(
const scoped_refptr<net::IOBuffer>& buffer,
int buffer_size,
net::CompletionOnceCallback callback,
const net::NetworkTrafficAnnotationTag& ) { … }
net::CompletionOnceCallback PseudoTcpAdapter::Core::Connect(
net::CompletionOnceCallback callback) { … }
void PseudoTcpAdapter::Core::OnTcpOpen(PseudoTcp* tcp) { … }
void PseudoTcpAdapter::Core::OnTcpReadable(PseudoTcp* tcp) { … }
void PseudoTcpAdapter::Core::OnTcpWriteable(PseudoTcp* tcp) { … }
void PseudoTcpAdapter::Core::OnTcpClosed(PseudoTcp* tcp, uint32_t error) { … }
void PseudoTcpAdapter::Core::SetAckDelay(int delay_ms) { … }
void PseudoTcpAdapter::Core::SetNoDelay(bool no_delay) { … }
void PseudoTcpAdapter::Core::SetReceiveBufferSize(int32_t size) { … }
void PseudoTcpAdapter::Core::SetSendBufferSize(int32_t size) { … }
void PseudoTcpAdapter::Core::SetWriteWaitsForSend(bool write_waits_for_send) { … }
void PseudoTcpAdapter::Core::DeleteSocket() { … }
cricket::IPseudoTcpNotify::WriteResult PseudoTcpAdapter::Core::TcpWritePacket(
PseudoTcp* tcp,
const char* buffer,
size_t len) { … }
void PseudoTcpAdapter::Core::DoReadFromSocket() { … }
void PseudoTcpAdapter::Core::HandleReadResults(int result) { … }
void PseudoTcpAdapter::Core::OnRead(int result) { … }
void PseudoTcpAdapter::Core::OnWritten(int result) { … }
void PseudoTcpAdapter::Core::AdjustClock() { … }
void PseudoTcpAdapter::Core::HandleTcpClock() { … }
void PseudoTcpAdapter::Core::CheckWriteComplete() { … }
PseudoTcpAdapter::PseudoTcpAdapter(std::unique_ptr<P2PDatagramSocket> socket)
: … { … }
PseudoTcpAdapter::~PseudoTcpAdapter() { … }
int PseudoTcpAdapter::Read(const scoped_refptr<net::IOBuffer>& buffer,
int buffer_size,
net::CompletionOnceCallback callback) { … }
int PseudoTcpAdapter::Write(
const scoped_refptr<net::IOBuffer>& buffer,
int buffer_size,
net::CompletionOnceCallback callback,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
int PseudoTcpAdapter::SetReceiveBufferSize(int32_t size) { … }
int PseudoTcpAdapter::SetSendBufferSize(int32_t size) { … }
net::CompletionOnceCallback PseudoTcpAdapter::Connect(
net::CompletionOnceCallback callback) { … }
void PseudoTcpAdapter::SetAckDelay(int delay_ms) { … }
void PseudoTcpAdapter::SetNoDelay(bool no_delay) { … }
void PseudoTcpAdapter::SetWriteWaitsForSend(bool write_waits_for_send) { … }
}