2023-12-17 03:29:08 -08:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-17 15:00:08 -08:00
|
|
|
#include "EHS.h"
|
|
|
|
#include "Str.h"
|
2023-12-17 03:29:08 -08:00
|
|
|
#include "Socket.h"
|
|
|
|
|
2023-12-17 15:56:13 -08:00
|
|
|
namespace ehs
|
2023-12-17 03:29:08 -08:00
|
|
|
{
|
|
|
|
class BaseUDP
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
AddrType addrType;
|
|
|
|
Str_8 address;
|
|
|
|
UInt_16 port;
|
|
|
|
bool bound;
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~BaseUDP() = default;
|
|
|
|
|
|
|
|
BaseUDP();
|
|
|
|
|
|
|
|
BaseUDP(const AddrType addrType);
|
|
|
|
|
|
|
|
BaseUDP(BaseUDP&& udp) noexcept;
|
|
|
|
|
|
|
|
BaseUDP(const BaseUDP& udp);
|
|
|
|
|
|
|
|
BaseUDP& operator=(BaseUDP&& udp) noexcept;
|
|
|
|
|
|
|
|
BaseUDP& operator=(const BaseUDP& udp);
|
|
|
|
|
|
|
|
virtual void Release() = 0;
|
|
|
|
|
|
|
|
virtual void Bind(const Str_8& address, const UInt_16 port) = 0;
|
|
|
|
|
|
|
|
virtual UInt_64 Send(const Str_8& addr, const UInt_16 port, const Byte* const data, const UInt_64 size) = 0;
|
|
|
|
|
|
|
|
virtual UInt_64 Receive(Str_8* const addr, UInt_16* const port, Byte* const data, const UInt_64 size) = 0;
|
|
|
|
|
|
|
|
bool IsBound() const;
|
|
|
|
|
|
|
|
virtual void SetBlocking(const bool blocking) = 0;
|
|
|
|
|
|
|
|
virtual bool IsBlocking() const = 0;
|
|
|
|
|
|
|
|
AddrType GetAddressType() const;
|
|
|
|
|
|
|
|
Str_8 GetLocalAddress() const;
|
|
|
|
|
|
|
|
UInt_16 GetLocalPort() const;
|
|
|
|
|
|
|
|
virtual bool IsValid() const = 0;
|
|
|
|
};
|
|
|
|
}
|