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


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

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

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

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

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

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

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

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

auto PVerifySSLServerCertParent::SendOnVerifySSLServerCertFinished(
        mozilla::Span<ByteArray const> aBuiltCertChain,
        const uint16_t& aCertTransparencyStatus,
        const EVStatus& aEVStatus,
        const bool& aSucceeded,
        const int32_t& aFinalError,
        const OverridableErrorCategory& aOverridableErrorCategory,
        const bool& aIsBuiltCertChainRootBuiltInRoot,
        const bool& aMadeOCSPRequests) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVerifySSLServerCert::Msg_OnVerifySSLServerCertFinished(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aBuiltCertChain);
    // Sentinel = 'aBuiltCertChain'
    ((&(writer__)))->WriteSentinel(772670931);
    IPC::WriteParam((&(writer__)), aCertTransparencyStatus);
    // Sentinel = 'aCertTransparencyStatus'
    ((&(writer__)))->WriteSentinel(1852770670);
    IPC::WriteParam((&(writer__)), aEVStatus);
    // Sentinel = 'aEVStatus'
    ((&(writer__)))->WriteSentinel(275186561);
    IPC::WriteParam((&(writer__)), aSucceeded);
    // Sentinel = 'aSucceeded'
    ((&(writer__)))->WriteSentinel(357893095);
    IPC::WriteParam((&(writer__)), aFinalError);
    // Sentinel = 'aFinalError'
    ((&(writer__)))->WriteSentinel(420021334);
    IPC::WriteParam((&(writer__)), aOverridableErrorCategory);
    // Sentinel = 'aOverridableErrorCategory'
    ((&(writer__)))->WriteSentinel(2173635097);
    IPC::WriteParam((&(writer__)), aIsBuiltCertChainRootBuiltInRoot);
    // Sentinel = 'aIsBuiltCertChainRootBuiltInRoot'
    ((&(writer__)))->WriteSentinel(3420130446);
    IPC::WriteParam((&(writer__)), aMadeOCSPRequests);
    // Sentinel = 'aMadeOCSPRequests'
    ((&(writer__)))->WriteSentinel(919012970);


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

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

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

auto PVerifySSLServerCertParent::OnMessageReceived(const Message& msg__) -> PVerifySSLServerCertParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PVerifySSLServerCert", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PVerifySSLServerCertParent",
                this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                "Ignored message for dead actor",
                (&(msg__))->type(),
                mozilla::ipc::MessageDirection::eSending);
        }
        return MsgProcessed;

    }
    switch (msg__.type()) {
    case PVerifySSLServerCert::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 PVerifySSLServerCertParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PVerifySSLServerCertParent::Result
{
    if (!CanSend()) {
        return MsgDropped;

    }
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace psm
} // namespace mozilla
