chromium/third_party/webrtc/test/network/fake_network_socket_server.cc

/*
 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "test/network/fake_network_socket_server.h"

#include <algorithm>
#include <string>
#include <utility>
#include <vector>

#include "absl/algorithm/container.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread.h"

namespace webrtc {
namespace test {
namespace {
std::string ToString(const rtc::SocketAddress& addr) {}

}  // namespace

// Represents a socket, which will operate with emulated network.
class FakeNetworkSocket : public rtc::Socket,
                          public EmulatedNetworkReceiverInterface {};

FakeNetworkSocket::FakeNetworkSocket(FakeNetworkSocketServer* socket_server,
                                     rtc::Thread* thread)
    :{}

FakeNetworkSocket::~FakeNetworkSocket() {}

void FakeNetworkSocket::OnPacketReceived(EmulatedIpPacket packet) {}

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

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

int FakeNetworkSocket::Bind(const rtc::SocketAddress& addr) {}

int FakeNetworkSocket::Connect(const rtc::SocketAddress& addr) {}

int FakeNetworkSocket::Send(const void* pv, size_t cb) {}

int FakeNetworkSocket::SendTo(const void* pv,
                              size_t cb,
                              const rtc::SocketAddress& addr) {}

int FakeNetworkSocket::Recv(void* pv, size_t cb, int64_t* timestamp) {}

// Reads 1 packet from internal queue. Reads up to `cb` bytes into `pv`
// and returns the length of received packet.
int FakeNetworkSocket::RecvFrom(void* pv,
                                size_t cb,
                                rtc::SocketAddress* paddr,
                                int64_t* timestamp) {}

int FakeNetworkSocket::Listen(int backlog) {}

rtc::Socket* FakeNetworkSocket::Accept(rtc::SocketAddress* /*paddr*/) {}

int FakeNetworkSocket::Close() {}

int FakeNetworkSocket::GetError() const {}

void FakeNetworkSocket::SetError(int error) {}

rtc::Socket::ConnState FakeNetworkSocket::GetState() const {}

int FakeNetworkSocket::GetOption(Option opt, int* value) {}

int FakeNetworkSocket::SetOption(Option opt, int value) {}

FakeNetworkSocketServer::FakeNetworkSocketServer(
    EndpointsContainer* endpoints_container)
    :{}
FakeNetworkSocketServer::~FakeNetworkSocketServer() = default;

EmulatedEndpointImpl* FakeNetworkSocketServer::GetEndpointNode(
    const rtc::IPAddress& ip) {}

void FakeNetworkSocketServer::Unregister(FakeNetworkSocket* socket) {}

rtc::Socket* FakeNetworkSocketServer::CreateSocket(int family, int type) {}

void FakeNetworkSocketServer::SetMessageQueue(rtc::Thread* thread) {}

// Always returns true (if return false, it won't be invoked again...)
bool FakeNetworkSocketServer::Wait(webrtc::TimeDelta max_wait_duration,
                                   bool process_io) {}

void FakeNetworkSocketServer::WakeUp() {}

}  // namespace test
}  // namespace webrtc