//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/psm/PPKCS11ModuleParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/psm/PKCS11ModuleParent.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace psm {
auto PPKCS11ModuleParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PPKCS11ModuleParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PPKCS11ModuleParent::PPKCS11ModuleParent() :
mozilla::ipc::IToplevelProtocol("PPKCS11ModuleParent", kProtocolId, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PPKCS11ModuleParent);
}
PPKCS11ModuleParent::~PPKCS11ModuleParent()
{
MOZ_COUNT_DTOR(PPKCS11ModuleParent);
}
auto PPKCS11ModuleParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PPKCS11ModuleParent'");
AddRef();
}
auto PPKCS11ModuleParent::ActorDealloc() -> void
{
Release();
}
auto PPKCS11ModuleParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PPKCS11ModuleParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PPKCS11ModuleParent::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PPKCS11ModuleParent::SendAddModule(
const nsACString& aModuleName,
const nsACString& aLibraryPath,
const uint32_t& aMechanismFlags,
const uint32_t& aCipherFlags,
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PPKCS11Module::Msg_AddModule(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aModuleName);
// Sentinel = 'aModuleName'
((&(writer__)))->WriteSentinel(428672073);
IPC::WriteParam((&(writer__)), aLibraryPath);
// Sentinel = 'aLibraryPath'
((&(writer__)))->WriteSentinel(509281476);
IPC::WriteParam((&(writer__)), aMechanismFlags);
// Sentinel = 'aMechanismFlags'
((&(writer__)))->WriteSentinel(776340964);
IPC::WriteParam((&(writer__)), aCipherFlags);
// Sentinel = 'aCipherFlags'
((&(writer__)))->WriteSentinel(497288362);
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_AddModule", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PPKCS11Module::Reply_AddModule__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PPKCS11ModuleParent::SendAddModule(
const nsACString& aModuleName,
const nsACString& aLibraryPath,
const uint32_t& aMechanismFlags,
const uint32_t& aCipherFlags) -> RefPtr<AddModulePromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendAddModule(std::move(aModuleName), std::move(aLibraryPath), std::move(aMechanismFlags), std::move(aCipherFlags), [promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PPKCS11ModuleParent::SendDeleteModule(
const nsACString& aModuleName,
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PPKCS11Module::Msg_DeleteModule(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aModuleName);
// Sentinel = 'aModuleName'
((&(writer__)))->WriteSentinel(428672073);
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_DeleteModule", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PPKCS11Module::Reply_DeleteModule__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PPKCS11ModuleParent::SendDeleteModule(const nsACString& aModuleName) -> RefPtr<DeleteModulePromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendDeleteModule(std::move(aModuleName), [promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PPKCS11ModuleParent::SendListModules(
mozilla::ipc::ResolveCallback<std::tuple<nsresult, nsTArray<ModuleInfo>>>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PPKCS11Module::Msg_ListModules(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_ListModules", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PPKCS11Module::Reply_ListModules__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto maybe__modules = IPC::ReadParam<nsTArray<ModuleInfo>>(aReader);
if (!maybe__modules) {
(aReader)->FatalError("Error deserializing 'ModuleInfo[]'");
return MsgValueError;
}
auto& modules = *maybe__modules;
// Sentinel = 'modules'
if ((!((aReader)->ReadSentinel(199557882)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ModuleInfo[]'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::make_tuple(std::move(rv), std::move(modules)));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PPKCS11ModuleParent::SendListModules() -> RefPtr<ListModulesPromise>
{
RefPtr<MozPromise<std::tuple<nsresult, nsTArray<ModuleInfo>>, ResponseRejectReason, true>::Private> promise__ = new MozPromise<std::tuple<nsresult, nsTArray<ModuleInfo>>, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendListModules([promise__](std::tuple<nsresult, nsTArray<ModuleInfo>>&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PPKCS11ModuleParent::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PPKCS11ModuleParent::OnMessageReceived(const Message& msg__) -> PPKCS11ModuleParent::Result
{
switch (msg__.type()) {
case PPKCS11Module::Reply_AddModule__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_AddModule", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PPKCS11Module::Reply_DeleteModule__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_DeleteModule", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PPKCS11Module::Reply_ListModules__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PPKCS11Module", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PPKCS11ModuleParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PPKCS11Module::Msg_ListModules", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
default:
return MsgNotKnown;
case SHMEM_CREATED_MESSAGE_TYPE:
{
if (!ShmemCreated(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
case SHMEM_DESTROYED_MESSAGE_TYPE:
{
if (!ShmemDestroyed(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
}
}
auto PPKCS11ModuleParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PPKCS11ModuleParent::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace psm
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::psm::PPKCS11ModuleParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
// Sentinel = 'PPKCS11Module'
(aWriter)->WriteSentinel(463668298);
}
auto ParamTraits<::mozilla::psm::PPKCS11ModuleParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
if (!maybe__actor) {
aReader->FatalError("Error deserializing managed PPKCS11Module actor");
return {};
}
auto& actor = *maybe__actor;
// Sentinel = 'PPKCS11Module'
if ((!((aReader)->ReadSentinel(463668298)))) {
mozilla::ipc::SentinelReadError("Error deserializing managed PPKCS11Module actor");
return {};
}
if (actor && actor->GetProtocolId() != PPKCS11ModuleMsgStart) {
aReader->FatalError("Unexpected actor type (expected PPKCS11Module)");
return {};
}
return static_cast<::mozilla::psm::PPKCS11ModuleParent*>(actor);
}
} // namespace IPC