| // chromeos/ash/services/connectivity/public/mojom/passpoint.mojom.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROMEOS_ASH_SERVICES_CONNECTIVITY_PUBLIC_MOJOM_PASSPOINT_MOJOM_H_ |
| #define CHROMEOS_ASH_SERVICES_CONNECTIVITY_PUBLIC_MOJOM_PASSPOINT_MOJOM_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <optional> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "base/types/cxx23_to_underlying.h" |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| #include "mojo/public/cpp/bindings/struct_traits.h" |
| #include "mojo/public/cpp/bindings/union_traits.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "chromeos/ash/services/connectivity/public/mojom/passpoint.mojom-features.h" |
| #include "chromeos/ash/services/connectivity/public/mojom/passpoint.mojom-shared.h" |
| #include "chromeos/ash/services/connectivity/public/mojom/passpoint.mojom-forward.h" |
| #include <string> |
| #include <vector> |
| |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/lib/message_size_estimator.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| |
| |
| |
| |
| |
| |
| namespace chromeos::connectivity::mojom { |
| |
| class PasspointEventsListenerProxy; |
| |
| template <typename ImplRefTraits> |
| class PasspointEventsListenerStub; |
| |
| class PasspointEventsListenerRequestValidator; |
| |
| |
| class PasspointEventsListener |
| : public PasspointEventsListenerInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = PasspointEventsListenerInterfaceBase; |
| using Proxy_ = PasspointEventsListenerProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = PasspointEventsListenerStub<ImplRefTraits>; |
| |
| using RequestValidator_ = PasspointEventsListenerRequestValidator; |
| using ResponseValidator_ = mojo::PassThroughFilter; |
| enum MethodMinVersions : uint32_t { |
| kOnPasspointSubscriptionAddedMinVersion = 0, |
| kOnPasspointSubscriptionRemovedMinVersion = 0, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct OnPasspointSubscriptionAdded_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct OnPasspointSubscriptionRemoved_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~PasspointEventsListener() = default; |
| |
| |
| virtual void OnPasspointSubscriptionAdded(PasspointSubscriptionPtr subscription) = 0; |
| |
| |
| virtual void OnPasspointSubscriptionRemoved(PasspointSubscriptionPtr subscription) = 0; |
| }; |
| |
| class PasspointServiceProxy; |
| |
| template <typename ImplRefTraits> |
| class PasspointServiceStub; |
| |
| class PasspointServiceRequestValidator; |
| class PasspointServiceResponseValidator; |
| |
| |
| class PasspointService |
| : public PasspointServiceInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = PasspointServiceInterfaceBase; |
| using Proxy_ = PasspointServiceProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = PasspointServiceStub<ImplRefTraits>; |
| |
| using RequestValidator_ = PasspointServiceRequestValidator; |
| using ResponseValidator_ = PasspointServiceResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kGetPasspointSubscriptionMinVersion = 0, |
| kListPasspointSubscriptionsMinVersion = 0, |
| kDeletePasspointSubscriptionMinVersion = 0, |
| kRegisterPasspointListenerMinVersion = 0, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct GetPasspointSubscription_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct ListPasspointSubscriptions_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct DeletePasspointSubscription_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct RegisterPasspointListener_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~PasspointService() = default; |
| |
| |
| using GetPasspointSubscriptionCallback = base::OnceCallback<void(PasspointSubscriptionPtr)>; |
| |
| virtual void GetPasspointSubscription(const std::string& id, GetPasspointSubscriptionCallback callback) = 0; |
| |
| |
| using ListPasspointSubscriptionsCallback = base::OnceCallback<void(std::vector<PasspointSubscriptionPtr>)>; |
| |
| virtual void ListPasspointSubscriptions(ListPasspointSubscriptionsCallback callback) = 0; |
| |
| |
| using DeletePasspointSubscriptionCallback = base::OnceCallback<void(bool)>; |
| |
| virtual void DeletePasspointSubscription(const std::string& id, DeletePasspointSubscriptionCallback callback) = 0; |
| |
| |
| virtual void RegisterPasspointListener(::mojo::PendingRemote<PasspointEventsListener> listener) = 0; |
| }; |
| |
| |
| |
| class PasspointEventsListenerProxy |
| : public PasspointEventsListener { |
| public: |
| using InterfaceType = PasspointEventsListener; |
| |
| explicit PasspointEventsListenerProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void OnPasspointSubscriptionAdded(PasspointSubscriptionPtr subscription) final; |
| |
| void OnPasspointSubscriptionRemoved(PasspointSubscriptionPtr subscription) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| |
| |
| |
| class PasspointServiceProxy |
| : public PasspointService { |
| public: |
| using InterfaceType = PasspointService; |
| |
| explicit PasspointServiceProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void GetPasspointSubscription(const std::string& id, GetPasspointSubscriptionCallback callback) final; |
| |
| void ListPasspointSubscriptions(ListPasspointSubscriptionsCallback callback) final; |
| |
| void DeletePasspointSubscription(const std::string& id, DeletePasspointSubscriptionCallback callback) final; |
| |
| void RegisterPasspointListener(::mojo::PendingRemote<PasspointEventsListener> listener) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| class PasspointEventsListenerStubDispatch { |
| public: |
| static bool Accept(PasspointEventsListener* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| PasspointEventsListener* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<PasspointEventsListener>> |
| class PasspointEventsListenerStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| PasspointEventsListenerStub() = default; |
| ~PasspointEventsListenerStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return PasspointEventsListenerStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return PasspointEventsListenerStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class PasspointServiceStubDispatch { |
| public: |
| static bool Accept(PasspointService* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| PasspointService* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<PasspointService>> |
| class PasspointServiceStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| PasspointServiceStub() = default; |
| ~PasspointServiceStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return PasspointServiceStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return PasspointServiceStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class PasspointEventsListenerRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class PasspointServiceRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class PasspointServiceResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| class PasspointSubscription { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<PasspointSubscription, T>::value>; |
| using DataView = PasspointSubscriptionDataView; |
| using Data_ = internal::PasspointSubscription_Data; |
| |
| template <typename... Args> |
| static PasspointSubscriptionPtr New(Args&&... args) { |
| return PasspointSubscriptionPtr( |
| std::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static PasspointSubscriptionPtr From(const U& u) { |
| return mojo::TypeConverter<PasspointSubscriptionPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, PasspointSubscription>::Convert(*this); |
| } |
| |
| |
| PasspointSubscription(); |
| |
| PasspointSubscription( |
| const std::string& id, |
| std::vector<std::string> domains, |
| const std::string& friendly_name, |
| const std::string& provisioning_source, |
| const std::optional<std::string>& trusted_ca, |
| int64_t expiration_epoch_ms); |
| |
| |
| ~PasspointSubscription(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = PasspointSubscriptionPtr> |
| PasspointSubscriptionPtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator!=(const T& rhs) const { return !operator==(rhs); } |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| PasspointSubscription::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| PasspointSubscription::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::PasspointSubscription_UnserializedMessageContext< |
| UserType, PasspointSubscription::DataView>>(0, 0, std::move(input)), |
| MOJO_CREATE_MESSAGE_FLAG_NONE); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| mojo::Message message; |
| return mojo::internal::DeserializeImpl<PasspointSubscription::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return PasspointSubscription::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::PasspointSubscription_UnserializedMessageContext< |
| UserType, PasspointSubscription::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<PasspointSubscription::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| std::string id; |
| |
| std::vector<std::string> domains; |
| |
| std::string friendly_name; |
| |
| std::string provisioning_source; |
| |
| std::optional<std::string> trusted_ca; |
| |
| int64_t expiration_epoch_ms; |
| |
| // Serialise this struct into a trace. |
| void WriteIntoTrace(perfetto::TracedValue traced_context) const; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| PasspointSubscriptionPtr PasspointSubscription::Clone() const { |
| return New( |
| mojo::Clone(id), |
| mojo::Clone(domains), |
| mojo::Clone(friendly_name), |
| mojo::Clone(provisioning_source), |
| mojo::Clone(trusted_ca), |
| mojo::Clone(expiration_epoch_ms) |
| ); |
| } |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>*> |
| bool PasspointSubscription::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->id, other_struct.id)) |
| return false; |
| if (!mojo::Equals(this->domains, other_struct.domains)) |
| return false; |
| if (!mojo::Equals(this->friendly_name, other_struct.friendly_name)) |
| return false; |
| if (!mojo::Equals(this->provisioning_source, other_struct.provisioning_source)) |
| return false; |
| if (!mojo::Equals(this->trusted_ca, other_struct.trusted_ca)) |
| return false; |
| if (!mojo::Equals(this->expiration_epoch_ms, other_struct.expiration_epoch_ms)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, PasspointSubscription::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.id < rhs.id) |
| return true; |
| if (rhs.id < lhs.id) |
| return false; |
| if (lhs.domains < rhs.domains) |
| return true; |
| if (rhs.domains < lhs.domains) |
| return false; |
| if (lhs.friendly_name < rhs.friendly_name) |
| return true; |
| if (rhs.friendly_name < lhs.friendly_name) |
| return false; |
| if (lhs.provisioning_source < rhs.provisioning_source) |
| return true; |
| if (rhs.provisioning_source < lhs.provisioning_source) |
| return false; |
| if (lhs.trusted_ca < rhs.trusted_ca) |
| return true; |
| if (rhs.trusted_ca < lhs.trusted_ca) |
| return false; |
| if (lhs.expiration_epoch_ms < rhs.expiration_epoch_ms) |
| return true; |
| if (rhs.expiration_epoch_ms < lhs.expiration_epoch_ms) |
| return false; |
| return false; |
| } |
| |
| |
| } // chromeos::connectivity::mojom |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct StructTraits<::chromeos::connectivity::mojom::PasspointSubscription::DataView, |
| ::chromeos::connectivity::mojom::PasspointSubscriptionPtr> { |
| static bool IsNull(const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { return !input; } |
| static void SetToNull(::chromeos::connectivity::mojom::PasspointSubscriptionPtr* output) { output->reset(); } |
| |
| static const decltype(::chromeos::connectivity::mojom::PasspointSubscription::id)& id( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->id; |
| } |
| |
| static const decltype(::chromeos::connectivity::mojom::PasspointSubscription::domains)& domains( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->domains; |
| } |
| |
| static const decltype(::chromeos::connectivity::mojom::PasspointSubscription::friendly_name)& friendly_name( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->friendly_name; |
| } |
| |
| static const decltype(::chromeos::connectivity::mojom::PasspointSubscription::provisioning_source)& provisioning_source( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->provisioning_source; |
| } |
| |
| static const decltype(::chromeos::connectivity::mojom::PasspointSubscription::trusted_ca)& trusted_ca( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->trusted_ca; |
| } |
| |
| static decltype(::chromeos::connectivity::mojom::PasspointSubscription::expiration_epoch_ms) expiration_epoch_ms( |
| const ::chromeos::connectivity::mojom::PasspointSubscriptionPtr& input) { |
| return input->expiration_epoch_ms; |
| } |
| |
| static bool Read(::chromeos::connectivity::mojom::PasspointSubscription::DataView input, ::chromeos::connectivity::mojom::PasspointSubscriptionPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // CHROMEOS_ASH_SERVICES_CONNECTIVITY_PUBLIC_MOJOM_PASSPOINT_MOJOM_H_ |