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

#ifndef PWebTransportParent_h
#define PWebTransportParent_h

#include "mozilla/dom/PWebTransport.h"
#ifdef DEBUG
#include "prenv.h"
#endif  // DEBUG

#include "mozilla/Tainting.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
class nsIFile;

// Headers for things that cannot be forward declared
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/IntegrityPolicy.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "nsIContentSecurityPolicy.h"

namespace mozilla {
struct void_t;
} // namespace mozilla

namespace mozilla {
namespace ipc {
class DataPipeReceiver;
} // namespace ipc
} // namespace mozilla

namespace mozilla {
namespace ipc {
class DataPipeSender;
} // namespace ipc
} // namespace mozilla

namespace mozilla {
namespace dom {


class PWebTransportParent :
    public mozilla::ipc::IToplevelProtocol
{
private:
public:
    static constexpr ::mozilla::ipc::ProtocolId kProtocolId = PWebTransportMsgStart;
protected:
    typedef mozilla::ipc::ActorId ActorId;
    typedef ::mozilla::dom::BidirectionalStream BidirectionalStream;
    typedef ::mozilla::dom::BidirectionalStreamResponse BidirectionalStreamResponse;
    typedef ::mozilla::ipc::ByteBuf ByteBuf;
    typedef ::mozilla::ipc::CSPInfo CSPInfo;
    typedef ::mozilla::ipc::ContentPrincipalInfo ContentPrincipalInfo;
    typedef ::mozilla::ipc::ContentSecurityPolicy ContentSecurityPolicy;
    typedef ::mozilla::ipc::DataPipeReceiver DataPipeReceiver;
    typedef ::mozilla::ipc::DataPipeSender DataPipeSender;
    typedef ::mozilla::dom::IntegrityPolicy::Destinations Destinations;
    template<class FooSide> using Endpoint = mozilla::ipc::Endpoint<FooSide>;
    typedef ::mozilla::ipc::ExpandedPrincipalInfo ExpandedPrincipalInfo;
    typedef ::mozilla::ipc::FileDescriptor FileDescriptor;
    typedef ::mozilla::ipc::IntegrityPolicyArgs IntegrityPolicyArgs;
    typedef ::mozilla::ipc::IntegrityPolicyEntry IntegrityPolicyEntry;
    template<class FooSide> using ManagedEndpoint = mozilla::ipc::ManagedEndpoint<FooSide>;
    typedef ::mozilla::ipc::NullPrincipalInfo NullPrincipalInfo;
    typedef ::mozilla::OriginAttributes OriginAttributes;
    typedef ::mozilla::ipc::PolicyContainerArgs PolicyContainerArgs;
    typedef ::mozilla::ipc::PrincipalInfo PrincipalInfo;
    typedef base::ProcessId ProcessId;
    typedef mozilla::ipc::ProtocolId ProtocolId;
    typedef ::nsIContentSecurityPolicy::RequireTrustedTypesForDirectiveState RequireTrustedTypesForDirectiveState;
    typedef ::mozilla::dom::ResetError ResetError;
    typedef mozilla::ipc::ResponseRejectReason ResponseRejectReason;
    typedef ::mozilla::ipc::Shmem Shmem;
    typedef ::mozilla::dom::IntegrityPolicy::Sources Sources;
    typedef ::mozilla::dom::StopSendingError StopSendingError;
    typedef ::mozilla::dom::StreamResetOrStopSendingError StreamResetOrStopSendingError;
    typedef ::mozilla::ipc::SystemPrincipalInfo SystemPrincipalInfo;
    typedef ::mozilla::TimeStamp TimeStamp;
    typedef ::mozilla::dom::UnidirectionalStream UnidirectionalStream;
    typedef ::mozilla::dom::UnidirectionalStreamResponse UnidirectionalStreamResponse;
    template<class T> using UniquePtr = mozilla::UniquePtr<T>;
    typedef ::mozilla::ipc::WebTransportHash WebTransportHash;
    typedef ::int16_t int16_t;
    typedef ::int32_t int32_t;
    typedef ::int64_t int64_t;
    typedef ::int8_t int8_t;
    typedef ::intptr_t intptr_t;
    typedef ::nsCString nsCString;
    typedef ::nsString nsString;
    typedef ::nsresult nsresult;
    typedef ::uint16_t uint16_t;
    typedef ::uint32_t uint32_t;
    typedef ::uint64_t uint64_t;
    typedef ::uint8_t uint8_t;
    typedef ::uintptr_t uintptr_t;
    typedef ::mozilla::void_t void_t;

public:
    typedef std::function<void(const UnidirectionalStreamResponse&)> CreateUnidirectionalStreamResolver;
    typedef std::function<void(const BidirectionalStreamResponse&)> CreateBidirectionalStreamResolver;
    typedef std::function<void(const nsresult&)> OutgoingDatagramResolver;
    typedef std::function<void(const uint64_t&)> GetMaxDatagramSizeResolver;
    typedef MozPromise<nsresult, ResponseRejectReason, true> CloseAllPromise;

protected:
    void
    ProcessingError(
            Result aCode,
            const char* aReason) override;
    bool
    ShouldContinueFromReplyTimeout() override;

public:
    typedef mozilla::ipc::IProtocol IProtocol;
    typedef IPC::Message Message;
    typedef base::ProcessHandle ProcessHandle;
    typedef mozilla::ipc::MessageChannel MessageChannel;

public:
    MOZ_IMPLICIT PWebTransportParent();

    virtual ~PWebTransportParent();

protected:
    void
    ActorAlloc() final;
    void
    ActorDealloc() final;
public:
    mozilla::Span<mozilla::ipc::ProtocolId const>
    ManagedProtocolIds() const final;

    UntypedManagedContainer*
    GetManagedActors(mozilla::ipc::ProtocolId aProtocol) final;

    void
    RejectPendingResponses(ResponseRejectReason aReason) final;

    [[nodiscard]] bool
    SendIncomingUnidirectionalStream(
            const uint64_t& streamId,
            DataPipeReceiver* receive);

    [[nodiscard]] bool
    SendIncomingBidirectionalStream(
            const uint64_t& streamId,
            DataPipeReceiver* receive,
            DataPipeSender* send);

    [[nodiscard]] bool
    SendIncomingDatagram(
            mozilla::Span<uint8_t const> data,
            const TimeStamp& receivedTime);

    [[nodiscard]] bool
    SendRemoteClosed(
            const bool& cleanly,
            const uint32_t& code,
            const nsACString& reason);

    [[nodiscard]] bool
    SendOnStreamResetOrStopSending(
            const uint64_t& streamId,
            const StreamResetOrStopSendingError& error);

    void
    SendCloseAll(
            mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    [[nodiscard]] RefPtr<CloseAllPromise>
    SendCloseAll();

    void
    DeallocManagee(
            mozilla::ipc::ProtocolId aProtocolId,
            IProtocol* aListener) override;

    Result
    OnMessageReceived(const Message& msg__) override;

    Result
    OnMessageReceived(
            const Message& msg__,
            UniquePtr<Message>& reply__) override;

private:
    mozilla::ipc::IPDLAsyncReturnsCallbacks mAsyncCallbacks;

};


} // namespace dom
} // namespace mozilla
namespace IPC {
template<>
struct ParamTraits <::mozilla::dom::PWebTransportParent*>
{
    typedef ::mozilla::dom::PWebTransportParent* paramType;
    static void
    Write(
            IPC::MessageWriter* aWriter,
            const paramType& aVar);
    static IPC::ReadResult<paramType>
    Read(IPC::MessageReader* aReader);
};
} // namespace IPC

#endif // ifndef PWebTransportParent_h
