//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/psm/PSelectTLSClientAuthCertParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/psm/SelectTLSClientAuthCertParent.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 PSelectTLSClientAuthCertParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PSelectTLSClientAuthCertParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

MOZ_IMPLICIT PSelectTLSClientAuthCertParent::PSelectTLSClientAuthCertParent() :
    mozilla::ipc::IToplevelProtocol("PSelectTLSClientAuthCertParent", kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PSelectTLSClientAuthCertParent);
}

PSelectTLSClientAuthCertParent::~PSelectTLSClientAuthCertParent()
{
    MOZ_COUNT_DTOR(PSelectTLSClientAuthCertParent);
}

auto PSelectTLSClientAuthCertParent::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PSelectTLSClientAuthCertParent'");
    AddRef();
}

auto PSelectTLSClientAuthCertParent::ActorDealloc() -> void
{
    Release();
}

auto PSelectTLSClientAuthCertParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    return {};
}

auto PSelectTLSClientAuthCertParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    default:
        return nullptr;
    }
}

auto PSelectTLSClientAuthCertParent::SendTLSClientAuthCertSelected(
        const ByteArray& aSelectedCertBytes,
        mozilla::Span<ByteArray const> aSelectedCertChainBytes) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSelectTLSClientAuthCert::Msg_TLSClientAuthCertSelected(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aSelectedCertBytes);
    // Sentinel = 'aSelectedCertBytes'
    ((&(writer__)))->WriteSentinel(1114048288);
    IPC::WriteParam((&(writer__)), aSelectedCertChainBytes);
    // Sentinel = 'aSelectedCertChainBytes'
    ((&(writer__)))->WriteSentinel(1789200643);


    if (mozilla::ipc::LoggingEnabledFor("PSelectTLSClientAuthCert", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PSelectTLSClientAuthCertParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PSelectTLSClientAuthCert::Msg_TLSClientAuthCertSelected", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PSelectTLSClientAuthCertParent::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}

auto PSelectTLSClientAuthCertParent::OnMessageReceived(const Message& msg__) -> PSelectTLSClientAuthCertParent::Result
{
    switch (msg__.type()) {
    case PSelectTLSClientAuthCert::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    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 PSelectTLSClientAuthCertParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PSelectTLSClientAuthCertParent::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace psm
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::psm::PSelectTLSClientAuthCertParent*>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
    // Sentinel = 'PSelectTLSClientAuthCert'
    (aWriter)->WriteSentinel(1870924067);
}

auto ParamTraits<::mozilla::psm::PSelectTLSClientAuthCertParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
    if (!maybe__actor) {
        aReader->FatalError("Error deserializing managed PSelectTLSClientAuthCert actor");
        return {};

    }
    auto& actor = *maybe__actor;
    // Sentinel = 'PSelectTLSClientAuthCert'
    if ((!((aReader)->ReadSentinel(1870924067)))) {
        mozilla::ipc::SentinelReadError("Error deserializing managed PSelectTLSClientAuthCert actor");
        return {};
    }

    if (actor && actor->GetProtocolId() != PSelectTLSClientAuthCertMsgStart) {
        aReader->FatalError("Unexpected actor type (expected PSelectTLSClientAuthCert)");

        return {};
    }
    return static_cast<::mozilla::psm::PSelectTLSClientAuthCertParent*>(actor);
}

} // namespace IPC
