#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "services/network/public/mojom/udp_socket.mojom.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 "services/network/public/mojom/udp_socket.mojom-params-data.h"
#include "services/network/public/mojom/udp_socket.mojom-shared-message-ids.h"
#include "services/network/public/mojom/udp_socket.mojom-import-headers.h"
#include "services/network/public/mojom/udp_socket.mojom-test-utils.h"
namespace network::mojom {
UDPSocketOptions::UDPSocketOptions()
: … { … }
UDPSocketOptions::UDPSocketOptions(
bool allow_address_reuse_in,
bool allow_broadcast_in,
bool allow_address_sharing_for_multicast_in,
uint32_t multicast_interface_in,
uint32_t multicast_time_to_live_in,
bool multicast_loopback_mode_in,
int32_t send_buffer_size_in,
int32_t receive_buffer_size_in,
::network::mojom::OptionalBool ipv6_only_in)
: … { … }
UDPSocketOptions::~UDPSocketOptions() = default;
size_t UDPSocketOptions::Hash(size_t seed) const { … }
void UDPSocketOptions::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool UDPSocketOptions::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char UDPSocket::Name_[] = …;
UDPSocket::IPCStableHashFunction UDPSocket::MessageToMethodInfo_(mojo::Message& message) { … }
const char* UDPSocket::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t UDPSocket::Bind_Sym::IPCStableHash() { … }
uint32_t UDPSocket::Connect_Sym::IPCStableHash() { … }
uint32_t UDPSocket::SetBroadcast_Sym::IPCStableHash() { … }
uint32_t UDPSocket::SetSendBufferSize_Sym::IPCStableHash() { … }
uint32_t UDPSocket::SetReceiveBufferSize_Sym::IPCStableHash() { … }
uint32_t UDPSocket::JoinGroup_Sym::IPCStableHash() { … }
uint32_t UDPSocket::LeaveGroup_Sym::IPCStableHash() { … }
uint32_t UDPSocket::ReceiveMore_Sym::IPCStableHash() { … }
uint32_t UDPSocket::ReceiveMoreWithBufferSize_Sym::IPCStableHash() { … }
uint32_t UDPSocket::SendTo_Sym::IPCStableHash() { … }
uint32_t UDPSocket::Send_Sym::IPCStableHash() { … }
uint32_t UDPSocket::Close_Sym::IPCStableHash() { … }
# endif
class UDPSocket_Bind_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_Connect_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_SetBroadcast_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_SetSendBufferSize_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_SetReceiveBufferSize_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_JoinGroup_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_LeaveGroup_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_SendTo_ForwardToCallback
: public mojo::MessageReceiver { … };
class UDPSocket_Send_ForwardToCallback
: public mojo::MessageReceiver { … };
UDPSocketProxy::UDPSocketProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void UDPSocketProxy::Bind(
const ::net::IPEndPoint& in_local_addr, UDPSocketOptionsPtr in_socket_options, BindCallback callback) { … }
void UDPSocketProxy::Connect(
const ::net::IPEndPoint& in_remote_addr, UDPSocketOptionsPtr in_socket_options, ConnectCallback callback) { … }
void UDPSocketProxy::SetBroadcast(
bool in_broadcast, SetBroadcastCallback callback) { … }
void UDPSocketProxy::SetSendBufferSize(
int32_t in_send_buffer_size, SetSendBufferSizeCallback callback) { … }
void UDPSocketProxy::SetReceiveBufferSize(
int32_t in_receive_buffer_size, SetReceiveBufferSizeCallback callback) { … }
void UDPSocketProxy::JoinGroup(
const ::net::IPAddress& in_group_address, JoinGroupCallback callback) { … }
void UDPSocketProxy::LeaveGroup(
const ::net::IPAddress& in_group_address, LeaveGroupCallback callback) { … }
void UDPSocketProxy::ReceiveMore(
uint32_t in_num_additional_datagrams) { … }
void UDPSocketProxy::ReceiveMoreWithBufferSize(
uint32_t in_num_additional_datagrams, uint32_t in_buffer_size) { … }
void UDPSocketProxy::SendTo(
const ::net::IPEndPoint& in_dest_addr, ::base::span<const ::uint8_t> in_data, const ::net::MutableNetworkTrafficAnnotationTag& in_traffic_annotation, SendToCallback callback) { … }
void UDPSocketProxy::Send(
::base::span<const ::uint8_t> in_data, const ::net::MutableNetworkTrafficAnnotationTag& in_traffic_annotation, SendCallback callback) { … }
void UDPSocketProxy::Close(
) { … }
class UDPSocket_Bind_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_Bind_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_Bind_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr_out) { … }
class UDPSocket_Connect_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_Connect_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_Connect_ProxyToResponder::Run(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_local_addr_out) { … }
class UDPSocket_SetBroadcast_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_SetBroadcast_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_SetBroadcast_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_SetSendBufferSize_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_SetSendBufferSize_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_SetSendBufferSize_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_SetReceiveBufferSize_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_SetReceiveBufferSize_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_SetReceiveBufferSize_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_JoinGroup_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_JoinGroup_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_JoinGroup_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_LeaveGroup_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_LeaveGroup_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_LeaveGroup_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_SendTo_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_SendTo_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_SendTo_ProxyToResponder::Run(
int32_t in_result) { … }
class UDPSocket_Send_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool UDPSocket_Send_ForwardToCallback::Accept(
mojo::Message* message) { … }
void UDPSocket_Send_ProxyToResponder::Run(
int32_t in_result) { … }
bool UDPSocketStubDispatch::Accept(
UDPSocket* impl,
mojo::Message* message) { … }
bool UDPSocketStubDispatch::AcceptWithResponder(
UDPSocket* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kUDPSocketValidationInfo[] = …;
bool UDPSocketRequestValidator::Accept(mojo::Message* message) { … }
bool UDPSocketResponseValidator::Accept(mojo::Message* message) { … }
const char UDPSocketListener::Name_[] = …;
UDPSocketListener::IPCStableHashFunction UDPSocketListener::MessageToMethodInfo_(mojo::Message& message) { … }
const char* UDPSocketListener::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t UDPSocketListener::OnReceived_Sym::IPCStableHash() { … }
# endif
UDPSocketListenerProxy::UDPSocketListenerProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void UDPSocketListenerProxy::OnReceived(
int32_t in_result, const std::optional<::net::IPEndPoint>& in_src_addr, std::optional<::base::span<const ::uint8_t>> in_data) { … }
bool UDPSocketListenerStubDispatch::Accept(
UDPSocketListener* impl,
mojo::Message* message) { … }
bool UDPSocketListenerStubDispatch::AcceptWithResponder(
UDPSocketListener* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kUDPSocketListenerValidationInfo[] = …;
bool UDPSocketListenerRequestValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::network::mojom::UDPSocketOptions::DataView, ::network::mojom::UDPSocketOptionsPtr>::Read(
::network::mojom::UDPSocketOptions::DataView input,
::network::mojom::UDPSocketOptionsPtr* output) { … }
}
namespace network::mojom {
void UDPSocketInterceptorForTesting::Bind(const ::net::IPEndPoint& local_addr, UDPSocketOptionsPtr socket_options, BindCallback callback) { … }
void UDPSocketInterceptorForTesting::Connect(const ::net::IPEndPoint& remote_addr, UDPSocketOptionsPtr socket_options, ConnectCallback callback) { … }
void UDPSocketInterceptorForTesting::SetBroadcast(bool broadcast, SetBroadcastCallback callback) { … }
void UDPSocketInterceptorForTesting::SetSendBufferSize(int32_t send_buffer_size, SetSendBufferSizeCallback callback) { … }
void UDPSocketInterceptorForTesting::SetReceiveBufferSize(int32_t receive_buffer_size, SetReceiveBufferSizeCallback callback) { … }
void UDPSocketInterceptorForTesting::JoinGroup(const ::net::IPAddress& group_address, JoinGroupCallback callback) { … }
void UDPSocketInterceptorForTesting::LeaveGroup(const ::net::IPAddress& group_address, LeaveGroupCallback callback) { … }
void UDPSocketInterceptorForTesting::ReceiveMore(uint32_t num_additional_datagrams) { … }
void UDPSocketInterceptorForTesting::ReceiveMoreWithBufferSize(uint32_t num_additional_datagrams, uint32_t buffer_size) { … }
void UDPSocketInterceptorForTesting::SendTo(const ::net::IPEndPoint& dest_addr, ::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation, SendToCallback callback) { … }
void UDPSocketInterceptorForTesting::Send(::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation, SendCallback callback) { … }
void UDPSocketInterceptorForTesting::Close() { … }
UDPSocketAsyncWaiter::UDPSocketAsyncWaiter(
UDPSocket* proxy) : … { … }
UDPSocketAsyncWaiter::~UDPSocketAsyncWaiter() = default;
void UDPSocketAsyncWaiter::Bind(
const ::net::IPEndPoint& local_addr, UDPSocketOptionsPtr socket_options, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr_out) { … }
void UDPSocketAsyncWaiter::Connect(
const ::net::IPEndPoint& remote_addr, UDPSocketOptionsPtr socket_options, int32_t* out_result, std::optional<::net::IPEndPoint>* out_local_addr_out) { … }
void UDPSocketAsyncWaiter::SetBroadcast(
bool broadcast, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::SetBroadcast(
bool broadcast) { … }
void UDPSocketAsyncWaiter::SetSendBufferSize(
int32_t send_buffer_size, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::SetSendBufferSize(
int32_t send_buffer_size) { … }
void UDPSocketAsyncWaiter::SetReceiveBufferSize(
int32_t receive_buffer_size, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::SetReceiveBufferSize(
int32_t receive_buffer_size) { … }
void UDPSocketAsyncWaiter::JoinGroup(
const ::net::IPAddress& group_address, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::JoinGroup(
const ::net::IPAddress& group_address) { … }
void UDPSocketAsyncWaiter::LeaveGroup(
const ::net::IPAddress& group_address, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::LeaveGroup(
const ::net::IPAddress& group_address) { … }
void UDPSocketAsyncWaiter::SendTo(
const ::net::IPEndPoint& dest_addr, ::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::SendTo(
const ::net::IPEndPoint& dest_addr, ::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { … }
void UDPSocketAsyncWaiter::Send(
::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation, int32_t* out_result) { … }
int32_t UDPSocketAsyncWaiter::Send(
::base::span<const ::uint8_t> data, const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { … }
void UDPSocketListenerInterceptorForTesting::OnReceived(int32_t result, const std::optional<::net::IPEndPoint>& src_addr, std::optional<::base::span<const ::uint8_t>> data) { … }
UDPSocketListenerAsyncWaiter::UDPSocketListenerAsyncWaiter(
UDPSocketListener* proxy) : … { … }
UDPSocketListenerAsyncWaiter::~UDPSocketListenerAsyncWaiter() = default;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif