First commit.
This commit is contained in:
54
include/ehs/io/socket/BaseUDP.h
Normal file
54
include/ehs/io/socket/BaseUDP.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "ehs/EHS.h"
|
||||
#include "ehs/Str.h"
|
||||
#include "Socket.h"
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseUDP
|
||||
{
|
||||
protected:
|
||||
AddrType type;
|
||||
Str_8 address;
|
||||
UInt_16 port;
|
||||
bool bound;
|
||||
|
||||
public:
|
||||
virtual ~BaseUDP() = default;
|
||||
|
||||
BaseUDP();
|
||||
|
||||
BaseUDP(AddrType type);
|
||||
|
||||
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(AddrType type, const Str_8& address, UInt_16 port) = 0;
|
||||
|
||||
virtual UInt_64 Send(AddrType type, const Str_8& address, UInt_16 port, const Byte* data, UInt_64 size) = 0;
|
||||
|
||||
virtual UInt_64 Receive(AddrType* type, Str_8* address, UInt_16* port, Byte* data, UInt_64 size) = 0;
|
||||
|
||||
bool IsBound() const;
|
||||
|
||||
virtual void SetBlocking(bool blocking) = 0;
|
||||
|
||||
virtual bool IsBlocking() const = 0;
|
||||
|
||||
AddrType GetLocalAddressType() const;
|
||||
|
||||
Str_8 GetLocalAddress() const;
|
||||
|
||||
UInt_16 GetLocalPort() const;
|
||||
|
||||
virtual bool IsValid() const = 0;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user