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

#ifndef PTCPSocket_h
#define PTCPSocket_h

#include "mozilla/Attributes.h"
#include "IPCMessageStart.h"
#include "mozilla/RefPtr.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "mozilla/MozPromise.h"
#include "mozilla/OperatorNewExtensions.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/ipc/ByteBuf.h"
#include "mozilla/ipc/FileDescriptor.h"
#include "mozilla/ipc/IPCForwards.h"
#include "mozilla/ipc/Shmem.h"

// Headers for typedefs
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/ipc/IPDLStructMember.h"


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |struct TCPError|
//
class TCPError final
{
private:
    typedef ::nsString nsString;
    typedef ::nsresult nsresult;

public:
#ifdef __clang__
#  pragma clang diagnostic push
#  if __has_warning("-Wdefaulted-function-deleted")
#    pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
#  endif
#endif
    TCPError() = default;
#ifdef __clang__
#  pragma clang diagnostic pop
#endif

    MOZ_IMPLICIT TCPError(
            const nsString& _name,
            const nsString& _message,
            const nsresult& _errorCode) :
        name_(_name),
        message_(_message),
        errorCode_(_errorCode)
    {
    }

    MOZ_IMPLICIT TCPError(
            nsString&& _name,
            nsString&& _message,
            nsresult&& _errorCode) :
        name_(std::move(_name)),
        message_(std::move(_message)),
        errorCode_(std::move(_errorCode))
    {
    }

    nsString&
    name()
    {
        return name_;
    }
    const nsString&
    name() const
    {
        return name_;
    }

    nsString&
    message()
    {
        return message_;
    }
    const nsString&
    message() const
    {
        return message_;
    }

    nsresult&
    errorCode()
    {
        return errorCode_;
    }
    const nsresult&
    errorCode() const
    {
        return errorCode_;
    }

private:
    ::mozilla::ipc::IPDLStructMember<nsString> name_;
    ::mozilla::ipc::IPDLStructMember<nsString> message_;
    ::mozilla::ipc::IPDLStructMember<nsresult> errorCode_;
};

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


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |union SendableData|
//
class SendableData final
{
public:
    enum Type {
        T__None,
        TArrayOfuint8_t = 1,
        TnsCString,
        T__Last = TnsCString
    };

private:
    typedef ::uint8_t uint8_t;
    typedef ::nsCString nsCString;
    typedef nsTArray<uint8_t> ArrayOfuint8_t__tdef;
    typedef nsCString nsCString__tdef;

    nsTArray<uint8_t>*
    ptr_ArrayOfuint8_t()
    {
        return (&(mVArrayOfuint8_t));
    }
    const nsTArray<uint8_t>*
    constptr_ArrayOfuint8_t() const
    {
        return (&(mVArrayOfuint8_t));
    }
    nsCString*
    ptr_nsCString()
    {
        return (&(mVnsCString));
    }
    const nsCString*
    constptr_nsCString() const
    {
        return (&(mVnsCString));
    }

    void
    MaybeDestroy();

    void
    AssertSanity() const
    {
        MOZ_RELEASE_ASSERT((T__None) <= (mType), "invalid type tag");
        MOZ_RELEASE_ASSERT((mType) <= (T__Last), "invalid type tag");
    }
    void
    AssertSanity(Type aType) const
    {
        AssertSanity();
        MOZ_RELEASE_ASSERT((mType) == (aType), "unexpected type tag");
    }

public:
    MOZ_IMPLICIT SendableData() :
        mType(T__None)
    {
    }

    MOZ_IMPLICIT SendableData(const nsTArray<uint8_t>& aOther);

    MOZ_IMPLICIT SendableData(nsTArray<uint8_t>&& aOther);

    MOZ_IMPLICIT SendableData(const nsCString& aOther);

    MOZ_IMPLICIT SendableData(nsCString&& aOther);

    MOZ_IMPLICIT SendableData(const SendableData& aOther);

    MOZ_IMPLICIT SendableData(SendableData&& aOther);

    ~SendableData();

    Type
    type() const
    {
        return mType;
    }

    SendableData&
    operator=(const nsTArray<uint8_t>& aRhs);

    SendableData&
    operator=(nsTArray<uint8_t>&& aRhs);

    SendableData&
    operator=(const nsCString& aRhs);

    SendableData&
    operator=(nsCString&& aRhs);

    SendableData&
    operator=(const SendableData& aRhs);

    SendableData&
    operator=(SendableData&& aRhs);

    nsTArray<uint8_t>&
    get_ArrayOfuint8_t()
    {
        AssertSanity(TArrayOfuint8_t);
        return (*(ptr_ArrayOfuint8_t()));
    }
    const nsTArray<uint8_t>&
    get_ArrayOfuint8_t() const
    {
        AssertSanity(TArrayOfuint8_t);
        return (*(constptr_ArrayOfuint8_t()));
    }
    operator nsTArray<uint8_t>&()
    {
        return get_ArrayOfuint8_t();
    }
    operator const nsTArray<uint8_t>&() const
    {
        return get_ArrayOfuint8_t();
    }

    nsCString&
    get_nsCString()
    {
        AssertSanity(TnsCString);
        return (*(ptr_nsCString()));
    }
    const nsCString&
    get_nsCString() const
    {
        AssertSanity(TnsCString);
        return (*(constptr_nsCString()));
    }
    operator nsCString&()
    {
        return get_nsCString();
    }
    operator const nsCString&() const
    {
        return get_nsCString();
    }

private:
    union {
        nsTArray<uint8_t> mVArrayOfuint8_t;
        nsCString mVnsCString;
    };
    Type mType;
};

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


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |union CallbackData|
//
class CallbackData final
{
public:
    enum Type {
        T__None,
        Tvoid_t = 1,
        TSendableData,
        TTCPError,
        T__Last = TTCPError
    };

private:
    typedef ::mozilla::void_t void_t;
    typedef ::SendableData SendableData;
    typedef ::TCPError TCPError;
    typedef void_t void_t__tdef;
    typedef SendableData SendableData__tdef;
    typedef TCPError TCPError__tdef;

