blob: 6e9ba82ff0758cc971aeb1587ffb7bf9db5f994f [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 <zircon/fidl.h>
namespace llcpp {
namespace test {
namespace name {
class Parent;
class Child;
extern "C" const fidl_type_t v1_test_name_ParentGetChildRequestTable;
extern "C" const fidl_type_t v1_test_name_ParentGetChildResponseTable;
extern "C" const fidl_type_t v1_test_name_ParentGetChildRequestRequestTable;
extern "C" const fidl_type_t v1_test_name_ParentGetChildRequestResponseTable;
extern "C" const fidl_type_t v1_test_name_ParentTakeChildRequestTable;
extern "C" const fidl_type_t v1_test_name_ParentTakeChildResponseTable;
extern "C" const fidl_type_t v1_test_name_ParentTakeChildRequestRequestTable;
extern "C" const fidl_type_t v1_test_name_ParentTakeChildRequestResponseTable;
class Parent final {
Parent() = delete;
public:
struct GetChildResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel c;
static constexpr const fidl_type_t* Type =
&v1_test_name_ParentGetChildResponseTable;
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;
};
using GetChildRequest = ::fidl::AnyZeroArgMessage;
struct GetChildRequestResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel r;
static constexpr const fidl_type_t* Type =
&v1_test_name_ParentGetChildRequestResponseTable;
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;
};
using GetChildRequestRequest = ::fidl::AnyZeroArgMessage;
struct TakeChildRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel c;
static constexpr const fidl_type_t* Type =
&v1_test_name_ParentTakeChildRequestTable;
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;
};
struct TakeChildRequestRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel r;
static constexpr const fidl_type_t* Type =
&v1_test_name_ParentTakeChildRequestRequestTable;
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;
};
// Collection of return types of FIDL calls in this protocol.
class ResultOf final {
ResultOf() = delete;
private:
template <typename ResponseType>
class GetChild_Impl final
: private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
GetChild_Impl(::zx::unowned_channel _client_end);
~GetChild_Impl() = default;
GetChild_Impl(GetChild_Impl&& other) = default;
GetChild_Impl& operator=(GetChild_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 GetChildRequest_Impl final
: private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
GetChildRequest_Impl(::zx::unowned_channel _client_end);
~GetChildRequest_Impl() = default;
GetChildRequest_Impl(GetChildRequest_Impl&& other) = default;
GetChildRequest_Impl& operator=(GetChildRequest_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 TakeChild_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
TakeChild_Impl(::zx::unowned_channel _client_end, ::zx::channel c);
~TakeChild_Impl() = default;
TakeChild_Impl(TakeChild_Impl&& other) = default;
TakeChild_Impl& operator=(TakeChild_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
class TakeChildRequest_Impl final
: private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
TakeChildRequest_Impl(::zx::unowned_channel _client_end, ::zx::channel r);
~TakeChildRequest_Impl() = default;
TakeChildRequest_Impl(TakeChildRequest_Impl&& other) = default;
TakeChildRequest_Impl& operator=(TakeChildRequest_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using GetChild = GetChild_Impl<GetChildResponse>;
using GetChildRequest = GetChildRequest_Impl<GetChildRequestResponse>;
using TakeChild = TakeChild_Impl;
using TakeChildRequest = TakeChildRequest_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 GetChild_Impl final
: private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
GetChild_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _response_buffer);
~GetChild_Impl() = default;
GetChild_Impl(GetChild_Impl&& other) = default;
GetChild_Impl& operator=(GetChild_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 GetChildRequest_Impl final
: private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
GetChildRequest_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _response_buffer);
~GetChildRequest_Impl() = default;
GetChildRequest_Impl(GetChildRequest_Impl&& other) = default;
GetChildRequest_Impl& operator=(GetChildRequest_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 TakeChild_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
TakeChild_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer, ::zx::channel c);
~TakeChild_Impl() = default;
TakeChild_Impl(TakeChild_Impl&& other) = default;
TakeChild_Impl& operator=(TakeChild_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
class TakeChildRequest_Impl final
: private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
TakeChildRequest_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer, ::zx::channel r);
~TakeChildRequest_Impl() = default;
TakeChildRequest_Impl(TakeChildRequest_Impl&& other) = default;
TakeChildRequest_Impl& operator=(TakeChildRequest_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using GetChild = GetChild_Impl<GetChildResponse>;
using GetChildRequest = GetChildRequest_Impl<GetChildRequestResponse>;
using TakeChild = TakeChild_Impl;
using TakeChildRequest = TakeChildRequest_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 40 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::GetChild GetChild();
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::GetChild GetChild(::fidl::BytePart _response_buffer);
// Allocates 40 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::GetChildRequest GetChildRequest();
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::GetChildRequest GetChildRequest(
::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::TakeChild TakeChild(::zx::channel c);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::TakeChild TakeChild(::fidl::BytePart _request_buffer,
::zx::channel c);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::TakeChildRequest TakeChildRequest(::zx::channel r);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::TakeChildRequest TakeChildRequest(
::fidl::BytePart _request_buffer, ::zx::channel r);
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 40 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::GetChild GetChild(::zx::unowned_channel _client_end);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::GetChild GetChild(
::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
// Allocates 40 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::GetChildRequest GetChildRequest(
::zx::unowned_channel _client_end);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::GetChildRequest GetChildRequest(
::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::TakeChild TakeChild(::zx::unowned_channel _client_end,
::zx::channel c);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::TakeChild TakeChild(
::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer,
::zx::channel c);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::TakeChildRequest TakeChildRequest(
::zx::unowned_channel _client_end, ::zx::channel r);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::TakeChildRequest TakeChildRequest(
::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer,
::zx::channel r);
};
// 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<GetChildResponse> GetChild(
::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer);
static ::fidl::DecodeResult<GetChildRequestResponse> GetChildRequest(
::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer);
static ::fidl::internal::StatusAndError TakeChild(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<TakeChildRequest> params);
static ::fidl::internal::StatusAndError TakeChildRequest(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<TakeChildRequestRequest> params);
};
// Pure-virtual interface to be implemented by a server.
class Interface {
public:
Interface() = default;
virtual ~Interface() = default;
using _Outer = Parent;
using _Base = ::fidl::CompleterBase;
class GetChildCompleterBase : public _Base {
public:
void Reply(::zx::channel c);
void Reply(::fidl::BytePart _buffer, ::zx::channel c);
void Reply(::fidl::DecodedMessage<GetChildResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using GetChildCompleter = ::fidl::Completer<GetChildCompleterBase>;
virtual void GetChild(GetChildCompleter::Sync _completer) = 0;
class GetChildRequestCompleterBase : public _Base {
public:
void Reply(::zx::channel r);
void Reply(::fidl::BytePart _buffer, ::zx::channel r);
void Reply(::fidl::DecodedMessage<GetChildRequestResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using GetChildRequestCompleter =
::fidl::Completer<GetChildRequestCompleterBase>;
virtual void GetChildRequest(GetChildRequestCompleter::Sync _completer) = 0;
using TakeChildCompleter = ::fidl::Completer<>;
virtual void TakeChild(::zx::channel c,
TakeChildCompleter::Sync _completer) = 0;
using TakeChildRequestCompleter = ::fidl::Completer<>;
virtual void TakeChildRequest(
::zx::channel r, TakeChildRequestCompleter::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 GetChildRequest(
const ::fidl::DecodedMessage<Parent::GetChildRequest>& _msg);
static void GetChildResponse(
const ::fidl::DecodedMessage<Parent::GetChildResponse>& _msg);
static void GetChildRequestRequest(
const ::fidl::DecodedMessage<Parent::GetChildRequestRequest>& _msg);
static void GetChildRequestResponse(
const ::fidl::DecodedMessage<Parent::GetChildRequestResponse>& _msg);
static void TakeChildRequest(
const ::fidl::DecodedMessage<Parent::TakeChildRequest>& _msg);
static void TakeChildRequestRequest(
const ::fidl::DecodedMessage<Parent::TakeChildRequestRequest>& _msg);
};
};
class Child final {
Child() = delete;
public:
// Collection of return types of FIDL calls in this protocol.
class ResultOf final {
ResultOf() = delete;
private:
public:
};
// 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:
public:
};
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_; }
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:
};
// 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:
};
// Helper functions to fill in the transaction header in a
// |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
};
};
} // namespace name
} // namespace test
} // namespace llcpp
namespace fidl {
template <>
struct IsFidlType<::llcpp::test::name::Parent::GetChildResponse>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::test::name::Parent::GetChildResponse>
: public std::true_type {};
static_assert(sizeof(::llcpp::test::name::Parent::GetChildResponse) ==
::llcpp::test::name::Parent::GetChildResponse::PrimarySize);
static_assert(offsetof(::llcpp::test::name::Parent::GetChildResponse, c) == 16);
template <>
struct IsFidlType<::llcpp::test::name::Parent::GetChildRequestResponse>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::test::name::Parent::GetChildRequestResponse>
: public std::true_type {};
static_assert(
sizeof(::llcpp::test::name::Parent::GetChildRequestResponse) ==
::llcpp::test::name::Parent::GetChildRequestResponse::PrimarySize);
static_assert(offsetof(::llcpp::test::name::Parent::GetChildRequestResponse,
r) == 16);
template <>
struct IsFidlType<::llcpp::test::name::Parent::TakeChildRequest>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::test::name::Parent::TakeChildRequest>
: public std::true_type {};
static_assert(sizeof(::llcpp::test::name::Parent::TakeChildRequest) ==
::llcpp::test::name::Parent::TakeChildRequest::PrimarySize);
static_assert(offsetof(::llcpp::test::name::Parent::TakeChildRequest, c) == 16);
template <>
struct IsFidlType<::llcpp::test::name::Parent::TakeChildRequestRequest>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::test::name::Parent::TakeChildRequestRequest>
: public std::true_type {};
static_assert(
sizeof(::llcpp::test::name::Parent::TakeChildRequestRequest) ==
::llcpp::test::name::Parent::TakeChildRequestRequest::PrimarySize);
static_assert(offsetof(::llcpp::test::name::Parent::TakeChildRequestRequest,
r) == 16);
} // namespace fidl