#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-params-data.h"
#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-shared-message-ids.h"
#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
namespace blink::mojom::blink {
DirectTCPSocketOptions::DirectTCPSocketOptions()
: … { … }
DirectTCPSocketOptions::DirectTCPSocketOptions(
const ::net::HostPortPair& remote_addr_in,
std::optional<int32_t> send_buffer_size_in,
std::optional<int32_t> receive_buffer_size_in,
bool no_delay_in,
::network::mojom::blink::TCPKeepAliveOptionsPtr keep_alive_options_in,
std::optional<::net::DnsQueryType> dns_query_type_in)
: … { … }
DirectTCPSocketOptions::~DirectTCPSocketOptions() = default;
void DirectTCPSocketOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool DirectTCPSocketOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
DirectConnectedUDPSocketOptions::DirectConnectedUDPSocketOptions()
: … { … }
DirectConnectedUDPSocketOptions::DirectConnectedUDPSocketOptions(
const ::net::HostPortPair& remote_addr_in,
std::optional<int32_t> send_buffer_size_in,
std::optional<int32_t> receive_buffer_size_in,
std::optional<::net::DnsQueryType> dns_query_type_in)
: … { … }
DirectConnectedUDPSocketOptions::~DirectConnectedUDPSocketOptions() = default;
void DirectConnectedUDPSocketOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool DirectConnectedUDPSocketOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
DirectBoundUDPSocketOptions::DirectBoundUDPSocketOptions()
: … { … }
DirectBoundUDPSocketOptions::DirectBoundUDPSocketOptions(
const ::net::IPEndPoint& local_addr_in,
std::optional<int32_t> send_buffer_size_in,
std::optional<int32_t> receive_buffer_size_in,
std::optional<bool> ipv6_only_in)
: … { … }
DirectBoundUDPSocketOptions::~DirectBoundUDPSocketOptions() = default;
void DirectBoundUDPSocketOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool DirectBoundUDPSocketOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
DirectTCPServerSocketOptions::DirectTCPServerSocketOptions()
: … { … }
DirectTCPServerSocketOptions::DirectTCPServerSocketOptions(
const ::net::IPEndPoint& local_addr_in,
std::optional<bool> ipv6_only_in,
std::optional<uint32_t> backlog_in)
: … { … }
DirectTCPServerSocketOptions::~DirectTCPServerSocketOptions() = default;
void DirectTCPServerSocketOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool DirectTCPServerSocketOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char DirectSocketsService::Name_[] = …;
DirectSocketsService::IPCStableHashFunction DirectSocketsService::MessageToMethodInfo_(mojo::Message& message) { … }
const char* DirectSocketsService::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t DirectSocketsService::OpenTCPSocket_Sym::IPCStableHash() { … }
uint32_t DirectSocketsService::OpenConnectedUDPSocket_Sym::IPCStableHash() { … }
uint32_t DirectSocketsService::OpenBoundUDPSocket_Sym::IPCStableHash() { … }
uint32_t DirectSocketsService::OpenTCPServerSocket_Sym::IPCStableHash() { … }
# endif
class DirectSocketsService_OpenTCPSocket_ForwardToCallback
: public mojo::MessageReceiver { … };
class DirectSocketsService_OpenConnectedUDPSocket_ForwardToCallback
: public mojo::MessageReceiver { … };
class DirectSocketsService_OpenBoundUDPSocket_ForwardToCallback
: public mojo::MessageReceiver { … };
class DirectSocketsService_OpenTCPServerSocket_ForwardToCallback
: public mojo::MessageReceiver { … };
DirectSocketsServiceProxy::DirectSocketsServiceProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void DirectSocketsServiceProxy::OpenTCPSocket(
DirectTCPSocketOptionsPtr in_options, ::mojo::PendingReceiver<::network::mojom::blink::TCPConnectedSocket> in_receiver, ::mojo::PendingRemote<::network::mojom::blink::SocketObserver> in_observer, OpenTCPSocketCallback callback) { … }
void DirectSocketsServiceProxy::OpenConnectedUDPSocket(
DirectConnectedUDPSocketOptionsPtr in_options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> in_receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> in_listener, OpenConnectedUDPSocketCallback callback) { … }
void DirectSocketsServiceProxy::OpenBoundUDPSocket(
DirectBoundUDPSocketOptionsPtr in_options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> in_receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> in_listener, OpenBoundUDPSocketCallback callback) { … }
void DirectSocketsServiceProxy::OpenTCPServerSocket(
DirectTCPServerSocketOptionsPtr in_options, ::mojo::PendingReceiver<::network::mojom::blink::TCPServerSocket> in_receiver, OpenTCPServerSocketCallback callback) { … }
class DirectSocketsService_OpenTCPSocket_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool DirectSocketsService_OpenTCPSocket_ForwardToCallback::Accept(
mojo::Message* message) { … }
void DirectSocketsService_OpenTCPSocket_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr, const std::optional<::net::IPEndPoint>& in_peer_addr, ::mojo::ScopedDataPipeConsumerHandle in_receive_stream, ::mojo::ScopedDataPipeProducerHandle in_send_stream) { … }
class DirectSocketsService_OpenConnectedUDPSocket_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool DirectSocketsService_OpenConnectedUDPSocket_ForwardToCallback::Accept(
mojo::Message* message) { … }
void DirectSocketsService_OpenConnectedUDPSocket_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr, const std::optional<::net::IPEndPoint>& in_peer_addr) { … }
class DirectSocketsService_OpenBoundUDPSocket_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool DirectSocketsService_OpenBoundUDPSocket_ForwardToCallback::Accept(
mojo::Message* message) { … }
void DirectSocketsService_OpenBoundUDPSocket_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr) { … }
class DirectSocketsService_OpenTCPServerSocket_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool DirectSocketsService_OpenTCPServerSocket_ForwardToCallback::Accept(
mojo::Message* message) { … }
void DirectSocketsService_OpenTCPServerSocket_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr) { … }
bool DirectSocketsServiceStubDispatch::Accept(
DirectSocketsService* impl,
mojo::Message* message) { … }
bool DirectSocketsServiceStubDispatch::AcceptWithResponder(
DirectSocketsService* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kDirectSocketsServiceValidationInfo[] = …;
bool DirectSocketsServiceRequestValidator::Accept(mojo::Message* message) { … }
bool DirectSocketsServiceResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::blink::mojom::blink::DirectTCPSocketOptions::DataView, ::blink::mojom::blink::DirectTCPSocketOptionsPtr>::Read(
::blink::mojom::blink::DirectTCPSocketOptions::DataView input,
::blink::mojom::blink::DirectTCPSocketOptionsPtr* output) { … }
bool StructTraits<::blink::mojom::blink::DirectConnectedUDPSocketOptions::DataView, ::blink::mojom::blink::DirectConnectedUDPSocketOptionsPtr>::Read(
::blink::mojom::blink::DirectConnectedUDPSocketOptions::DataView input,
::blink::mojom::blink::DirectConnectedUDPSocketOptionsPtr* output) { … }
bool StructTraits<::blink::mojom::blink::DirectBoundUDPSocketOptions::DataView, ::blink::mojom::blink::DirectBoundUDPSocketOptionsPtr>::Read(
::blink::mojom::blink::DirectBoundUDPSocketOptions::DataView input,
::blink::mojom::blink::DirectBoundUDPSocketOptionsPtr* output) { … }
bool StructTraits<::blink::mojom::blink::DirectTCPServerSocketOptions::DataView, ::blink::mojom::blink::DirectTCPServerSocketOptionsPtr>::Read(
::blink::mojom::blink::DirectTCPServerSocketOptions::DataView input,
::blink::mojom::blink::DirectTCPServerSocketOptionsPtr* output) { … }
}
namespace blink::mojom::blink {
void DirectSocketsServiceInterceptorForTesting::OpenTCPSocket(DirectTCPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::TCPConnectedSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::SocketObserver> observer, OpenTCPSocketCallback callback) { … }
void DirectSocketsServiceInterceptorForTesting::OpenConnectedUDPSocket(DirectConnectedUDPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> listener, OpenConnectedUDPSocketCallback callback) { … }
void DirectSocketsServiceInterceptorForTesting::OpenBoundUDPSocket(DirectBoundUDPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> listener, OpenBoundUDPSocketCallback callback) { … }
void DirectSocketsServiceInterceptorForTesting::OpenTCPServerSocket(DirectTCPServerSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::TCPServerSocket> receiver, OpenTCPServerSocketCallback callback) { … }
DirectSocketsServiceAsyncWaiter::DirectSocketsServiceAsyncWaiter(
DirectSocketsService* proxy) : … { … }
DirectSocketsServiceAsyncWaiter::~DirectSocketsServiceAsyncWaiter() = default;
void DirectSocketsServiceAsyncWaiter::OpenTCPSocket(
DirectTCPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::TCPConnectedSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::SocketObserver> observer, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr, std::optional<::net::IPEndPoint>* out_peer_addr, ::mojo::ScopedDataPipeConsumerHandle* out_receive_stream, ::mojo::ScopedDataPipeProducerHandle* out_send_stream) { … }
void DirectSocketsServiceAsyncWaiter::OpenConnectedUDPSocket(
DirectConnectedUDPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> listener, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr, std::optional<::net::IPEndPoint>* out_peer_addr) { … }
void DirectSocketsServiceAsyncWaiter::OpenBoundUDPSocket(
DirectBoundUDPSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::RestrictedUDPSocket> receiver, ::mojo::PendingRemote<::network::mojom::blink::UDPSocketListener> listener, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr) { … }
void DirectSocketsServiceAsyncWaiter::OpenTCPServerSocket(
DirectTCPServerSocketOptionsPtr options, ::mojo::PendingReceiver<::network::mojom::blink::TCPServerSocket> receiver, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif