blob: c20af991a61ed1234ab7b02a4f37e9f2e7e2e6c5 [file] [log] [blame]
// 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/coding.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/envelope.h>
#include <lib/fidl/llcpp/memory.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>
namespace llcpp {
namespace test {
namespace name {
struct WithErrorSyntax_ResponseAsStruct_Response;
class WithErrorSyntax_ResponseAsStruct_Result;
struct WithErrorSyntax_ErrorAsPrimitive_Response;
class WithErrorSyntax_ErrorAsPrimitive_Result;
struct WithErrorSyntax_ErrorAsEnum_Response;
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
v1_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 =
&v1_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;
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
v1_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 =
&v1_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;
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
v1_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 =
&v1_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;
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
v1_test_name_WithErrorSyntax_ResponseAsStruct_ResponseTable;
struct WithErrorSyntax_ResponseAsStruct_Response {
static constexpr const fidl_type_t* Type =
&v1_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;
int64_t a = {};
int64_t b = {};
int64_t c = {};
};
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntax_ErrorAsPrimitive_ResponseTable;
struct WithErrorSyntax_ErrorAsPrimitive_Response {
static constexpr const fidl_type_t* Type =
&v1_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;
uint8_t __reserved = {};
};
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntax_ErrorAsEnum_ResponseTable;
struct WithErrorSyntax_ErrorAsEnum_Response {
static constexpr const fidl_type_t* Type =
&v1_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;
uint8_t __reserved = {};
};
extern "C" const fidl_type_t v1_test_name_ChannelProtocolMethodARequestTable;
extern "C" const fidl_type_t v1_test_name_ChannelProtocolMethodAResponseTable;
extern "C" const fidl_type_t v1_test_name_ChannelProtocolEventARequestTable;
extern "C" const fidl_type_t v1_test_name_ChannelProtocolEventAEventTable;
extern "C" const fidl_type_t v1_test_name_ChannelProtocolMethodBRequestTable;
extern "C" const fidl_type_t v1_test_name_ChannelProtocolMethodBResponseTable;
extern "C" const fidl_type_t
v1_test_name_ChannelProtocolMutateSocketRequestTable;
extern "C" const fidl_type_t
v1_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;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct EventAResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int64_t a;
int64_t b;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct MethodBResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int64_t result;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct MethodBRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int64_t a;
int64_t b;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = MethodBResponse;
};
struct MutateSocketResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::socket b;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct MutateSocketRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::socket a;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = MutateSocketResponse;
};
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;
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;
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;
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;
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;
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;
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::DecodeResult<MethodBResponse> MethodB(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<MethodBRequest> params,
::fidl::BytePart response_buffer);
static ::fidl::DecodeResult<MutateSocketResponse> MutateSocket(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<MutateSocketRequest> params,
::fidl::BytePart response_buffer);
};
// 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);
// Helper functions to fill in the transaction header in a
// |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
static void MethodARequest(
const ::fidl::DecodedMessage<ChannelProtocol::MethodARequest>& _msg);
static void EventAResponse(
const ::fidl::DecodedMessage<ChannelProtocol::EventAResponse>& _msg);
static void MethodBRequest(
const ::fidl::DecodedMessage<ChannelProtocol::MethodBRequest>& _msg);
static void MethodBResponse(
const ::fidl::DecodedMessage<ChannelProtocol::MethodBResponse>& _msg);
static void MutateSocketRequest(
const ::fidl::DecodedMessage<ChannelProtocol::MutateSocketRequest>&
_msg);
static void MutateSocketResponse(
const ::fidl::DecodedMessage<ChannelProtocol::MutateSocketResponse>&
_msg);
};
};
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestNoResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestNoResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestEmptyResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestEmptyResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestWithResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseNoRequestWithResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestNoResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestNoResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestEmptyResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestEmptyResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestWithResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseWithRequestWithResponseResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseOnEmptyResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseOnEmptyResponseEventTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseOnWithResponseRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithAndWithoutRequestResponseOnWithResponseEventTable;
class WithAndWithoutRequestResponse final {
WithAndWithoutRequestResponse() = delete;
public:
using NoRequestNoResponseRequest = ::fidl::AnyZeroArgMessage;
using NoRequestEmptyResponseResponse = ::fidl::AnyZeroArgMessage;
using NoRequestEmptyResponseRequest = ::fidl::AnyZeroArgMessage;
struct NoRequestWithResponseResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView ret;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using NoRequestWithResponseRequest = ::fidl::AnyZeroArgMessage;
struct WithRequestNoResponseRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView arg;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
using WithRequestEmptyResponseResponse = ::fidl::AnyZeroArgMessage;
struct WithRequestEmptyResponseRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView arg;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct WithRequestWithResponseResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView ret;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct WithRequestWithResponseRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView arg;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = WithRequestWithResponseResponse;
};
using OnEmptyResponseResponse = ::fidl::AnyZeroArgMessage;
struct OnWithResponseResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::StringView ret;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
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;
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;
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;
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::StringView arg);
~WithRequestNoResponse_Impl() = default;
WithRequestNoResponse_Impl(WithRequestNoResponse_Impl&& other) = default;
WithRequestNoResponse_Impl& operator=(
WithRequestNoResponse_Impl&& other) = default;
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,
::fidl::StringView arg);
~WithRequestEmptyResponse_Impl() = default;
WithRequestEmptyResponse_Impl(WithRequestEmptyResponse_Impl&& other) =
default;
WithRequestEmptyResponse_Impl& operator=(
WithRequestEmptyResponse_Impl&& other) = default;
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,
::fidl::StringView arg);
~WithRequestWithResponse_Impl() = default;
WithRequestWithResponse_Impl(WithRequestWithResponse_Impl&& other) =
default;
WithRequestWithResponse_Impl& operator=(
WithRequestWithResponse_Impl&& other) = default;
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;
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;
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;
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;
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;
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;
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::DecodeResult<WithRequestEmptyResponseResponse>
WithRequestEmptyResponse(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<WithRequestEmptyResponseRequest> params,
::fidl::BytePart response_buffer);
static ::fidl::DecodeResult<WithRequestWithResponseResponse>
WithRequestWithResponse(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<WithRequestWithResponseRequest> params,
::fidl::BytePart response_buffer);
};
// 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);
// Helper functions to fill in the transaction header in a
// |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
static void NoRequestNoResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::NoRequestNoResponseRequest>& _msg);
static void NoRequestEmptyResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::NoRequestEmptyResponseRequest>&
_msg);
static void NoRequestEmptyResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::NoRequestEmptyResponseResponse>&
_msg);
static void NoRequestWithResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::NoRequestWithResponseRequest>& _msg);
static void NoRequestWithResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::NoRequestWithResponseResponse>&
_msg);
static void WithRequestNoResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::WithRequestNoResponseRequest>& _msg);
static void WithRequestEmptyResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::WithRequestEmptyResponseRequest>&
_msg);
static void WithRequestEmptyResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::WithRequestEmptyResponseResponse>&
_msg);
static void WithRequestWithResponseRequest(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::WithRequestWithResponseRequest>&
_msg);
static void WithRequestWithResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::WithRequestWithResponseResponse>&
_msg);
static void OnEmptyResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::OnEmptyResponseResponse>& _msg);
static void OnWithResponseResponse(
const ::fidl::DecodedMessage<
WithAndWithoutRequestResponse::OnWithResponseResponse>& _msg);
};
};
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntaxResponseAsStructRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntaxResponseAsStructResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntaxErrorAsPrimitiveRequestTable;
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntaxErrorAsPrimitiveResponseTable;
extern "C" const fidl_type_t
v1_test_name_WithErrorSyntaxErrorAsEnumRequestTable;
extern "C" const fidl_type_t
v1_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;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using ResponseAsStructRequest = ::fidl::AnyZeroArgMessage;
struct ErrorAsPrimitiveResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::test::name::WithErrorSyntax_ErrorAsPrimitive_Result result;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using ErrorAsPrimitiveRequest = ::fidl::AnyZeroArgMessage;
struct ErrorAsEnumResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::test::name::WithErrorSyntax_ErrorAsEnum_Result result;
static constexpr const fidl_type_t* Type =
&v1_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 ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using ErrorAsEnumRequest = ::fidl::AnyZeroArgMessage;
// 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;
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;
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;
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;
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;
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;
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);
};
// 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);
}
// Helper functions to fill in the transaction header in a
// |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
static void ResponseAsStructRequest(
const ::fidl::DecodedMessage<WithErrorSyntax::ResponseAsStructRequest>&
_msg);
static void ResponseAsStructResponse(
const ::fidl::DecodedMessage<WithErrorSyntax::ResponseAsStructResponse>&
_msg);
static void ErrorAsPrimitiveRequest(
const ::fidl::DecodedMessage<WithErrorSyntax::ErrorAsPrimitiveRequest>&
_msg);
static void ErrorAsPrimitiveResponse(
const ::fidl::DecodedMessage<WithErrorSyntax::ErrorAsPrimitiveResponse>&
_msg);
static void ErrorAsEnumRequest(
const ::fidl::DecodedMessage<WithErrorSyntax::ErrorAsEnumRequest>&
_msg);
static void ErrorAsEnumResponse(
const ::fidl::DecodedMessage<WithErrorSyntax::ErrorAsEnumResponse>&
_msg);
};
};
} // namespace name
} // namespace test
} // namespace llcpp
namespace fidl {
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::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::
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::
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::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::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::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::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::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