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


#include "mozilla/net/PSocketProcessBackgroundParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/net/SocketProcessBackgroundParent.h"

#include "mozilla/psm/PVerifySSLServerCertParent.h"
#include "mozilla/psm/PSelectTLSClientAuthCertParent.h"
#include "mozilla/psm/PIPCClientCertsParent.h"
#include "mozilla/net/PWebSocketConnectionParent.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 net {


auto PSocketProcessBackgroundParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

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

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

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

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

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

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

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

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

auto PSocketProcessBackgroundParent::OnMessageReceived(const Message& msg__) -> PSocketProcessBackgroundParent::Result
{
    switch (msg__.type()) {
    case PSocketProcessBackground::Msg_InitVerifySSLServerCert__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSocketProcessBackground", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSocketProcessBackgroundParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSocketProcessBackground::Msg_InitVerifySSLServerCert", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::psm::PVerifySSLServerCertParent>>((&(reader__)));
            if (!maybe__aEndpoint) {
                FatalError("Error deserializing 'Endpoint<::mozilla::psm::PVerifySSLServerCertParent>'");
                return MsgValueError;

            }
            auto& aEndpoint = *maybe__aEndpoint;
            // Sentinel = 'aEndpoint'
            if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::psm::PVerifySSLServerCertParent>'");
                return MsgValueError;
            }
            auto maybe__aPeerCertChain = IPC::ReadParam<nsTArray<ByteArray>>((&(reader__)));
            if (!maybe__aPeerCertChain) {
                FatalError("Error deserializing 'ByteArray[]'");
                return MsgValueError;

            }
            auto& aPeerCertChain = *maybe__aPeerCertChain;
            // Sentinel = 'aPeerCertChain'
            if ((!(((&(reader__)))->ReadSentinel(664667487)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteArray[]'");
                return MsgValueError;
            }
            auto maybe__aHostName = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aHostName) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;

            }
            auto& aHostName = *maybe__aHostName;
            // Sentinel = 'aHostName'
            if ((!(((&(reader__)))->ReadSentinel(290128769)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto maybe__aPort = IPC::ReadParam<int32_t>((&(reader__)));
            if (!maybe__aPort) {
                FatalError("Error deserializing 'int32_t'");
                return MsgValueError;

            }
            auto& aPort = *maybe__aPort;
            // Sentinel = 'aPort'
            if ((!(((&(reader__)))->ReadSentinel(97452551)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'int32_t'");
                return MsgValueError;
            }
            auto maybe__aOriginAttributes = IPC::ReadParam<OriginAttributes>((&(reader__)));
            if (!maybe__aOriginAttributes) {
                FatalError("Error deserializing 'OriginAttributes'");
                return MsgValueError;

            }
            auto& aOriginAttributes = *maybe__aOriginAttributes;
            // Sentinel = 'aOriginAttributes'
            if ((!(((&(reader__)))->ReadSentinel(1021839089)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'OriginAttributes'");
                return MsgValueError;
            }
            auto maybe__aStapledOCSPResponse = IPC::ReadParam<mozilla::Maybe<ByteArray>>((&(reader__)));
            if (!maybe__aStapledOCSPResponse) {
                FatalError("Error deserializing 'ByteArray?'");
                return MsgValueError;

            }
            auto& aStapledOCSPResponse = *maybe__aStapledOCSPResponse;
            // Sentinel = 'aStapledOCSPResponse'
            if ((!(((&(reader__)))->ReadSentinel(1333856179)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteArray?'");
                return MsgValueError;
            }
            auto maybe__aSctsFromTLSExtension = IPC::ReadParam<mozilla::Maybe<ByteArray>>((&(reader__)));
            if (!maybe__aSctsFromTLSExtension) {
                FatalError("Error deserializing 'ByteArray?'");
                return MsgValueError;

            }
            auto& aSctsFromTLSExtension = *maybe__aSctsFromTLSExtension;
            // Sentinel = 'aSctsFromTLSExtension'
            if ((!(((&(reader__)))->ReadSentinel(1492453443)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteArray?'");
                return MsgValueError;
            }
            auto maybe__aDcInfo = IPC::ReadParam<mozilla::Maybe<DelegatedCredentialInfoArg>>((&(reader__)));
            if (!maybe__aDcInfo) {
                FatalError("Error deserializing 'DelegatedCredentialInfoArg?'");
                return MsgValueError;

            }
            auto& aDcInfo = *maybe__aDcInfo;
            // Sentinel = 'aDcInfo'
            if ((!(((&(reader__)))->ReadSentinel(165544597)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'DelegatedCredentialInfoArg?'");
                return MsgValueError;
            }
            auto maybe__aProviderFlags = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aProviderFlags) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aProviderFlags = *maybe__aProviderFlags;
            // Sentinel = 'aProviderFlags'
            if ((!(((&(reader__)))->ReadSentinel(701957530)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto maybe__aCertVerifierFlags = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aCertVerifierFlags) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aCertVerifierFlags = *maybe__aCertVerifierFlags;
            // Sentinel = 'aCertVerifierFlags'
            if ((!(((&(reader__)))->ReadSentinel(1116079897)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<SocketProcessBackgroundParent*>(this))->RecvInitVerifySSLServerCert(std::move(aEndpoint), std::move(aPeerCertChain), std::move(aHostName), std::move(aPort), std::move(aOriginAttributes), std::move(aStapledOCSPResponse), std::move(aSctsFromTLSExtension), std::move(aDcInfo), std::move(aProviderFlags), std::move(aCertVerifierFlags));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PSocketProcessBackground::Msg_InitSelectTLSClientAuthCert__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSocketProcessBackground", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSocketProcessBackgroundParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSocketProcessBackground::Msg_InitSelectTLSClientAuthCert", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::psm::PSelectTLSClientAuthCertParent>>((&(reader__)));
            if (!maybe__aEndpoint) {
                FatalError("Error deserializing 'Endpoint<::mozilla::psm::PSelectTLSClientAuthCertParent>'");
                return MsgValueError;

            }
            auto& aEndpoint = *maybe__aEndpoint;
            // Sentinel = 'aEndpoint'
            if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::psm::PSelectTLSClientAuthCertParent>'");
                return MsgValueError;
            }
            auto maybe__aHostName = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aHostName) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;

            }
            auto& aHostName = *maybe__aHostName;
            // Sentinel = 'aHostName'
            if ((!(((&(reader__)))->ReadSentinel(290128769)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto maybe__aOriginAttributes = IPC::ReadParam<OriginAttributes>((&(reader__)));
            if (!maybe__aOriginAttributes) {
                FatalError("Error deserializing 'OriginAttributes'");
                return MsgValueError;

            }
            auto& aOriginAttributes = *maybe__aOriginAttributes;
            // Sentinel = 'aOriginAttributes'
            if ((!(((&(reader__)))->ReadSentinel(1021839089)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'OriginAttributes'");
                return MsgValueError;
            }
            auto maybe__aPort = IPC::ReadParam<int32_t>((&(reader__)));
            if (!maybe__aPort) {
                FatalError("Error deserializing 'int32_t'");
                return MsgValueError;

            }
            auto& aPort = *maybe__aPort;
            // Sentinel = 'aPort'
            if ((!(((&(reader__)))->ReadSentinel(97452551)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'int32_t'");
                return MsgValueError;
            }
            auto maybe__aProviderFlags = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aProviderFlags) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aProviderFlags = *maybe__aProviderFlags;
            // Sentinel = 'aProviderFlags'
            if ((!(((&(reader__)))->ReadSentinel(701957530)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto maybe__aProviderTlsFlags = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aProviderTlsFlags) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aProviderTlsFlags = *maybe__aProviderTlsFlags;
            // Sentinel = 'aProviderTlsFlags'
            if ((!(((&(reader__)))->ReadSentinel(1025771213)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto maybe__aServerCertBytes = IPC::ReadParam<ByteArray>((&(reader__)));
            if (!maybe__aServerCertBytes) {
                FatalError("Error deserializing 'ByteArray'");
                return MsgValueError;

            }
            auto& aServerCertBytes = *maybe__aServerCertBytes;
            // Sentinel = 'aServerCertBytes'
            if ((!(((&(reader__)))->ReadSentinel(901777006)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteArray'");
                return MsgValueError;
            }
            auto maybe__aCANames = IPC::ReadParam<nsTArray<ByteArray>>((&(reader__)));
            if (!maybe__aCANames) {
                FatalError("Error deserializing 'ByteArray[]'");
                return MsgValueError;

            }
            auto& aCANames = *maybe__aCANames;
            // Sentinel = 'aCANames'
            if ((!(((&(reader__)))->ReadSentinel(200868570)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteArray[]'");
                return MsgValueError;
            }
            auto maybe__aBrowserId = IPC::ReadParam<uint64_t>((&(reader__)));
            if (!maybe__aBrowserId) {
                FatalError("Error deserializing 'uint64_t'");
                return MsgValueError;

            }
            auto& aBrowserId = *maybe__aBrowserId;
            // Sentinel = 'aBrowserId'
            if ((!(((&(reader__)))->ReadSentinel(363332595)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<SocketProcessBackgroundParent*>(this))->RecvInitSelectTLSClientAuthCert(std::move(aEndpoint), std::move(aHostName), std::move(aOriginAttributes), std::move(aPort), std::move(aProviderFlags), std::move(aProviderTlsFlags), std::move(aServerCertBytes), std::move(aCANames), std::move(aBrowserId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PSocketProcessBackground::Msg_InitIPCClientCerts__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSocketProcessBackground", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSocketProcessBackgroundParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSocketProcessBackground::Msg_InitIPCClientCerts", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::psm::PIPCClientCertsParent>>((&(reader__)));
            if (!maybe__aEndpoint) {
                FatalError("Error deserializing 'Endpoint<::mozilla::psm::PIPCClientCertsParent>'");
                return MsgValueError;

            }
            auto& aEndpoint = *maybe__aEndpoint;
            // Sentinel = 'aEndpoint'
            if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::psm::PIPCClientCertsParent>'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<SocketProcessBackgroundParent*>(this))->RecvInitIPCClientCerts(std::move(aEndpoint));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PSocketProcessBackground::Msg_InitWebSocketConnection__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSocketProcessBackground", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSocketProcessBackgroundParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSocketProcessBackground::Msg_InitWebSocketConnection", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::net::PWebSocketConnectionParent>>((&(reader__)));
            if (!maybe__aEndpoint) {
                FatalError("Error deserializing 'Endpoint<::mozilla::net::PWebSocketConnectionParent>'");
                return MsgValueError;

            }
            auto& aEndpoint = *maybe__aEndpoint;
            // Sentinel = 'aEndpoint'
            if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::net::PWebSocketConnectionParent>'");
                return MsgValueError;
            }
            auto maybe__aListenerId = IPC::ReadParam<uint32_t>((&(reader__)));
            if (!maybe__aListenerId) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;

            }
            auto& aListenerId = *maybe__aListenerId;
            // Sentinel = 'aListenerId'
            if ((!(((&(reader__)))->ReadSentinel(436667477)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<SocketProcessBackgroundParent*>(this))->RecvInitWebSocketConnection(std::move(aEndpoint), std::move(aListenerId));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            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 PSocketProcessBackgroundParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PSocketProcessBackgroundParent::Result
{
    return MsgNotKnown;
}



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

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

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

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

        return {};
    }
    return static_cast<::mozilla::net::PSocketProcessBackgroundParent*>(actor);
}

} // namespace IPC
