blob: 8510339248766dc675ab232c83b67b3b4f770645 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include <fidl/test.versions/cpp/markers.h>
#include <fidl/test.versions/cpp/wire_types.h>
#include <lib/fidl/llcpp/wire_messaging.h>
#ifdef __Fuchsia__
#include <lib/fidl/llcpp/client.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/server.h>
#include <lib/fidl/llcpp/service_handler_interface.h>
#include <lib/fidl/llcpp/sync_call.h>
#endif // __Fuchsia__
namespace test_versions {
class OtherProtocol;
class Protocol;
class Service;
} // namespace test_versions
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::ProtocolDetails<::test_versions::OtherProtocol> {};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::WireServerDispatcher<::test_versions::OtherProtocol>
final {
WireServerDispatcher() = delete;
static ::fidl::DispatchResult TryDispatch(
::fidl::WireServer<::test_versions::OtherProtocol>* impl,
::fidl::IncomingMessage& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn);
static void Dispatch(::fidl::WireServer<::test_versions::OtherProtocol>* impl,
::fidl::IncomingMessage&& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn);
private:
static const ::fidl::internal::MethodEntry entries_[];
static const ::fidl::internal::MethodEntry* entries_end_;
};
#endif // __Fuchsia__
namespace fidl {} // namespace fidl
namespace test_versions {
#ifdef __Fuchsia__
} // namespace test_versions
template <>
class ::fidl::internal::WireEventHandlerInterface<
::test_versions::OtherProtocol> {
public:
WireEventHandlerInterface() = default;
virtual ~WireEventHandlerInterface() = default;
};
template <>
class ::fidl::WireAsyncEventHandler<::test_versions::OtherProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::test_versions::OtherProtocol>,
public ::fidl::internal::AsyncEventHandler {
public:
WireAsyncEventHandler() = default;
};
template <>
class ::fidl::WireSyncEventHandler<::test_versions::OtherProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::test_versions::OtherProtocol> {
public:
WireSyncEventHandler() = default;
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the
// corresponding virtual method.
::fidl::Status HandleOneEvent(
::fidl::UnownedClientEnd<::test_versions::OtherProtocol> client_end);
private:
[[maybe_unused]] bool got_transitional_ = false;
};
template <>
class ::fidl::internal::WireEventDispatcher<::test_versions::OtherProtocol>
final : public ::fidl::internal::IncomingEventDispatcher<
::fidl::WireAsyncEventHandler<::test_versions::OtherProtocol>> {
public:
explicit WireEventDispatcher(
::fidl::WireAsyncEventHandler<::test_versions::OtherProtocol>*
event_handler)
: IncomingEventDispatcher(event_handler) {}
private:
std::optional<::fidl::UnbindInfo> DispatchEvent(
::fidl::IncomingMessage& msg,
::fidl::internal::IncomingTransportContext transport_context) override;
};
// Methods to make a sync FIDL call directly on an unowned handle or a
// const reference to a |fidl::ClientEnd<::test_versions::OtherProtocol>|,
// avoiding setting up a client.
template <>
class ::fidl::internal::WireSyncClientImpl<::test_versions::OtherProtocol> final
: public ::fidl::internal::SyncEndpointManagedVeneer<
::fidl::internal::WireSyncClientImpl<
::test_versions::OtherProtocol>> {
public:
private:
::fidl::UnownedClientEnd<::test_versions::OtherProtocol> _client_end() const {
return ::fidl::UnownedClientEnd<::test_versions::OtherProtocol>(
_transport().get<::fidl::internal::ChannelTransport>());
}
};
template <>
class ::fidl::internal::WireSyncBufferClientImpl<::test_versions::OtherProtocol>
final : public ::fidl::internal::SyncEndpointBufferVeneer<
::fidl::internal::WireSyncBufferClientImpl<
::test_versions::OtherProtocol>> {
public:
private:
::fidl::UnownedClientEnd<::test_versions::OtherProtocol> _client_end() const {
return ::fidl::UnownedClientEnd<::test_versions::OtherProtocol>(
_transport().get<::fidl::internal::ChannelTransport>());
}
};
// Pure-virtual interface to be implemented by a server.
// This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>|
// and |fidl::ServerEnd<SomeProtocol>|).
template <>
class ::fidl::WireServer<::test_versions::OtherProtocol>
: public ::fidl::internal::IncomingMessageDispatcher {
public:
WireServer() = default;
virtual ~WireServer() = default;
// The FIDL protocol type that is implemented by this server.
using _EnclosingProtocol = ::test_versions::OtherProtocol;
private:
void dispatch_message(
::fidl::IncomingMessage&& msg, ::fidl::Transaction* txn,
::fidl::internal::IncomingTransportContext transport_context) final;
};
namespace test_versions {
#endif // __Fuchsia__
} // namespace test_versions
template <>
struct ::fidl::internal::WireOrdinal<::test_versions::Protocol::Foo> final {
static constexpr uint64_t value = 6231434419097198905lu;
};
namespace test_versions {} // namespace test_versions
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::ProtocolDetails<::test_versions::Protocol> {};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::WireServerDispatcher<::test_versions::Protocol> final {
WireServerDispatcher() = delete;
static ::fidl::DispatchResult TryDispatch(
::fidl::WireServer<::test_versions::Protocol>* impl,
::fidl::IncomingMessage& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn);
static void Dispatch(::fidl::WireServer<::test_versions::Protocol>* impl,
::fidl::IncomingMessage&& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn);
private:
static const ::fidl::internal::MethodEntry entries_[];
static const ::fidl::internal::MethodEntry* entries_end_;
};
#endif // __Fuchsia__
template <>
struct ::fidl::WireRequest<::test_versions::Protocol::Foo> final {
WireRequest() = default;
};
template <>
struct ::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>
final {
FIDL_ALIGNDECL
fidl_message_header_t header;
TransactionalRequest() { _InitHeader(); }
private:
void _InitHeader();
};
namespace fidl {
template <>
struct IsFidlType<
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>>
: public std::true_type {};
template <>
struct IsFidlType<::fidl::WireRequest<::test_versions::Protocol::Foo>>
: public std::true_type {};
template <>
struct IsFidlTransactionalMessage<
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>>
: public std::true_type {};
template <>
struct IsFidlTransactionalMessage<
::fidl::WireRequest<::test_versions::Protocol::Foo>>
: public std::false_type {};
template <>
struct TypeTraits<
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>> {
static constexpr const fidl_type_t* kType = nullptr;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize =
FIDL_ALIGN(0 + sizeof(fidl_message_header_t));
static constexpr uint32_t kPrimarySizeV1 =
FIDL_ALIGN(0 + sizeof(fidl_message_header_t));
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 0;
static constexpr bool kHasFlexibleEnvelope = false;
static constexpr bool kHasPointer = false;
static constexpr ::fidl::internal::TransactionalMessageKind kMessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
static_assert(sizeof(::fidl::internal::TransactionalRequest<
::test_versions::Protocol::Foo>) ==
TypeTraits<::fidl::internal::TransactionalRequest<
::test_versions::Protocol::Foo>>::kPrimarySize);
static_assert(
offsetof(
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>,
header) == 0);
template <>
struct TypeTraits<::fidl::WireRequest<::test_versions::Protocol::Foo>> {
static constexpr const fidl_type_t* kType = nullptr;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 0;
static constexpr uint32_t kPrimarySizeV1 = 0;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 0;
static constexpr bool kHasFlexibleEnvelope = false;
static constexpr bool kHasPointer = false;
static constexpr ::fidl::internal::TransactionalMessageKind kMessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
} // namespace fidl
namespace test_versions {
#ifdef __Fuchsia__
} // namespace test_versions
template <>
class [[nodiscard]] ::fidl::WireResult<::test_versions::Protocol::Foo> final
: public ::fidl::Status {
public:
WireResult(
::fidl::UnownedClientEnd<::test_versions::Protocol> client,
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>*
request);
explicit WireResult(const ::fidl::Status& result) : ::fidl::Status(result) {}
WireResult(WireResult&&) = delete;
WireResult(const WireResult&) = delete;
WireResult* operator=(WireResult&&) = delete;
WireResult* operator=(const WireResult&) = delete;
~WireResult() = default;
private:
};
template <>
class [[nodiscard]] ::fidl::WireUnownedResult<::test_versions::Protocol::Foo>
final : public ::fidl::Status {
public:
explicit WireUnownedResult(
::fidl::UnownedClientEnd<::test_versions::Protocol> client_end,
::fidl::internal::AnyBufferAllocator& allocator,
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>*
request);
explicit WireUnownedResult(const ::fidl::Status& result)
: ::fidl::Status(result) {}
WireUnownedResult(WireUnownedResult&&) = delete;
WireUnownedResult(const WireUnownedResult&) = delete;
WireUnownedResult* operator=(WireUnownedResult&&) = delete;
WireUnownedResult* operator=(const WireUnownedResult&) = delete;
~WireUnownedResult() = default;
};
template <>
class ::fidl::internal::WireEventHandlerInterface<::test_versions::Protocol> {
public:
WireEventHandlerInterface() = default;
virtual ~WireEventHandlerInterface() = default;
};
template <>
class ::fidl::WireAsyncEventHandler<::test_versions::Protocol>
: public ::fidl::internal::WireEventHandlerInterface<
::test_versions::Protocol>,
public ::fidl::internal::AsyncEventHandler {
public:
WireAsyncEventHandler() = default;
};
template <>
class ::fidl::WireSyncEventHandler<::test_versions::Protocol>
: public ::fidl::internal::WireEventHandlerInterface<
::test_versions::Protocol> {
public:
WireSyncEventHandler() = default;
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the
// corresponding virtual method.
::fidl::Status HandleOneEvent(
::fidl::UnownedClientEnd<::test_versions::Protocol> client_end);
private:
[[maybe_unused]] bool got_transitional_ = false;
};
template <>
class ::fidl::internal::WireEventDispatcher<::test_versions::Protocol> final
: public ::fidl::internal::IncomingEventDispatcher<
::fidl::WireAsyncEventHandler<::test_versions::Protocol>> {
public:
explicit WireEventDispatcher(
::fidl::WireAsyncEventHandler<::test_versions::Protocol>* event_handler)
: IncomingEventDispatcher(event_handler) {}
private:
std::optional<::fidl::UnbindInfo> DispatchEvent(
::fidl::IncomingMessage& msg,
::fidl::internal::IncomingTransportContext transport_context) override;
};
// Methods to make a sync FIDL call directly on an unowned handle or a
// const reference to a |fidl::ClientEnd<::test_versions::Protocol>|,
// avoiding setting up a client.
template <>
class ::fidl::internal::WireSyncClientImpl<::test_versions::Protocol> final
: public ::fidl::internal::SyncEndpointManagedVeneer<
::fidl::internal::WireSyncClientImpl<::test_versions::Protocol>> {
public:
// Allocates 32 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::WireResult<::test_versions::Protocol::Foo> Foo() {
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>
_request{};
return ::fidl::WireResult<::test_versions::Protocol::Foo>(_client_end(),
&_request);
}
private:
::fidl::UnownedClientEnd<::test_versions::Protocol> _client_end() const {
return ::fidl::UnownedClientEnd<::test_versions::Protocol>(
_transport().get<::fidl::internal::ChannelTransport>());
}
};
template <>
class ::fidl::internal::WireSyncBufferClientImpl<::test_versions::Protocol>
final : public ::fidl::internal::SyncEndpointBufferVeneer<
::fidl::internal::WireSyncBufferClientImpl<
::test_versions::Protocol>> {
public:
// Caller provides the backing storage for FIDL message via an argument to
// `.buffer()`.
::fidl::WireUnownedResult<::test_versions::Protocol::Foo> Foo() {
::fidl::internal::TransactionalRequest<::test_versions::Protocol::Foo>
_request{};
return ::fidl::WireUnownedResult<::test_versions::Protocol::Foo>(
_client_end(), _allocator(), &_request);
}
private:
::fidl::UnownedClientEnd<::test_versions::Protocol> _client_end() const {
return ::fidl::UnownedClientEnd<::test_versions::Protocol>(
_transport().get<::fidl::internal::ChannelTransport>());
}
};
// Pure-virtual interface to be implemented by a server.
// This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>|
// and |fidl::ServerEnd<SomeProtocol>|).
template <>
class ::fidl::WireServer<::test_versions::Protocol>
: public ::fidl::internal::IncomingMessageDispatcher {
public:
WireServer() = default;
virtual ~WireServer() = default;
// The FIDL protocol type that is implemented by this server.
using _EnclosingProtocol = ::test_versions::Protocol;
using FooCompleter =
::fidl::internal::WireCompleter<::test_versions::Protocol::Foo>;
using FooRequestView =
::fidl::internal::WireRequestView<::test_versions::Protocol::Foo>;
virtual void Foo(FooRequestView request, FooCompleter::Sync& completer) = 0;
private:
void dispatch_message(
::fidl::IncomingMessage&& msg, ::fidl::Transaction* txn,
::fidl::internal::IncomingTransportContext transport_context) final;
};
namespace test_versions {
#endif // __Fuchsia__
class Service final {
Service() = default;
public:
static constexpr char Name[] = "test.versions.Service";
// Client protocol for connecting to member protocols of a service instance.
class ServiceClient final {
ServiceClient() = delete;
public:
ServiceClient(::zx::channel dir,
::fidl::internal::ConnectMemberFunc connect_func)
: dir_(std::move(dir)), connect_func_(connect_func) {}
// Connects to the member protocol "p".
// Returns a |fidl::ClientEnd<::test_versions::Protocol>| on success,
// which can be used with |fidl::BindSyncClient| to create a synchronous
// client, or |fidl::WireClient| or |fidl::WireSharedClient| to create a
// client that supports both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::test_versions::Protocol>> connect_p() {
auto endpoints = ::fidl::CreateEndpoints<::test_versions::Protocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection =
connect_func_(::zx::unowned_channel(dir_), ::fidl::StringView("p"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
private:
::zx::channel dir_;
::fidl::internal::ConnectMemberFunc connect_func_;
};
// Facilitates member protocol registration for servers.
class Handler final {
public:
// Constructs a FIDL Service-typed handler. Does not take ownership of
// |service_handler|.
explicit Handler(::fidl::ServiceHandlerInterface* service_handler)
: service_handler_(service_handler) {}
// Adds member "p" to the service instance. |handler| will be invoked on
// connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_p(::fidl::ServiceHandlerInterface::MemberHandler<
::test_versions::Protocol>
handler) {
return service_handler_->AddMember("p", std::move(handler));
}
private:
::fidl::ServiceHandlerInterface* service_handler_; // Not owned.
};
};
} // namespace test_versions
namespace fidl {
#ifdef __Fuchsia__
} // namespace fidl
template <>
class ::fidl::internal::WireWeakOnewayClientImpl<::test_versions::OtherProtocol>
: public ::fidl::internal::ClientImplBase {
public:
using ClientImplBase::ClientImplBase;
};
template <>
class ::fidl::internal::WireWeakAsyncClientImpl<::test_versions::OtherProtocol>
final : public ::fidl::internal::WireWeakOnewayClientImpl<
::test_versions::OtherProtocol> {
public:
using WireWeakOnewayClientImpl::WireWeakOnewayClientImpl;
};
template <>
class ::fidl::internal::WireWeakOnewayBufferClientImpl<
::test_versions::OtherProtocol>
: public ::fidl::internal::BufferClientImplBase {
public:
using BufferClientImplBase::BufferClientImplBase;
};
template <>
class ::fidl::internal::WireWeakAsyncBufferClientImpl<
::test_versions::OtherProtocol>
final : public ::fidl::internal::WireWeakOnewayBufferClientImpl<
::test_versions::OtherProtocol> {
public:
using WireWeakOnewayBufferClientImpl::WireWeakOnewayBufferClientImpl;
};
template <>
class ::fidl::internal::WireWeakSyncClientImpl<::test_versions::OtherProtocol>
final : public ::fidl::internal::WireWeakOnewayClientImpl<
::test_versions::OtherProtocol> {
public:
using WireWeakOnewayClientImpl::WireWeakOnewayClientImpl;
};
namespace fidl {
#endif // __Fuchsia__
} // namespace fidl
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireWeakEventSender<::test_versions::OtherProtocol>
: public ::fidl::internal::WeakEventSenderBase {
public:
using WeakEventSenderBase::WeakEventSenderBase;
};
template <>
class ::fidl::internal::WireWeakBufferEventSender<
::test_versions::OtherProtocol>
: public ::fidl::internal::WeakBufferEventSenderBase {
public:
using WeakBufferEventSenderBase::WeakBufferEventSenderBase;
};
template <>
class ::fidl::internal::WireEventSender<::test_versions::OtherProtocol>
: public ::fidl::internal::SyncEndpointManagedVeneer<
::fidl::internal::WireEventSender<::test_versions::OtherProtocol>> {
public:
using SyncEndpointManagedVeneer::SyncEndpointManagedVeneer;
};
template <>
class ::fidl::internal::WireBufferEventSender<::test_versions::OtherProtocol>
: public ::fidl::internal::SyncEndpointBufferVeneer<
::fidl::internal::WireBufferEventSender<
::test_versions::OtherProtocol>> {
public:
using SyncEndpointBufferVeneer::SyncEndpointBufferVeneer;
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireWeakOnewayClientImpl<::test_versions::Protocol>
: public ::fidl::internal::ClientImplBase {
public:
using ClientImplBase::ClientImplBase;
// Allocates 32 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::Status Foo();
};
template <>
class ::fidl::internal::WireWeakAsyncClientImpl<::test_versions::Protocol> final
: public ::fidl::internal::WireWeakOnewayClientImpl<
::test_versions::Protocol> {
public:
using WireWeakOnewayClientImpl::WireWeakOnewayClientImpl;
};
template <>
class ::fidl::internal::WireWeakOnewayBufferClientImpl<
::test_versions::Protocol> : public ::fidl::internal::BufferClientImplBase {
public:
using BufferClientImplBase::BufferClientImplBase;
// Caller provides the backing storage for FIDL message.
::fidl::Status Foo();
};
template <>
class ::fidl::internal::WireWeakAsyncBufferClientImpl<::test_versions::Protocol>
final : public ::fidl::internal::WireWeakOnewayBufferClientImpl<
::test_versions::Protocol> {
public:
using WireWeakOnewayBufferClientImpl::WireWeakOnewayBufferClientImpl;
};
template <>
class ::fidl::internal::WireWeakSyncClientImpl<::test_versions::Protocol> final
: public ::fidl::internal::WireWeakOnewayClientImpl<
::test_versions::Protocol> {
public:
using WireWeakOnewayClientImpl::WireWeakOnewayClientImpl;
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireWeakEventSender<::test_versions::Protocol>
: public ::fidl::internal::WeakEventSenderBase {
public:
using WeakEventSenderBase::WeakEventSenderBase;
};
template <>
class ::fidl::internal::WireWeakBufferEventSender<::test_versions::Protocol>
: public ::fidl::internal::WeakBufferEventSenderBase {
public:
using WeakBufferEventSenderBase::WeakBufferEventSenderBase;
};
template <>
class ::fidl::internal::WireEventSender<::test_versions::Protocol>
: public ::fidl::internal::SyncEndpointManagedVeneer<
::fidl::internal::WireEventSender<::test_versions::Protocol>> {
public:
using SyncEndpointManagedVeneer::SyncEndpointManagedVeneer;
};
template <>
class ::fidl::internal::WireBufferEventSender<::test_versions::Protocol>
: public ::fidl::internal::SyncEndpointBufferVeneer<
::fidl::internal::WireBufferEventSender<::test_versions::Protocol>> {
public:
using SyncEndpointBufferVeneer::SyncEndpointBufferVeneer;
};
#endif // __Fuchsia__