chromium/components/webrtc/fake_ssl_client_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.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/webrtc/fake_ssl_client_socket.h"

#include <stddef.h>
#include <stdint.h>

#include <cstdlib>
#include <cstring>
#include <string_view>
#include <utility>

#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"

namespace webrtc {

namespace {

// The constants below were taken from libjingle's socketadapters.cc.
// Basically, we do a "fake" SSL handshake to fool proxies into
// thinking this is a real SSL connection.

// This is a SSL v2 CLIENT_HELLO message.
// TODO(juberti): Should this have a session id? The response doesn't have a
// certificate, so the hello should have a session id.
static const uint8_t kSslClientHello[] =;

// This is a TLSv1 SERVER_HELLO message.
static const uint8_t kSslServerHello[] =;

// TODO(crbug.com/40171113): This annotation is not test specific but is for
// test. We should fix it.
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =;

scoped_refptr<net::DrainableIOBuffer> NewDrainableIOBufferWithSize(int size) {}

}  // namespace

std::string_view FakeSSLClientSocket::GetSslClientHello() {}

std::string_view FakeSSLClientSocket::GetSslServerHello() {}

FakeSSLClientSocket::FakeSSLClientSocket(
    std::unique_ptr<net::StreamSocket> transport_socket)
    :{}

FakeSSLClientSocket::~FakeSSLClientSocket() {}

int FakeSSLClientSocket::Read(net::IOBuffer* buf,
                              int buf_len,
                              net::CompletionOnceCallback callback) {}

int FakeSSLClientSocket::ReadIfReady(net::IOBuffer* buf,
                                     int buf_len,
                                     net::CompletionOnceCallback callback) {}

int FakeSSLClientSocket::CancelReadIfReady() {}

int FakeSSLClientSocket::Write(
    net::IOBuffer* buf,
    int buf_len,
    net::CompletionOnceCallback callback,
    const net::NetworkTrafficAnnotationTag& traffic_annotation) {}

int FakeSSLClientSocket::SetReceiveBufferSize(int32_t size) {}

int FakeSSLClientSocket::SetSendBufferSize(int32_t size) {}

int FakeSSLClientSocket::Connect(net::CompletionOnceCallback callback) {}

int FakeSSLClientSocket::DoHandshakeLoop() {}

void FakeSSLClientSocket::RunUserConnectCallback(int status) {}

void FakeSSLClientSocket::DoHandshakeLoopWithUserConnectCallback() {}

int FakeSSLClientSocket::DoConnect() {}

void FakeSSLClientSocket::OnConnectDone(int status) {}

void FakeSSLClientSocket::ProcessConnectDone() {}

int FakeSSLClientSocket::DoSendClientHello() {}

void FakeSSLClientSocket::OnSendClientHelloDone(int status) {}

void FakeSSLClientSocket::ProcessSendClientHelloDone(size_t written) {}

int FakeSSLClientSocket::DoVerifyServerHello() {}

void FakeSSLClientSocket::OnVerifyServerHelloDone(int status) {}

net::Error FakeSSLClientSocket::ProcessVerifyServerHelloDone(size_t read) {}

void FakeSSLClientSocket::Disconnect() {}

bool FakeSSLClientSocket::IsConnected() const {}

bool FakeSSLClientSocket::IsConnectedAndIdle() const {}

int FakeSSLClientSocket::GetPeerAddress(net::IPEndPoint* address) const {}

int FakeSSLClientSocket::GetLocalAddress(net::IPEndPoint* address) const {}

const net::NetLogWithSource& FakeSSLClientSocket::NetLog() const {}

bool FakeSSLClientSocket::WasEverUsed() const {}

net::NextProto FakeSSLClientSocket::GetNegotiatedProtocol() const {}

bool FakeSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) {}

int64_t FakeSSLClientSocket::GetTotalReceivedBytes() const {}

void FakeSSLClientSocket::ApplySocketTag(const net::SocketTag& tag) {}

}  // namespace webrtc