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

#ifndef PUDPSocket_h
#define PUDPSocket_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/IPDLStructMember.h"
#include "mozilla/net/DNS.h"
#include "mozilla/ipc/IPCStream.h"


//-----------------------------------------------------------------------------
// Declaration of the IPDL type |struct UDPAddressInfo|
//
class UDPAddressInfo final
{
private:
    typedef ::nsCString nsCString;
    typedef ::uint16_t uint16_t;

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

    MOZ_IMPLICIT UDPAddressInfo(
            const nsCString& _addr,
            const uint16_t& _port) :
        addr_(_addr),
        port_(_port)
    {
    }

    MOZ_IMPLICIT UDPAddressInfo(
            nsCString&& _addr,
            uint16_t&& _port) :
        addr_(std::move(_addr)),
        port_(std::move(_port))
    {
    }

    nsCString&
    addr()
    {
        return addr_;
    }
    const nsCString&
    addr() const
    {
        return addr_;
    }

    uint16_t&
    port()
    {
        return port_;
    }
    const uint16_t&
    port() const
    {
        return port_;
    }

private:
    ::mozilla::ipc::IPDLStructMember<nsCString> addr_;
    ::mozilla::ipc::IPDLStructMember<uint16_t> port_;
};

namespace IPC {
template<>
struct ParamTraits <::UDPAddressInfo>
{
    typedef ::UDPAddressInfo 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 UDPSocketAddr|
//
class UDPSocketAddr final
{
public:
    enum Type {
        T__None,
        TUDPAddressInfo = 1,
        TNetAddr,
        T__Last = TNetAddr
    };

private:
    typedef ::UDPAddressInfo UDPAddressInfo;
    typedef ::mozilla::net::NetAddr NetAddr;
    typedef UDPAddressInfo UDPAddressInfo__tdef;
    typedef NetAddr NetAddr__tdef;

    UDPAddressInfo*
    ptr_UDPAddressInfo()
    {
        return (&(mVUDPAddressInfo));
    }
    const UDPAddressInfo*
    constptr_UDPAddressInfo() const
    {
        return (&(mVUDPAddressInfo));
    }
    NetAddr*
    ptr_NetAddr()
    {
        return (&(mVNetAddr));
    }
    const NetAddr*
    constptr_NetAddr() const
    {
        return (&(mVNetAddr));
    }

    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 UDPSocketAddr() :
        mType(T__None)
    {
    }

    MOZ_IMPLICIT UDPSocketAddr(const UDPAddressInfo& aOther);

    MOZ_IMPLICIT UDPSocketAddr(UDPAddressInfo&& aOther);

    MOZ_IMPLICIT UDPSocketAddr(const NetAddr& aOther);

    MOZ_IMPLICIT UDPSocketAddr(NetAddr&& aOther);

    MOZ_IMPLICIT UDPSocketAddr(const UDPSocketAddr& aOther);

    MOZ_IMPLICIT UDPSocketAddr(UDPSocketAddr&& aOther);

    ~UDPSocketAddr();

    Type
    type() const
    {
        return mType;
    }

    UDPSocketAddr&
    operator=(const UDPAddressInfo& aRhs);

    UDPSocketAddr&
    operator=(UDPAddressInfo&& aRhs);

    UDPSocketAddr&
    operator=(const NetAddr& aRhs);

    UDPSocketAddr&
    operator=(NetAddr&& aRhs);

    UDPSocketAddr&
    operator=(const UDPSocketAddr& aRhs);

    UDPSocketAddr&
    operator=(UDPSocketAddr&& aRhs);

    UDPAddressInfo&
    get_UDPAddressInfo()
    {
        AssertSanity(TUDPAddressInfo);
        return (*(ptr_UDPAddressInfo()));
    }
    const UDPAddressInfo&
    get_UDPAddressInfo() const
    {
        AssertSanity(TUDPAddressInfo);
        return (*(constptr_UDPAddressInfo()));
    }
    operator UDPAddressInfo&()
    {
        return get_UDPAddressInfo();
    }
    operator const UDPAddressInfo&() const
    {
        return get_UDPAddressInfo();
    }

