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


#include "mozilla/net/PTRRServiceChild.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.h"
#include "mozilla/net/TRRServiceChild.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpResponseHead.h"
#include "nsIPropertyBag2.h"

#include "mozilla/net/PSocketProcessChild.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 PTRRServiceChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

MOZ_IMPLICIT PTRRServiceChild::PTRRServiceChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PTRRServiceChild);
}

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

auto PTRRServiceChild::ActorAlloc() -> void
{
    AddRef();
}

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

auto PTRRServiceChild::OtherPid() const -> ::base::ProcessId
{
    ::base::ProcessId pid =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
    MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
    return pid;
}

auto PTRRServiceChild::OtherChildID() const -> ::GeckoChildID
{
    ::GeckoChildID childID =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
    MOZ_RELEASE_ASSERT(childID != -1);
    return childID;
}

auto PTRRServiceChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
    return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}

auto PTRRServiceChild::Manager() const -> PSocketProcessChild*
{
    return static_cast<PSocketProcessChild*>(IProtocol::Manager());
}

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

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

auto PTRRServiceChild::SendNotifyNetworkConnectivityServiceObservers(const nsACString& aTopic) -> bool
{
    UniquePtr<IPC::Message> msg__ = PTRRService::Msg_NotifyNetworkConnectivityServiceObservers(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTopic);
    // Sentinel = 'aTopic'
    ((&(writer__)))->WriteSentinel(137429601);


    if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PTRRServiceChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PTRRService::Msg_NotifyNetworkConnectivityServiceObservers", OTHER);

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

auto PTRRServiceChild::SendInitTRRConnectionInfo(const bool& aForceReinit) -> bool
{
    UniquePtr<IPC::Message> msg__ = PTRRService::Msg_InitTRRConnectionInfo(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aForceReinit);
    // Sentinel = 'aForceReinit'
    ((&(writer__)))->WriteSentinel(501613756);


    if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PTRRServiceChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PTRRService::Msg_InitTRRConnectionInfo", OTHER);

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

auto PTRRServiceChild::SendSetConfirmationState(const uint32_t& aNewState) -> bool
{
    UniquePtr<IPC::Message> msg__ = PTRRService::Msg_SetConfirmationState(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aNewState);
    // Sentinel = 'aNewState'
    ((&(writer__)))->WriteSentinel(290325389);


    if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PTRRServiceChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PTRRService::Msg_SetConfirmationState", OTHER);

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

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

auto PTRRServiceChild::OnMessageReceived(const Message& msg__) -> PTRRServiceChild::Result
{
    switch (msg__.type()) {
    case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            return MsgProcessed;
        }
    case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            this->ActorDisconnected(ManagedEndpointDropped);
            return MsgProcessed;
        }
    case PTRRService::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg___delete__", OTHER);

            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->Recv__delete__();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }


            this->ActorDisconnected(Deletion);

            return MsgProcessed;
        }
    case PTRRService::Msg_UpdatePlatformDNSInformation__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_UpdatePlatformDNSInformation", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aSuffixList = IPC::ReadParam<nsTArray<nsCString>>((&(reader__)));
            if (!maybe__aSuffixList) {
                FatalError("Error deserializing 'nsCString[]'");
                return MsgValueError;

            }
            auto& aSuffixList = *maybe__aSuffixList;
            // Sentinel = 'aSuffixList'
            if ((!(((&(reader__)))->ReadSentinel(438174835)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvUpdatePlatformDNSInformation(std::move(aSuffixList));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PTRRService::Msg_UpdateParentalControlEnabled__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_UpdateParentalControlEnabled", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aEnabled = IPC::ReadParam<bool>((&(reader__)));
            if (!maybe__aEnabled) {
                FatalError("Error deserializing 'bool'");
                return MsgValueError;

            }
            auto& aEnabled = *maybe__aEnabled;
            // Sentinel = 'aEnabled'
            if ((!(((&(reader__)))->ReadSentinel(224789261)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvUpdateParentalControlEnabled(std::move(aEnabled));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PTRRService::Msg_ClearDNSCache__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_ClearDNSCache", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aTrrToo = IPC::ReadParam<bool>((&(reader__)));
            if (!maybe__aTrrToo) {
                FatalError("Error deserializing 'bool'");
                return MsgValueError;

            }
            auto& aTrrToo = *maybe__aTrrToo;
            // Sentinel = 'aTrrToo'
            if ((!(((&(reader__)))->ReadSentinel(183567052)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvClearDNSCache(std::move(aTrrToo));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PTRRService::Msg_SetDetectedTrrURI__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_SetDetectedTrrURI", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aURI = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aURI) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;

            }
            auto& aURI = *maybe__aURI;
            // Sentinel = 'aURI'
            if ((!(((&(reader__)))->ReadSentinel(57934162)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvSetDetectedTrrURI(std::move(aURI));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PTRRService::Msg_SetDefaultTRRConnectionInfo__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_SetDefaultTRRConnectionInfo", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aConnInfoArgs = IPC::ReadParam<mozilla::Maybe<HttpConnectionInfoCloneArgs>>((&(reader__)));
            if (!maybe__aConnInfoArgs) {
                FatalError("Error deserializing 'HttpConnectionInfoCloneArgs?'");
                return MsgValueError;

            }
            auto& aConnInfoArgs = *maybe__aConnInfoArgs;
            // Sentinel = 'aConnInfoArgs'
            if ((!(((&(reader__)))->ReadSentinel(578880777)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'HttpConnectionInfoCloneArgs?'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvSetDefaultTRRConnectionInfo(std::move(aConnInfoArgs));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PTRRService::Msg_UpdateEtcHosts__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PTRRService", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PTRRServiceChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PTRRService::Msg_UpdateEtcHosts", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aHosts = IPC::ReadParam<nsTArray<nsCString>>((&(reader__)));
            if (!maybe__aHosts) {
                FatalError("Error deserializing 'nsCString[]'");
                return MsgValueError;

            }
            auto& aHosts = *maybe__aHosts;
            // Sentinel = 'aHosts'
            if ((!(((&(reader__)))->ReadSentinel(136577651)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<TRRServiceChild*>(this))->RecvUpdateEtcHosts(std::move(aHosts));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

auto PTRRServiceChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PTRRServiceChild::Result
{
    return MsgNotKnown;
}



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

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

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

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

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

} // namespace IPC
