blob: f6e6a9f7ad48c7293acd72cc7e5c3679d5df6371 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#include <fidl/test.drivertwoway/cpp/driver/wire_messaging.h>
#include <memory>
namespace test_drivertwoway {
[[maybe_unused]] constexpr uint64_t kTwoWay_Add_Ordinal = 989730524426044687lu;
[[maybe_unused]] constexpr ::fidl::MessageDynamicFlags
kTwoWay_Add_DynamicFlags = ::fidl::MessageDynamicFlags::kStrictMethod;
extern "C" const fidl_type_t test_drivertwoway_TwoWayAddRequestTable;
extern "C" const fidl_type_t test_drivertwoway_TwoWayAddTopResponseTable;
#ifdef __Fuchsia__
} // namespace test_drivertwoway
::fdf::WireUnownedResult<::test_drivertwoway::TwoWay::Add>::WireUnownedResult(
::fdf::UnownedClientEnd<::test_drivertwoway::TwoWay> client_end,
const ::fdf::Arena& arena,
::fidl::internal::TransactionalRequest<::test_drivertwoway::TwoWay::Add>*
request) {
constexpr uint32_t buffer_size = ::fidl::MaxSizeInChannel<
::fidl::internal::TransactionalRequest<::test_drivertwoway::TwoWay::Add>,
::fidl::MessageDirection::kSending>();
uint8_t* buffer = static_cast<uint8_t*>(arena.Allocate(buffer_size));
::fidl::unstable::UnownedEncodedMessage<
::fidl::internal::TransactionalRequest<::test_drivertwoway::TwoWay::Add>,
fidl::internal::DriverTransport>
request_message(buffer, buffer_size, request);
auto& outgoing = request_message.GetOutgoingMessage();
::fidl::internal::IncomingTransportContext incoming_context;
::fidl::CallOptions call_options = {
.outgoing_transport_context =
::fidl::internal::OutgoingTransportContext::Create<
fidl::internal::DriverTransport>(arena.get()),
.out_incoming_transport_context = &incoming_context,
};
uint32_t call_result_num_bytes;
outgoing.Call<::fidl::internal::TransactionalResponse<
::test_drivertwoway::TwoWay::Add>>(client_end.handle(), &bytes_,
&call_result_num_bytes,
std::move(call_options));
arena_ =
fdf::Arena(incoming_context.release<fidl::internal::DriverTransport>());
::fidl::Status::operator=(outgoing);
}
namespace test_drivertwoway {
#endif // __Fuchsia__
#ifdef __Fuchsia__
} // namespace test_drivertwoway
::fidl::internal::WireBufferThenable<::test_drivertwoway::TwoWay::Add>
fidl::internal::WireWeakAsyncBufferClientImpl<::test_drivertwoway::TwoWay>::Add(
uint16_t addend1, uint16_t addend2) {
constexpr uint32_t _buffer_size =
::fidl::AsyncClientMethodBufferSizeInChannel<
::test_drivertwoway::TwoWay::Add>();
uint8_t* _buffer = static_cast<uint8_t*>(_arena().Allocate(_buffer_size));
::fidl::internal::TransactionalRequest<::test_drivertwoway::TwoWay::Add>
_request{addend1, addend2};
fidl::WriteOptions _options = {};
_options.outgoing_transport_context =
::fidl::internal::OutgoingTransportContext::Create<
::fidl::internal::DriverTransport>(_arena().get());
return ::fidl::internal::WireBufferThenable<::test_drivertwoway::TwoWay::Add>{
_client_base(), std::move(_options), _buffer, _buffer_size, &_request};
}
::fdf::WireUnownedResult<::test_drivertwoway::TwoWay::Add>
fidl::internal::WireWeakSyncClientImpl<::test_drivertwoway::TwoWay>::Add(
uint16_t addend1, uint16_t addend2) {
return _client_base()->MakeSyncCallWith(
[&](std::shared_ptr<::fidl::internal::AnyTransport> _transport) {
::fidl::internal::TransactionalRequest<::test_drivertwoway::TwoWay::Add>
_request{addend1, addend2};
return ::fdf::WireUnownedResult<::test_drivertwoway::TwoWay::Add>(
::fdf::UnownedClientEnd<::test_drivertwoway::TwoWay>(
_transport->get<::fidl::internal::DriverTransport>()),
arena_, &_request);
});
}
namespace test_drivertwoway {
#endif // __Fuchsia__
} // namespace test_drivertwoway
#ifdef __Fuchsia__
::fidl::Status
fidl::WireSyncEventHandler<::test_drivertwoway::TwoWay>::HandleOneEvent(
::fdf::UnownedClientEnd<::test_drivertwoway::TwoWay> client_end) {
ZX_PANIC("events not supported for transport 'Driver'");
}
std::optional<::fidl::UnbindInfo>
fidl::internal::WireEventDispatcher<::test_drivertwoway::TwoWay>::DispatchEvent(
fidl::IncomingMessage& msg,
internal::IncomingTransportContext transport_context) {
ZX_PANIC("events not supported for transport 'Driver'");
}
#endif // __Fuchsia__
#ifdef __Fuchsia__
constexpr ::fidl::internal::MethodEntry fidl::internal::WireServerDispatcher<
::test_drivertwoway::TwoWay>::entries_[] = {
{
::test_drivertwoway::kTwoWay_Add_Ordinal,
[](void* interface, ::fidl::IncomingMessage&& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn) {
::fidl::unstable::DecodedMessage<
::fidl::internal::TransactionalRequest<
::test_drivertwoway::TwoWay::Add>>
decoded{std::move(msg)};
if (unlikely(!decoded.ok())) {
return decoded.status();
}
auto* primary = &decoded.PrimaryObject()->body;
::fidl::internal::WireCompleter<
::test_drivertwoway::TwoWay::Add>::Sync completer(txn);
fdf::Arena arena(
transport_context.release<::fidl::internal::DriverTransport>());
reinterpret_cast<::fdf::WireServer<::test_drivertwoway::TwoWay>*>(
interface)
->Add(primary, arena, completer);
return ZX_OK;
},
},
};
const ::fidl::internal::MethodEntry* fidl::internal::WireServerDispatcher<
::test_drivertwoway::TwoWay>::entries_end_ = &entries_[1];
::fidl::DispatchResult
fidl::internal::WireServerDispatcher<::test_drivertwoway::TwoWay>::TryDispatch(
::fdf::WireServer<::test_drivertwoway::TwoWay>* impl,
::fidl::IncomingMessage& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn) {
return ::fidl::internal::TryDispatch(impl, msg, std::move(transport_context),
txn, entries_, entries_end_);
}
void fidl::internal::WireServerDispatcher<::test_drivertwoway::TwoWay>::
Dispatch(::fdf::WireServer<::test_drivertwoway::TwoWay>* impl,
::fidl::IncomingMessage&& msg,
internal::IncomingTransportContext transport_context,
::fidl::Transaction* txn) {
::fidl::internal::Dispatch(impl, msg, std::move(transport_context), txn,
entries_, entries_end_);
}
void fdf::WireServer<::test_drivertwoway::TwoWay>::dispatch_message(
::fidl::IncomingMessage&& msg, ::fidl::Transaction* txn,
::fidl::internal::IncomingTransportContext transport_context) {
::fidl::internal::WireServerDispatcher<::test_drivertwoway::TwoWay>::Dispatch(
this, std::move(msg), std::move(transport_context), txn);
}
#endif // __Fuchsia__
#ifdef __Fuchsia__
void fidl::internal::WireBufferCompleterImpl<
::test_drivertwoway::TwoWay::Add>::Reply(uint16_t sum) {
::fidl::internal::TransactionalResponse<::test_drivertwoway::TwoWay::Add>
_response{sum};
constexpr uint32_t _buffer_size = ::fidl::ServerReplyBufferSizeInChannel<
::test_drivertwoway::TwoWay::Add>();
uint8_t* _buffer = static_cast<uint8_t*>(_arena().Allocate(_buffer_size));
::fidl::unstable::UnownedEncodedMessage<
::fidl::internal::TransactionalResponse<::test_drivertwoway::TwoWay::Add>,
::fidl::internal::DriverTransport>
_response_message(_buffer, _buffer_size, &_response);
return _core()->SendReply(
&_response_message.GetOutgoingMessage(),
::fidl::internal::OutgoingTransportContext::Create<
::fidl::internal::DriverTransport>(_arena().get()));
}
#endif // __Fuchsia__
void ::fidl::internal::TransactionalRequest<
::test_drivertwoway::TwoWay::Add>::_InitHeader() {
::fidl::InitTxnHeader(&header, 0, ::test_drivertwoway::kTwoWay_Add_Ordinal,
::test_drivertwoway::kTwoWay_Add_DynamicFlags);
}
void ::fidl::internal::TransactionalResponse<
::test_drivertwoway::TwoWay::Add>::_InitHeader() {
::fidl::InitTxnHeader(&header, 0, ::test_drivertwoway::kTwoWay_Add_Ordinal,
::test_drivertwoway::kTwoWay_Add_DynamicFlags);
}