// services/network/public/mojom/restricted_udp_socket.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

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

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef SERVICES_NETWORK_PUBLIC_MOJOM_RESTRICTED_UDP_SOCKET_MOJOM_DATA_VIEW_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_RESTRICTED_UDP_SOCKET_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "services/network/public/mojom/restricted_udp_socket.mojom-shared-internal.h"
#include "mojo/public/mojom/base/read_only_buffer.mojom-shared.h"
#include "services/network/public/mojom/host_resolver.mojom-shared.h"
#include "services/network/public/mojom/network_param.mojom-shared.h"
#include "services/network/public/mojom/udp_socket.mojom-shared.h"
#include "services/network/public/mojom/ip_address.mojom-shared.h"


namespace network::mojom {
class RestrictedUDPSocketParamsDataView;



}  // network::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::network::mojom::RestrictedUDPSocketParamsDataView> {
  using Data = ::network::mojom::internal::RestrictedUDPSocketParams_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace network::mojom {


enum class RestrictedUDPSocketMode : int32_t {
  
  CONNECTED = 0,
  
  BOUND = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

 std::ostream& operator<<(std::ostream& os, RestrictedUDPSocketMode value);
inline bool IsKnownEnumValue(RestrictedUDPSocketMode value) {
  return internal::RestrictedUDPSocketMode_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(RestrictedUDPSocketMode) {
  return true;
}
// Interface base classes. They are used for type safety check.
class RestrictedUDPSocketInterfaceBase {};

using RestrictedUDPSocketPtrDataView =
    mojo::InterfacePtrDataView<RestrictedUDPSocketInterfaceBase>;
using RestrictedUDPSocketRequestDataView =
    mojo::InterfaceRequestDataView<RestrictedUDPSocketInterfaceBase>;
using RestrictedUDPSocketAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<RestrictedUDPSocketInterfaceBase>;
using RestrictedUDPSocketAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<RestrictedUDPSocketInterfaceBase>;


class RestrictedUDPSocketParamsDataView {
 public:
  RestrictedUDPSocketParamsDataView() = default;

  RestrictedUDPSocketParamsDataView(
      internal::RestrictedUDPSocketParams_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetSocketOptionsDataView(
      ::network::mojom::UDPSocketOptionsDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadSocketOptions(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::network::mojom::UDPSocketOptionsDataView, UserType>(),
    "Attempting to read the optional `socket_options` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadSocketOptions` instead "
    "of `ReadSocketOptions if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->socket_options.Get();
    return mojo::internal::Deserialize<::network::mojom::UDPSocketOptionsDataView>(
        pointer, output, message_);
  }
 private:
  internal::RestrictedUDPSocketParams_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // network::mojom

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_RESTRICTED_UDP_SOCKET_MOJOM_DATA_VIEW_H_