    NetAddr&
    get_NetAddr()
    {
        AssertSanity(TNetAddr);
        return (*(ptr_NetAddr()));
    }
    const NetAddr&
    get_NetAddr() const
    {
        AssertSanity(TNetAddr);
        return (*(constptr_NetAddr()));
    }
    operator NetAddr&()
    {
        return get_NetAddr();
    }
    operator const NetAddr&() const
    {
        return get_NetAddr();
    }

private:
    union {
        UDPAddressInfo mVUDPAddressInfo;
        NetAddr mVNetAddr;
    };
    Type mType;
};

namespace IPC {
template<>
struct ParamTraits <::UDPSocketAddr>
{
    typedef ::UDPSocketAddr 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 UDPData|
//
class UDPData final
{
public:
    enum Type {
        T__None,
        TArrayOfuint8_t = 1,
        TIPCStream,
        T__Last = TIPCStream
    };

private:
    typedef ::uint8_t uint8_t;
    typedef ::mozilla::ipc::IPCStream IPCStream;
    typedef nsTArray<uint8_t> ArrayOfuint8_t__tdef;
    typedef IPCStream IPCStream__tdef;

    nsTArray<uint8_t>*
    ptr_ArrayOfuint8_t()
    {
        return (&(mVArrayOfuint8_t));
    }
    const nsTArray<uint8_t>*
    constptr_ArrayOfuint8_t() const
    {
        return (&(mVArrayOfuint8_t));
    }
    IPCStream*
    ptr_IPCStream()
    {
        return (&(mVIPCStream));
    }
    const IPCStream*
    constptr_IPCStream() const
    {
        return (&(mVIPCStream));
    }

    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 UDPData() :
        mType(T__None)
    {
    }

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

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

    MOZ_IMPLICIT UDPData(const IPCStream& aOther);

    MOZ_IMPLICIT UDPData(IPCStream&& aOther);

    MOZ_IMPLICIT UDPData(const UDPData& aOther);

    MOZ_IMPLICIT UDPData(UDPData&& aOther);

    ~UDPData();

    Type
    type() const
    {
        return mType;
    }

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

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

    UDPData&
    operator=(const IPCStream& aRhs);

    UDPData&
    operator=(IPCStream&& aRhs);

    UDPData&
    operator=(const UDPData& aRhs);

    UDPData&
    operator=(UDPData&& 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();
    }

    IPCStream&
    get_IPCStream()
    {
        AssertSanity(TIPCStream);
        return (*(ptr_IPCStream()));
    }
    const IPCStream&
    get_IPCStream() const
    {
        AssertSanity(TIPCStream);
        return (*(constptr_IPCStream()));
    }
    operator IPCStream&()
    {
        return get_IPCStream();
    }
    operator const IPCStream&() const
    {
        return get_IPCStream();
    }

private:
    union {
        nsTArray<uint8_t> mVArrayOfuint8_t;
        IPCStream mVIPCStream;
    };
    Type mType;
};

namespace IPC {
template<>
struct ParamTraits <::UDPData>
{
    typedef ::UDPData 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 PUDPSocketParent;
} // namespace net
} // namespace mozilla
namespace mozilla {
namespace net {
class PUDPSocketChild;
} // namespace net
} // namespace mozilla

//-----------------------------------------------------------------------------
// Code common to PUDPSocketChild and PUDPSocketParent
//
namespace mozilla {
namespace net {
namespace PUDPSocket {

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

enum MessageType {
    PUDPSocketStart = PUDPSocketMsgStart << 16,
    Msg_Bind__ID,
    Msg_Connect__ID,
    Msg_OutgoingData__ID,
    Msg_JoinMulticast__ID,
    Msg_LeaveMulticast__ID,
    Msg_Close__ID,
    Msg_RequestDelete__ID,
    Msg_CallbackOpened__ID,
    Msg_CallbackConnected__ID,
    Msg_CallbackClosed__ID,
    Msg_CallbackReceivedData__ID,
    Msg_CallbackError__ID,
    Msg___delete____ID,
    Reply___delete____ID,
    PUDPSocketEnd
};

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

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

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

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

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

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

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

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

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

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

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

mozilla::UniquePtr<IPC::Message>
Msg_CallbackError(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 PUDPSocket
} // namespace net
} // namespace mozilla

#endif // ifndef PUDPSocket_h
