blob: e0bd0e9c1d63cfab4d2ab91837f263c9f906076a [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 fidl {
namespace test {
namespace json {
class Parent;
class Child;
extern "C" const fidl_type_t v1_fidl_test_json_ParentFirstRequestTable;
extern "C" const fidl_type_t v1_fidl_test_json_ParentFirstResponseTable;
class Parent final {
Parent() = delete;
public:
struct FirstRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel request;
static constexpr const fidl_type_t* Type =
&v1_fidl_test_json_ParentFirstRequestTable;
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:
class First_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
First_Impl(::zx::unowned_channel _client_end, ::zx::channel request);
~First_Impl() = default;
First_Impl(First_Impl&& other) = default;
First_Impl& operator=(First_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using First = First_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:
class First_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
First_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer, ::zx::channel request);
~First_Impl() = default;
First_Impl(First_Impl&& other) = default;
First_Impl& operator=(First_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using First = First_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 24 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::First First(::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::First First(::fidl::BytePart _request_buffer,
::zx::channel request);
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 24 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::First First(::zx::unowned_channel _client_end,
::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::First First(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer,
::zx::channel request);
};
// 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 First(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<FirstRequest> 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;
using FirstCompleter = ::fidl::Completer<>;
virtual void First(::zx::channel request,
FirstCompleter::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 FirstRequest(
const ::fidl::DecodedMessage<Parent::FirstRequest>& _msg);
};
};
extern "C" const fidl_type_t v1_fidl_test_json_ChildFirstRequestTable;
extern "C" const fidl_type_t v1_fidl_test_json_ChildFirstResponseTable;
extern "C" const fidl_type_t v1_fidl_test_json_ChildSecondRequestTable;
extern "C" const fidl_type_t v1_fidl_test_json_ChildSecondResponseTable;
class Child final {
Child() = delete;
public:
struct FirstRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel request;
static constexpr const fidl_type_t* Type =
&v1_fidl_test_json_ChildFirstRequestTable;
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 SecondRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel request;
static constexpr const fidl_type_t* Type =
&v1_fidl_test_json_ChildSecondRequestTable;
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:
class First_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
First_Impl(::zx::unowned_channel _client_end, ::zx::channel request);
~First_Impl() = default;
First_Impl(First_Impl&& other) = default;
First_Impl& operator=(First_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
class Second_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
Second_Impl(::zx::unowned_channel _client_end, ::zx::channel request);
~Second_Impl() = default;
Second_Impl(Second_Impl&& other) = default;
Second_Impl& operator=(Second_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using First = First_Impl;
using Second = Second_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:
class First_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
First_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer, ::zx::channel request);
~First_Impl() = default;
First_Impl(First_Impl&& other) = default;
First_Impl& operator=(First_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
class Second_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
Second_Impl(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer, ::zx::channel request);
~Second_Impl() = default;
Second_Impl(Second_Impl&& other) = default;
Second_Impl& operator=(Second_Impl&& other) = default;
using Super::error;
using Super::ok;
using Super::status;
};
public:
using First = First_Impl;
using Second = Second_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 24 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::First First(::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::First First(::fidl::BytePart _request_buffer,
::zx::channel request);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
ResultOf::Second Second(::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
UnownedResultOf::Second Second(::fidl::BytePart _request_buffer,
::zx::channel request);
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 24 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::First First(::zx::unowned_channel _client_end,
::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::First First(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer,
::zx::channel request);
// Allocates 24 bytes of message buffer on the stack. No heap allocation
// necessary.
static ResultOf::Second Second(::zx::unowned_channel _client_end,
::zx::channel request);
// Caller provides the backing storage for FIDL message via request and
// response buffers.
static UnownedResultOf::Second Second(::zx::unowned_channel _client_end,
::fidl::BytePart _request_buffer,
::zx::channel request);
};
// 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 First(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<FirstRequest> params);
static ::fidl::internal::StatusAndError Second(
::zx::unowned_channel _client_end,
::fidl::DecodedMessage<SecondRequest> params);
};
// Pure-virtual interface to be implemented by a server.
class Interface {
public:
Interface() = default;
virtual ~Interface() = default;
using _Outer = Child;
using _Base = ::fidl::CompleterBase;
using FirstCompleter = ::fidl::Completer<>;
virtual void First(::zx::channel request,
FirstCompleter::Sync _completer) = 0;
using SecondCompleter = ::fidl::Completer<>;
virtual void Second(::zx::channel request,
SecondCompleter::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 FirstRequest(
const ::fidl::DecodedMessage<Child::FirstRequest>& _msg);
static void SecondRequest(
const ::fidl::DecodedMessage<Child::SecondRequest>& _msg);
};
};
} // namespace json
} // namespace test
} // namespace fidl
} // namespace llcpp
namespace fidl {
template <>
struct IsFidlType<::llcpp::fidl::test::json::Parent::FirstRequest>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fidl::test::json::Parent::FirstRequest>
: public std::true_type {};
static_assert(sizeof(::llcpp::fidl::test::json::Parent::FirstRequest) ==
::llcpp::fidl::test::json::Parent::FirstRequest::PrimarySize);
static_assert(offsetof(::llcpp::fidl::test::json::Parent::FirstRequest,
request) == 16);
template <>
struct IsFidlType<::llcpp::fidl::test::json::Child::FirstRequest>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fidl::test::json::Child::FirstRequest>
: public std::true_type {};
static_assert(sizeof(::llcpp::fidl::test::json::Child::FirstRequest) ==
::llcpp::fidl::test::json::Child::FirstRequest::PrimarySize);
static_assert(offsetof(::llcpp::fidl::test::json::Child::FirstRequest,
request) == 16);
template <>
struct IsFidlType<::llcpp::fidl::test::json::Child::SecondRequest>
: public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fidl::test::json::Child::SecondRequest>
: public std::true_type {};
static_assert(sizeof(::llcpp::fidl::test::json::Child::SecondRequest) ==
::llcpp::fidl::test::json::Child::SecondRequest::PrimarySize);
static_assert(offsetof(::llcpp::fidl::test::json::Child::SecondRequest,
request) == 16);
} // namespace fidl