chromium/services/network/p2p/socket.cc

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

#include "services/network/p2p/socket.h"

#include <utility>

#include "base/containers/span_reader.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "net/base/net_errors.h"
#include "services/network/p2p/socket_tcp.h"
#include "services/network/p2p/socket_udp.h"
#include "services/network/proxy_resolving_client_socket_factory.h"

namespace {

// Used to back histogram value of "WebRTC.ICE.TcpSocketErrorCode" and
// "WebRTC.ICE.UdpSocketErrorCode".
enum class SocketErrorCode {};

const uint32_t kStunMagicCookie =;

// Map the network error to SocketErrorCode for the UMA histogram.
// static
static SocketErrorCode MapNetErrorToSocketErrorCode(int net_err) {}
}  // namespace

namespace network {

P2PSocket::P2PSocket(Delegate* delegate,
                     mojo::PendingRemote<mojom::P2PSocketClient> client,
                     mojo::PendingReceiver<mojom::P2PSocket> socket,
                     ProtocolType protocol_type)
    :{}

P2PSocket::~P2PSocket() = default;

// Verifies that the packet |data| has a valid STUN header.
// static
bool P2PSocket::GetStunPacketType(base::span<const uint8_t> data,
                                  StunMessageType* type) {}

// static
bool P2PSocket::IsRequestOrResponse(StunMessageType type) {}

// static
void P2PSocket::ReportSocketError(int result, const char* histogram_name) {}

// static
std::unique_ptr<P2PSocket> P2PSocket::Create(
    Delegate* delegate,
    mojo::PendingRemote<mojom::P2PSocketClient> client,
    mojo::PendingReceiver<mojom::P2PSocket> socket,
    P2PSocketType type,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    net::NetLog* net_log,
    ProxyResolvingClientSocketFactory* proxy_resolving_socket_factory,
    P2PMessageThrottler* throttler,
    std::optional<base::UnguessableToken> devtools_token) {}

mojo::PendingRemote<mojom::P2PSocketClient>
P2PSocket::ReleaseClientForTesting() {}

mojo::PendingReceiver<mojom::P2PSocket> P2PSocket::ReleaseReceiverForTesting() {}

void P2PSocket::OnError() {}

}  // namespace network