chromium/remoting/test/fake_socket_factory.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/test/fake_socket_factory.h"

#include <algorithm>
#include <cstddef>
#include <cstdlib>
#include <memory>
#include <numbers>
#include <string>

#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/base/io_buffer.h"
#include "remoting/base/leaky_bucket.h"
#include "third_party/webrtc/api/units/timestamp.h"
#include "third_party/webrtc/media/base/rtp_utils.h"
#include "third_party/webrtc/rtc_base/async_packet_socket.h"
#include "third_party/webrtc/rtc_base/network/received_packet.h"
#include "third_party/webrtc/rtc_base/socket.h"
#include "third_party/webrtc/rtc_base/time_utils.h"

namespace remoting {

namespace {

const int kPortRangeStart =;
const int kPortRangeEnd =;

double RandDouble() {}

double GetNormalRandom(double average, double stddev) {}

class FakeUdpSocket : public rtc::AsyncPacketSocket {};

FakeUdpSocket::FakeUdpSocket(FakePacketSocketFactory* factory,
                             scoped_refptr<FakeNetworkDispatcher> dispatcher,
                             const rtc::SocketAddress& local_address)
    :{}

FakeUdpSocket::~FakeUdpSocket() {}

void FakeUdpSocket::ReceivePacket(const rtc::SocketAddress& from,
                                  const rtc::SocketAddress& to,
                                  const scoped_refptr<net::IOBuffer>& data,
                                  int data_size) {}

rtc::SocketAddress FakeUdpSocket::GetLocalAddress() const {}

rtc::SocketAddress FakeUdpSocket::GetRemoteAddress() const {}

int FakeUdpSocket::Send(const void* data,
                        size_t data_size,
                        const rtc::PacketOptions& options) {}

int FakeUdpSocket::SendTo(const void* data,
                          size_t data_size,
                          const rtc::SocketAddress& address,
                          const rtc::PacketOptions& options) {}

int FakeUdpSocket::Close() {}

rtc::AsyncPacketSocket::State FakeUdpSocket::GetState() const {}

int FakeUdpSocket::GetOption(rtc::Socket::Option option, int* value) {}

int FakeUdpSocket::SetOption(rtc::Socket::Option option, int value) {}

int FakeUdpSocket::GetError() const {}

void FakeUdpSocket::SetError(int error) {}

}  // namespace

FakePacketSocketFactory::PendingPacket::PendingPacket() :{}

FakePacketSocketFactory::PendingPacket::PendingPacket(
    const rtc::SocketAddress& from,
    const rtc::SocketAddress& to,
    const scoped_refptr<net::IOBuffer>& data,
    int data_size)
    :{}

FakePacketSocketFactory::PendingPacket::PendingPacket(
    const PendingPacket& other) = default;

FakePacketSocketFactory::PendingPacket::~PendingPacket() = default;

FakePacketSocketFactory::FakePacketSocketFactory(
    FakeNetworkDispatcher* dispatcher)
    :{}

FakePacketSocketFactory::~FakePacketSocketFactory() {}

void FakePacketSocketFactory::OnSocketDestroyed(int port) {}

void FakePacketSocketFactory::SetBandwidth(int bandwidth, int max_buffer) {}

void FakePacketSocketFactory::SetLatency(base::TimeDelta average,
                                         base::TimeDelta stddev) {}

rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateUdpSocket(
    const rtc::SocketAddress& local_address,
    uint16_t min_port,
    uint16_t max_port) {}

rtc::AsyncListenSocket* FakePacketSocketFactory::CreateServerTcpSocket(
    const rtc::SocketAddress& local_address,
    uint16_t min_port,
    uint16_t max_port,
    int opts) {}

rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateClientTcpSocket(
    const rtc::SocketAddress& local_address,
    const rtc::SocketAddress& remote_address,
    const rtc::PacketSocketTcpOptions& opts) {}

std::unique_ptr<webrtc::AsyncDnsResolverInterface>
FakePacketSocketFactory::CreateAsyncDnsResolver() {}

const scoped_refptr<base::SingleThreadTaskRunner>&
FakePacketSocketFactory::GetThread() const {}

const rtc::IPAddress& FakePacketSocketFactory::GetAddress() const {}

void FakePacketSocketFactory::ReceivePacket(
    const rtc::SocketAddress& from,
    const rtc::SocketAddress& to,
    const scoped_refptr<net::IOBuffer>& data,
    int data_size) {}

void FakePacketSocketFactory::DoReceivePacket() {}

void FakePacketSocketFactory::ResetStats() {}

}  // namespace remoting