blob: eecf127e4e6ad841351affa4843be5fc5817ee85 [file] [log] [blame]
// mojom/passpoint.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJOM_PASSPOINT_MOJOM_SHARED_H_
#define MOJOM_PASSPOINT_MOJOM_SHARED_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/enum_traits.h"
#include "mojo/public/cpp/bindings/interface_data_view.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/map_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "mojom/passpoint.mojom-shared-internal.h"
#include "mojo/public/cpp/bindings/lib/interface_serialization.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace chromeos::connectivity::mojom {
class PasspointSubscriptionDataView;
} // chromeos::connectivity::mojom
namespace mojo {
namespace internal {
template <>
struct MojomTypeTraits<::chromeos::connectivity::mojom::PasspointSubscriptionDataView> {
using Data = ::chromeos::connectivity::mojom::internal::PasspointSubscription_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
} // namespace internal
} // namespace mojo
namespace chromeos::connectivity::mojom {
// Interface base classes. They are used for type safety check.
class PasspointEventsListenerInterfaceBase {};
using PasspointEventsListenerPtrDataView =
mojo::InterfacePtrDataView<PasspointEventsListenerInterfaceBase>;
using PasspointEventsListenerRequestDataView =
mojo::InterfaceRequestDataView<PasspointEventsListenerInterfaceBase>;
using PasspointEventsListenerAssociatedPtrInfoDataView =
mojo::AssociatedInterfacePtrInfoDataView<PasspointEventsListenerInterfaceBase>;
using PasspointEventsListenerAssociatedRequestDataView =
mojo::AssociatedInterfaceRequestDataView<PasspointEventsListenerInterfaceBase>;
class PasspointServiceInterfaceBase {};
using PasspointServicePtrDataView =
mojo::InterfacePtrDataView<PasspointServiceInterfaceBase>;
using PasspointServiceRequestDataView =
mojo::InterfaceRequestDataView<PasspointServiceInterfaceBase>;
using PasspointServiceAssociatedPtrInfoDataView =
mojo::AssociatedInterfacePtrInfoDataView<PasspointServiceInterfaceBase>;
using PasspointServiceAssociatedRequestDataView =
mojo::AssociatedInterfaceRequestDataView<PasspointServiceInterfaceBase>;
class PasspointSubscriptionDataView {
public:
PasspointSubscriptionDataView() = default;
PasspointSubscriptionDataView(
internal::PasspointSubscription_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
inline void GetIdDataView(
mojo::StringDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadId(UserType* output) {
auto* pointer = data_->id.Get();
return mojo::internal::Deserialize<mojo::StringDataView>(
pointer, output, message_);
}
inline void GetDomainsDataView(
mojo::ArrayDataView<mojo::StringDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadDomains(UserType* output) {
auto* pointer = data_->domains.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::StringDataView>>(
pointer, output, message_);
}
inline void GetFriendlyNameDataView(
mojo::StringDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadFriendlyName(UserType* output) {
auto* pointer = data_->friendly_name.Get();
return mojo::internal::Deserialize<mojo::StringDataView>(
pointer, output, message_);
}
inline void GetProvisioningSourceDataView(
mojo::StringDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadProvisioningSource(UserType* output) {
auto* pointer = data_->provisioning_source.Get();
return mojo::internal::Deserialize<mojo::StringDataView>(
pointer, output, message_);
}
inline void GetTrustedCaDataView(
mojo::StringDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadTrustedCa(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::StringDataView, UserType>(),
"Attempting to read the optional `trusted_ca` 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 `MaybeReadTrustedCa` instead "
"of `ReadTrustedCa if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->trusted_ca.Get();
return mojo::internal::Deserialize<mojo::StringDataView>(
pointer, output, message_);
}
int64_t expiration_epoch_ms() const {
return data_->expiration_epoch_ms;
}
private:
internal::PasspointSubscription_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
} // chromeos::connectivity::mojom
namespace std {
} // namespace std
namespace mojo {
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::chromeos::connectivity::mojom::PasspointSubscriptionDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::chromeos::connectivity::mojom::PasspointSubscriptionDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::chromeos::connectivity::mojom::internal::PasspointSubscription_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
decltype(Traits::id(input)) in_id = Traits::id(input);
mojo::internal::MessageFragment<
typename decltype(fragment->id)::BaseType> id_fragment(
fragment.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_id, id_fragment);
fragment->id.Set(
id_fragment.is_null() ? nullptr : id_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->id.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null id in PasspointSubscription struct");
decltype(Traits::domains(input)) in_domains = Traits::domains(input);
mojo::internal::MessageFragment<
typename decltype(fragment->domains)::BaseType>
domains_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& domains_validate_params =
mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>>(
in_domains, domains_fragment, &domains_validate_params);
fragment->domains.Set(
domains_fragment.is_null() ? nullptr : domains_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->domains.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null domains in PasspointSubscription struct");
decltype(Traits::friendly_name(input)) in_friendly_name = Traits::friendly_name(input);
mojo::internal::MessageFragment<
typename decltype(fragment->friendly_name)::BaseType> friendly_name_fragment(
fragment.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_friendly_name, friendly_name_fragment);
fragment->friendly_name.Set(
friendly_name_fragment.is_null() ? nullptr : friendly_name_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->friendly_name.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null friendly_name in PasspointSubscription struct");
decltype(Traits::provisioning_source(input)) in_provisioning_source = Traits::provisioning_source(input);
mojo::internal::MessageFragment<
typename decltype(fragment->provisioning_source)::BaseType> provisioning_source_fragment(
fragment.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_provisioning_source, provisioning_source_fragment);
fragment->provisioning_source.Set(
provisioning_source_fragment.is_null() ? nullptr : provisioning_source_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->provisioning_source.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null provisioning_source in PasspointSubscription struct");
decltype(Traits::trusted_ca(input)) in_trusted_ca = Traits::trusted_ca(input);
mojo::internal::MessageFragment<
typename decltype(fragment->trusted_ca)::BaseType> trusted_ca_fragment(
fragment.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_trusted_ca, trusted_ca_fragment);
fragment->trusted_ca.Set(
trusted_ca_fragment.is_null() ? nullptr : trusted_ca_fragment.data());
fragment->expiration_epoch_ms = Traits::expiration_epoch_ms(input);
}
static bool Deserialize(::chromeos::connectivity::mojom::internal::PasspointSubscription_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::chromeos::connectivity::mojom::PasspointSubscriptionDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
} // namespace mojo
namespace chromeos::connectivity::mojom {
inline void PasspointSubscriptionDataView::GetIdDataView(
mojo::StringDataView* output) {
auto pointer = data_->id.Get();
*output = mojo::StringDataView(pointer, message_);
}
inline void PasspointSubscriptionDataView::GetDomainsDataView(
mojo::ArrayDataView<mojo::StringDataView>* output) {
auto pointer = data_->domains.Get();
*output = mojo::ArrayDataView<mojo::StringDataView>(pointer, message_);
}
inline void PasspointSubscriptionDataView::GetFriendlyNameDataView(
mojo::StringDataView* output) {
auto pointer = data_->friendly_name.Get();
*output = mojo::StringDataView(pointer, message_);
}
inline void PasspointSubscriptionDataView::GetProvisioningSourceDataView(
mojo::StringDataView* output) {
auto pointer = data_->provisioning_source.Get();
*output = mojo::StringDataView(pointer, message_);
}
inline void PasspointSubscriptionDataView::GetTrustedCaDataView(
mojo::StringDataView* output) {
auto pointer = data_->trusted_ca.Get();
*output = mojo::StringDataView(pointer, message_);
}
} // chromeos::connectivity::mojom
// Declare TraceFormatTraits for enums, which should be defined in ::perfetto
// namespace.
#endif // MOJOM_PASSPOINT_MOJOM_SHARED_H_