chromium/components/openscreen_platform/tls_connection_factory.cc

// Copyright 2019 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/openscreen_platform/tls_connection_factory.h"

#include <openssl/pool.h>
#include <utility>

#include "base/notreached.h"
#include "components/openscreen_platform/network_context.h"
#include "components/openscreen_platform/network_util.h"
#include "components/openscreen_platform/tls_client_connection.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
#include "net/ssl/ssl_info.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/openscreen/src/platform/api/tls_connection.h"
#include "third_party/openscreen/src/platform/base/tls_connect_options.h"
#include "third_party/openscreen/src/platform/base/tls_credentials.h"
#include "third_party/openscreen/src/platform/base/tls_listen_options.h"

namespace openscreen {

class TaskRunner;

std::unique_ptr<TlsConnectionFactory> TlsConnectionFactory::CreateFactory(
    Client& client,
    TaskRunner& task_runner) {}

}  // namespace openscreen

namespace openscreen_platform {

namespace {

IPEndpoint;
TlsConnectOptions;
TlsCredentials;
TlsListenOptions;

constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =;

}  // namespace

TlsConnectionFactory::~TlsConnectionFactory() = default;

void TlsConnectionFactory::Connect(const IPEndpoint& remote_address,
                                   const TlsConnectOptions& options) {}

void TlsConnectionFactory::SetListenCredentials(
    const TlsCredentials& credentials) {}

void TlsConnectionFactory::Listen(const IPEndpoint& local_address,
                                  const TlsListenOptions& options) {}

TlsConnectionFactory::TlsConnectionFactory(
    openscreen::TlsConnectionFactory::Client& client)
    :{}

TlsConnectionFactory::TcpConnectRequest::TcpConnectRequest(
    openscreen::TlsConnectOptions options_in,
    openscreen::IPEndpoint remote_address_in,
    mojo::Remote<network::mojom::TCPConnectedSocket> tcp_socket_in)
    :{}
TlsConnectionFactory::TcpConnectRequest::TcpConnectRequest(
    TcpConnectRequest&&) = default;
TlsConnectionFactory::TcpConnectRequest&
TlsConnectionFactory::TcpConnectRequest::operator=(TcpConnectRequest&&) =
    default;

TlsConnectionFactory::TcpConnectRequest::~TcpConnectRequest() = default;

TlsConnectionFactory::TlsUpgradeRequest::TlsUpgradeRequest(
    openscreen::IPEndpoint local_address_in,
    openscreen::IPEndpoint remote_address_in,
    mojo::Remote<network::mojom::TCPConnectedSocket> tcp_socket_in,
    mojo::Remote<network::mojom::TLSClientSocket> tls_socket_in)
    :{}
TlsConnectionFactory::TlsUpgradeRequest::TlsUpgradeRequest(
    TlsUpgradeRequest&&) = default;
TlsConnectionFactory::TlsUpgradeRequest&
TlsConnectionFactory::TlsUpgradeRequest::operator=(TlsUpgradeRequest&&) =
    default;
TlsConnectionFactory::TlsUpgradeRequest::~TlsUpgradeRequest() = default;

void TlsConnectionFactory::OnTcpConnect(
    TcpConnectRequest request,
    int32_t net_result,
    const std::optional<net::IPEndPoint>& local_address,
    const std::optional<net::IPEndPoint>& remote_address,
    mojo::ScopedDataPipeConsumerHandle receive_stream,
    mojo::ScopedDataPipeProducerHandle send_stream) {}

void TlsConnectionFactory::OnTlsUpgrade(
    TlsUpgradeRequest request,
    int32_t net_result,
    mojo::ScopedDataPipeConsumerHandle receive_stream,
    mojo::ScopedDataPipeProducerHandle send_stream,
    const std::optional<net::SSLInfo>& ssl_info) {}

}  // namespace openscreen_platform