    void_t*
    ptr_void_t()
    {
        return (&(mVvoid_t));
    }
    const void_t*
    constptr_void_t() const
    {
        return (&(mVvoid_t));
    }
    SendableData*
    ptr_SendableData()
    {
        return (&(mVSendableData));
    }
    const SendableData*
    constptr_SendableData() const
    {
        return (&(mVSendableData));
    }
    TCPError*
    ptr_TCPError()
    {
        return (&(mVTCPError));
    }
    const TCPError*
    constptr_TCPError() const
    {
        return (&(mVTCPError));
    }

    void
    MaybeDestroy();

    void
    AssertSanity() const
    {
        MOZ_RELEASE_ASSERT((T__None) <= (mType), "invalid type tag");
        MOZ_RELEASE_ASSERT((mType) <= (T__Last), "invalid type tag");
    }
    void
    AssertSanity(Type aType) const
    {
        AssertSanity();
        MOZ_RELEASE_ASSERT((mType) == (aType), "unexpected type tag");
    }

public:
    MOZ_IMPLICIT CallbackData() :
        mType(T__None)
    {
    }

    MOZ_IMPLICIT CallbackData(const void_t& aOther);

    MOZ_IMPLICIT CallbackData(void_t&& aOther);

    MOZ_IMPLICIT CallbackData(const SendableData& aOther);

    MOZ_IMPLICIT CallbackData(SendableData&& aOther);

    MOZ_IMPLICIT CallbackData(const TCPError& aOther);

    MOZ_IMPLICIT CallbackData(TCPError&& aOther);

    MOZ_IMPLICIT CallbackData(const CallbackData& aOther);

    MOZ_IMPLICIT CallbackData(CallbackData&& aOther);

    ~CallbackData();

    Type
    type() const
    {
        return mType;
    }

    CallbackData&
    operator=(const void_t& aRhs);

    CallbackData&
    operator=(void_t&& aRhs);

    CallbackData&
    operator=(const SendableData& aRhs);

    CallbackData&
    operator=(SendableData&& aRhs);

    CallbackData&
    operator=(const TCPError& aRhs);

    CallbackData&
    operator=(TCPError&& aRhs);

    CallbackData&
    operator=(const CallbackData& aRhs);

    CallbackData&
    operator=(CallbackData&& aRhs);

    void_t&
    get_void_t()
    {
        AssertSanity(Tvoid_t);
        return (*(ptr_void_t()));
    }
    const void_t&
    get_void_t() const
    {
        AssertSanity(Tvoid_t);
        return (*(constptr_void_t()));
    }
    operator void_t&()
    {
        return get_void_t();
    }
    operator const void_t&() const
    {
        return get_void_t();
    }

    SendableData&
    get_SendableData()
    {
        AssertSanity(TSendableData);
        return (*(ptr_SendableData()));
    }
    const SendableData&
    get_SendableData() const
    {
        AssertSanity(TSendableData);
        return (*(constptr_SendableData()));
    }
    operator SendableData&()
    {
        return get_SendableData();
    }
    operator const SendableData&() const
    {
        return get_SendableData();
    }

    TCPError&
    get_TCPError()
    {
        AssertSanity(TTCPError);
        return (*(ptr_TCPError()));
    }
    const TCPError&
    get_TCPError() const
    {
        AssertSanity(TTCPError);
        return (*(constptr_TCPError()));
    }
    operator TCPError&()
    {
        return get_TCPError();
    }
    operator const TCPError&() const
    {
        return get_TCPError();
    }

private:
    union {
        void_t mVvoid_t;
        SendableData mVSendableData;
        TCPError mVTCPError;
    };
    Type mType;
};

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

namespace mozilla {
namespace net {
class PTCPSocketParent;
} // namespace net
} // namespace mozilla
namespace mozilla {
namespace net {
class PTCPSocketChild;
} // namespace net
} // namespace mozilla

//-----------------------------------------------------------------------------
// Code common to PTCPSocketChild and PTCPSocketParent
//
namespace mozilla {
namespace net {
namespace PTCPSocket {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::net::PTCPSocketParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::net::PTCPSocketChild>* aChild);

enum MessageType {
    PTCPSocketStart = PTCPSocketMsgStart << 16,
    Msg_Open__ID,
    Msg_Data__ID,
    Msg_StartTLS__ID,
    Msg_Suspend__ID,
    Msg_Resume__ID,
    Msg_Close__ID,
    Msg_Callback__ID,
    Msg_UpdateBufferedAmount__ID,
    Msg_RequestDelete__ID,
    Msg___delete____ID,
    Reply___delete____ID,
    PTCPSocketEnd
};

mozilla::UniquePtr<IPC::Message>
Msg_Open(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_Data(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_StartTLS(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_Suspend(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_Resume(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_Close(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_Callback(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_UpdateBufferedAmount(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg_RequestDelete(IPC::Message::routeid_t routingId);

mozilla::UniquePtr<IPC::Message>
Msg___delete__(IPC::Message::routeid_t routingId);
mozilla::UniquePtr<IPC::Message>
Reply___delete__(IPC::Message::routeid_t routingId);



} // namespace PTCPSocket
} // namespace net
} // namespace mozilla

#endif // ifndef PTCPSocket_h
