| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <lib/fidl/internal.h> |
| #include <lib/fidl/llcpp/array.h> |
| #include <lib/fidl/llcpp/buffer_allocator.h> |
| #include <lib/fidl/llcpp/buffer_then_heap_allocator.h> |
| #include <lib/fidl/llcpp/client.h> |
| #include <lib/fidl/llcpp/coding.h> |
| #include <lib/fidl/llcpp/connect_service.h> |
| #include <lib/fidl/llcpp/envelope.h> |
| #include <lib/fidl/llcpp/errors.h> |
| #include <lib/fidl/llcpp/linearized_and_encoded.h> |
| #include <lib/fidl/llcpp/memory.h> |
| #include <lib/fidl/llcpp/server.h> |
| #include <lib/fidl/llcpp/service_handler_interface.h> |
| #include <lib/fidl/llcpp/string_view.h> |
| #include <lib/fidl/llcpp/sync_call.h> |
| #include <lib/fidl/llcpp/tracking_ptr.h> |
| #include <lib/fidl/llcpp/traits.h> |
| #include <lib/fidl/llcpp/transaction.h> |
| #include <lib/fidl/llcpp/vector_view.h> |
| #include <lib/fidl/txn_header.h> |
| #include <lib/fit/function.h> |
| #include <lib/zx/channel.h> |
| #include <lib/zx/socket.h> |
| #include <zircon/fidl.h> |
| |
| #include <variant> |
| |
| namespace llcpp { |
| |
| namespace test { |
| namespace name { |
| |
| enum class obj_type : uint32_t { |
| NONE = 0u, |
| SOCKET = 14u, |
| }; |
| |
| struct WithErrorSyntax_ResponseAsStruct_Response; |
| class WithErrorSyntax_ResponseAsStruct_Result; |
| struct WithErrorSyntax_ErrorAsPrimitive_Response; |
| class WithErrorSyntax_ErrorAsPrimitive_Result; |
| struct WithErrorSyntax_ErrorAsEnum_Response; |
| class Transitional; |
| class ChannelProtocol; |
| class WithAndWithoutRequestResponse; |
| enum class ErrorEnun : uint32_t { |
| ERR_FOO = 1u, |
| ERR_BAR = 2u, |
| }; |
| |
| class WithErrorSyntax_ErrorAsEnum_Result; |
| class WithErrorSyntax; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntax_ResponseAsStruct_ResultTable; |
| |
| class WithErrorSyntax_ResponseAsStruct_Result { |
| public: |
| WithErrorSyntax_ResponseAsStruct_Result() |
| : ordinal_(Ordinal::Invalid), envelope_{} {} |
| |
| WithErrorSyntax_ResponseAsStruct_Result( |
| WithErrorSyntax_ResponseAsStruct_Result&&) = default; |
| WithErrorSyntax_ResponseAsStruct_Result& operator=( |
| WithErrorSyntax_ResponseAsStruct_Result&&) = default; |
| |
| ~WithErrorSyntax_ResponseAsStruct_Result() { reset_ptr(nullptr); } |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; } |
| |
| bool is_response() const { return ordinal_ == Ordinal::kResponse; } |
| |
| static WithErrorSyntax_ResponseAsStruct_Result WithResponse( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response>&& |
| val) { |
| WithErrorSyntax_ResponseAsStruct_Result result; |
| result.set_response(std::move(val)); |
| return result; |
| } |
| |
| void set_response( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response>&& |
| elem) { |
| ordinal_ = Ordinal::kResponse; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response& |
| mutable_response() { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response*>( |
| envelope_.data.get()); |
| } |
| const ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response& |
| response() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response*>( |
| envelope_.data.get()); |
| } |
| |
| bool is_err() const { return ordinal_ == Ordinal::kErr; } |
| |
| static WithErrorSyntax_ResponseAsStruct_Result WithErr( |
| ::fidl::tracking_ptr<uint32_t>&& val) { |
| WithErrorSyntax_ResponseAsStruct_Result result; |
| result.set_err(std::move(val)); |
| return result; |
| } |
| |
| void set_err(::fidl::tracking_ptr<uint32_t>&& elem) { |
| ordinal_ = Ordinal::kErr; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| uint32_t& mutable_err() { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<uint32_t*>(envelope_.data.get()); |
| } |
| const uint32_t& err() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<uint32_t*>(envelope_.data.get()); |
| } |
| Tag which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<Tag>(ordinal_); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ResponseAsStruct_ResultTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 24; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| |
| private: |
| enum class Ordinal : fidl_xunion_tag_t { |
| Invalid = 0, |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| void reset_ptr(::fidl::tracking_ptr<void>&& new_ptr) { |
| // To clear the existing value, std::move it and let it go out of scope. |
| switch (static_cast<fidl_xunion_tag_t>(ordinal_)) { |
| case 1: { |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response> |
| to_destroy = static_cast<::fidl::tracking_ptr< |
| ::llcpp::test::name:: |
| WithErrorSyntax_ResponseAsStruct_Response>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| case 2: { |
| ::fidl::tracking_ptr<uint32_t> to_destroy = |
| static_cast<::fidl::tracking_ptr<uint32_t>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| } |
| |
| envelope_.data = std::move(new_ptr); |
| } |
| |
| static void SizeAndOffsetAssertionHelper(); |
| Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::Envelope<void> envelope_; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntax_ErrorAsPrimitive_ResultTable; |
| |
| class WithErrorSyntax_ErrorAsPrimitive_Result { |
| public: |
| WithErrorSyntax_ErrorAsPrimitive_Result() |
| : ordinal_(Ordinal::Invalid), envelope_{} {} |
| |
| WithErrorSyntax_ErrorAsPrimitive_Result( |
| WithErrorSyntax_ErrorAsPrimitive_Result&&) = default; |
| WithErrorSyntax_ErrorAsPrimitive_Result& operator=( |
| WithErrorSyntax_ErrorAsPrimitive_Result&&) = default; |
| |
| ~WithErrorSyntax_ErrorAsPrimitive_Result() { reset_ptr(nullptr); } |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; } |
| |
| bool is_response() const { return ordinal_ == Ordinal::kResponse; } |
| |
| static WithErrorSyntax_ErrorAsPrimitive_Result WithResponse( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response>&& |
| val) { |
| WithErrorSyntax_ErrorAsPrimitive_Result result; |
| result.set_response(std::move(val)); |
| return result; |
| } |
| |
| void set_response( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response>&& |
| elem) { |
| ordinal_ = Ordinal::kResponse; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& |
| mutable_response() { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response*>( |
| envelope_.data.get()); |
| } |
| const ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& |
| response() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response*>( |
| envelope_.data.get()); |
| } |
| |
| bool is_err() const { return ordinal_ == Ordinal::kErr; } |
| |
| static WithErrorSyntax_ErrorAsPrimitive_Result WithErr( |
| ::fidl::tracking_ptr<uint32_t>&& val) { |
| WithErrorSyntax_ErrorAsPrimitive_Result result; |
| result.set_err(std::move(val)); |
| return result; |
| } |
| |
| void set_err(::fidl::tracking_ptr<uint32_t>&& elem) { |
| ordinal_ = Ordinal::kErr; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| uint32_t& mutable_err() { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<uint32_t*>(envelope_.data.get()); |
| } |
| const uint32_t& err() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<uint32_t*>(envelope_.data.get()); |
| } |
| Tag which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<Tag>(ordinal_); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ErrorAsPrimitive_ResultTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| |
| private: |
| enum class Ordinal : fidl_xunion_tag_t { |
| Invalid = 0, |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| void reset_ptr(::fidl::tracking_ptr<void>&& new_ptr) { |
| // To clear the existing value, std::move it and let it go out of scope. |
| switch (static_cast<fidl_xunion_tag_t>(ordinal_)) { |
| case 1: { |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response> |
| to_destroy = static_cast<::fidl::tracking_ptr< |
| ::llcpp::test::name:: |
| WithErrorSyntax_ErrorAsPrimitive_Response>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| case 2: { |
| ::fidl::tracking_ptr<uint32_t> to_destroy = |
| static_cast<::fidl::tracking_ptr<uint32_t>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| } |
| |
| envelope_.data = std::move(new_ptr); |
| } |
| |
| static void SizeAndOffsetAssertionHelper(); |
| Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::Envelope<void> envelope_; |
| }; |
| |
| extern "C" const fidl_type_t test_name_WithErrorSyntax_ErrorAsEnum_ResultTable; |
| |
| class WithErrorSyntax_ErrorAsEnum_Result { |
| public: |
| WithErrorSyntax_ErrorAsEnum_Result() |
| : ordinal_(Ordinal::Invalid), envelope_{} {} |
| |
| WithErrorSyntax_ErrorAsEnum_Result(WithErrorSyntax_ErrorAsEnum_Result&&) = |
| default; |
| WithErrorSyntax_ErrorAsEnum_Result& operator=( |
| WithErrorSyntax_ErrorAsEnum_Result&&) = default; |
| |
| ~WithErrorSyntax_ErrorAsEnum_Result() { reset_ptr(nullptr); } |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; } |
| |
| bool is_response() const { return ordinal_ == Ordinal::kResponse; } |
| |
| static WithErrorSyntax_ErrorAsEnum_Result WithResponse( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response>&& val) { |
| WithErrorSyntax_ErrorAsEnum_Result result; |
| result.set_response(std::move(val)); |
| return result; |
| } |
| |
| void set_response( |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response>&& elem) { |
| ordinal_ = Ordinal::kResponse; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response& |
| mutable_response() { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response*>( |
| envelope_.data.get()); |
| } |
| const ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response& response() |
| const { |
| ZX_ASSERT(ordinal_ == Ordinal::kResponse); |
| return *static_cast< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response*>( |
| envelope_.data.get()); |
| } |
| |
| bool is_err() const { return ordinal_ == Ordinal::kErr; } |
| |
| static WithErrorSyntax_ErrorAsEnum_Result WithErr( |
| ::fidl::tracking_ptr<::llcpp::test::name::ErrorEnun>&& val) { |
| WithErrorSyntax_ErrorAsEnum_Result result; |
| result.set_err(std::move(val)); |
| return result; |
| } |
| |
| void set_err(::fidl::tracking_ptr<::llcpp::test::name::ErrorEnun>&& elem) { |
| ordinal_ = Ordinal::kErr; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| ::llcpp::test::name::ErrorEnun& mutable_err() { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<::llcpp::test::name::ErrorEnun*>(envelope_.data.get()); |
| } |
| const ::llcpp::test::name::ErrorEnun& err() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kErr); |
| return *static_cast<::llcpp::test::name::ErrorEnun*>(envelope_.data.get()); |
| } |
| Tag which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<Tag>(ordinal_); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ErrorAsEnum_ResultTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| |
| private: |
| enum class Ordinal : fidl_xunion_tag_t { |
| Invalid = 0, |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| void reset_ptr(::fidl::tracking_ptr<void>&& new_ptr) { |
| // To clear the existing value, std::move it and let it go out of scope. |
| switch (static_cast<fidl_xunion_tag_t>(ordinal_)) { |
| case 1: { |
| ::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response> |
| to_destroy = static_cast<::fidl::tracking_ptr< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| case 2: { |
| ::fidl::tracking_ptr<::llcpp::test::name::ErrorEnun> to_destroy = |
| static_cast<::fidl::tracking_ptr<::llcpp::test::name::ErrorEnun>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| } |
| |
| envelope_.data = std::move(new_ptr); |
| } |
| |
| static void SizeAndOffsetAssertionHelper(); |
| Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::Envelope<void> envelope_; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntax_ResponseAsStruct_ResponseTable; |
| |
| struct WithErrorSyntax_ResponseAsStruct_Response { |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ResponseAsStruct_ResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| |
| int64_t a = {}; |
| |
| int64_t b = {}; |
| |
| int64_t c = {}; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntax_ErrorAsPrimitive_ResponseTable; |
| |
| struct WithErrorSyntax_ErrorAsPrimitive_Response { |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ErrorAsPrimitive_ResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 1; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| |
| uint8_t __reserved = {}; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntax_ErrorAsEnum_ResponseTable; |
| |
| struct WithErrorSyntax_ErrorAsEnum_Response { |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntax_ErrorAsEnum_ResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 1; |
| [[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| |
| uint8_t __reserved = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_name_TransitionalRequestRequestTable; |
| extern "C" const fidl_type_t test_name_TransitionalRequestResponseTable; |
| extern "C" const fidl_type_t test_name_TransitionalOneWayRequestTable; |
| extern "C" const fidl_type_t test_name_TransitionalOneWayResponseTable; |
| extern "C" const fidl_type_t test_name_TransitionalEventRequestTable; |
| extern "C" const fidl_type_t test_name_TransitionalEventEventTable; |
| |
| class Transitional final { |
| Transitional() = delete; |
| |
| public: |
| struct RequestResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t y; |
| explicit RequestResponse(int64_t y) : y(y) { _InitHeader(); } |
| RequestResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_TransitionalRequestResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct RequestRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t x; |
| explicit RequestRequest(zx_txid_t _txid, int64_t x) : x(x) { |
| _InitHeader(_txid); |
| } |
| explicit RequestRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_TransitionalRequestRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = RequestResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct OneWayRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t x; |
| explicit OneWayRequest(zx_txid_t _txid, int64_t x) : x(x) { |
| _InitHeader(_txid); |
| } |
| explicit OneWayRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_TransitionalOneWayRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct EventResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t x; |
| explicit EventResponse(int64_t x) : x(x) { _InitHeader(); } |
| EventResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_TransitionalEventEventTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| |
| struct EventHandlers { |
| fit::callback<zx_status_t(int64_t x)> event; |
| |
| // Fallback handler when an unknown ordinal is received. |
| // Caller may put custom error handling logic here. |
| fit::callback<zx_status_t()> unknown; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class Request_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| Request_Impl(::zx::unowned_channel _client_end, int64_t x); |
| ~Request_Impl() = default; |
| Request_Impl(Request_Impl&& other) = default; |
| Request_Impl& operator=(Request_Impl&& other) = default; |
| Request_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class OneWay_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| OneWay_Impl(::zx::unowned_channel _client_end, int64_t x); |
| ~OneWay_Impl() = default; |
| OneWay_Impl(OneWay_Impl&& other) = default; |
| OneWay_Impl& operator=(OneWay_Impl&& other) = default; |
| OneWay_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| |
| public: |
| using Request = Request_Impl<RequestResponse>; |
| using OneWay = OneWay_Impl; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class Request_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| Request_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, int64_t x, |
| ::fidl::BytePart _response_buffer); |
| ~Request_Impl() = default; |
| Request_Impl(Request_Impl&& other) = default; |
| Request_Impl& operator=(Request_Impl&& other) = default; |
| Request_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class OneWay_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| OneWay_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, int64_t x); |
| ~OneWay_Impl() = default; |
| OneWay_Impl(OneWay_Impl&& other) = default; |
| OneWay_Impl& operator=(OneWay_Impl&& other) = default; |
| OneWay_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| |
| public: |
| using Request = Request_Impl<RequestResponse>; |
| using OneWay = OneWay_Impl; |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Allocates 48 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::Request Request(int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::Request Request(::fidl::BytePart _request_buffer, |
| int64_t x, |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::OneWay OneWay(int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::OneWay OneWay(::fidl::BytePart _request_buffer, int64_t x); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| zx_status_t HandleEvents(EventHandlers handlers); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 48 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::Request Request(::zx::unowned_channel _client_end, |
| int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::Request Request(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| int64_t x, |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::OneWay OneWay(::zx::unowned_channel _client_end, |
| int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::OneWay OneWay(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| int64_t x); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| static zx_status_t HandleEvents(::zx::unowned_channel client_end, |
| EventHandlers handlers); |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| static ::fidl::DecodeResult<RequestResponse> Request( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<RequestRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<RequestResponse> Request( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<RequestRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::internal::StatusAndError OneWay( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<OneWayRequest> params); |
| |
| static ::fidl::internal::StatusAndError OneWay( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<OneWayRequest> params); |
| }; |
| |
| struct AsyncEventHandlers; |
| class RequestResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = Transitional; |
| using _Base = ::fidl::CompleterBase; |
| |
| class RequestCompleterBase : public _Base { |
| public: |
| void Reply(int64_t y); |
| void Reply(::fidl::BytePart _buffer, int64_t y); |
| void Reply(::fidl::DecodedMessage<RequestResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using RequestCompleter = ::fidl::Completer<RequestCompleterBase>; |
| |
| virtual void Request(int64_t x, RequestCompleter::Sync _completer) { |
| _completer.Close(ZX_ERR_NOT_SUPPORTED); |
| } |
| |
| using OneWayCompleter = ::fidl::Completer<>; |
| |
| virtual void OneWay(int64_t x, OneWayCompleter::Sync _completer) { |
| _completer.Close(ZX_ERR_NOT_SUPPORTED); |
| } |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the |
| // server implementation. If there is no matching handler, it returns false, |
| // leaving the message and transaction intact. In all other cases, it consumes |
| // the message and returns true. It is possible to chain multiple TryDispatch |
| // functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the |
| // protocol. If there is no matching handler, it closes all the handles in |
| // |msg| and closes the channel with a |ZX_ERR_NOT_SUPPORTED| epitaph, before |
| // returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used |
| // with |fidl::Bind| to reduce template expansion. Do not call this method |
| // manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| static zx_status_t SendEventEvent(::zx::unowned_channel _chan, int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via response buffers. |
| static zx_status_t SendEventEvent(::zx::unowned_channel _chan, |
| ::fidl::BytePart _buffer, int64_t x); |
| |
| // Messages are encoded in-place. |
| static zx_status_t SendEventEvent( |
| ::zx::unowned_channel _chan, |
| ::fidl::DecodedMessage<EventResponse> params); |
| |
| class EventSender; |
| }; |
| |
| extern "C" const fidl_type_t test_name_ChannelProtocolMethodARequestTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolMethodAResponseTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolEventARequestTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolEventAEventTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolMethodBRequestTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolMethodBResponseTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolMutateSocketRequestTable; |
| extern "C" const fidl_type_t test_name_ChannelProtocolMutateSocketResponseTable; |
| |
| class ChannelProtocol final { |
| ChannelProtocol() = delete; |
| |
| public: |
| struct MethodARequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t a; |
| int64_t b; |
| explicit MethodARequest(zx_txid_t _txid, int64_t a, int64_t b) |
| : a(a), b(b) { |
| _InitHeader(_txid); |
| } |
| explicit MethodARequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolMethodARequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct EventAResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t a; |
| int64_t b; |
| explicit EventAResponse(int64_t a, int64_t b) : a(a), b(b) { |
| _InitHeader(); |
| } |
| EventAResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolEventAEventTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct MethodBResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t result; |
| explicit MethodBResponse(int64_t result) : result(result) { _InitHeader(); } |
| MethodBResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolMethodBResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct MethodBRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t a; |
| int64_t b; |
| explicit MethodBRequest(zx_txid_t _txid, int64_t a, int64_t b) |
| : a(a), b(b) { |
| _InitHeader(_txid); |
| } |
| explicit MethodBRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolMethodBRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = MethodBResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct MutateSocketResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::socket b; |
| explicit MutateSocketResponse(::zx::socket& b) : b(std::move(b)) { |
| _InitHeader(); |
| } |
| MutateSocketResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolMutateSocketResponseTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct MutateSocketRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::socket a; |
| explicit MutateSocketRequest(zx_txid_t _txid, ::zx::socket& a) |
| : a(std::move(a)) { |
| _InitHeader(_txid); |
| } |
| explicit MutateSocketRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ChannelProtocolMutateSocketRequestTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = MutateSocketResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct EventHandlers { |
| fit::callback<zx_status_t(int64_t a, int64_t b)> event_a; |
| |
| // Fallback handler when an unknown ordinal is received. |
| // Caller may put custom error handling logic here. |
| fit::callback<zx_status_t()> unknown; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| class MethodA_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| MethodA_Impl(::zx::unowned_channel _client_end, int64_t a, int64_t b); |
| ~MethodA_Impl() = default; |
| MethodA_Impl(MethodA_Impl&& other) = default; |
| MethodA_Impl& operator=(MethodA_Impl&& other) = default; |
| MethodA_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class MethodB_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| MethodB_Impl(::zx::unowned_channel _client_end, int64_t a, int64_t b); |
| ~MethodB_Impl() = default; |
| MethodB_Impl(MethodB_Impl&& other) = default; |
| MethodB_Impl& operator=(MethodB_Impl&& other) = default; |
| MethodB_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class MutateSocket_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| MutateSocket_Impl(::zx::unowned_channel _client_end, ::zx::socket& a); |
| ~MutateSocket_Impl() = default; |
| MutateSocket_Impl(MutateSocket_Impl&& other) = default; |
| MutateSocket_Impl& operator=(MutateSocket_Impl&& other) = default; |
| MutateSocket_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using MethodA = MethodA_Impl; |
| using MethodB = MethodB_Impl<MethodBResponse>; |
| using MutateSocket = MutateSocket_Impl<MutateSocketResponse>; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| class MethodA_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| MethodA_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, int64_t a, int64_t b); |
| ~MethodA_Impl() = default; |
| MethodA_Impl(MethodA_Impl&& other) = default; |
| MethodA_Impl& operator=(MethodA_Impl&& other) = default; |
| MethodA_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class MethodB_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| MethodB_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, int64_t a, int64_t b, |
| ::fidl::BytePart _response_buffer); |
| ~MethodB_Impl() = default; |
| MethodB_Impl(MethodB_Impl&& other) = default; |
| MethodB_Impl& operator=(MethodB_Impl&& other) = default; |
| MethodB_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class MutateSocket_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| MutateSocket_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, ::zx::socket a, |
| ::fidl::BytePart _response_buffer); |
| ~MutateSocket_Impl() = default; |
| MutateSocket_Impl(MutateSocket_Impl&& other) = default; |
| MutateSocket_Impl& operator=(MutateSocket_Impl&& other) = default; |
| MutateSocket_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using MethodA = MethodA_Impl; |
| using MethodB = MethodB_Impl<MethodBResponse>; |
| using MutateSocket = MutateSocket_Impl<MutateSocketResponse>; |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Allocates 32 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::MethodA MethodA(int64_t a, int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::MethodA MethodA(::fidl::BytePart _request_buffer, |
| int64_t a, int64_t b); |
| |
| // Allocates 56 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::MethodB MethodB(int64_t a, int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::MethodB MethodB(::fidl::BytePart _request_buffer, |
| int64_t a, int64_t b, |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 48 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::MutateSocket MutateSocket(::zx::socket a); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::MutateSocket MutateSocket( |
| ::fidl::BytePart _request_buffer, ::zx::socket a, |
| ::fidl::BytePart _response_buffer); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| zx_status_t HandleEvents(EventHandlers handlers); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 32 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::MethodA MethodA(::zx::unowned_channel _client_end, |
| int64_t a, int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::MethodA MethodA(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| int64_t a, int64_t b); |
| |
| // Allocates 56 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::MethodB MethodB(::zx::unowned_channel _client_end, |
| int64_t a, int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::MethodB MethodB(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| int64_t a, int64_t b, |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 48 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::MutateSocket MutateSocket( |
| ::zx::unowned_channel _client_end, ::zx::socket a); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::MutateSocket MutateSocket( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::zx::socket a, ::fidl::BytePart _response_buffer); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| static zx_status_t HandleEvents(::zx::unowned_channel client_end, |
| EventHandlers handlers); |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| static ::fidl::internal::StatusAndError MethodA( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<MethodARequest> params); |
| |
| static ::fidl::internal::StatusAndError MethodA( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<MethodARequest> params); |
| |
| static ::fidl::DecodeResult<MethodBResponse> MethodB( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<MethodBRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<MethodBResponse> MethodB( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<MethodBRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<MutateSocketResponse> MutateSocket( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<MutateSocketRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<MutateSocketResponse> MutateSocket( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<MutateSocketRequest> params, |
| ::fidl::BytePart response_buffer); |
| }; |
| |
| struct AsyncEventHandlers; |
| class MethodBResponseContext; |
| class MutateSocketResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = ChannelProtocol; |
| using _Base = ::fidl::CompleterBase; |
| |
| using MethodACompleter = ::fidl::Completer<>; |
| |
| virtual void MethodA(int64_t a, int64_t b, |
| MethodACompleter::Sync _completer) = 0; |
| |
| class MethodBCompleterBase : public _Base { |
| public: |
| void Reply(int64_t result); |
| void Reply(::fidl::BytePart _buffer, int64_t result); |
| void Reply(::fidl::DecodedMessage<MethodBResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using MethodBCompleter = ::fidl::Completer<MethodBCompleterBase>; |
| |
| virtual void MethodB(int64_t a, int64_t b, |
| MethodBCompleter::Sync _completer) = 0; |
| |
| class MutateSocketCompleterBase : public _Base { |
| public: |
| void Reply(::zx::socket b); |
| void Reply(::fidl::BytePart _buffer, ::zx::socket b); |
| void Reply(::fidl::DecodedMessage<MutateSocketResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using MutateSocketCompleter = ::fidl::Completer<MutateSocketCompleterBase>; |
| |
| virtual void MutateSocket(::zx::socket a, |
| MutateSocketCompleter::Sync _completer) = 0; |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the |
| // server implementation. If there is no matching handler, it returns false, |
| // leaving the message and transaction intact. In all other cases, it consumes |
| // the message and returns true. It is possible to chain multiple TryDispatch |
| // functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the |
| // protocol. If there is no matching handler, it closes all the handles in |
| // |msg| and closes the channel with a |ZX_ERR_NOT_SUPPORTED| epitaph, before |
| // returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used |
| // with |fidl::Bind| to reduce template expansion. Do not call this method |
| // manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| static zx_status_t SendEventAEvent(::zx::unowned_channel _chan, int64_t a, |
| int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via response buffers. |
| static zx_status_t SendEventAEvent(::zx::unowned_channel _chan, |
| ::fidl::BytePart _buffer, int64_t a, |
| int64_t b); |
| |
| // Messages are encoded in-place. |
| static zx_status_t SendEventAEvent( |
| ::zx::unowned_channel _chan, |
| ::fidl::DecodedMessage<EventAResponse> params); |
| |
| class EventSender; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestNoResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestNoResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestEmptyResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestEmptyResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestWithResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseNoRequestWithResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestNoResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestNoResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestEmptyResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestEmptyResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestWithResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseWithRequestWithResponseResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseOnEmptyResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseOnEmptyResponseEventTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseOnWithResponseRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithAndWithoutRequestResponseOnWithResponseEventTable; |
| |
| class WithAndWithoutRequestResponse final { |
| WithAndWithoutRequestResponse() = delete; |
| |
| public: |
| struct NoRequestNoResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit NoRequestNoResponseRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct NoRequestEmptyResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| NoRequestEmptyResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct NoRequestEmptyResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit NoRequestEmptyResponseRequest(zx_txid_t _txid) { |
| _InitHeader(_txid); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct NoRequestWithResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView ret; |
| explicit NoRequestWithResponseResponse(const ::fidl::StringView& ret) |
| : ret(::fidl::unowned_ptr_t<const char>(ret.data()), ret.size()) { |
| _InitHeader(); |
| } |
| NoRequestWithResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseNoRequestWithResponseResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct NoRequestWithResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit NoRequestWithResponseRequest(zx_txid_t _txid) { |
| _InitHeader(_txid); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = NoRequestWithResponseResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct WithRequestNoResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView arg; |
| explicit WithRequestNoResponseRequest(zx_txid_t _txid, |
| const ::fidl::StringView& arg) |
| : arg(::fidl::unowned_ptr_t<const char>(arg.data()), arg.size()) { |
| _InitHeader(_txid); |
| } |
| explicit WithRequestNoResponseRequest(zx_txid_t _txid) { |
| _InitHeader(_txid); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseWithRequestNoResponseRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct WithRequestEmptyResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| WithRequestEmptyResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct WithRequestEmptyResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView arg; |
| explicit WithRequestEmptyResponseRequest(zx_txid_t _txid, |
| const ::fidl::StringView& arg) |
| : arg(::fidl::unowned_ptr_t<const char>(arg.data()), arg.size()) { |
| _InitHeader(_txid); |
| } |
| explicit WithRequestEmptyResponseRequest(zx_txid_t _txid) { |
| _InitHeader(_txid); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseWithRequestEmptyResponseRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct WithRequestWithResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView ret; |
| explicit WithRequestWithResponseResponse(const ::fidl::StringView& ret) |
| : ret(::fidl::unowned_ptr_t<const char>(ret.data()), ret.size()) { |
| _InitHeader(); |
| } |
| WithRequestWithResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseWithRequestWithResponseResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct WithRequestWithResponseRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView arg; |
| explicit WithRequestWithResponseRequest(zx_txid_t _txid, |
| const ::fidl::StringView& arg) |
| : arg(::fidl::unowned_ptr_t<const char>(arg.data()), arg.size()) { |
| _InitHeader(_txid); |
| } |
| explicit WithRequestWithResponseRequest(zx_txid_t _txid) { |
| _InitHeader(_txid); |
| } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseWithRequestWithResponseRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = WithRequestWithResponseResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct OnEmptyResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| OnEmptyResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct OnWithResponseResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView ret; |
| explicit OnWithResponseResponse(const ::fidl::StringView& ret) |
| : ret(::fidl::unowned_ptr_t<const char>(ret.data()), ret.size()) { |
| _InitHeader(); |
| } |
| OnWithResponseResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithAndWithoutRequestResponseOnWithResponseEventTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| |
| struct EventHandlers { |
| fit::callback<zx_status_t()> on_empty_response; |
| |
| fit::callback<zx_status_t(::fidl::StringView ret)> on_with_response; |
| |
| // Fallback handler when an unknown ordinal is received. |
| // Caller may put custom error handling logic here. |
| fit::callback<zx_status_t()> unknown; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| class NoRequestNoResponse_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| NoRequestNoResponse_Impl(::zx::unowned_channel _client_end); |
| ~NoRequestNoResponse_Impl() = default; |
| NoRequestNoResponse_Impl(NoRequestNoResponse_Impl&& other) = default; |
| NoRequestNoResponse_Impl& operator=(NoRequestNoResponse_Impl&& other) = |
| default; |
| NoRequestNoResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class NoRequestEmptyResponse_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| NoRequestEmptyResponse_Impl(::zx::unowned_channel _client_end); |
| ~NoRequestEmptyResponse_Impl() = default; |
| NoRequestEmptyResponse_Impl(NoRequestEmptyResponse_Impl&& other) = |
| default; |
| NoRequestEmptyResponse_Impl& operator=( |
| NoRequestEmptyResponse_Impl&& other) = default; |
| NoRequestEmptyResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class NoRequestWithResponse_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| NoRequestWithResponse_Impl(::zx::unowned_channel _client_end); |
| ~NoRequestWithResponse_Impl() = default; |
| NoRequestWithResponse_Impl(NoRequestWithResponse_Impl&& other) = default; |
| NoRequestWithResponse_Impl& operator=( |
| NoRequestWithResponse_Impl&& other) = default; |
| NoRequestWithResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class WithRequestNoResponse_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| WithRequestNoResponse_Impl(::zx::unowned_channel _client_end, |
| const ::fidl::StringView& arg); |
| ~WithRequestNoResponse_Impl() = default; |
| WithRequestNoResponse_Impl(WithRequestNoResponse_Impl&& other) = default; |
| WithRequestNoResponse_Impl& operator=( |
| WithRequestNoResponse_Impl&& other) = default; |
| WithRequestNoResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class WithRequestEmptyResponse_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| WithRequestEmptyResponse_Impl(::zx::unowned_channel _client_end, |
| const ::fidl::StringView& arg); |
| ~WithRequestEmptyResponse_Impl() = default; |
| WithRequestEmptyResponse_Impl(WithRequestEmptyResponse_Impl&& other) = |
| default; |
| WithRequestEmptyResponse_Impl& operator=( |
| WithRequestEmptyResponse_Impl&& other) = default; |
| WithRequestEmptyResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class WithRequestWithResponse_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| WithRequestWithResponse_Impl(::zx::unowned_channel _client_end, |
| const ::fidl::StringView& arg); |
| ~WithRequestWithResponse_Impl() = default; |
| WithRequestWithResponse_Impl(WithRequestWithResponse_Impl&& other) = |
| default; |
| WithRequestWithResponse_Impl& operator=( |
| WithRequestWithResponse_Impl&& other) = default; |
| WithRequestWithResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using NoRequestNoResponse = NoRequestNoResponse_Impl; |
| using NoRequestEmptyResponse = |
| NoRequestEmptyResponse_Impl<NoRequestEmptyResponseResponse>; |
| using NoRequestWithResponse = |
| NoRequestWithResponse_Impl<NoRequestWithResponseResponse>; |
| using WithRequestNoResponse = WithRequestNoResponse_Impl; |
| using WithRequestEmptyResponse = |
| WithRequestEmptyResponse_Impl<WithRequestEmptyResponseResponse>; |
| using WithRequestWithResponse = |
| WithRequestWithResponse_Impl<WithRequestWithResponseResponse>; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| class NoRequestNoResponse_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| NoRequestNoResponse_Impl(::zx::unowned_channel _client_end); |
| ~NoRequestNoResponse_Impl() = default; |
| NoRequestNoResponse_Impl(NoRequestNoResponse_Impl&& other) = default; |
| NoRequestNoResponse_Impl& operator=(NoRequestNoResponse_Impl&& other) = |
| default; |
| NoRequestNoResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class NoRequestEmptyResponse_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| NoRequestEmptyResponse_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~NoRequestEmptyResponse_Impl() = default; |
| NoRequestEmptyResponse_Impl(NoRequestEmptyResponse_Impl&& other) = |
| default; |
| NoRequestEmptyResponse_Impl& operator=( |
| NoRequestEmptyResponse_Impl&& other) = default; |
| NoRequestEmptyResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class NoRequestWithResponse_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| NoRequestWithResponse_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~NoRequestWithResponse_Impl() = default; |
| NoRequestWithResponse_Impl(NoRequestWithResponse_Impl&& other) = default; |
| NoRequestWithResponse_Impl& operator=( |
| NoRequestWithResponse_Impl&& other) = default; |
| NoRequestWithResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class WithRequestNoResponse_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| WithRequestNoResponse_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg); |
| ~WithRequestNoResponse_Impl() = default; |
| WithRequestNoResponse_Impl(WithRequestNoResponse_Impl&& other) = default; |
| WithRequestNoResponse_Impl& operator=( |
| WithRequestNoResponse_Impl&& other) = default; |
| WithRequestNoResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| template <typename ResponseType> |
| class WithRequestEmptyResponse_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| WithRequestEmptyResponse_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| ~WithRequestEmptyResponse_Impl() = default; |
| WithRequestEmptyResponse_Impl(WithRequestEmptyResponse_Impl&& other) = |
| default; |
| WithRequestEmptyResponse_Impl& operator=( |
| WithRequestEmptyResponse_Impl&& other) = default; |
| WithRequestEmptyResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class WithRequestWithResponse_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| WithRequestWithResponse_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| ~WithRequestWithResponse_Impl() = default; |
| WithRequestWithResponse_Impl(WithRequestWithResponse_Impl&& other) = |
| default; |
| WithRequestWithResponse_Impl& operator=( |
| WithRequestWithResponse_Impl&& other) = default; |
| WithRequestWithResponse_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using NoRequestNoResponse = NoRequestNoResponse_Impl; |
| using NoRequestEmptyResponse = |
| NoRequestEmptyResponse_Impl<NoRequestEmptyResponseResponse>; |
| using NoRequestWithResponse = |
| NoRequestWithResponse_Impl<NoRequestWithResponseResponse>; |
| using WithRequestNoResponse = WithRequestNoResponse_Impl; |
| using WithRequestEmptyResponse = |
| WithRequestEmptyResponse_Impl<WithRequestEmptyResponseResponse>; |
| using WithRequestWithResponse = |
| WithRequestWithResponse_Impl<WithRequestWithResponseResponse>; |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Allocates 16 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::NoRequestNoResponse NoRequestNoResponse(); |
| |
| // Allocates 32 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::NoRequestEmptyResponse NoRequestEmptyResponse(); |
| |
| // Allocates 16 bytes of request buffer on the stack. Response is |
| // heap-allocated. |
| ResultOf::NoRequestWithResponse NoRequestWithResponse(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::NoRequestWithResponse NoRequestWithResponse( |
| ::fidl::BytePart _response_buffer); |
| |
| // Request is heap-allocated. |
| ResultOf::WithRequestNoResponse WithRequestNoResponse( |
| ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::WithRequestNoResponse WithRequestNoResponse( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg); |
| |
| // Allocates 16 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| ResultOf::WithRequestEmptyResponse WithRequestEmptyResponse( |
| ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::WithRequestEmptyResponse WithRequestEmptyResponse( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| |
| // Request is heap-allocated. Response is heap-allocated. |
| ResultOf::WithRequestWithResponse WithRequestWithResponse( |
| ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::WithRequestWithResponse WithRequestWithResponse( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| zx_status_t HandleEvents(EventHandlers handlers); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 16 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::NoRequestNoResponse NoRequestNoResponse( |
| ::zx::unowned_channel _client_end); |
| |
| // Allocates 32 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::NoRequestEmptyResponse NoRequestEmptyResponse( |
| ::zx::unowned_channel _client_end); |
| |
| // Allocates 16 bytes of request buffer on the stack. Response is |
| // heap-allocated. |
| static ResultOf::NoRequestWithResponse NoRequestWithResponse( |
| ::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::NoRequestWithResponse NoRequestWithResponse( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Request is heap-allocated. |
| static ResultOf::WithRequestNoResponse WithRequestNoResponse( |
| ::zx::unowned_channel _client_end, ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::WithRequestNoResponse WithRequestNoResponse( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg); |
| |
| // Allocates 16 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| static ResultOf::WithRequestEmptyResponse WithRequestEmptyResponse( |
| ::zx::unowned_channel _client_end, ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::WithRequestEmptyResponse WithRequestEmptyResponse( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg, ::fidl::BytePart _response_buffer); |
| |
| // Request is heap-allocated. Response is heap-allocated. |
| static ResultOf::WithRequestWithResponse WithRequestWithResponse( |
| ::zx::unowned_channel _client_end, ::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::WithRequestWithResponse WithRequestWithResponse( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg, ::fidl::BytePart _response_buffer); |
| |
| // Handle all possible events defined in this protocol. |
| // Blocks to consume exactly one message from the channel, then call the |
| // corresponding handler defined in |EventHandlers|. The return status of |
| // the handler function is folded with any transport-level errors and |
| // returned. |
| static zx_status_t HandleEvents(::zx::unowned_channel client_end, |
| EventHandlers handlers); |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| static ::fidl::internal::StatusAndError NoRequestNoResponse( |
| ::zx::unowned_channel _client_end); |
| |
| static ::fidl::DecodeResult<NoRequestEmptyResponseResponse> |
| NoRequestEmptyResponse(::zx::unowned_channel _client_end, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<NoRequestWithResponseResponse> |
| NoRequestWithResponse(::zx::unowned_channel _client_end, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::internal::StatusAndError WithRequestNoResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<WithRequestNoResponseRequest> params); |
| |
| static ::fidl::internal::StatusAndError WithRequestNoResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<WithRequestNoResponseRequest> params); |
| |
| static ::fidl::DecodeResult<WithRequestEmptyResponseResponse> |
| WithRequestEmptyResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<WithRequestEmptyResponseRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<WithRequestEmptyResponseResponse> |
| WithRequestEmptyResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<WithRequestEmptyResponseRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<WithRequestWithResponseResponse> |
| WithRequestWithResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<WithRequestWithResponseRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<WithRequestWithResponseResponse> |
| WithRequestWithResponse( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<WithRequestWithResponseRequest> params, |
| ::fidl::BytePart response_buffer); |
| }; |
| |
| struct AsyncEventHandlers; |
| class NoRequestEmptyResponseResponseContext; |
| class NoRequestWithResponseResponseContext; |
| class WithRequestEmptyResponseResponseContext; |
| class WithRequestWithResponseResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = WithAndWithoutRequestResponse; |
| using _Base = ::fidl::CompleterBase; |
| |
| using NoRequestNoResponseCompleter = ::fidl::Completer<>; |
| |
| virtual void NoRequestNoResponse( |
| NoRequestNoResponseCompleter::Sync _completer) = 0; |
| |
| class NoRequestEmptyResponseCompleterBase : public _Base { |
| public: |
| void Reply(); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using NoRequestEmptyResponseCompleter = |
| ::fidl::Completer<NoRequestEmptyResponseCompleterBase>; |
| |
| virtual void NoRequestEmptyResponse( |
| NoRequestEmptyResponseCompleter::Sync _completer) = 0; |
| |
| class NoRequestWithResponseCompleterBase : public _Base { |
| public: |
| void Reply(::fidl::StringView ret); |
| void Reply(::fidl::BytePart _buffer, ::fidl::StringView ret); |
| void Reply(::fidl::DecodedMessage<NoRequestWithResponseResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using NoRequestWithResponseCompleter = |
| ::fidl::Completer<NoRequestWithResponseCompleterBase>; |
| |
| virtual void NoRequestWithResponse( |
| NoRequestWithResponseCompleter::Sync _completer) = 0; |
| |
| using WithRequestNoResponseCompleter = ::fidl::Completer<>; |
| |
| virtual void WithRequestNoResponse( |
| ::fidl::StringView arg, |
| WithRequestNoResponseCompleter::Sync _completer) = 0; |
| |
| class WithRequestEmptyResponseCompleterBase : public _Base { |
| public: |
| void Reply(); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using WithRequestEmptyResponseCompleter = |
| ::fidl::Completer<WithRequestEmptyResponseCompleterBase>; |
| |
| virtual void WithRequestEmptyResponse( |
| ::fidl::StringView arg, |
| WithRequestEmptyResponseCompleter::Sync _completer) = 0; |
| |
| class WithRequestWithResponseCompleterBase : public _Base { |
| public: |
| void Reply(::fidl::StringView ret); |
| void Reply(::fidl::BytePart _buffer, ::fidl::StringView ret); |
| void Reply( |
| ::fidl::DecodedMessage<WithRequestWithResponseResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using WithRequestWithResponseCompleter = |
| ::fidl::Completer<WithRequestWithResponseCompleterBase>; |
| |
| virtual void WithRequestWithResponse( |
| ::fidl::StringView arg, |
| WithRequestWithResponseCompleter::Sync _completer) = 0; |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the |
| // server implementation. If there is no matching handler, it returns false, |
| // leaving the message and transaction intact. In all other cases, it consumes |
| // the message and returns true. It is possible to chain multiple TryDispatch |
| // functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the |
| // protocol. If there is no matching handler, it closes all the handles in |
| // |msg| and closes the channel with a |ZX_ERR_NOT_SUPPORTED| epitaph, before |
| // returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used |
| // with |fidl::Bind| to reduce template expansion. Do not call this method |
| // manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| static zx_status_t SendOnEmptyResponseEvent(::zx::unowned_channel _chan); |
| |
| static zx_status_t SendOnWithResponseEvent(::zx::unowned_channel _chan, |
| ::fidl::StringView ret); |
| |
| // Caller provides the backing storage for FIDL message via response buffers. |
| static zx_status_t SendOnWithResponseEvent(::zx::unowned_channel _chan, |
| ::fidl::BytePart _buffer, |
| ::fidl::StringView ret); |
| |
| // Messages are encoded in-place. |
| static zx_status_t SendOnWithResponseEvent( |
| ::zx::unowned_channel _chan, |
| ::fidl::DecodedMessage<OnWithResponseResponse> params); |
| |
| class EventSender; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntaxResponseAsStructRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntaxResponseAsStructResponseTable; |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntaxErrorAsPrimitiveRequestTable; |
| extern "C" const fidl_type_t |
| test_name_WithErrorSyntaxErrorAsPrimitiveResponseTable; |
| extern "C" const fidl_type_t test_name_WithErrorSyntaxErrorAsEnumRequestTable; |
| extern "C" const fidl_type_t test_name_WithErrorSyntaxErrorAsEnumResponseTable; |
| |
| class WithErrorSyntax final { |
| WithErrorSyntax() = delete; |
| |
| public: |
| struct ResponseAsStructResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result result; |
| explicit ResponseAsStructResponse( |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result& result) |
| : result(std::move(result)) { |
| _InitHeader(); |
| } |
| ResponseAsStructResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntaxResponseAsStructResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 40; |
| static constexpr uint32_t MaxOutOfLine = 24; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct ResponseAsStructRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit ResponseAsStructRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = ResponseAsStructResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct ErrorAsPrimitiveResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result result; |
| explicit ErrorAsPrimitiveResponse( |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result& result) |
| : result(std::move(result)) { |
| _InitHeader(); |
| } |
| ErrorAsPrimitiveResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntaxErrorAsPrimitiveResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 40; |
| static constexpr uint32_t MaxOutOfLine = 8; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct ErrorAsPrimitiveRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit ErrorAsPrimitiveRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = ErrorAsPrimitiveResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct ErrorAsEnumResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result result; |
| explicit ErrorAsEnumResponse( |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result& result) |
| : result(std::move(result)) { |
| _InitHeader(); |
| } |
| ErrorAsEnumResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_WithErrorSyntaxErrorAsEnumResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 40; |
| static constexpr uint32_t MaxOutOfLine = 8; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct ErrorAsEnumRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit ErrorAsEnumRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = ErrorAsEnumResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class ResponseAsStruct_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| ResponseAsStruct_Impl(::zx::unowned_channel _client_end); |
| ~ResponseAsStruct_Impl() = default; |
| ResponseAsStruct_Impl(ResponseAsStruct_Impl&& other) = default; |
| ResponseAsStruct_Impl& operator=(ResponseAsStruct_Impl&& other) = default; |
| ResponseAsStruct_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class ErrorAsPrimitive_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| ErrorAsPrimitive_Impl(::zx::unowned_channel _client_end); |
| ~ErrorAsPrimitive_Impl() = default; |
| ErrorAsPrimitive_Impl(ErrorAsPrimitive_Impl&& other) = default; |
| ErrorAsPrimitive_Impl& operator=(ErrorAsPrimitive_Impl&& other) = default; |
| ErrorAsPrimitive_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class ErrorAsEnum_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| ErrorAsEnum_Impl(::zx::unowned_channel _client_end); |
| ~ErrorAsEnum_Impl() = default; |
| ErrorAsEnum_Impl(ErrorAsEnum_Impl&& other) = default; |
| ErrorAsEnum_Impl& operator=(ErrorAsEnum_Impl&& other) = default; |
| ErrorAsEnum_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using ResponseAsStruct = ResponseAsStruct_Impl<ResponseAsStructResponse>; |
| using ErrorAsPrimitive = ErrorAsPrimitive_Impl<ErrorAsPrimitiveResponse>; |
| using ErrorAsEnum = ErrorAsEnum_Impl<ErrorAsEnumResponse>; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class ResponseAsStruct_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| ResponseAsStruct_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~ResponseAsStruct_Impl() = default; |
| ResponseAsStruct_Impl(ResponseAsStruct_Impl&& other) = default; |
| ResponseAsStruct_Impl& operator=(ResponseAsStruct_Impl&& other) = default; |
| ResponseAsStruct_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class ErrorAsPrimitive_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| ErrorAsPrimitive_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~ErrorAsPrimitive_Impl() = default; |
| ErrorAsPrimitive_Impl(ErrorAsPrimitive_Impl&& other) = default; |
| ErrorAsPrimitive_Impl& operator=(ErrorAsPrimitive_Impl&& other) = default; |
| ErrorAsPrimitive_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class ErrorAsEnum_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| ErrorAsEnum_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~ErrorAsEnum_Impl() = default; |
| ErrorAsEnum_Impl(ErrorAsEnum_Impl&& other) = default; |
| ErrorAsEnum_Impl& operator=(ErrorAsEnum_Impl&& other) = default; |
| ErrorAsEnum_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using ResponseAsStruct = ResponseAsStruct_Impl<ResponseAsStructResponse>; |
| using ErrorAsPrimitive = ErrorAsPrimitive_Impl<ErrorAsPrimitiveResponse>; |
| using ErrorAsEnum = ErrorAsEnum_Impl<ErrorAsEnumResponse>; |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Allocates 80 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::ResponseAsStruct ResponseAsStruct(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::ResponseAsStruct ResponseAsStruct( |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 64 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::ErrorAsPrimitive ErrorAsPrimitive(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::ErrorAsPrimitive ErrorAsPrimitive( |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 64 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::ErrorAsEnum ErrorAsEnum(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::ErrorAsEnum ErrorAsEnum(::fidl::BytePart _response_buffer); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 80 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::ResponseAsStruct ResponseAsStruct( |
| ::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::ResponseAsStruct ResponseAsStruct( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Allocates 64 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::ErrorAsPrimitive ErrorAsPrimitive( |
| ::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::ErrorAsPrimitive ErrorAsPrimitive( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Allocates 64 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::ErrorAsEnum ErrorAsEnum(::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::ErrorAsEnum ErrorAsEnum( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| static ::fidl::DecodeResult<ResponseAsStructResponse> ResponseAsStruct( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<ErrorAsPrimitiveResponse> ErrorAsPrimitive( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<ErrorAsEnumResponse> ErrorAsEnum( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| }; |
| |
| struct AsyncEventHandlers; |
| class ResponseAsStructResponseContext; |
| class ErrorAsPrimitiveResponseContext; |
| class ErrorAsEnumResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = WithErrorSyntax; |
| using _Base = ::fidl::CompleterBase; |
| |
| class ResponseAsStructCompleterBase : public _Base { |
| public: |
| void Reply( |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result result); |
| void ReplySuccess(int64_t a, int64_t b, int64_t c); |
| void ReplyError(uint32_t error); |
| void Reply( |
| ::fidl::BytePart _buffer, |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result result); |
| void ReplySuccess(::fidl::BytePart _buffer, int64_t a, int64_t b, |
| int64_t c); |
| void Reply(::fidl::DecodedMessage<ResponseAsStructResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using ResponseAsStructCompleter = |
| ::fidl::Completer<ResponseAsStructCompleterBase>; |
| |
| virtual void ResponseAsStruct( |
| ResponseAsStructCompleter::Sync _completer) = 0; |
| |
| class ErrorAsPrimitiveCompleterBase : public _Base { |
| public: |
| void Reply( |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result result); |
| void ReplySuccess(); |
| void ReplyError(uint32_t error); |
| void Reply( |
| ::fidl::BytePart _buffer, |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result result); |
| void ReplySuccess(::fidl::BytePart _buffer); |
| void Reply(::fidl::DecodedMessage<ErrorAsPrimitiveResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using ErrorAsPrimitiveCompleter = |
| ::fidl::Completer<ErrorAsPrimitiveCompleterBase>; |
| |
| virtual void ErrorAsPrimitive( |
| ErrorAsPrimitiveCompleter::Sync _completer) = 0; |
| |
| class ErrorAsEnumCompleterBase : public _Base { |
| public: |
| void Reply( |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result result); |
| void ReplySuccess(); |
| void ReplyError(ErrorEnun error); |
| void Reply( |
| ::fidl::BytePart _buffer, |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result result); |
| void ReplySuccess(::fidl::BytePart _buffer); |
| void Reply(::fidl::DecodedMessage<ErrorAsEnumResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using ErrorAsEnumCompleter = ::fidl::Completer<ErrorAsEnumCompleterBase>; |
| |
| virtual void ErrorAsEnum(ErrorAsEnumCompleter::Sync _completer) = 0; |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the |
| // server implementation. If there is no matching handler, it returns false, |
| // leaving the message and transaction intact. In all other cases, it consumes |
| // the message and returns true. It is possible to chain multiple TryDispatch |
| // functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the |
| // protocol. If there is no matching handler, it closes all the handles in |
| // |msg| and closes the channel with a |ZX_ERR_NOT_SUPPORTED| epitaph, before |
| // returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used |
| // with |fidl::Bind| to reduce template expansion. Do not call this method |
| // manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| class EventSender; |
| }; |
| |
| } // namespace name |
| } // namespace test |
| } // namespace llcpp |
| |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::obj_type> : public std::true_type {}; |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response>); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response, |
| a) == 0); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response, |
| b) == 8); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response, |
| c) == 16); |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response) == |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Response:: |
| PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result>); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response>); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response, |
| __reserved) == 0); |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response) == |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Response:: |
| PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response>); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response, |
| __reserved) == 0); |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response) == |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Response::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Transitional::RequestRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Transitional::RequestRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Transitional::RequestRequest) == |
| ::llcpp::test::name::Transitional::RequestRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Transitional::RequestRequest, x) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Transitional::RequestResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Transitional::RequestResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Transitional::RequestResponse) == |
| ::llcpp::test::name::Transitional::RequestResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Transitional::RequestResponse, y) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Transitional::OneWayRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Transitional::OneWayRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Transitional::OneWayRequest) == |
| ::llcpp::test::name::Transitional::OneWayRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Transitional::OneWayRequest, x) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Transitional::EventResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Transitional::EventResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Transitional::EventResponse) == |
| ::llcpp::test::name::Transitional::EventResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Transitional::EventResponse, x) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::MethodARequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::MethodARequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::MethodARequest) == |
| ::llcpp::test::name::ChannelProtocol::MethodARequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::MethodARequest, |
| a) == 16); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::MethodARequest, |
| b) == 24); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::EventAResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::EventAResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::EventAResponse) == |
| ::llcpp::test::name::ChannelProtocol::EventAResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::EventAResponse, |
| a) == 16); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::EventAResponse, |
| b) == 24); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::MethodBRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::MethodBRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::MethodBRequest) == |
| ::llcpp::test::name::ChannelProtocol::MethodBRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::MethodBRequest, |
| a) == 16); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::MethodBRequest, |
| b) == 24); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::MethodBResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::MethodBResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::MethodBResponse) == |
| ::llcpp::test::name::ChannelProtocol::MethodBResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::ChannelProtocol::MethodBResponse, |
| result) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::MutateSocketRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::MutateSocketRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::MutateSocketRequest) == |
| ::llcpp::test::name::ChannelProtocol::MutateSocketRequest::PrimarySize); |
| static_assert( |
| offsetof(::llcpp::test::name::ChannelProtocol::MutateSocketRequest, a) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ChannelProtocol::MutateSocketResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::ChannelProtocol::MutateSocketResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::ChannelProtocol::MutateSocketResponse) == |
| ::llcpp::test::name::ChannelProtocol::MutateSocketResponse::PrimarySize); |
| static_assert( |
| offsetof(::llcpp::test::name::ChannelProtocol::MutateSocketResponse, b) == |
| 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestNoResponseRequest> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestNoResponseRequest> : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestNoResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestNoResponseRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseRequest> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseResponse> : public std::true_type { |
| }; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestEmptyResponseResponse::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseRequest> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseRequest> : public std::true_type { |
| }; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseResponse> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| NoRequestWithResponseResponse, |
| ret) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestNoResponseRequest> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestNoResponseRequest> : public std::true_type { |
| }; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestNoResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestNoResponseRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestNoResponseRequest, |
| arg) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseRequest> : public std::true_type { |
| }; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseRequest, |
| arg) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestEmptyResponseResponse::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseRequest> : public std::true_type { |
| }; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseRequest) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseRequest, |
| arg) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseResponse> : public std::true_type { |
| }; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| WithRequestWithResponseResponse, |
| ret) == 16); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithAndWithoutRequestResponse::OnEmptyResponseResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithAndWithoutRequestResponse::OnEmptyResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| OnEmptyResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| OnEmptyResponseResponse::PrimarySize); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithAndWithoutRequestResponse::OnWithResponseResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithAndWithoutRequestResponse::OnWithResponseResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| OnWithResponseResponse) == |
| ::llcpp::test::name::WithAndWithoutRequestResponse:: |
| OnWithResponseResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::WithAndWithoutRequestResponse:: |
| OnWithResponseResponse, |
| ret) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::ErrorEnun> : public std::true_type {}; |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result>); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax::ResponseAsStructRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithErrorSyntax::ResponseAsStructRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ResponseAsStructRequest) == |
| ::llcpp::test::name::WithErrorSyntax::ResponseAsStructRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithErrorSyntax::ResponseAsStructResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithErrorSyntax::ResponseAsStructResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ResponseAsStructResponse) == |
| ::llcpp::test::name::WithErrorSyntax::ResponseAsStructResponse:: |
| PrimarySize); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax::ResponseAsStructResponse, |
| result) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveRequest) == |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveResponse) == |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveResponse:: |
| PrimarySize); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax::ErrorAsPrimitiveResponse, |
| result) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax::ErrorAsEnumRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithErrorSyntax::ErrorAsEnumRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ErrorAsEnumRequest) == |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsEnumRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::WithErrorSyntax::ErrorAsEnumResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::WithErrorSyntax::ErrorAsEnumResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::WithErrorSyntax::ErrorAsEnumResponse) == |
| ::llcpp::test::name::WithErrorSyntax::ErrorAsEnumResponse::PrimarySize); |
| static_assert( |
| offsetof(::llcpp::test::name::WithErrorSyntax::ErrorAsEnumResponse, |
| result) == 16); |
| |
| } // namespace fidl |
| |
| namespace llcpp { |
| |
| namespace test { |
| namespace name { |
| |
| struct Transitional::AsyncEventHandlers { |
| std::variant<::fit::function<void(int64_t x)>, |
| ::fit::function<void(::fidl::DecodedMessage<EventResponse> msg)>> |
| event; |
| }; |
| |
| class Transitional::RequestResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~RequestResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<RequestResponse> msg) = 0; |
| |
| protected: |
| RequestResponseContext() = default; |
| }; |
| |
| class Transitional::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Asynchronous variant of |Transitional.Request()|. Allocates 24 bytes of |
| // request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError Request(int64_t x, |
| ::fit::callback<void(int64_t y)> _cb); |
| |
| // Asynchronous variant of |Transitional.Request()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError Request(::fidl::BytePart _request_buffer, int64_t x, |
| RequestResponseContext* _context); |
| // Synchronous variant of |Transitional.Request()|. Allocates 48 bytes of |
| // message buffer on the stack. No heap allocation necessary. |
| ResultOf::Request Request_Sync(int64_t x); |
| |
| // Synchronous variant of |Transitional.Request()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::Request Request_Sync(::fidl::BytePart _request_buffer, |
| int64_t x, |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::StatusAndError OneWay(int64_t x); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| ::fidl::StatusAndError OneWay(::fidl::BytePart _request_buffer, int64_t x); |
| |
| private: |
| friend class ::fidl::Client<Transitional>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class Transitional::EventSender { |
| public: |
| zx_status_t Event(int64_t x) { |
| if (auto _binding = binding_.lock()) { |
| return SendEventEvent(_binding->channel(), std::move(x)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| zx_status_t Event(::fidl::BytePart _buffer, int64_t x) { |
| if (auto _binding = binding_.lock()) { |
| return SendEventEvent(_binding->channel(), std::move(_buffer), |
| std::move(x)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| private: |
| friend class ::fidl::ServerBindingRef<Transitional>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| struct ChannelProtocol::AsyncEventHandlers { |
| std::variant< |
| ::fit::function<void(int64_t a, int64_t b)>, |
| ::fit::function<void(::fidl::DecodedMessage<EventAResponse> msg)>> |
| event_a; |
| }; |
| |
| class ChannelProtocol::MethodBResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~MethodBResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<MethodBResponse> msg) = 0; |
| |
| protected: |
| MethodBResponseContext() = default; |
| }; |
| |
| class ChannelProtocol::MutateSocketResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~MutateSocketResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<MutateSocketResponse> msg) = 0; |
| |
| protected: |
| MutateSocketResponseContext() = default; |
| }; |
| |
| class ChannelProtocol::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Allocates 32 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::StatusAndError MethodA(int64_t a, int64_t b); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| ::fidl::StatusAndError MethodA(::fidl::BytePart _request_buffer, int64_t a, |
| int64_t b); |
| |
| // Asynchronous variant of |ChannelProtocol.MethodB()|. Allocates 32 bytes of |
| // request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError MethodB(int64_t a, int64_t b, |
| ::fit::callback<void(int64_t result)> _cb); |
| |
| // Asynchronous variant of |ChannelProtocol.MethodB()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError MethodB(::fidl::BytePart _request_buffer, int64_t a, |
| int64_t b, MethodBResponseContext* _context); |
| // Synchronous variant of |ChannelProtocol.MethodB()|. Allocates 56 bytes of |
| // message buffer on the stack. No heap allocation necessary. |
| ResultOf::MethodB MethodB_Sync(int64_t a, int64_t b); |
| |
| // Synchronous variant of |ChannelProtocol.MethodB()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::MethodB MethodB_Sync(::fidl::BytePart _request_buffer, |
| int64_t a, int64_t b, |
| ::fidl::BytePart _response_buffer); |
| |
| // Asynchronous variant of |ChannelProtocol.MutateSocket()|. Allocates 24 |
| // bytes of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError MutateSocket( |
| ::zx::socket a, ::fit::callback<void(::zx::socket b)> _cb); |
| |
| // Asynchronous variant of |ChannelProtocol.MutateSocket()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError MutateSocket(::fidl::BytePart _request_buffer, |
| ::zx::socket a, |
| MutateSocketResponseContext* _context); |
| // Synchronous variant of |ChannelProtocol.MutateSocket()|. Allocates 48 bytes |
| // of message buffer on the stack. No heap allocation necessary. |
| ResultOf::MutateSocket MutateSocket_Sync(::zx::socket a); |
| |
| // Synchronous variant of |ChannelProtocol.MutateSocket()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::MutateSocket MutateSocket_Sync( |
| ::fidl::BytePart _request_buffer, ::zx::socket a, |
| ::fidl::BytePart _response_buffer); |
| |
| private: |
| friend class ::fidl::Client<ChannelProtocol>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class ChannelProtocol::EventSender { |
| public: |
| zx_status_t EventA(int64_t a, int64_t b) { |
| if (auto _binding = binding_.lock()) { |
| return SendEventAEvent(_binding->channel(), std::move(a), std::move(b)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| zx_status_t EventA(::fidl::BytePart _buffer, int64_t a, int64_t b) { |
| if (auto _binding = binding_.lock()) { |
| return SendEventAEvent(_binding->channel(), std::move(_buffer), |
| std::move(a), std::move(b)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| private: |
| friend class ::fidl::ServerBindingRef<ChannelProtocol>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| struct WithAndWithoutRequestResponse::AsyncEventHandlers { |
| ::fit::function<void()> on_empty_response; |
| |
| std::variant< |
| ::fit::function<void(::fidl::StringView ret)>, |
| ::fit::function<void(::fidl::DecodedMessage<OnWithResponseResponse> msg)>> |
| on_with_response; |
| }; |
| |
| class WithAndWithoutRequestResponse::NoRequestEmptyResponseResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~NoRequestEmptyResponseResponseContext() = default; |
| virtual void OnReply() = 0; |
| |
| protected: |
| NoRequestEmptyResponseResponseContext() = default; |
| }; |
| |
| class WithAndWithoutRequestResponse::NoRequestWithResponseResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~NoRequestWithResponseResponseContext() = default; |
| virtual void OnReply( |
| ::fidl::DecodedMessage<NoRequestWithResponseResponse> msg) = 0; |
| |
| protected: |
| NoRequestWithResponseResponseContext() = default; |
| }; |
| |
| class WithAndWithoutRequestResponse::WithRequestEmptyResponseResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~WithRequestEmptyResponseResponseContext() = default; |
| virtual void OnReply() = 0; |
| |
| protected: |
| WithRequestEmptyResponseResponseContext() = default; |
| }; |
| |
| class WithAndWithoutRequestResponse::WithRequestWithResponseResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~WithRequestWithResponseResponseContext() = default; |
| virtual void OnReply( |
| ::fidl::DecodedMessage<WithRequestWithResponseResponse> msg) = 0; |
| |
| protected: |
| WithRequestWithResponseResponseContext() = default; |
| }; |
| |
| class WithAndWithoutRequestResponse::ClientImpl final |
| : private ::fidl::internal::ClientBase { |
| public: |
| // Allocates 16 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::StatusAndError NoRequestNoResponse(); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestEmptyResponse()|. Allocates 16 |
| // bytes of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError NoRequestEmptyResponse(::fit::callback<void()> _cb); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestEmptyResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError NoRequestEmptyResponse( |
| NoRequestEmptyResponseResponseContext* _context); |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestEmptyResponse()|. Allocates 32 |
| // bytes of message buffer on the stack. No heap allocation necessary. |
| ResultOf::NoRequestEmptyResponse NoRequestEmptyResponse_Sync(); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestWithResponse()|. Allocates 16 bytes |
| // of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError NoRequestWithResponse( |
| ::fit::callback<void(::fidl::StringView ret)> _cb); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestWithResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError NoRequestWithResponse( |
| NoRequestWithResponseResponseContext* _context); |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestWithResponse()|. Allocates 16 bytes |
| // of request buffer on the stack. Response is heap-allocated. |
| ResultOf::NoRequestWithResponse NoRequestWithResponse_Sync(); |
| |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.NoRequestWithResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::NoRequestWithResponse NoRequestWithResponse_Sync( |
| ::fidl::BytePart _response_buffer); |
| |
| // Request is heap-allocated. |
| ::fidl::StatusAndError WithRequestNoResponse(::fidl::StringView arg); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| ::fidl::StatusAndError WithRequestNoResponse(::fidl::BytePart _request_buffer, |
| ::fidl::StringView arg); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestEmptyResponse()|. The request and |
| // callback are allocated on the heap. |
| ::fidl::StatusAndError WithRequestEmptyResponse(::fidl::StringView arg, |
| ::fit::callback<void()> _cb); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestEmptyResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError WithRequestEmptyResponse( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| WithRequestEmptyResponseResponseContext* _context); |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestEmptyResponse()|. Allocates 16 |
| // bytes of response buffer on the stack. Request is heap-allocated. |
| ResultOf::WithRequestEmptyResponse WithRequestEmptyResponse_Sync( |
| ::fidl::StringView arg); |
| |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestEmptyResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::WithRequestEmptyResponse WithRequestEmptyResponse_Sync( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestWithResponse()|. The request and |
| // callback are allocated on the heap. |
| ::fidl::StatusAndError WithRequestWithResponse( |
| ::fidl::StringView arg, |
| ::fit::callback<void(::fidl::StringView ret)> _cb); |
| |
| // Asynchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestWithResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError WithRequestWithResponse( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| WithRequestWithResponseResponseContext* _context); |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestWithResponse()|. Request is |
| // heap-allocated. Response is heap-allocated. |
| ResultOf::WithRequestWithResponse WithRequestWithResponse_Sync( |
| ::fidl::StringView arg); |
| |
| // Synchronous variant of |
| // |WithAndWithoutRequestResponse.WithRequestWithResponse()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::WithRequestWithResponse WithRequestWithResponse_Sync( |
| ::fidl::BytePart _request_buffer, ::fidl::StringView arg, |
| ::fidl::BytePart _response_buffer); |
| |
| private: |
| friend class ::fidl::Client<WithAndWithoutRequestResponse>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class WithAndWithoutRequestResponse::EventSender { |
| public: |
| zx_status_t OnEmptyResponse() { |
| if (auto _binding = binding_.lock()) { |
| return SendOnEmptyResponseEvent(_binding->channel()); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| zx_status_t OnWithResponse(::fidl::StringView ret) { |
| if (auto _binding = binding_.lock()) { |
| return SendOnWithResponseEvent(_binding->channel(), std::move(ret)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| zx_status_t OnWithResponse(::fidl::BytePart _buffer, ::fidl::StringView ret) { |
| if (auto _binding = binding_.lock()) { |
| return SendOnWithResponseEvent(_binding->channel(), std::move(_buffer), |
| std::move(ret)); |
| } |
| return ZX_ERR_CANCELED; |
| } |
| |
| private: |
| friend class ::fidl::ServerBindingRef<WithAndWithoutRequestResponse>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| struct WithErrorSyntax::AsyncEventHandlers {}; |
| |
| class WithErrorSyntax::ResponseAsStructResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~ResponseAsStructResponseContext() = default; |
| virtual void OnReply( |
| ::fidl::DecodedMessage<ResponseAsStructResponse> msg) = 0; |
| |
| protected: |
| ResponseAsStructResponseContext() = default; |
| }; |
| |
| class WithErrorSyntax::ErrorAsPrimitiveResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~ErrorAsPrimitiveResponseContext() = default; |
| virtual void OnReply( |
| ::fidl::DecodedMessage<ErrorAsPrimitiveResponse> msg) = 0; |
| |
| protected: |
| ErrorAsPrimitiveResponseContext() = default; |
| }; |
| |
| class WithErrorSyntax::ErrorAsEnumResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~ErrorAsEnumResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<ErrorAsEnumResponse> msg) = 0; |
| |
| protected: |
| ErrorAsEnumResponseContext() = default; |
| }; |
| |
| class WithErrorSyntax::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Asynchronous variant of |WithErrorSyntax.ResponseAsStruct()|. Allocates 16 |
| // bytes of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError ResponseAsStruct( |
| ::fit::callback<void( |
| ::llcpp::test::name::WithErrorSyntax_ResponseAsStruct_Result result)> |
| _cb); |
| |
| // Asynchronous variant of |WithErrorSyntax.ResponseAsStruct()|. Caller |
| // provides the backing storage for FIDL message via request and response |
| // buffers. Ownership of _context is given unsafely to the binding until |
| // OnError() or OnReply() are called on it. |
| ::fidl::StatusAndError ResponseAsStruct( |
| ResponseAsStructResponseContext* _context); |
| // Synchronous variant of |WithErrorSyntax.ResponseAsStruct()|. Allocates 80 |
| // bytes of message buffer on the stack. No heap allocation necessary. |
| ResultOf::ResponseAsStruct ResponseAsStruct_Sync(); |
| |
| // Synchronous variant of |WithErrorSyntax.ResponseAsStruct()|. Caller |
| // provides the backing storage for FIDL message via request and response |
| // buffers. |
| UnownedResultOf::ResponseAsStruct ResponseAsStruct_Sync( |
| ::fidl::BytePart _response_buffer); |
| |
| // Asynchronous variant of |WithErrorSyntax.ErrorAsPrimitive()|. Allocates 16 |
| // bytes of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError ErrorAsPrimitive( |
| ::fit::callback<void( |
| ::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result result)> |
| _cb); |
| |
| // Asynchronous variant of |WithErrorSyntax.ErrorAsPrimitive()|. Caller |
| // provides the backing storage for FIDL message via request and response |
| // buffers. Ownership of _context is given unsafely to the binding until |
| // OnError() or OnReply() are called on it. |
| ::fidl::StatusAndError ErrorAsPrimitive( |
| ErrorAsPrimitiveResponseContext* _context); |
| // Synchronous variant of |WithErrorSyntax.ErrorAsPrimitive()|. Allocates 64 |
| // bytes of message buffer on the stack. No heap allocation necessary. |
| ResultOf::ErrorAsPrimitive ErrorAsPrimitive_Sync(); |
| |
| // Synchronous variant of |WithErrorSyntax.ErrorAsPrimitive()|. Caller |
| // provides the backing storage for FIDL message via request and response |
| // buffers. |
| UnownedResultOf::ErrorAsPrimitive ErrorAsPrimitive_Sync( |
| ::fidl::BytePart _response_buffer); |
| |
| // Asynchronous variant of |WithErrorSyntax.ErrorAsEnum()|. Allocates 16 bytes |
| // of request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError ErrorAsEnum( |
| ::fit::callback< |
| void(::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result result)> |
| _cb); |
| |
| // Asynchronous variant of |WithErrorSyntax.ErrorAsEnum()|. Caller provides |
| // the backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError ErrorAsEnum(ErrorAsEnumResponseContext* _context); |
| // Synchronous variant of |WithErrorSyntax.ErrorAsEnum()|. Allocates 64 bytes |
| // of message buffer on the stack. No heap allocation necessary. |
| ResultOf::ErrorAsEnum ErrorAsEnum_Sync(); |
| |
| // Synchronous variant of |WithErrorSyntax.ErrorAsEnum()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::ErrorAsEnum ErrorAsEnum_Sync( |
| ::fidl::BytePart _response_buffer); |
| |
| private: |
| friend class ::fidl::Client<WithErrorSyntax>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class WithErrorSyntax::EventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<WithErrorSyntax>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| } // namespace name |
| } // namespace test |
| } // namespace llcpp |