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


#include "mozilla/net/PHttpConnectionMgrParent.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/HttpConnectionMgrParent.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpResponseHead.h"
#include "nsIPropertyBag2.h"

#include "mozilla/net/PAltSvcTransactionParent.h"
#include "mozilla/net/PSocketProcessParent.h"
#include "mozilla/net/PHttpTransactionParent.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 {


MOZ_IMPLICIT PHttpConnectionMgrParent::PHttpConnectionMgrParent() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PHttpConnectionMgrParent);
}

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

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

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

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

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

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

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

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

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

auto PHttpConnectionMgrParent::Send__delete__(PHttpConnectionMgrParent* actor) -> bool
{
    if (!actor || !actor->CanSend()) {
        NS_WARNING("Attempt to __delete__ missing or closed actor");
        return false;
    }
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg___delete__((actor)->Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            actor};


    if (mozilla::ipc::LoggingEnabledFor("PHttpConnectionMgr", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PHttpConnectionMgrParent",
            actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PHttpConnectionMgr::Msg___delete__", OTHER);

    bool sendok__ = (actor)->ChannelSend(std::move(msg__));

    actor->ActorDisconnected(Deletion);
    return sendok__;
}

auto PHttpConnectionMgrParent::SendDoShiftReloadConnectionCleanupWithConnInfo(const HttpConnectionInfoCloneArgs& aArgs) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_DoShiftReloadConnectionCleanupWithConnInfo(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpConnectionMgrParent::SendUpdateCurrentBrowserId(const uint64_t& aId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_UpdateCurrentBrowserId(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PHttpConnectionMgrParent::SendAddTransaction(
        mozilla::NotNull<PHttpTransactionParent*> aTrans,
        const int32_t& aPriority) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_AddTransaction(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aPriority);
    // Sentinel = 'aPriority'
    ((&(writer__)))->WriteSentinel(303367108);


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

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

auto PHttpConnectionMgrParent::SendAddTransactionWithStickyConn(
        mozilla::NotNull<PHttpTransactionParent*> aTrans,
        const int32_t& aPriority,
        mozilla::NotNull<PHttpTransactionParent*> aTransWithStickyConn) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_AddTransactionWithStickyConn(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aPriority);
    // Sentinel = 'aPriority'
    ((&(writer__)))->WriteSentinel(303367108);
    IPC::WriteParam((&(writer__)), aTransWithStickyConn);
    // Sentinel = 'aTransWithStickyConn'
    ((&(writer__)))->WriteSentinel(1405487115);


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

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

auto PHttpConnectionMgrParent::SendRescheduleTransaction(
        mozilla::NotNull<PHttpTransactionParent*> aTrans,
        const int32_t& aPriority) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_RescheduleTransaction(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aPriority);
    // Sentinel = 'aPriority'
    ((&(writer__)))->WriteSentinel(303367108);


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

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

auto PHttpConnectionMgrParent::SendUpdateClassOfServiceOnTransaction(
        mozilla::NotNull<PHttpTransactionParent*> aTrans,
        const ClassOfService& aClassOfService) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_UpdateClassOfServiceOnTransaction(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aClassOfService);
    // Sentinel = 'aClassOfService'
    ((&(writer__)))->WriteSentinel(770770398);


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

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

auto PHttpConnectionMgrParent::SendCancelTransaction(
        mozilla::NotNull<PHttpTransactionParent*> aTrans,
        const nsresult& aReason) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_CancelTransaction(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aReason);
    // Sentinel = 'aReason'
    ((&(writer__)))->WriteSentinel(180093642);


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

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

auto PHttpConnectionMgrParent::SendSpeculativeConnect(
        const HttpConnectionInfoCloneArgs& aConnInfo,
        const mozilla::Maybe<SpeculativeConnectionOverriderArgs>& aOverriderArgs,
        const uint32_t& aCaps,
        const mozilla::Maybe<mozilla::NotNull<PAltSvcTransactionParent*>>& aTrans,
        const bool& aFetchHTTPSRR) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_SpeculativeConnect(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aConnInfo);
    // Sentinel = 'aConnInfo'
    ((&(writer__)))->WriteSentinel(284558204);
    IPC::WriteParam((&(writer__)), aOverriderArgs);
    // Sentinel = 'aOverriderArgs'
    ((&(writer__)))->WriteSentinel(703268257);
    IPC::WriteParam((&(writer__)), aCaps);
    // Sentinel = 'aCaps'
    ((&(writer__)))->WriteSentinel(90964457);
    IPC::WriteParam((&(writer__)), aTrans);
    // Sentinel = 'aTrans'
    ((&(writer__)))->WriteSentinel(136970858);
    IPC::WriteParam((&(writer__)), aFetchHTTPSRR);
    // Sentinel = 'aFetchHTTPSRR'
    ((&(writer__)))->WriteSentinel(547292291);


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

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

auto PHttpConnectionMgrParent::SendStartWebSocketConnection(
        mozilla::NotNull<PHttpTransactionParent*> aTransWithStickyConn,
        const uint32_t& aListenerId) -> bool
{
    UniquePtr<IPC::Message> msg__ = PHttpConnectionMgr::Msg_StartWebSocketConnection(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aTransWithStickyConn);
    // Sentinel = 'aTransWithStickyConn'
    ((&(writer__)))->WriteSentinel(1405487115);
    IPC::WriteParam((&(writer__)), aListenerId);
    // Sentinel = 'aListenerId'
    ((&(writer__)))->WriteSentinel(436667477);


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

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

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

auto PHttpConnectionMgrParent::OnMessageReceived(const Message& msg__) -> PHttpConnectionMgrParent::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 PHttpConnectionMgr::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

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



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

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

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

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

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

} // namespace IPC
